[Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug

原因:

不知道,可能是个Bug,在真机上运行会出现。

解决方法:

在TextField的onChanged事件里添加代码:

 

 onChanged: (value) {
                                //操作
                                _textEditingController.text = value;
                                //添加的代码:光标一直在文本框后面
                                _textEditingController.value = TextEditingValue(
                                    text: _textEditingController.text,
                                    selection:
                                        TextSelection.fromPosition(TextPosition(
                                      affinity: TextAffinity.downstream,
                                      offset:
                                          _textEditingController.text.length,
                                    )));
                              },

 

 

 

 

 

 

TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
[Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug   TRANSLATE with [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug COPY THE URL BELOW [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug Back EMBED THE SNIPPET BELOW IN YOUR SITE [Flutter] 解决Flutter文本框Textfield输入时光标一直在文字前面的bug Enable collaborative features and customize widget: Bing Webmaster Portal Back
上一篇:【Web前端】富文本编辑器execCommand(“bold“)字体加粗命令无效的原因


下一篇:今天的码农女孩做了关于BOM的笔记 2022/1/11