PersistentTabView constructor

PersistentTabView(
  1. BuildContext context, {
  2. Key? key,
  3. List<PersistentBottomNavBarItem>? items,
  4. required List<Widget> screens,
  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. PopActionScreensType popActionScreens = PopActionScreensType.all,
  20. bool confineInSafeArea = true,
  21. Future<bool> onWillPop(
    1. BuildContext?
    )?,
  22. bool stateManagement = true,
  23. bool handleAndroidBackButtonPress = true,
  24. ItemAnimationProperties? itemAnimationProperties,
  25. bool? hideNavigationBar,
  26. ScreenTransitionAnimation screenTransitionAnimation = const ScreenTransitionAnimation(),
  27. NavBarStyle navBarStyle = NavBarStyle.style1,
})

Implementation

PersistentTabView(this.context,
    {Key? key,
    List<PersistentBottomNavBarItem>? items,
    required this.screens,
    this.controller,
    double navBarHeight = kBottomNavigationBarHeight,
    this.margin = EdgeInsets.zero,
    this.backgroundColor = CupertinoColors.white,
    ValueChanged<int>? onItemSelected,
    NeumorphicProperties? neumorphicProperties,
    this.floatingActionButton,
    NavBarPadding padding = const NavBarPadding.all(null),
    NavBarDecoration decoration = const NavBarDecoration(),
    this.resizeToAvoidBottomInset = false,
    this.bottomScreenMargin,
    this.selectedTabScreenContext,
    this.hideNavigationBarWhenKeyboardShows = true,
    bool popAllScreensOnTapOfSelectedTab = true,
    PopActionScreensType popActionScreens = PopActionScreensType.all,
    this.confineInSafeArea = true,
    this.onWillPop,
    this.stateManagement = true,
    this.handleAndroidBackButtonPress = true,
    ItemAnimationProperties? itemAnimationProperties,
    this.hideNavigationBar,
    this.screenTransitionAnimation = const ScreenTransitionAnimation(),
    NavBarStyle navBarStyle = NavBarStyle.style1})
    : 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,
        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,
      ) {
  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)");
}