底片中的文本框在颤抖 [英] textbox inside bottomsheet in flutter
本文介绍了底片中的文本框在颤抖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个底图,如下所示
I have a bottomsheet which looks like below
当我赞不绝口时,它里面有一个文本框
It has a text box inside it when I cliked on that I am getting something like
我的文本框完全被键盘覆盖. 有什么办法可以解决这个问题?
my text box is completely covered by the keyboard. is there any way to solve this?
下面是代码
Widget buildSupportingWidget(
Map<String, Object> items, StateSetter setState) {
if (items['type'] == "string") {
dispName = items['displayName'];
return Container(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 27.0,
vertical: 16.0,
),
child: new TextFormField(
style: new TextStyle(fontSize: 12.0, color: Colors.black),
decoration: new InputDecoration(
labelText: "Enter value",
),
keyboardType: TextInputType.text,
controller: filterTextFieldData,
)));
}
return null;
}
我在bottomshhet内部的小部件上方调用.
I am calling above widget inside the bottomshhet.
谢谢
推荐答案
上周,我遇到了同样的问题,我通过创建有状态的底部工作表并添加具有高度为Column的容器的容器来解决它
Last week I faced same issue I solved it by create stateful bottom sheet and add Container with height last widget of Column
打开底页
InkWell(
onTap: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return ModalBottomSheet(
);
});
})
有状态的底页
class ModalBottomSheet extends StatefulWidget {
@override
_ModalBottomSheetState createState() => _ModalBottomSheetState();
}
class _ModalBottomSheetState extends State<ModalBottomSheet>
with SingleTickerProviderStateMixin {
@override
Widget build(BuildContext context) {
double keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
// TODO: implement build
return Wrap(
children: <Widget>[
Container(
margin:
EdgeInsets.only(left: 10.0, right: 10.0, top: 15.0, bottom: 15.0),
child: Column(
Widgets(),
Container(
height: keyboardHeight ,
)
)
)
],
);
}
}
键盘可见性包也可以帮助我检查键盘是否打开
also Keyboard Visibility package help me to check keyboard open or not
这篇关于底片中的文本框在颤抖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文