AppBar 在使用弯曲底部导航时位于通知栏上方

时间:2020-12-22 03:53:18

标签: flutter

当我使用我的应用程序时,我的应用程序栏的弯曲底部导航栏位于应用程序栏的安全区域上方,并覆盖了通知栏的一小部分。这只发生在具有底部导航栏的页面上。我认为是导航栏的问题。有人对此有任何解决方案吗?谢谢。

 import 'package:flutter/material.dart';
    import 'package:flutter/cupertino.dart';
    import 'package:curved_navigation_bar/curved_navigation_bar.dart';
    import 'package:flutter_ecommerce_app/screens/ShoppingCartPage(p).dart';
    import 'package:flutter_ecommerce_app/screens/HomeScreen.dart';
    import 'package:flutter_ecommerce_app/screens/profilePage.dart';
    import 'package:flutter_ecommerce_app/screens/OurStores.dart';
    import 'package:flutter_ecommerce_app/screens/NotificationsScreen.dart';
    import 'package:flutter_ecommerce_app/screens/circularMenuScreen.dart';
    import 'package:circular_menu/circular_menu.dart';
    import 'dart:math';

class BottomNavBarWidget extends StatefulWidget {
  @override
  _BottomNavBarWidgetState createState() => new _BottomNavBarWidgetState();
}

class _BottomNavBarWidgetState extends State<BottomNavBarWidget> {
  int currentIndex = 0;
  GlobalKey _bottomNavigationKey = GlobalKey();
  final List<Widget> viewContainer = [
    HomeScreen(),
    notifications(),
    CircularMenuScreen(),
    CartScreen(),
    ProfilePage()
  ];

  @override
  Widget build(BuildContext context) {
    // void onTap(int index) {
    //   setState(() {
    //     currentIndex = index;
    //   });
    // }

    return SafeArea(
      child: new Scaffold(
        body: Padding(
          padding: const EdgeInsets.only(top: 30),
          child: viewContainer[currentIndex],
        ),
        bottomNavigationBar: CurvedNavigationBar(
          key: _bottomNavigationKey,
          index: currentIndex,
          height: 45.0,
          items: <Widget>[
            Icon(
              Icons.home,
              // color: Colors.white,
            ),
            Icon(
              Icons.notifications_active_rounded,
              // color: Colors.white,
            ),
            Container(
              width: 40,
              height: 40,
              child: Image.asset('assets/images/app-icon-logo.png'),
            ),
            Icon(
              Icons.shopping_cart,
              // color: Colors.white,
            ),
            Icon(
              Icons.person,
              // color: Colors.white,
            ),
          ],
          // color: Colors.lightBlueAccent,
          color: Colors.grey[300],
          buttonBackgroundColor: Colors.grey[300],
          backgroundColor: Colors.white60,
          animationCurve: Curves.fastOutSlowIn,
          animationDuration: Duration(milliseconds: 600),
          onTap: (index) {
            setState(() {
              currentIndex = index;
              print(currentIndex);
            });
          },
        ),
      ),
    );
  }
}

这些是我正在谈论的图片:homeScreenProfile Page

0 个答案:

没有答案
相关问题