persistent_bottom_nav_bar_v2 5.0.0-beta.2 persistent_bottom_nav_bar_v2: ^5.0.0-beta.2 copied to clipboard
A highly customizable bottom navigation bar for Flutter. It is shipped with 17 prebuilt styles you can choose from, but can also be used with your very own style without sacrificing any features. Base [...]
import 'package:flutter/material.dart';
import 'package:persistent_bottom_nav_bar_v2/persistent_bottom_nav_bar_v2.dart';
import 'package:persistent_bottom_nav_bar_v2_example_project/interactive_example.dart';
import 'package:persistent_bottom_nav_bar_v2_example_project/screens.dart';
void main() => runApp(PersistenBottomNavBarDemo());
class PersistenBottomNavBarDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Persistent Bottom Navigation Bar Demo',
home: InteractiveExample(),
routes: {
// When navigating to the "/first" route, build the FirstScreen widget.
'/first': (context) => MainScreen2(),
// When navigating to the "/second" route, build the SecondScreen widget.
'/second': (context) => MainScreen3(),
},
);
}
}
class MinimalExample extends StatelessWidget {
MinimalExample({Key key}) : super(key: key);
List<PersistentTabConfig> _tabs() {
return [
PersistentTabConfig(
screen: MainScreen(),
item: ItemConfig(
icon: Icon(Icons.home),
title: "Home",
),
),
PersistentTabConfig(
screen: MainScreen(),
item: ItemConfig(
icon: Icon(Icons.message),
title: "Messages",
),
),
PersistentTabConfig(
screen: MainScreen(),
item: ItemConfig(
icon: Icon(Icons.settings),
title: "Settings",
),
),
];
}
@override
Widget build(BuildContext context) {
return PersistentTabView(
tabs: _tabs(),
navBarBuilder: (navBarConfig) => Style1BottomNavBar(
navBarConfig: navBarConfig,
navBarDecoration: NavBarDecoration(
color: Colors.white,
),
),
);
}
}