我觉得我还没有完全获得 persistentFooterButtons 。我以为它们会是安全区域的一部分,所以当键盘可见时我可以看到它们。有没有办法做到这一点?
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Persisting test'),
),
body: Center(child: TextFormField()),
persistentFooterButtons: <Widget>[
IconButton(icon: Icon(Icons.map), onPressed: () {}),
IconButton(icon: Icon(Icons.view_week), onPressed: () {}),
],
);
}
答案 0 :(得分:0)
您可以尝试使用Stack
和Align
小部件
return Scaffold(
appBar: AppBar(
title: Text('Persisting test'),
),
body: Center(
child: Stack(
children: <Widget>[
TextFormField(),
Align(
alignment: Alignment.bottomRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(icon: Icon(Icons.map), onPressed: () {}),
IconButton(icon: Icon(Icons.view_week), onPressed: () {}),
],
),
)
],
)),
);
答案 1 :(得分:0)
我希望这对您有帮助
Widget bodySection = new Expanded(
child: new Container (
padding: new EdgeInsets.all(8.0),
color: Colors.white70,
child: new TextFormField(
style: const TextStyle(
color: Colors.black,
),
decoration: new InputDecoration(
icon: new Icon(
Icons.lock,
color: Colors.black,
),
border: InputBorder.none,
hintText: "Enter some text here ..",
hintStyle: const TextStyle(color: Colors.black, fontSize: 12.0),
contentPadding: const EdgeInsets.only(
top: 20.0, right: 5.0, bottom: 20.0, left:30.0),
),
),
),
);
Widget fixedBottomSection = new Container (
padding: new EdgeInsets.all(8.0),
color: Colors.purpleAccent[200],
height: 48.0,
child:
new InkWell(
onTap: _continue,
child: new Center(
child: new Text('Next ' , style: TextStyle(color: Colors.white , fontWeight: FontWeight.bold),),
),
)
);
Widget content = new Column(
// This makes each child fill the full width of the screen
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
bodySection,
fixedBottomSection,
],
);
return new Scaffold(
appBar: new AppBar(
// backgroundColor: Colors.purpleAccent[200],
title: new Text("Fixed bottom action bar above keyboard"),
),
body: new Padding(
padding: new EdgeInsets.symmetric(vertical: 0.0, horizontal: 0.0),
child: content,
),
);