User interface 颤振:如何移动文本字段字符计数器?
这个题目很好地概括了这个问题。我有一个User interface 颤振:如何移动文本字段字符计数器?,user-interface,flutter,dart,textfield,maxlength,User Interface,Flutter,Dart,Textfield,Maxlength,这个题目很好地概括了这个问题。我有一个TextField和一个maxLength:250,它看起来是这样的: 有没有办法把柜台放在别的地方?最佳设置在发送按钮的左侧,但可能正好位于文本字段的上方和左侧。有什么想法吗?谢谢 可能没有必要,但以下是我的代码: TextField( controller: inputTextEditingController, focusNode: inputFocusNode, s
TextField
和一个maxLength:250
,它看起来是这样的:
有没有办法把柜台放在别的地方?最佳设置在发送按钮的左侧,但可能正好位于文本字段的上方和左侧。有什么想法吗?谢谢
可能没有必要,但以下是我的代码:
TextField(
controller: inputTextEditingController,
focusNode: inputFocusNode,
style: TextStyle(color: Platform.isAndroid ? Colors.green : Colors.blue, height: 0.8),
maxLength: 250,
maxLines: null,
decoration: InputDecoration(
contentPadding: const EdgeInsets.fromLTRB(20, 15, 0, 15),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(28)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Platform.isAndroid ? Colors.green : Colors.blue),
borderRadius: BorderRadius.circular(28)),
suffixIcon: IconButton(
onPressed: _handleSubmitted,
icon: Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 20, 0),
child: Icon(Icons.send,
color: inputFocusNode.hasFocus
? Platform.isAndroid ? Colors.green : Colors.blue
: Colors.black54),
),
),
hintText: "Say something!",
hintStyle: inputFocusNode.hasFocus
? TextStyle(color: Platform.isAndroid ? Colors.green : Colors.blue, fontSize: 16)
: TextStyle(color: Colors.black54)),
在文本字段中使用装饰。添加反文本:“”
祝您好运您需要构建并传递自己的计数器作为TextField小部件的buildCounter参数
TextField(
最大长度:250,
buildCounter:({currentLength,maxLength,isFocused})=>填充(
填充:仅限常量边集(左:16.0),
子:容器(
对齐:alignment.centerLeft,
子项:文本(currentLength.toString()+“/”+maxLength.toString()),
),
)
child: new TextField(
style: BurmeseUtil.textStyle(context),
controller: txtController,
maxLength: 1500,
maxLines: null,
decoration: new InputDecoration(
counterText: '',
border: OutlineInputBorder(),
),
),