Advertisement
AnoTest

Flut_Backup_2_Class_WordData

Feb 8th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 6.91 KB | None | 0 0
  1. import 'dart:ui';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_svg/flutter_svg.dart';
  4. import 'package:RunAppTest/cards_data.dart';
  5. import 'package:RunAppTest/prevent.dart';
  6. import 'package:hexcolor/hexcolor.dart';
  7. import 'package:sizer/sizer.dart';
  8.  
  9. class WorldData extends StatelessWidget {
  10.   final Map covidDataFrance;
  11.   const WorldData({
  12.     Key key,
  13.     this.covidDataFrance,
  14.   }) : super(key: key);
  15.  
  16.   @override
  17.   Widget build(BuildContext context) {
  18.     return Scaffold(
  19.       body: Column(
  20.         children: [
  21.           Container(
  22.             padding: EdgeInsets.only(left: 20, top: 20, right: 20, bottom: 40),
  23.             width: double.infinity,
  24. /*            decoration: BoxDecoration(
  25.               boxShadow: [
  26.                 BoxShadow(
  27.                   color: Colors.blueAccent,
  28.                   //blurRadius: 3, //3
  29.                   //offset: Offset(2, 1), //2.4
  30.                 ),
  31.               ],
  32.               //color: kPrimaryColor.withOpacity(0.80),
  33.               color: Colors.blueAccent.withOpacity(0.5),
  34.               borderRadius: BorderRadius.only(
  35.                 bottomLeft: Radius.circular(50),
  36.                 bottomRight: Radius.circular(50),
  37.               ),
  38.             ),*/
  39.             child: Wrap(
  40.               runSpacing: 20, //espace entre les cards
  41.               spacing: 20,
  42.               children: [
  43.                 Design(
  44.                   svgpicIcons: SvgPicture.asset(
  45.                     "assets/icons/case_1.svg",
  46.                     color: Colors.blue,
  47.                     height: 20,
  48.                     width: 20,
  49.                   ),
  50.                   coloricon: Colors.blue,
  51.                   title: 'TotalConfirmed',
  52.                   count: covidDataFrance['cases'].toString(),
  53.                 ),
  54.                 Design(
  55.                   svgpicIcons: SvgPicture.asset(
  56.                     "assets/icons/death.svg",
  57.                     color: Colors.red,
  58.                     height: 20,
  59.                     width: 20,
  60.                   ),
  61.                   coloricon: Colors.redAccent,
  62.                   title: 'TotalDeaths',
  63.                   count: covidDataFrance['deaths'].toString(),
  64.                 ),
  65.                 Design(
  66.                   svgpicIcons: SvgPicture.asset(
  67.                     "assets/icons/heart.svg",
  68.                     //  color: Colors.green,
  69.                     height: 20,
  70.                     width: 20,
  71.                   ),
  72.                   coloricon: Colors.greenAccent,
  73.                   title: 'TotalRecovered',
  74.                   count: covidDataFrance['recovered'].toString(),
  75.                 ),
  76.                 // DateOneCard(),
  77.               ],
  78.             ),
  79.           ),
  80.           //Appelle de l'affiche des préventions
  81.           //Prevent(),
  82.         ],
  83.       ),
  84.       //),
  85.     );
  86.   }
  87. }
  88.  
  89. class Design extends StatelessWidget {
  90.   final String count;
  91.   final String title;
  92.   final Color coloricon;
  93.   final SvgPicture svgpicIcons;
  94.  
  95.   const Design({
  96.     Key key,
  97.     this.count,
  98.     this.title,
  99.     this.coloricon,
  100.     this.svgpicIcons,
  101.   }) : super(key: key);
  102.  
  103.   @override
  104.   Widget build(BuildContext context) {
  105.     return LayoutBuilder(builder: (context, constraints) {
  106.       return Container(
  107.         width: constraints.maxWidth / 2 - 10, //permet d'afficher sur 2
  108.         //Il permet de donne la taill dispo pour le wdget
  109.         decoration: BoxDecoration(
  110.           color: Colors
  111.               .white, //Couleur du container qui contient text cas confirmé
  112.           borderRadius: BorderRadius.circular(8),
  113.           boxShadow: [
  114.             BoxShadow(
  115.               color: Colors.cyanAccent,
  116.               //blurRadius: 1.5,
  117.               //offset: Offset(3, 4),
  118.             ),
  119.           ],
  120.         ),
  121.         child: Column(
  122.           children: <Widget>[
  123.             Padding(
  124.               padding: const EdgeInsets.all(10.0),
  125.               child: Row(
  126.                 children: <Widget>[
  127.                   Container(
  128.                     //image svg dans un  container
  129.                     alignment: Alignment.center,
  130.                     height: 3.5.h,
  131.                     width: 30,
  132.                     decoration: BoxDecoration(
  133.                       color: Color(0xFFFF9C00).withOpacity(0.12),
  134.                       shape: BoxShape.circle,
  135.                     ),
  136.                     child: svgpicIcons,
  137.                     //color: Color.fromRGBO(252, 140, 4, 1),
  138.                     //color: Colors.blueAccent,
  139.                     //color: coloricon,
  140.                     //height: 12,
  141.                     //width: 12,
  142.                     //),
  143.                   ),
  144.                   SizedBox(
  145.                     width:
  146.                         5, //espace entre l'icon svg et le text 'cas confirmé'
  147.                   ),
  148.                   Text(
  149.                     title
  150.                         .toString(), //Titre soit cas confirmé ou Mort ou recovered
  151.                     maxLines: 1,
  152.                     overflow: TextOverflow.ellipsis,
  153.                     style: TextStyle(
  154.                       fontWeight: FontWeight.bold,
  155.                       color: HexColor('a9abaf'),
  156.                       //color: Colors.blueAccent,
  157.                     ),
  158.                   ),
  159.                 ],
  160.               ),
  161.             ),
  162.             Padding(
  163.               padding: const EdgeInsets.all(2.0), //a changer
  164.               child: Row(
  165.                 //2eme ligne
  166.                 children: [
  167.                   Padding(
  168.                     padding: const EdgeInsets.all(10.0),
  169.                     child: RichText(
  170.                       text: TextSpan(
  171.                         style: TextStyle(color: Colors.black),
  172.                         children: [
  173.                           TextSpan(
  174.                             text: count.toString(),
  175.                             style:
  176.                                 Theme.of(context).textTheme.bodyText1.copyWith(
  177.                                       fontWeight: FontWeight.bold,
  178.                                       color: HexColor('3a3e49'),
  179.                                       fontSize: 20, //taille des resultat
  180.                                     ),
  181.                           ),
  182.                           TextSpan(
  183.                             text: "\nPersonnes",
  184.                             style: TextStyle(
  185.                               fontSize: 12,
  186.                               fontWeight: FontWeight.bold,
  187.                               color: Colors.black.withOpacity(0.5),
  188.                               letterSpacing: 2.0,
  189.                               height:
  190.                                   2, //distance separant du 1 ere text et du 2em
  191.                             ),
  192.                           ),
  193.                         ],
  194.                       ),
  195.                     ),
  196.                   ),
  197.                 ],
  198.               ),
  199.             ),
  200.           ],
  201.         ),
  202.       );
  203.     });
  204.   }
  205. }
  206.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement