Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 底部导航盖体中的对齐小部件_Flutter_Dart - Fatal编程技术网

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( ...
     )
)