added more info on stations in UI
This commit is contained in:
@@ -15,11 +15,31 @@ class FloodStationListView extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = _stations.elementAt(index);
|
final item = _stations.elementAt(index);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
isThreeLine: true,
|
||||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||||
builder: (context) => FloodStationPage(floodStation: item),
|
builder: (context) => FloodStationPage(floodStation: item),
|
||||||
)),
|
)),
|
||||||
title: Text(item.label),
|
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,
|
itemCount: _stations.length,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class FloodStation {
|
|||||||
final DateTime? dateOpened;
|
final DateTime? dateOpened;
|
||||||
final String catchmentName;
|
final String catchmentName;
|
||||||
final String label;
|
final String label;
|
||||||
|
final String riverName;
|
||||||
|
|
||||||
FloodStation({
|
FloodStation({
|
||||||
required this.id,
|
required this.id,
|
||||||
@@ -15,6 +16,7 @@ class FloodStation {
|
|||||||
this.dateOpened,
|
this.dateOpened,
|
||||||
required this.catchmentName,
|
required this.catchmentName,
|
||||||
required this.label,
|
required this.label,
|
||||||
|
required this.riverName,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory FloodStation.fromMap(Map<String, dynamic> json) => FloodStation(
|
factory FloodStation.fromMap(Map<String, dynamic> json) => FloodStation(
|
||||||
@@ -25,6 +27,7 @@ class FloodStation {
|
|||||||
dateOpened: DateTime.tryParse(json['dateOpened'] ?? ''),
|
dateOpened: DateTime.tryParse(json['dateOpened'] ?? ''),
|
||||||
catchmentName: parseStringValue(json['catchmentName']),
|
catchmentName: parseStringValue(json['catchmentName']),
|
||||||
label: parseStringValue(json['label']),
|
label: parseStringValue(json['label']),
|
||||||
|
riverName: parseStringValue(json['riverName']),
|
||||||
);
|
);
|
||||||
|
|
||||||
static double parseDoubleValue(dynamic value) {
|
static double parseDoubleValue(dynamic value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user