Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 5.15 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class MyApp extends StatelessWidget {
  4.   final Color _black = Color(0xFF3B3B3B);
  5.   final Color _grey = Color(0xFFA9A9B0);
  6. //final Color _blue = Color(0xFF118DF0);
  7.  
  8.   @override
  9.   Widget build(BuildContext context) {
  10.     return MaterialApp(
  11.       debugShowCheckedModeBanner: false,
  12.       title: 'Fliply',
  13.       home: Scaffold(
  14.         backgroundColor: Colors.white,
  15.         body: Column(
  16.           children: <Widget>[
  17.             _topBar(),
  18.             SearchBar(),
  19.             _filterBar(),
  20.             Categories(),
  21.           ],
  22.         ),
  23.       ),
  24.     );
  25.   }
  26.  
  27.   Widget _topBar() {
  28.     return AppBar(
  29.       elevation: 0.0,
  30.       backgroundColor: Colors.white,
  31.       title: Container(
  32.         child: Row(
  33.           children: <Widget>[
  34.             Icon(
  35.               Icons.location_on,
  36.               color: _black,
  37.             ),
  38.             SizedBox(width: 4.0),
  39.             Text(
  40.               'CHENNAI, INDIA',
  41.               style: TextStyle(
  42.                 fontFamily: 'SF-Pro-Display',
  43.                 fontSize: 18.0,
  44.                 fontWeight: FontWeight.w500,
  45.                 color: _black,
  46.               ),
  47.             ),
  48.             Spacer(),
  49.             IconButton(
  50.               icon: Icon(
  51.                 Icons.notifications,
  52.                 color: _black,
  53.               ),
  54.               onPressed: () {},
  55.             )
  56.           ],
  57.         ),
  58.       ),
  59.     );
  60.   }
  61.  
  62.   Widget _filterBar() {
  63.     return Container(
  64.       margin: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
  65.       child: Row(
  66.         mainAxisSize: MainAxisSize.max,
  67.         mainAxisAlignment: MainAxisAlignment.spaceBetween,
  68.         children: <Widget>[
  69.           Text(
  70.             'Recently Added',
  71.             style: TextStyle(
  72.               fontSize: 30.0,
  73.               fontWeight: FontWeight.bold,
  74.               color: _black,
  75.             ),
  76.           ),
  77.           IconButton(
  78.             icon: Icon(
  79.               Icons.filter_list,
  80.               color: _grey,
  81.               size: 34.0,
  82.             ),
  83.             onPressed: () {},
  84.           )
  85.         ],
  86.       ),
  87.     );
  88.   }
  89. }
  90.  
  91. class SearchBar extends StatelessWidget {
  92.   @override
  93.   Widget build(BuildContext context) {
  94.     return Container(
  95.       padding: EdgeInsets.symmetric(horizontal: 25.0),
  96.       margin: EdgeInsets.fromLTRB(10.0, 5.0, 15.0, 15.0),
  97.       decoration: BoxDecoration(
  98.         color: Colors.grey.shade100,
  99.         borderRadius: BorderRadius.circular(30.0),
  100.       ),
  101.       child: TextField(
  102.         decoration: InputDecoration(
  103.           border: InputBorder.none,
  104.           hintText: 'What are you looking for?',
  105.           hintStyle: TextStyle(
  106.             fontSize: 16.0,
  107.             color: Colors.grey,
  108.           ),
  109.           suffixIcon: Icon(
  110.             Icons.search,
  111.             color: Colors.black54,
  112.           ),
  113.         ),
  114.       ),
  115.     );
  116.   }
  117. }
  118.  
  119. class Categories extends StatefulWidget {
  120.   @override
  121.   _CategoriesState createState() => _CategoriesState();
  122. }
  123.  
  124. class _CategoriesState extends State<Categories>
  125.     with SingleTickerProviderStateMixin {
  126.   TabController tabController;
  127.  
  128.   @override
  129.   void initState() {
  130.     super.initState();
  131.     tabController = TabController(vsync: this, length: 6);
  132.   }
  133.  
  134.   @override
  135.   void dispose() {
  136.     tabController.dispose();
  137.     super.dispose();
  138.   }
  139.  
  140.   @override
  141.   Widget build(BuildContext context) {
  142.     return Container(
  143.       margin: EdgeInsets.only(left: 10.0),
  144.       child: TabBar(
  145.         controller: tabController,
  146.         isScrollable: true,
  147.         indicatorColor: Colors.blue,
  148.         indicatorSize: TabBarIndicatorSize.label,
  149.         indicatorWeight: 2.0,
  150.         labelColor: Colors.black,
  151.         unselectedLabelColor: Colors.grey,
  152.         tabs: <Widget>[
  153.           Tab(
  154.             child: Text(
  155.               'All',
  156.               style: TextStyle(
  157.                 fontSize: 16.0,
  158.                 fontWeight: FontWeight.w300,
  159.               ),
  160.             ),
  161.           ),
  162.           Tab(
  163.             child: Text(
  164.               'Cars',
  165.               style: TextStyle(
  166.                 fontSize: 16.0,
  167.                 fontWeight: FontWeight.w300,
  168.               ),
  169.             ),
  170.           ),
  171.           Tab(
  172.             child: Text(
  173.               'Electronics',
  174.               style: TextStyle(
  175.                 fontSize: 16.0,
  176.                 fontWeight: FontWeight.w300,
  177.               ),
  178.             ),
  179.           ),
  180.           Tab(
  181.             child: Text(
  182.               'Clothing',
  183.               style: TextStyle(
  184.                 fontSize: 16.0,
  185.                 fontWeight: FontWeight.w300,
  186.               ),
  187.             ),
  188.           ),
  189.           Tab(
  190.             child: Text(
  191.               'Home',
  192.               style: TextStyle(
  193.                 fontWeight: FontWeight.w300,
  194.                 fontSize: 16.0,
  195.               ),
  196.             ),
  197.           ),
  198.           Tab(
  199.             child: Text(
  200.               'Accessories',
  201.               style: TextStyle(
  202.                 fontSize: 16.0,
  203.                 fontWeight: FontWeight.w300,
  204.               ),
  205.             ),
  206.           ),
  207.         ],
  208.       ),
  209.     );
  210.   }
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement