Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 8.17 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:google_fonts/google_fonts.dart';
  3. import 'package:travel2/model.dart';
  4.  
  5. void main() => runApp(MyApp());
  6.  
  7. class MyApp extends StatelessWidget {
  8.   @override
  9.   Widget build(BuildContext context) {
  10.     return MaterialApp(
  11.       title: 'Travel UI',
  12.       debugShowCheckedModeBanner: false,
  13.       theme: ThemeData(
  14.         primarySwatch: Colors.blue,
  15.       ),
  16.       home: Travel2(),
  17.     );
  18.   }
  19. }
  20.  
  21. class Travel2 extends StatefulWidget {
  22.   @override
  23.   _Travel2State createState() => _Travel2State();
  24. }
  25.  
  26. class _Travel2State extends State<Travel2> {
  27.   bool isSelected = false;
  28.   @override
  29.   Widget build(BuildContext context) {
  30.     return Scaffold(
  31.       body: Container(
  32.         color: Colors.white,
  33.         child: SingleChildScrollView(
  34.           child: Column(
  35.             crossAxisAlignment: CrossAxisAlignment.start,
  36.             children: <Widget>[
  37.               Container(
  38.                 width: MediaQuery.of(context).size.width,
  39.                 height: 450,
  40.                 color: Colors.black12,
  41.                 child: Stack(
  42.                   children: <Widget>[
  43.                     Container(
  44.                       width: MediaQuery.of(context).size.width,
  45.                       height: 250,
  46.                       decoration: BoxDecoration(
  47.                           image: DecorationImage(
  48.                         image: AssetImage("images/asia.jpeg"),
  49.                         fit: BoxFit.cover,
  50.                       )),
  51.                     ),
  52.                     Positioned(
  53.                       top: 200,
  54.                       child: Container(
  55.                           width: MediaQuery.of(context).size.width,
  56.                           height: MediaQuery.of(context).size.height,
  57.                           padding:
  58.                               EdgeInsets.only(left: 20, right: 25, top: 20),
  59.                           decoration: BoxDecoration(
  60.                             borderRadius: BorderRadius.only(
  61.                               topRight: Radius.circular(45),
  62.                             ),
  63.                             color: Colors.white,
  64.                           ),
  65.                           child: Column(
  66.                             crossAxisAlignment: CrossAxisAlignment.start,
  67.                             children: <Widget>[
  68.                               Row(
  69.                                 mainAxisAlignment:
  70.                                     MainAxisAlignment.spaceBetween,
  71.                                 children: <Widget>[
  72.                                   Row(
  73.                                     children: <Widget>[
  74.                                       CircleAvatar(
  75.                                         radius: 24,
  76.                                         backgroundColor: Colors.white,
  77.                                         backgroundImage: AssetImage(
  78.                                             "images/jessicaveranda.jpg"),
  79.                                       ),
  80.                                       SizedBox(width: 15),
  81.                                       Text(
  82.                                         "Jessica Veranda",
  83.                                         style: GoogleFonts.lato(
  84.                                             fontSize: 18,
  85.                                             fontWeight: FontWeight.w600),
  86.                                       ),
  87.                                     ],
  88.                                   ),
  89.                                   Text(
  90.                                     "22.3 k",
  91.                                     style: GoogleFonts.openSans(
  92.                                         fontSize: 14,
  93.                                         fontWeight: FontWeight.w400),
  94.                                   )
  95.                                 ],
  96.                               ),
  97.                               SizedBox(height: 23),
  98.                               Text(
  99.                                 "Description :",
  100.                                 style: GoogleFonts.arvo(
  101.                                     fontSize: 17, fontWeight: FontWeight.w600),
  102.                               ),
  103.                               Text(
  104.                                 "aut dicta possimus sint mollitia voluptas commodi quo doloremque iste corrupti reiciendis voluptatem eius rerum sit cumque quod eligendi laborum minima perferendis recusandae assumenda consectetur porro architecto ipsum ipsam",
  105.                                 textAlign: TextAlign.justify,
  106.                                 style: GoogleFonts.openSans(
  107.                                     fontSize: 15, fontWeight: FontWeight.w400),
  108.                               ),
  109.                               SizedBox(height: 20),
  110.                             ],
  111.                           )),
  112.                     ),
  113.                     Positioned(
  114.                       top: 170,
  115.                       right: 20,
  116.                       child: CircleAvatar(
  117.                         radius: 30,
  118.                         foregroundColor: Colors.black12,
  119.                         child: IconButton(
  120.                           icon: Icon(Icons.favorite),
  121.                           color: Colors.red,
  122.                           iconSize: 30,
  123.                           onPressed: () {},
  124.                         ),
  125.                       ),
  126.                     )
  127.                   ],
  128.                 ),
  129.               ),
  130.               Padding(
  131.                 child: Text(
  132.                   "Recommended for you",
  133.                   style: GoogleFonts.arvo(
  134.                       fontSize: 17, fontWeight: FontWeight.w600),
  135.                 ),
  136.                 padding: EdgeInsets.only(left: 20),
  137.               ),
  138.               SizedBox(height: 17),
  139.               Container(
  140.                 margin: EdgeInsets.only(left: 10),
  141.                 width: double.infinity,
  142.                 color: Colors.white,
  143.                 height: 220,
  144.                 child: PopularHorizontal(),
  145.               )
  146.             ],
  147.           ),
  148.         ),
  149.       ),
  150.     );
  151.   }
  152. }
  153.  
  154. class PopularHorizontal extends StatelessWidget {
  155.   @override
  156.   Widget build(BuildContext context) {
  157.     return ListView.builder(
  158.       scrollDirection: Axis.horizontal,
  159.       itemCount: dummyTravel.length,
  160.       physics: BouncingScrollPhysics(),
  161.       itemBuilder: (BuildContext context, int index) {
  162.         final data = dummyTravel[index];
  163.  
  164.         return Column(
  165.           children: <Widget>[
  166.             Container(
  167.               width: 230,
  168.               height: 160,
  169.               margin: EdgeInsets.symmetric(horizontal: 12),
  170.               decoration: BoxDecoration(
  171.                 borderRadius: BorderRadius.circular(15),
  172.                 color: Colors.white,
  173.                 image: DecorationImage(
  174.                   image: AssetImage(data.urlimage),
  175.                   fit: BoxFit.cover,
  176.                 ),
  177.               ),
  178.             ),
  179.             SizedBox(height: 7),
  180.             Container(
  181.               width: 230,
  182.               height: 50,
  183.               color: Colors.white,
  184.               padding: EdgeInsets.only(left: 20),
  185.               child: Column(
  186.                 crossAxisAlignment: CrossAxisAlignment.start,
  187.                 children: <Widget>[
  188.                   Text(
  189.                     data.name,
  190.                     style: GoogleFonts.arvo(
  191.                         fontSize: 18,
  192.                         fontWeight: FontWeight.w800,
  193.                         textStyle: TextStyle(color: Colors.blue)),
  194.                   ),
  195.                   Row(
  196.                     children: <Widget>[
  197.                       Icon(
  198.                         Icons.location_on,
  199.                         size: 18,
  200.                         color: Colors.black54,
  201.                       ),
  202.                       SizedBox(width: 8),
  203.                       Text(
  204.                         data.country,
  205.                         style: GoogleFonts.roboto(
  206.                           fontSize: 13,
  207.                           fontWeight: FontWeight.w300,
  208.                         ),
  209.                       ),
  210.                     ],
  211.                   ),
  212.                 ],
  213.               ),
  214.             )
  215.           ],
  216.         );
  217.       },
  218.     );
  219.   }
  220. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement