【发布时间】:2020-08-08 22:54:52
【问题描述】:
我正在尝试将多个child 写入flutter 脚手架body: 标记。
我是 Flutter 的新手,我不知道如何在一个 body 标签内处理多个孩子。 他是我尝试过的。
return new Scaffold(
appBar: AppBar(
leading: new Icon(Icons.live_tv),
title: const Text('SnapNews'),
backgroundColor: Colors.red,
actions: <Widget>[
IconButton(
icon: Icon(Icons.help),
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (_) => Help()));
},
),
],
),
body: new ListView.builder(
itemCount: 10,
itemBuilder: (context, index) {
return new GestureDetector(
onTap: () {
print("tapped");
},
child: new Padding(
padding: const EdgeInsets.all(8.0),
child: new Container(
color: Colors.grey,
height: 100.0,
),
),
);
},
),
floatingActionButton: FloatingActionButton.extended(
elevation: 4.0,
icon: const Icon(Icons.camera_enhance),
label: const Text('Snap'),
backgroundColor: Colors.red,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => CameraScreen()),
);
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: BottomAppBar(
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(null),
onPressed: () {},
),
IconButton(
icon: Icon(null),
onPressed: () {},
)
],
),
),
);
这会产生如下的图形用户界面:
但我想在这个ListView 的顶部添加一个Search Bar
如何将另一个孩子/孩子添加到 body: 标记
谢谢。
【问题讨论】: