Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 9.31 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:google_fonts/google_fonts.dart';
  3.  
  4. class Travel1 extends StatelessWidget {
  5.   @override
  6.   Widget build(BuildContext context) {
  7.     return Scaffold(
  8.       body: Container(
  9.         child: SingleChildScrollView(
  10.           child: Column(
  11.             children: <Widget>[
  12.               Container(
  13.                 width: MediaQuery.of(context).size.width,
  14.                 height: 260,
  15.                 decoration: BoxDecoration(
  16.                   borderRadius: BorderRadius.only(
  17.                     bottomLeft: Radius.circular(25),
  18.                     bottomRight: Radius.circular(25),
  19.                   ),
  20.                   image: DecorationImage(
  21.                     image: AssetImage("assets/images/footstep.jpg"),
  22.                     fit: BoxFit.cover,
  23.                   ),
  24.                 ),
  25.                 child: Stack(
  26.                   children: <Widget>[
  27.                     Positioned(
  28.                       bottom: 20,
  29.                       left: 10,
  30.                       right: 10,
  31.                       child: Column(
  32.                         crossAxisAlignment: CrossAxisAlignment.start,
  33.                         children: <Widget>[
  34.                           Padding(
  35.                             padding:
  36.                                 const EdgeInsets.only(left: 18.0, bottom: 10.0),
  37.                             child: Text(
  38.                               "Discovery",
  39.                               style: GoogleFonts.lato(
  40.                                 fontSize: 25,
  41.                                 fontWeight: FontWeight.bold,
  42.                                 textStyle: TextStyle(color: Colors.white),
  43.                               ),
  44.                             ),
  45.                           ),
  46.                           Container(
  47.                             margin: EdgeInsets.only(left: 8, right: 8),
  48.                             padding: EdgeInsets.only(left: 10, right: 10),
  49.                             width: MediaQuery.of(context).size.width,
  50.                             height: 50,
  51.                             decoration: BoxDecoration(
  52.                               borderRadius: BorderRadius.circular(12),
  53.                               color: Colors.white,
  54.                             ),
  55.                             child: Row(
  56.                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
  57.                               children: <Widget>[
  58.                                 Container(
  59.                                   width: 250,
  60.                                   height: 50,
  61.                                   child: TextField(
  62.                                     decoration: InputDecoration(
  63.                                       hintText: 'Search your destination....',
  64.                                       hintStyle: GoogleFonts.openSans(),
  65.                                       disabledBorder: InputBorder.none,
  66.                                       focusedBorder: InputBorder.none,
  67.                                       fillColor: Colors.white,
  68.                                       focusColor: Colors.white,
  69.                                       enabledBorder: InputBorder.none,
  70.                                     ),
  71.                                   ),
  72.                                 ),
  73.                                 IconButton(
  74.                                   icon: Icon(Icons.search),
  75.                                   onPressed: () {},
  76.                                 ),
  77.                               ],
  78.                             ),
  79.                           ),
  80.                         ],
  81.                       ),
  82.                     )
  83.                   ],
  84.                 ),
  85.               ),
  86.               SizedBox(height: 15),
  87.               Container(
  88.                 width: double.infinity,
  89.                 height: 100,
  90.                 margin: EdgeInsets.only(left: 10),
  91.                 child: HorizontalItems(),
  92.               ),
  93.               SizedBox(height: 20),
  94.               Container(
  95.                 margin: EdgeInsets.only(left: 20, right: 20),
  96.                 child: Row(
  97.                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
  98.                   children: <Widget>[
  99.                     Text(
  100.                       "Popular Destination",
  101.                       style: GoogleFonts.roboto(
  102.                           fontSize: 24, fontWeight: FontWeight.bold),
  103.                     ),
  104.                     Row(
  105.                       children: <Widget>[
  106.                         Text(
  107.                           "See all",
  108.                           style: GoogleFonts.openSans(
  109.                               fontSize: 17, fontWeight: FontWeight.w300),
  110.                         ),
  111.                         Icon(
  112.                           Icons.arrow_forward,
  113.                           size: 15,
  114.                           color: Colors.black54,
  115.                         )
  116.                       ],
  117.                     ),
  118.                   ],
  119.                 ),
  120.               ),
  121.               SizedBox(height: 20),
  122.               Container(
  123.                 width: double.infinity,
  124.                 height: 240,
  125.                 margin: EdgeInsets.only(left: 10),
  126.                 child: PopularItems(),
  127.               ),
  128.               SizedBox(height: 70),
  129.             ],
  130.           ),
  131.         ),
  132.       ),
  133.     );
  134.   }
  135. }
  136.  
  137. class HorizontalItems extends StatelessWidget {
  138.   @override
  139.   Widget build(BuildContext context) {
  140.     return Scaffold(
  141.       body: ListView.builder(
  142.         scrollDirection: Axis.horizontal,
  143.         itemCount: dummyContinent.length,
  144.         physics: BouncingScrollPhysics(),
  145.         itemBuilder: (BuildContext context, int index) {
  146.           final data = dummyContinent[index];
  147.  
  148.           return Container(
  149.             width: 170,
  150.             height: 120,
  151.             margin: EdgeInsets.symmetric(horizontal: 12),
  152.             decoration: BoxDecoration(
  153.                 borderRadius: BorderRadius.circular(15),
  154.                 color: Colors.black12,
  155.                 image: DecorationImage(
  156.                   image: AssetImage(data.urlimage),
  157.                   fit: BoxFit.cover,
  158.                 )),
  159.             child: Stack(
  160.               children: <Widget>[
  161.                 Container(
  162.                   width: 170,
  163.                   height: 120,
  164.                   decoration: BoxDecoration(
  165.                       gradient: LinearGradient(
  166.                     colors: [
  167.                       Colors.white30,
  168.                       Colors.black12,
  169.                     ],
  170.                     begin: Alignment.topCenter,
  171.                     end: Alignment.bottomCenter,
  172.                   )),
  173.                 ),
  174.                 Center(
  175.                   child: Text(
  176.                     data.name,
  177.                     style: GoogleFonts.nunitoSans(
  178.                       fontSize: 20,
  179.                       fontWeight: FontWeight.bold,
  180.                       textStyle: TextStyle(
  181.                         color: Colors.white,
  182.                       ),
  183.                     ),
  184.                   ),
  185.                 ),
  186.               ],
  187.             ),
  188.           );
  189.         },
  190.       ),
  191.     );
  192.   }
  193. }
  194.  
  195.  
  196. class PopularItems extends StatelessWidget {
  197.   @override
  198.   Widget build(BuildContext context) {
  199.     return ListView.builder(
  200.       scrollDirection: Axis.horizontal,
  201.       itemCount: dummyPopularDestination.length,
  202.       physics: BouncingScrollPhysics(),
  203.       itemBuilder: (BuildContext context, int index) {
  204.         final data = dummyPopularDestination[index];
  205.  
  206.         return Column(
  207.           children: <Widget>[
  208.             Container(
  209.               width: 230,
  210.               height: 160,
  211.               margin: EdgeInsets.symmetric(horizontal: 12),
  212.               decoration: BoxDecoration(
  213.                 borderRadius: BorderRadius.circular(15),
  214.                 color: Colors.white,
  215.                 image: DecorationImage(
  216.                   image: AssetImage(data.urlimage),
  217.                   fit: BoxFit.cover,
  218.                 ),
  219.               ),
  220.             ),
  221.             SizedBox(height: 7),
  222.             Container(
  223.               width: 230,
  224.               height: 50,
  225.               color: Colors.white,
  226.               padding: EdgeInsets.only(left: 20),
  227.               child: Column(
  228.                 crossAxisAlignment: CrossAxisAlignment.start,
  229.                 children: <Widget>[
  230.                   Text(
  231.                     data.name,
  232.                     style: GoogleFonts.arvo(
  233.                         fontSize: 18,
  234.                         fontWeight: FontWeight.w800,
  235.                         textStyle: TextStyle(color: Colors.blue)),
  236.                   ),
  237.                   Row(
  238.                     children: <Widget>[
  239.                       Icon(
  240.                         Icons.location_on,
  241.                         size: 18,
  242.                         color: Colors.black54,
  243.                       ),
  244.                       SizedBox(width: 8),
  245.                       Text(
  246.                         data.country,
  247.                         style: GoogleFonts.roboto(
  248.                           fontSize: 13,
  249.                           fontWeight: FontWeight.w300,
  250.                         ),
  251.                       ),
  252.                     ],
  253.                   ),
  254.                 ],
  255.               ),
  256.             )
  257.           ],
  258.         );
  259.       },
  260.     );
  261.   }
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement