Advertisement
AnoTest

orderPage

Mar 11th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 6.47 KB | None | 0 0
  1. import 'package:badges/badges.dart';
  2.  
  3. import 'package:flutter/material.dart';
  4. import 'package:hexcolor/hexcolor.dart';
  5.  
  6. class OrderPage extends StatelessWidget {
  7.   final int sommePanier;
  8.   final String image;
  9.   final selectedProducts;
  10.   final String orderPrix;
  11.   const OrderPage(
  12.       {Key key,
  13.       this.sommePanier,
  14.       this.image,
  15.       this.selectedProducts,
  16.       this.orderPrix})
  17.       : super(key: key);
  18.  
  19.   @override
  20.   Widget build(BuildContext context) {
  21.     var width = MediaQuery.of(context).size.width;
  22.     //var orderProduct = Provider.of<MyStore>(context);
  23.     //var testCart = TestHomePage().of(context);
  24.     double height = MediaQuery.of(context).size.height;
  25.     return Scaffold(
  26.       backgroundColor: Colors.white,
  27.       appBar: AppBar(
  28.         iconTheme: IconThemeData(color: Colors.black),
  29.         title: Text(
  30.           'Delivecrous',
  31.           style: TextStyle(
  32.             color: Colors.black,
  33.             fontWeight: FontWeight.w300,
  34.             fontSize: 22,
  35.           ),
  36.         ),
  37.         centerTitle: true,
  38.         backgroundColor: HexColor('#FDF7EF'),
  39.         elevation: 0.0,
  40.         toolbarHeight: height * 0.10,
  41.         actions: [
  42.           Badge(
  43.             position: BadgePosition.topEnd(top: 15, end: 0),
  44.             child: Padding(
  45.               padding: const EdgeInsets.symmetric(horizontal: 10),
  46.               child: IconButton(
  47.                 icon: Icon(
  48.                   Icons.shopping_cart,
  49.                   size: 40,
  50.                 ),
  51.                 color: HexColor('130B11'),
  52.                 onPressed: () {
  53.                   /*Navigator.push(context,
  54.                       MaterialPageRoute(builder: (context) => RealHomePage()));*/
  55.                 },
  56.               ),
  57.             ),
  58.             badgeContent: Text(
  59.               sommePanier.toString(),
  60.               style: TextStyle(color: Colors.white),
  61.             ),
  62.             badgeColor: HexColor('E33620'),
  63.           ),
  64.         ],
  65.       ),
  66.       body: Column(
  67.         children: [
  68.           Padding(
  69.             padding:
  70.                 const EdgeInsets.symmetric(horizontal: 20.0, vertical: 15.0),
  71.             child: Row(
  72.               children: [
  73.                 Text(
  74.                   'Panier',
  75.                   style: TextStyle(
  76.                     fontWeight: FontWeight.w300,
  77.                     fontSize: 30,
  78.                   ),
  79.                   textAlign: TextAlign.start,
  80.                 ),
  81.               ],
  82.             ),
  83.           ),
  84.           Flexible(
  85.             child: GridView.count(
  86.               childAspectRatio: MediaQuery.of(context).devicePixelRatio * 0.35,
  87.               crossAxisCount: 2,
  88.               children: List.generate(selectedProducts.length, (index) {
  89.                 //bool salut = selectedProducts.toList()[index].valeurBool;
  90.                 return Container(
  91.                   child: Align(
  92.                     alignment: Alignment.center,
  93.                     child: Column(
  94.                       mainAxisAlignment: MainAxisAlignment.center,
  95.                       crossAxisAlignment: CrossAxisAlignment.center,
  96.                       children: [
  97.                         //Text(selectedProducts.toList()[index].nomProduit.toString()),
  98.                         //Image.asset(selectedProducts.toList()[index].imageProduit),
  99.                         Card(
  100.                           elevation: 0.0,
  101.                           child: Container(
  102.                             width: width / 2,
  103.                             child: Card(
  104.                               child: Column(
  105.                                 children: [
  106.                                   Image.asset(selectedProducts
  107.                                       .toList()[index]
  108.                                       .imageProduit),
  109.                                   Padding(
  110.                                     padding: const EdgeInsets.only(
  111.                                         left: 10.0, top: 10, right: 10),
  112.                                     child: Row(
  113.                                       mainAxisAlignment:
  114.                                           MainAxisAlignment.spaceBetween,
  115.                                       children: [
  116.                                         Text(
  117.                                           selectedProducts
  118.                                               .toList()[index]
  119.                                               .nomProduit
  120.                                               .toString(),
  121.                                           style: TextStyle(
  122.                                             fontSize: 20,
  123.                                             fontWeight: FontWeight.w300,
  124.                                           ),
  125.                                         ),
  126.                                         Text(
  127.                                           selectedProducts
  128.                                                   .toList()[index]
  129.                                                   .prix
  130.                                                   .toString() +
  131.                                               '€',
  132.                                           style: TextStyle(fontSize: 20),
  133.                                         )
  134.                                       ],
  135.                                     ),
  136.                                   ),
  137.                                   SizedBox(
  138.                                       height:
  139.                                           MediaQuery.of(context).size.height *
  140.                                               0.01),
  141.                                   Padding(
  142.                                     padding: const EdgeInsets.only(
  143.                                         top: 8.0, left: 10, bottom: 15),
  144.                                     child: Text(
  145.                                       'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  146.                                       style: TextStyle(
  147.                                         fontWeight: FontWeight.w300,
  148.                                       ),
  149.                                       maxLines: 4,
  150.                                     ),
  151.                                   ),
  152.                                 ],
  153.                               ),
  154.                             ),
  155.                           ),
  156.                         ),
  157.                       ],
  158.                     ),
  159.                   ),
  160.                 );
  161.               }),
  162.             ),
  163.           ),
  164.         ],
  165.       ),
  166.     );
  167.   }
  168. }
  169.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement