我一直在尝试使用底部带有文本字段的模式表。模式表工作正常,但是以某种方式我看不到我键入的文本。键盘会隐藏文本字段。我已经尝试过singlechildscrollview和扩展方法,但还不能完全解决。另外,我尝试用脚手架封闭底部薄板。即使我将底层纸张的高度设置为设备屏幕尺寸的90%,它仍会占用整个屏幕。我该怎么解决?!
代码:
modalSheet() {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15.0), topRight: Radius.circular(15.0)),
),
builder: (context) {
return Container(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
height: MediaQuery.of(context).size.height * 0.9,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: MediaQuery.of(context).size.height * 0.1,
color: Colors.green,
),
Container(
height: MediaQuery.of(context).size.height * 0.7,
color: Colors.blue,
),
Container(
height: MediaQuery.of(context).size.height * 0.1,
color: Colors.grey[200],
child: Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: Center(
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
suffixIcon: Icon(Icons.insert_emoticon),
hintText: 'Write a comment...',
hintStyle: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w600,
color: Colors.grey),
),
),
),
),
)
],
),
);
});
}