PersistentTabView.custom constructor

PersistentTabView.custom(
  1. BuildContext context, {
  2. Key? key,
  3. required List<Widget> screens,
  4. PersistentTabController? controller,
  5. EdgeInsets margin = EdgeInsets.zero,
  6. Widget? floatingActionButton,
  7. required Widget customWidget,
  8. required int itemCount,
  9. bool resizeToAvoidBottomInset = false,
  10. double? bottomScreenMargin,
  11. dynamic selectedTabScreenContext(
    1. BuildContext?
    )?,
  12. bool hideNavigationBarWhenKeyboardShows = true,
  13. Color backgroundColor = CupertinoColors.white,
  14. CutsomWidgetRouteAndNavigatorSettings routeAndNavigatorSettings = const CutsomWidgetRouteAndNavigatorSettings(),
  15. bool confineInSafeArea = true,
  16. Future<bool> onWillPop(
    1. BuildContext?
    )?,
  17. bool stateManagement = true,
  18. bool handleAndroidBackButtonPress = true,
  19. bool? hideNavigationBar,
  20. ScreenTransitionAnimation screenTransitionAnimation = const ScreenTransitionAnimation(),
})

Implementation

PersistentTabView.custom(
  this.context, {
  Key? key,
  required this.screens,
  this.controller,
  this.margin = EdgeInsets.zero,
  this.floatingActionButton,
  required Widget customWidget,
  required int itemCount,
  this.resizeToAvoidBottomInset = false,
  this.bottomScreenMargin,
  this.selectedTabScreenContext,
  this.hideNavigationBarWhenKeyboardShows = true,
  this.backgroundColor = CupertinoColors.white,
  CutsomWidgetRouteAndNavigatorSettings routeAndNavigatorSettings =
      const CutsomWidgetRouteAndNavigatorSettings(),
  this.confineInSafeArea = true,
  this.onWillPop,
  this.stateManagement = true,
  this.handleAndroidBackButtonPress = true,
  this.hideNavigationBar,
  this.screenTransitionAnimation = const ScreenTransitionAnimation(),
}) : super(
        key: key,
        context: context,
        screens: screens,
        controller: controller,
        margin: margin,
        routeAndNavigatorSettings: routeAndNavigatorSettings,
        backgroundColor: backgroundColor,
        floatingActionButton: floatingActionButton,
        customWidget: customWidget,
        itemCount: itemCount,
        resizeToAvoidBottomInset: resizeToAvoidBottomInset,
        bottomScreenMargin: bottomScreenMargin,
        onWillPop: onWillPop,
        confineInSafeArea: confineInSafeArea,
        stateManagement: stateManagement,
        handleAndroidBackButtonPress: handleAndroidBackButtonPress,
        hideNavigationBar: hideNavigationBar,
        screenTransitionAnimation: screenTransitionAnimation,
        isCustomWidget: true,
        decoration: NavBarDecoration(
          colorBehindNavBar: backgroundColor
        ),
      ) {
  assert(itemCount == screens.length,
      "screens and items length should be same. If you are using the onPressed callback function of 'PersistentBottomNavBarItem', enter a dummy screen like Container() in its place in the screens");
  assert(
      routeAndNavigatorSettings.navigatorKeys == null ||
          routeAndNavigatorSettings.navigatorKeys != null &&
              routeAndNavigatorSettings.navigatorKeys!.length !=
                  items!.length,
      "Number of 'Navigator Keys' must be equal to the number of bottom navigation tabs.");
}