Scaffold有一个属性resizeToAvoidBottomInset,默认为true,配合SingleChildScrollView可实现自适应键盘高度
class Demo extends StatelessWidget {
const Demo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true, //默认为true,可不写
appBar: AppBar(
title: const Text("Demo"),
),
body: SingleChildScrollView(
child: Column(),
),
);
}
}