added table view with color coded severity levels
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../widgets/flood_station_table.dart';
|
||||
import '../widgets/reading_graph.dart';
|
||||
import '../model/flood_station.dart';
|
||||
import '../model/reading.dart';
|
||||
@@ -48,8 +49,11 @@ class _FloodStationPageState extends State<FloodStationPage> {
|
||||
return Center(child: Text('No readings on record.'));
|
||||
} else if (_tableVisible) {
|
||||
return SingleChildScrollView(
|
||||
child: Table(
|
||||
children: _getTableChildren(snapshot.data!),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: FloodStationTable(
|
||||
readings: snapshot.data!,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -69,17 +73,4 @@ class _FloodStationPageState extends State<FloodStationPage> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
List<TableRow> _getTableChildren(List<Reading> list) {
|
||||
return list
|
||||
.map<TableRow>(
|
||||
(e) => TableRow(
|
||||
children: [
|
||||
Text(e.dateTime.toString()),
|
||||
Text(e.value.toString()),
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user