Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin{
- TabController controller;
- @override
- void initState(){
- super.initState();
- controller=TabController(vsync: this,length: 2);
- }
- @override
- void dispose(){
- controller.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text("Tab"),
- backgroundColor: Colors.teal,
- bottom: TabBar(
- controller: controller,
- tabs: <Widget>[
- Tab(
- icon: Icon(Icons.directions_bike),
- ),
- Tab(
- icon: Icon(Icons.directions_car),
- ),
- ],
- ),
- ),
- body:TabBarView(
- controller: controller,
- children: <Widget>[
- firstpage.FirstPage(),
- secondpage.SecondPage(),
- ],
- ),
- );
- }
- }
Add Comment
Please, Sign In to add comment