【问题标题】:Custom bottom navigation bar notch problem in iphone 12 miniiphone 12 mini 中的自定义底部导航栏缺口问题
【发布时间】:2022-10-04 17:37:38
【问题描述】:

如何使自定义导航栏像默认导航栏一样采用缺口问题

代码:

Scaffold(
        floatingActionButtonLocation: FloatingActionButtonLocation
            .startDocked, //specify the location of the FAB
        floatingActionButton: FloatingActionButton(
          backgroundColor: Colors.blue,
          onPressed: () {
            print('OK');
          },
          tooltip: "start FAB",
          child: Container(
            height: 60,
            margin: EdgeInsets.all(15.0),
            child: Icon(Icons.add),
          ),
          elevation: 4.0,
        ),
        bottomNavigationBar: BottomAppBar(
          child: Container(
            color: Colors.lightBlue,
            height: 60,
          ),
        ));

【问题讨论】:

    标签: ios flutter dart flutter-layout


    【解决方案1】:

    这就是我解决它的方法,但在这里我不打算使用 bottomNavigationBar Widget

     
    Scaffold(
            floatingActionButtonLocation: FloatingActionButtonLocation
                .startDocked, //specify the location of the FAB
            floatingActionButton: FloatingActionButton(
              backgroundColor: Colors.blue,
              onPressed: () {
                print('OK');
              },
              tooltip: "start FAB",
              child: Container(
                height: 60,
                margin: EdgeInsets.all(15.0),
                child: Icon(Icons.add),
              ),
              elevation: 4.0,
            ),
            bottomNavigationBar: BottomAppBar(
              color: Colors.blue,
              child: Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    color: Colors.lightBlue,
                    height: 50,
                  ),
                ],
              ),
            ));  
    

    【讨论】:

    • 但它没有缺口。
    • 你可以给属性形状: const CircularNotchedRectangle(), to bottomAppBar
    【解决方案2】:

    请尝试安全区小部件,它真的很有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-18
      • 2021-04-18
      • 1970-01-01
      相关资源
      最近更新 更多