【问题标题】:Extend Container behind bottom navigation flutter在底部导航颤振后面扩展容器
【发布时间】:2020-04-16 20:37:36
【问题描述】:

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

非常感谢任何帮助或想法,我是 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)
          )
        ),
      ),
      )
    ],
  )

【问题讨论】:

  • 你是怎么解决这个问题的?

标签: android ios flutter dart


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    backgroundColor 的值设置为Colors.white 以及Scaffold

    Scaffold(
      backgroundColor: Colors.white,
      bottomNavigationBar: BottomAppBar(
              shape: CircularNotchedRectangle(),
          ....
          ....
    

    【讨论】:

    • 这不是正确的答案。仅当屏幕上不显示任何内容时才有效
    猜你喜欢
    • 2022-11-25
    • 1970-01-01
    • 2017-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-02
    相关资源
    最近更新 更多