simple graph view with sorted data
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../Widgets/reading_graph.dart';
|
||||
import '../model/flood_station.dart';
|
||||
import '../model/reading.dart';
|
||||
import '../services/api.dart';
|
||||
@@ -18,15 +19,19 @@ class FloodStationPage extends StatelessWidget {
|
||||
future: Api.fetchReadingsFromStation(_floodStation.id),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
title:
|
||||
Text(snapshot.data!.elementAt(index).value.toString()),
|
||||
);
|
||||
},
|
||||
itemCount: snapshot.data!.length,
|
||||
return ReadingGraph(
|
||||
readings: snapshot.data!,
|
||||
);
|
||||
|
||||
// return ListView.builder(
|
||||
// itemBuilder: (context, index) {
|
||||
// return ListTile(
|
||||
// title:
|
||||
// Text(snapshot.data!.elementAt(index).value.toString()),
|
||||
// );
|
||||
// },
|
||||
// itemCount: snapshot.data!.length,
|
||||
// );
|
||||
} else {
|
||||
return Placeholder();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user