如何在Flutter中取消对textField光标的关注

时间:2020-10-26 23:30:02

标签: flutter dart flutter-layout textfield

当我单击远离文本字段时,它会颤抖地关闭键盘,但是光标会继续在文本字段中闪烁。我该如何阻止这种情况的发生?

TextField(
                  decoration: InputDecoration(
                    border: InputBorder.none,
                    suffixIcon: IconButton(
                      alignment: Alignment.topRight,
                      icon: Icon(Icons.check),
                      onPressed: () {
                        setState(() {
                          args.collection.notes[index] =
                              noteControllers[index].text;
                        });
                      },
                    ),
                  ),
                  keyboardType: TextInputType.multiline,
                  maxLines: null,
                  controller: noteControllers[index]
                    ..text = args.collection.notes[index],
                  onChanged: (text) => {args.collection.notes[index] = text},
                ),

有问题的文本字段

0 个答案:

没有答案