我想在我的 appBar 中使用一个图标来打开我的表单。目前我的表单位于我的应用程序(列)的正文中。我怎样才能做到这一点,而不是将表单放在正文中,我可以点击图标,然后会出现一个弹出窗口,有点像撰写推文?
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Social App'),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: IconButton(icon: Icon(Icons.add), onPressed: (){})
),
],
),
body: Column(
children: <Widget>[
Flexible(
flex: 0,
child: Card(
child: Form(
key: formKey,
child: Flex(
direction: Axis.vertical,
children: <Widget>[
ListTile(
leading: Icon(Icons.subject),
title: TextFormField(
initialValue: '',
onSaved: (val) => board.subject = val,
validator: (val) => val == "" ? val: null,
),
),
ListTile(
leading: Icon(Icons.message),
title: TextFormField(
initialValue: '',
onSaved: (val) => board.body = val,
validator: (val) => val == "" ? val: null,
),
),
FloatingActionButton(
child: Text('post'),
backgroundColor: Colors.pink,
onPressed: (){
handleSubmit();
},
),
],
),
),
),
),
如果还有什么我需要提供帮助的,请告诉我。并提前感谢。