Android TextField处于焦点时呈现溢出
我有一个带有文本字段的专栏,里面很灵活。灵活的列表视图包括显示英雄角色列表。 当我开始关注TextField时,显示会显示x像素的渲染溢出。如何避免这种情况Android TextField处于焦点时呈现溢出,android,dart,flutter,flutter-layout,Android,Dart,Flutter,Flutter Layout,我有一个带有文本字段的专栏,里面很灵活。灵活的列表视图包括显示英雄角色列表。 当我开始关注TextField时,显示会显示x像素的渲染溢出。如何避免这种情况 @override Widget build(BuildContext context) { return new Stack( children: <Widget>[ new Padding( padding: new EdgeInsets.all(10.0),
@override
Widget build(BuildContext context) {
return new Stack(
children: <Widget>[
new Padding(
padding: new EdgeInsets.all(10.0),
child: new TextField(
keyboardType: TextInputType.text,
controller: tc,
),
),
new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Container(
margin: new EdgeInsets.only(top: 60.0),
height: MediaQuery.of(context).size.height * 0.67,
child: checkList(context, characterDataWrapper), //MY LISTVIEW
),
new Flexible(
fit: FlexFit.loose,
child: new Container(),
),
new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new RaisedButton(
onPressed: getData,
color: Colors.red,
textColor: Colors.white,
child: new Text("Click"),
),
]),
],
)
],
);
}
@覆盖
小部件构建(构建上下文){
返回新堆栈(
儿童:[
新填料(
填充:新边缘设置。全部(10.0),
孩子:新文本字段(
键盘类型:TextInputType.text,
控制员:tc,,
),
),
新专栏(
mainAxisSize:mainAxisSize.min,
儿童:[
新容器(
边距:仅限新边集(顶部:60.0),
高度:MediaQuery.of(上下文).size.height*0.67,
子:检查表(上下文,characterDataWrapper),//我的列表视图
),
新柔性(
适合:FlexFit.宽松,
子级:新容器(),
),
新专栏(
crossAxisAlignment:crossAxisAlignment.center,
mainAxisSize:mainAxisSize.max,
mainAxisAlignment:mainAxisAlignment.end,
儿童:[
新升起的按钮(
onPressed:getData,
颜色:颜色,红色,
textColor:Colors.white,
子项:新文本(“单击”),
),
]),
],
)
],
);
}
我认为这个问题在
new Container(
margin: new EdgeInsets.only(top: 60.0),
height: MediaQuery.of(context).size.height * 0.67,
child: checkList(context, characterDataWrapper), //MY LISTVIEW
),
请提供您的代码或任何截图
我想你的顶部有一个文本字段,
中间有一个列表视图,底部有一个按钮
那么你可以这样试试
@override
Widget build(BuildContext context) {
return new Column(
children: <Widget>[
new TextField(
decoration: new InputDecoration(hintText: "I am the TextField"),
),
new Flexible(
flex: 1,
child: new ListView(
children: <Widget>[
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
new ListTile(
title: new Text("Some Text"),
),
],
)),
new RaisedButton(onPressed: () {})
],
);
}
@覆盖
小部件构建(构建上下文){
返回新列(
儿童:[
新文本字段(
装饰:新输入装饰(hintText:“我是文本字段”),
),
新柔性(
弹性:1,
子:新列表视图(
儿童:[
新ListTile(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
新建列表(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
新ListTile(
标题:新文本(“某些文本”),
),
],
)),
新建RaisedButton(按下时:(){})
],
);
}
我想这会对您有所帮助。请在您的问题中添加代码,以便重现错误,并提供手机屏幕截图。请提供您的代码,同时发布您需要显示的图像。我无法上传图像,因为我的声誉很低@GünterZöchbauer我添加了代码,它起作用了。谢谢你。!我使用了
Expanded
而不是Flexible
,但它起了作用。