added more info on stations in UI
This commit is contained in:
@@ -15,11 +15,31 @@ class FloodStationListView extends StatelessWidget {
|
||||
itemBuilder: (context, index) {
|
||||
final item = _stations.elementAt(index);
|
||||
return ListTile(
|
||||
isThreeLine: true,
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => FloodStationPage(floodStation: item),
|
||||
)),
|
||||
title: Text(item.label),
|
||||
subtitle: Text(item.town),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.home_outlined),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Text(item.town),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.water),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Text(item.riverName),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: _stations.length,
|
||||
|
||||
@@ -6,6 +6,7 @@ class FloodStation {
|
||||
final DateTime? dateOpened;
|
||||
final String catchmentName;
|
||||
final String label;
|
||||
final String riverName;
|
||||
|
||||
FloodStation({
|
||||
required this.id,
|
||||
@@ -15,6 +16,7 @@ class FloodStation {
|
||||
this.dateOpened,
|
||||
required this.catchmentName,
|
||||
required this.label,
|
||||
required this.riverName,
|
||||
});
|
||||
|
||||
factory FloodStation.fromMap(Map<String, dynamic> json) => FloodStation(
|
||||
@@ -25,6 +27,7 @@ class FloodStation {
|
||||
dateOpened: DateTime.tryParse(json['dateOpened'] ?? ''),
|
||||
catchmentName: parseStringValue(json['catchmentName']),
|
||||
label: parseStringValue(json['label']),
|
||||
riverName: parseStringValue(json['riverName']),
|
||||
);
|
||||
|
||||
static double parseDoubleValue(dynamic value) {
|
||||
|
||||
Reference in New Issue
Block a user