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