Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class Sorteio{
- bool isExpanded;
- String header;
- Corpo body;
- Sorteio( {this.isExpanded:true, this.header, this.body});
- }
- class Corpo{
- String regulamento;
- String vencedor;
- Corpo(this.regulamento, this.vencedor);
- }
- class SorteiosPage extends StatefulWidget{
- @override
- _SorteiosPageState createState() => new _SorteiosPageState();
- }
- class _SorteiosPageState extends State<SorteiosPage>{
- List<Sorteio> _items = <Sorteio>[
- new Sorteio(header:"Sorteio1", body:new Corpo("Regulamento","Vencedor")),
- new Sorteio(header:"Sorteio2", body:new Corpo("Regulamento","Vencedor")),
- ];
- Widget build(BuildContext context){
- return new Scaffold(
- appBar:new AppBar(
- title: new Text("Marine Supermercados"),
- backgroundColor: Colors.redAccent,
- ),
- body:new ListView(children: <ExpansionPanelList>[
- new ExpansionPanelList(
- expansionCallback: (int panelIndex, bool isExpanded){
- setState((){
- _items[panelIndex].isExpanded = !_items[panelIndex].isExpanded;
- });
- },
- children:_items.map((Sorteio sorteio){
- return new ExpansionPanel(
- isExpanded: sorteio.isExpanded,
- headerBuilder: (BuildContext context, bool isExpanded){
- return new Center(child:new Text(sorteio.header),);
- },
- body: new Column(
- children: <Widget>[
- new Divider(),
- new Center(
- child:new Container(
- padding: const EdgeInsets.symmetric(vertical:10.0),
- child: new Text(sorteio.body.regulamento),
- ),
- ),
- new Center(
- child:new Container(
- padding: const EdgeInsets.symmetric(vertical:10.0),
- child: new Text(sorteio.body.vencedor),
- ),
- ),
- ],),
- );
- }).toList(),
- ),
- ],
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement