0

在此处输入图像描述我使用了持久导航栏但是样式NavBarStyle.style1不起作用..

这是我的代码

 return PersistentTabView(context,
              controller: viewModel.controller,
              decoration: NavBarDecoration(boxShadow: [
                BoxShadow(
                    color: Colors.black.withOpacity(0.2),
                    blurRadius: 4,
                    offset: Offset(0, 2),
                    spreadRadius: 2)
              ]),
              screens: _buildScreens(),
              items: _navBarItems(context),
              confineInSafeArea: true,
              backgroundColor: Colors.white,
              handleAndroidBackButtonPress: true,
              resizeToAvoidBottomInset: true,
              stateManagement: true,
              hideNavigationBarWhenKeyboardShows: true,
              popAllScreensOnTapOfSelectedTab: true,
              routeAndNavigatorSettings: RouteAndNavigatorSettings(
                onGenerateRoute: RootRouter().onGenerateRoute,
                onUnknownRoute: RootRouter().unknownRouteHandler,
              ),
              popActionScreens: PopActionScreensType.all,
              itemAnimationProperties: ItemAnimationProperties(
                  curve: Curves.ease, duration: Duration(milliseconds: 200)),
              navBarStyle: NavBarStyle.style1);
  List<Widget> _buildScreens() {
    return [
      IneScreen(),
      SecondScreen(),
      ThirdScreen(),
      ProfileScreen()
    ];
  }

  List<PersistentBottomNavBarItem> _navBarItems(BuildContext context) {
    return [
      PersistentBottomNavBarItem(
          icon: Icon(App.ic_compass),
          activeColor: AppColors.primaryColor,
          inactiveColor: AppColors.onBackgroundColor2,
          title: AppLocalizations.of(context).search),
      PersistentBottomNavBarItem(
          icon: Icon(App.ic_pin),
          activeColor: AppColors.primaryColor,
          inactiveColor: AppColors.onBackgroundColor2,
          title: AppLocalizations.of(context).pins),
      PersistentBottomNavBarItem(
          icon: Icon(App.ic_phone),
          activeColor: AppColors.primaryColor,
          inactiveColor: AppColors.onBackgroundColor2,
          title: AppLocalizations.of(context).phone),
      PersistentBottomNavBarItem(
          icon: Icon(App.ic_profile),
          activeColor: AppColors.primaryColor,
          inactiveColor: AppColors.onBackgroundColor2,
          title: AppLocalizations.of(context).myAccount)
    ];
  }]

这是错误代码,只有 style1 不起作用

4

0 回答 0