抖动对齐errorText到textField的右下角

时间:2019-12-16 08:57:43

标签: flutter textfield flutter-layout

我想将inputDecoration errorText对齐到TextField的右下角。 默认模式为左下角。 我想将其设置为

this image

这是我的textField代码:

TextField authTextFiled(
    String hint, ValidationBloc bloc, AsyncSnapshot<String> snapshot) {
  return TextField(
    textAlign: TextAlign.right,
    onChanged: (String text) => bloc.updateText(text),
    decoration: InputDecoration(
      hintStyle: AppStyle.textFieldHintTextStyle,
      errorStyle: AppStyle.textFieldErrorTextStyle,
      errorText: snapshot.hasError ? snapshot.error : null,
      border: OutlineInputBorder(borderRadius: AppStyle.borderRadius),

      disabledBorder: OutlineInputBorder(
        borderRadius: AppStyle.borderRadius,
        borderSide: BorderSide(width: 1, color: AppColors.pinkDarkDisableColor)
      ),

      focusedBorder: OutlineInputBorder(
        borderRadius: AppStyle.borderRadius,
        borderSide: BorderSide(width: 1, color: AppColors.bluePrimaryColor),
      ),

      errorBorder: OutlineInputBorder(
          borderRadius: AppStyle.borderRadius,
          borderSide: BorderSide(width: 1, color: AppColors.pinkDarkHotColor)
      ),

      focusedErrorBorder: OutlineInputBorder(
          borderRadius: AppStyle.borderRadius,
          borderSide: BorderSide(width: 1, color: AppColors.pinkDarkHotColor)),
      hintText: hint,
    ),

    keyboardType: TextInputType.number,
    textDirection: TextDirection.rtl,
  );
}

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

TextFormField包裹在Directionality内并给出RTL方向,

Directionality(
            textDirection: TextDirection.rtl,
            child: TextFormField(
              ...

什么是Directionality CLass

  

确定文本和对文本方向敏感的渲染对象的环境方向性的小部件。

输出

enter image description here