首页 > 解决方案 > 在底部导航颤振后面扩展容器

问题描述

我正在尝试将底部导航栏后面的白色容器扩展到屏幕的最末端。不仅限于底部导航栏(如图所示)。

非常感谢任何帮助或想法,我是 Flutter 的新手。谢谢!

该应用程序的结构是:

bottomNavigationBar: BottomAppBar(
    shape: CircularNotchedRectangle(),
    notchMargin: 8.0,
    child: Row(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: <Widget>[
        IconButton(
          icon: Icon(
            Icons.show_chart,
          ),
          onPressed: () {},
        ),
        SizedBox(width: 48.0),
        IconButton(
          icon: Icon(
            Icons.filter_list,
          ),
          onPressed: () {},
        ),
      ],
    ),
  ),
  floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
  floatingActionButton: FloatingActionButton(
    child: Icon(Icons.add),
    onPressed: () {},
  ),
  body: Column(
    children: <Widget>[
      Expanded(
        child: Container(
        height: 100,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(40),
            topRight: Radius.circular(40)
          )
        ),
      ),
      )
    ],
  )

标签: androidiosflutterdart

解决方案


您可以在“Scaffold”类中使用“extendBody: true”

Scaffold(
    extendBody: true,
    body: _yourBody(),
    bottomNavigationBar: _yourBottomNavBar(),
)

推荐阅读