table of month values

This commit is contained in:
broodjeaap 2020-06-08 20:52:11 +02:00
parent 34df4cbc02
commit 0842a58865

View file

@ -28,35 +28,19 @@ class MonthValuesPage extends StatelessWidget {
"December": 5, "December": 5,
}; };
List<Widget> getMonthValueWidget(){ final monthTableRowTextStyle = TextStyle(fontSize: 35);
var monthWidgets = List<Widget>();
monthValues.forEach((key, value) { TableRow getMonthTableRow(MapEntry<String, int> month) {
monthWidgets.add( return TableRow(
Row( children: [
children: <Widget>[ TableCell(
Container( child: Text(month.key, style: monthTableRowTextStyle)
alignment: Alignment.center, ),
child: Text( TableCell(
key, child: Text(month.value.toString(), style: monthTableRowTextStyle)
style: TextStyle(
fontSize: 35
)
)
),
Container(
alignment: Alignment.centerRight,
child: Text(
value.toString(),
style: TextStyle(
fontSize: 35
)
)
)
],
) )
); ]
}); );
return monthWidgets;
} }
@override @override
@ -67,8 +51,8 @@ class MonthValuesPage extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: Text("Month Values") title: Text("Month Values")
), ),
body: Column( body: Table(
children: this.getMonthValueWidget() children: monthValues.entries.map(getMonthTableRow).toList()
) )
), ),
); );