当我尝试将 Slider
添加到应用程序底部时,整个 BottomAppBar
向上移动到中心,并且正文内容(“Test”)消失了,如屏幕截图所示:
如何在两个图标旁边添加 slider 而不破坏整个布局?
这是我的代码:
runApp(
MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
body: Center(
child: Text("Test"),
),
bottomNavigationBar: BottomAppBar(
child: Row(
children: [
Slider(
value: 1,
),
FlatButton(
child: Icon(Icons.photo_size_select_actual),
onPressed: () => {},
),
FlatButton(
child: Icon(Icons.camera_alt),
onPressed: () => {},
),
],
),
),
),
),
);
最佳答案
使用IntrinsicHeight
。这将允许它使用所需的确切高度,而不是更多。
bottomNavigationBar: BottomAppBar(
child: IntrinsicHeight(
child: Row(...),
),
)
关于flutter - 如何防止 slider 弄乱我的布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58681320/