Skip to content

Commit 6b19f2a

Browse files
committed
修复TextField失去焦点时,controller.clear()报错的问题
1 parent 9497e11 commit 6b19f2a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/ui/page/user/login_field_widget.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class _LoginTextFieldClearIconState extends State<LoginTextFieldClearIcon> {
167167
},
168168
child: InkWell(
169169
onTap: () {
170+
WidgetsBinding.instance.addPostFrameCallback((_) {
170171
widget.controller.clear();
172+
});
171173
},
172174
child: Icon(CupertinoIcons.clear,
173175
size: 30, color: Theme.of(context).hintColor)),

0 commit comments

Comments
 (0)