Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.62 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class Sorteio{
  4.   bool isExpanded;
  5.   String header;
  6.   Corpo body;
  7.   Sorteio( {this.isExpanded:true, this.header, this.body});
  8.  
  9. }
  10. class  Corpo{
  11.    String regulamento;
  12.    String vencedor;
  13.    Corpo(this.regulamento, this.vencedor);
  14.  
  15. }
  16. class SorteiosPage extends StatefulWidget{
  17.     @override
  18.     _SorteiosPageState createState() => new _SorteiosPageState();
  19. }
  20. class _SorteiosPageState extends State<SorteiosPage>{
  21.     List<Sorteio> _items = <Sorteio>[
  22.       new Sorteio(header:"Sorteio1", body:new Corpo("Regulamento","Vencedor")),
  23.       new Sorteio(header:"Sorteio2", body:new Corpo("Regulamento","Vencedor")),
  24.     ];  
  25.     Widget build(BuildContext context){
  26.       return new Scaffold(
  27.         appBar:new AppBar(
  28.           title: new Text("Marine Supermercados"),
  29.           backgroundColor: Colors.redAccent,
  30.         ),
  31.         body:new ListView(children: <ExpansionPanelList>[
  32.          
  33.                 new ExpansionPanelList(
  34.                      expansionCallback: (int panelIndex, bool isExpanded){          
  35.                        setState((){
  36.                          _items[panelIndex].isExpanded = !_items[panelIndex].isExpanded;
  37.                        });
  38.                      },
  39.                     children:_items.map((Sorteio sorteio){
  40.                       return new ExpansionPanel(
  41.                             isExpanded: sorteio.isExpanded,
  42.                             headerBuilder: (BuildContext context, bool isExpanded){
  43.                               return new Center(child:new Text(sorteio.header),);
  44.                             },
  45.                             body: new Column(
  46.                                 children: <Widget>[
  47.                                   new Divider(),
  48.                                   new Center(
  49.                                     child:new Container(
  50.                                       padding: const EdgeInsets.symmetric(vertical:10.0),
  51.                                     child: new Text(sorteio.body.regulamento),
  52.                                     ),
  53.                                     ),
  54.                                   new Center(
  55.                                     child:new Container(
  56.                                       padding: const EdgeInsets.symmetric(vertical:10.0),
  57.                                     child: new Text(sorteio.body.vencedor),
  58.                                     ),
  59.                                     ),
  60.                               ],),                    
  61.          
  62.                       );
  63.                     }).toList(),
  64.         ),
  65.         ],
  66.         ),
  67.       );
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement