PersistentTabView constructor
PersistentTabView(
- BuildContext context, {
- required List<
Widget> screens, - Key? key,
- List<
PersistentBottomNavBarItem> ? items, - 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,
- bool popAllScreensOnTapAnyTabs = false,
- 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,
{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,
);