Flutter 底部导航盖体中的对齐小部件
我有一个具有以下结构的脚手架,身体被底部导航覆盖。如果我评论导航,一切正常Flutter 底部导航盖体中的对齐小部件,flutter,dart,Flutter,Dart,我有一个具有以下结构的脚手架,身体被底部导航覆盖。如果我评论导航,一切正常 Scaffold( backgroundColor: Theme.of(context).backgroundColor, appBar: AppAppBar(title: this.title), body: Row( children: [ Expanded( child: Container(
Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
appBar: AppAppBar(title: this.title),
body: Row(
children: [
Expanded(
child: Container(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: this.pageProvider.horizontalPadding,
vertical: 25),
child: this.body,
),
),
)
],
),
bottomNavigationBar: AppNavigation(),
);
这是AppNavigation小部件的实现:
Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 64,
child: BottomNavigation(),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 80,
child: WorkoutButton(),
),
),
],
);
堆栈(
儿童:[
对齐(
对齐:对齐.bottomCenter,
子:容器(
身高:64,
子项:BottomNavigation(),
),
),
对齐(
对齐:对齐.bottomCenter,
子:容器(
身高:80,
子项:WorkoutButton(),
),
),
],
);
这就是主体,无论我使用什么小部件:
如果不够清晰,则主体几乎没有高度。为什么不使用
底部导航栏
小部件而不是堆栈
无论如何,这是因为您的堆栈是不受约束的,因此使用了所有可用空间。给它一些约束(例如,通过将其包装在带有一些高度约束的约束框中
)
非常感谢你,米盖尔!它工作得很好!我决定不使用BottomNavigationBar,因为我想创建自己的布局。在你的帮助下,一切看起来都很好
ConstrainedBox(
constraints: BoxConstraints.tightFor(height: 150.0),
child: Stack( ...
)
)