dibaloke

Untitled

Jan 13th, 2019
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.95 KB | None | 0 0
  1. class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin{
  2.   TabController controller;
  3.   @override
  4.   void initState(){
  5.     super.initState();
  6.     controller=TabController(vsync: this,length: 2);
  7.   }
  8.   @override
  9.   void dispose(){
  10.    controller.dispose();
  11.     super.dispose();
  12.   }
  13.  
  14.  
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     return Scaffold(
  18.       appBar: AppBar(
  19.         title: Text("Tab"),
  20.         backgroundColor: Colors.teal,
  21.         bottom: TabBar(
  22.           controller: controller,
  23.           tabs: <Widget>[
  24.             Tab(
  25.               icon: Icon(Icons.directions_bike),
  26.             ),
  27.             Tab(
  28.               icon: Icon(Icons.directions_car),
  29.             ),
  30.           ],
  31.         ),
  32.       ),
  33.       body:TabBarView(
  34.         controller: controller,
  35.         children: <Widget>[
  36.           firstpage.FirstPage(),
  37.           secondpage.SecondPage(),
  38.         ],
  39.       ),
  40.     );
  41.   }
  42. }
Add Comment
Please, Sign In to add comment