我的应用程序中有以下抽屉:
当我按下密码时,TextFormField我得到以下信息:
如您所见,密码TextFormField已被覆盖。我试图解决这个问题,正如这里所建议的:
class _LoginDrawer extends State<LoginDrawer> {
static var _listViewScrollController = new ScrollController();
@override
Widget build(BuildContext context) => new Drawer(
child: new ListView(
controller: _listViewScrollController,
children: <Widget>[
// ...
new Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: new GestureDetector(
onTap: () {
SchedulerBinding.instance.addPostFrameCallback((_) {
_listViewScrollController.jumpTo(
_listViewScrollController.position.maxScrollExtent);
});
},
child: new TextFormField(
obscureText: true,
decoration: new InputDecoration(labelText: "Password")),
),
),
],
),
);
}
Run Code Online (Sandbox Code Playgroud)
但这并不能解决问题,该应用程序的行为与以前相同。还有一些人建议使用 a ListViewthat is reversed 然后使用,listViewController.jumpTo(0.0)但这导致了不需要的效果,所有小部件都从底部开始:
根据 @aziza 发布的问题,它涉及到这个 github 问题:
https://github.com/flutter/flutter/issues/7032
解决方案是使用一个小部件,将元素向上移出键盘。这是颤振中的一个错误。
| 归档时间: |
|
| 查看次数: |
6369 次 |
| 最近记录: |