PersistentTabView constructor

PersistentTabView(
  1. BuildContext context, {
  2. required List<Widget> screens,
  3. Key? key,
  4. List<PersistentBottomNavBarItem>? items,
  5. PersistentTabController? controller,
  6. double navBarHeight = kBottomNavigationBarHeight,
  7. EdgeInsets margin = EdgeInsets.zero,
  8. Color backgroundColor = CupertinoColors.white,
  9. ValueChanged<int>? onItemSelected,
  10. NeumorphicProperties? neumorphicProperties,
  11. Widget? floatingActionButton,
  12. NavBarPadding padding = const NavBarPadding.all(null),
  13. NavBarDecoration decoration = const NavBarDecoration(),
  14. bool resizeToAvoidBottomInset = false,
  15. double? bottomScreenMargin,
  16. dynamic selectedTabScreenContext(
    1. BuildContext?
    )?,
  17. bool hideNavigationBarWhenKeyboardShows = true,
  18. bool popAllScreensOnTapOfSelectedTab = true,
  19. bool popAllScreensOnTapAnyTabs = false,
  20. PopActionScreensType popActionScreens = PopActionScreensType.all,
  21. bool confineInSafeArea = true,
  22. Future<bool> onWillPop(
    1. BuildContext?
    )?,
  23. bool stateManagement = true,
  24. bool handleAndroidBackButtonPress = true,
  25. ItemAnimationProperties? itemAnimationProperties,
  26. bool? hideNavigationBar,
  27. ScreenTransitionAnimation screenTransitionAnimation = const ScreenTransitionAnimation(),
  28. NavBarStyle navBarStyle = NavBarStyle.style1,
})

Implementation

PersistentTabView(this.context,
    {required this.screens,
    final Key? key,
    final List<PersistentBottomNavBarItem>? items,
    this.controller,
    final double navBarHeight = kBottomNavigationBarHeight,
    this.margin = EdgeInsets.zero,
    this.backgroundColor = CupertinoColors.white,
    final ValueChanged<int>? onItemSelected,
    final NeumorphicProperties? neumorphicProperties,
    this.floatingActionButton,
    final NavBarPadding padding = const NavBarPadding.all(null),
    final NavBarDecoration decoration = const NavBarDecoration(),
    this.resizeToAvoidBottomInset = false,
    this.bottomScreenMargin,
    this.selectedTabScreenContext,
    this.hideNavigationBarWhenKeyboardShows = true,
    final bool popAllScreensOnTapOfSelectedTab = true,
    final bool popAllScreensOnTapAnyTabs = false,
    final PopActionScreensType popActionScreens = PopActionScreensType.all,
    this.confineInSafeArea = true,
    this.onWillPop,
    this.stateManagement = true,
    this.handleAndroidBackButtonPress = true,
    final ItemAnimationProperties? itemAnimationProperties,
    this.hideNavigationBar,
    this.screenTransitionAnimation = const ScreenTransitionAnimation(),
    final NavBarStyle navBarStyle = NavBarStyle.style1})
    : assert(items != null,
          "Items can only be null in case of custom navigation bar style. Please add the items!"),
      assert(assertMidButtonStyles(navBarStyle, items!.length),
          "NavBar styles 15-18 only accept 3 or 5 PersistentBottomNavBarItem items."),
      assert(items!.length == 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(items!.length >= 2 && items.length <= 6,
          "NavBar should have at least 2 or maximum 6 items (Except for styles 15-18)"),
      assert(handleAndroidBackButtonPress && onWillPop == null,
          "If you declare the onWillPop function, you will have to handle the back function functionality yourself as your onWillPop function will override the default function."),
      super(
        key: key,
        context: context,
        screens: screens,
        controller: controller,
        margin: margin,
        items: items,
        padding: padding,
        decoration: decoration,
        hideNavigationBarWhenKeyboardShows:
            hideNavigationBarWhenKeyboardShows,
        itemAnimationProperties: itemAnimationProperties,
        navBarStyle: navBarStyle,
        popActionScreens: popActionScreens,
        popAllScreensOnTapOfSelectedTab: popAllScreensOnTapOfSelectedTab,
        popAllScreensOnTapAnyTabs: popAllScreensOnTapAnyTabs,
        navBarHeight: navBarHeight,
        backgroundColor: backgroundColor,
        onItemSelected: onItemSelected,
        neumorphicProperties: neumorphicProperties,
        floatingActionButton: floatingActionButton,
        resizeToAvoidBottomInset: resizeToAvoidBottomInset,
        bottomScreenMargin: bottomScreenMargin,
        onWillPop: onWillPop,
        isCustomWidget: false,
        confineInSafeArea: confineInSafeArea,
        stateManagement: stateManagement,
        handleAndroidBackButtonPress: handleAndroidBackButtonPress,
        hideNavigationBar: hideNavigationBar,
        screenTransitionAnimation: screenTransitionAnimation,
      );