我的应用中有以下抽屉:
当我按下密码 TextFormField
时,我得到以下信息:
如您所见,密码 TextFormField
已被覆盖。我试图解决这个问题,建议 here :
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")),
),
),
],
),
);
}
但这并不能解决问题,该应用程序的行为与以前相同。还有一些人建议使用反转的 ListView
然后使用 listViewController.jumpTo(0.0)
但这导致了不需要的效果,即所有小部件都从底部开始:
最佳答案
用 Scaffold 包裹您的 ListView 并设置 resizeToAvoidBottomInset: true,此属性。也许这可以帮助你。
https://stackoverflow.com/questions/48067818/