PersistentTabView.custom constructor

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

Implementation

PersistentTabView.custom(
  this.context, {
  Key? key,
  List<PersistentBottomNavBarItem>? items,
  required this.screens,
  this.controller,
  this.margin = EdgeInsets.zero,
  this.floatingActionButton,
  required Widget Function(NavBarEssentials) customWidget,
  required int itemCount,
  this.resizeToAvoidBottomInset = false,
  this.bottomScreenMargin,
  this.selectedTabScreenContext,
  this.hideNavigationBarWhenKeyboardShows = true,
  bool popAllScreensOnTapOfSelectedTab = true,
  this.backgroundColor = CupertinoColors.white,
  CustomWidgetRouteAndNavigatorSettings routeAndNavigatorSettings = const CustomWidgetRouteAndNavigatorSettings(),
  this.confineInSafeArea = true,
  this.onWillPop,
  this.stateManagement = true,
  this.handleAndroidBackButtonPress = true,
  this.hideNavigationBar,
  this.screenTransitionAnimation = const ScreenTransitionAnimation(),
}) : super(
        key: key,
        context: context,
        items: items,
        screens: screens,
        controller: controller,
        margin: margin,
        routeAndNavigatorSettings: routeAndNavigatorSettings,
        backgroundColor: backgroundColor,
        floatingActionButton: floatingActionButton,
        customWidget: customWidget,
        itemCount: itemCount,
        resizeToAvoidBottomInset: resizeToAvoidBottomInset,
        popAllScreensOnTapOfSelectedTab: popAllScreensOnTapOfSelectedTab,
        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.");
}