Advertisement
k4ilham

scroll tab bar

Jul 11th, 2021
944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 4.47 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class ScrollableTab extends StatefulWidget {
  4.   static const routeName = '/ScrollableTab';
  5.   @override
  6.   _ScrollableTabState createState() => _ScrollableTabState();
  7. }
  8.  
  9. class _ScrollableTabState extends State<ScrollableTab> {
  10.  
  11.   textStyle() {
  12.     return new TextStyle(color: Colors.white, fontSize: 30.0);
  13.   }
  14.  
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     return new DefaultTabController(
  18.       length: 7,
  19.       child: new Scaffold(
  20.         appBar: new AppBar(
  21.           title: new Text("Smiple Tab Demo",style: TextStyle(color: Colors.black)),
  22.           bottom: new TabBar(
  23.             isScrollable: true,
  24.             tabs: <Widget>[
  25.               new Tab(
  26.                 child: Row(
  27.                   children: <Widget>[
  28.                     Icon(Icons.home,color:  Colors.black),
  29.                     Text('Home',style: TextStyle(color:  Colors.black)),
  30.                   ],
  31.                 ),
  32.               ),
  33.               new Tab(
  34.                 child:Row(
  35.                   children: <Widget>[
  36.                     Icon(Icons.person_pin,color:  Colors.black),
  37.                     Text('Profile',style: TextStyle(color:  Colors.black)),
  38.                   ],
  39.                 ),
  40.               ),
  41.               new Tab(
  42.                 child: Row(
  43.                   children: <Widget>[
  44.                     Icon(Icons.save_alt,color:  Colors.black),
  45.                     Text('Saved',style: TextStyle(color:  Colors.black)),
  46.                   ],
  47.                 ),
  48.               ),
  49.               new Tab(
  50.                 child: Row(
  51.                   children: <Widget>[
  52.                     Icon(Icons.favorite_border,color:  Colors.black),
  53.                     Text('Favorite',style: TextStyle(color:  Colors.black)),
  54.                   ],
  55.                 ),
  56.               ),
  57.               new Tab(
  58.                 child: Row(
  59.                   children: <Widget>[
  60.                     Icon(Icons.info_outline,color:  Colors.black),
  61.                     Text('About',style: TextStyle(color:  Colors.black)),
  62.                   ],
  63.                 ),
  64.               ),
  65.               new Tab(
  66.                 child: Row(
  67.                   children: <Widget>[
  68.                     Icon(Icons.chat,color:  Colors.black),
  69.                     Text('Chat',style: TextStyle(color:  Colors.black)),
  70.                   ],
  71.                 ),
  72.               ),
  73.               new Tab(
  74.                 child: Row(
  75.                   children: <Widget>[
  76.                     Icon(Icons.settings,color:  Colors.black),
  77.                     Text('Settings',style: TextStyle(color:  Colors.black)),
  78.                   ],
  79.                 ),
  80.               )
  81.             ],
  82.           ),
  83.         ),
  84.         body: new TabBarView(
  85.           children: <Widget>[
  86.             new Container(
  87.               child: new Center(
  88.                 child: new Text(
  89.                   "Home",
  90.                   style: TextStyle(color:  Colors.black),
  91.                 ),
  92.               ),
  93.             ),
  94.             new Container(
  95.               child: new Center(
  96.                 child: new Text(
  97.                   "Profile",
  98.                   style: TextStyle(color:  Colors.black),
  99.                 ),
  100.               ),
  101.             ),
  102.             new Container(
  103.               child: new Center(
  104.                 child: new Text(
  105.                   "Saved",
  106.                   style: TextStyle(color:  Colors.black),
  107.                 ),
  108.               ),
  109.             ),
  110.             new Container(
  111.               child: new Center(
  112.                 child: new Text(
  113.                   "Favorite",
  114.                   style: TextStyle(color:  Colors.black),
  115.                 ),
  116.               ),
  117.             ),
  118.             new Container(
  119.               child: new Center(
  120.                 child: new Text(
  121.                   "About",
  122.                   style: TextStyle(color:  Colors.black),
  123.                 ),
  124.               ),
  125.             ),
  126.             new Container(
  127.               child: new Center(
  128.                 child: new Text(
  129.                   "Chat",
  130.                   style: TextStyle(color:  Colors.black),
  131.                 ),
  132.               ),
  133.             ),
  134.             new Container(
  135.               child: new Center(
  136.                 child: new Text(
  137.                   "Settings",
  138.                   style: TextStyle(color:  Colors.black),
  139.                 ),
  140.               ),
  141.             ),
  142.           ],
  143.         ),
  144.       ),
  145.     );
  146.   }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement