@@ -2,13 +2,12 @@ import 'dart:async'; // Import Timer
2
2
import 'package:flowmotion/core/widget_keys.dart' ;
3
3
import 'package:flowmotion/screens/congestionRating.dart' ;
4
4
import 'package:flowmotion/utilities/flowmotion_api_sgt.dart' ;
5
+ import 'package:flowmotion/widgets/congestionPointView.dart' ;
5
6
import 'package:flutter/material.dart' ;
6
7
import 'package:flutter_map/flutter_map.dart' ;
7
8
import 'package:geolocator/geolocator.dart' ;
8
9
import '../models/rating_point.dart' ;
9
10
import '../utilities/location_service.dart' ;
10
- import '../widgets/congestionGraph.dart' ;
11
- import '../widgets/imageViewer.dart' ;
12
11
import '../widgets/navigationBar.dart' ;
13
12
import 'package:latlong2/latlong.dart' ;
14
13
import 'package:flowmotion_api/flowmotion_api.dart' ;
@@ -261,56 +260,7 @@ class _FullMapScreenState extends State<FullMapScreen> {
261
260
262
261
// FutureBuilder for hourly graph
263
262
if (congestionRating.camera.id != null ) ...[
264
- FutureBuilder <void >(
265
- future: fetchGraphRatings (
266
- congestionRating.camera.id,
267
- 'hour' , // groupby
268
- formatToSingaporeTime (DateTime .now ().subtract (Duration (hours: 10 ))),
269
- formatToSingaporeTime (DateTime .now ())
270
- ),
271
- builder: (context, snapshot) {
272
- if (snapshot.connectionState == ConnectionState .waiting) {
273
- return CircularProgressIndicator ();
274
- } else if (snapshot.hasError) {
275
- return Text ("Error: ${snapshot .error }" );
276
- } else {
277
- if (historyRatings.isNotEmpty) {
278
- return Column (
279
- crossAxisAlignment: CrossAxisAlignment .start,
280
- children: [
281
- CongestionGraphs .buildHourlyCongestionRatingGraph (historyRatings),
282
- SizedBox (height: 20 ), // spacing between graph and images
283
- ImageViewerWithSlider (data: historyRatings),
284
- ],
285
- );
286
- } else {
287
- return Text ("No data available" );
288
- }
289
- }
290
- },
291
- ),
292
- SizedBox (height: 20 ),
293
- FutureBuilder <void >(
294
- future: fetchGraphRatings (
295
- congestionRating.camera.id, // cameraID
296
- 'day' , // groupby
297
- formatToSingaporeTime (DateTime .now ().subtract (Duration (days: 5 ))), // start time
298
- formatToSingaporeTime (DateTime .now ()) // end time
299
- ),
300
- builder: (context, snapshot) {
301
- if (snapshot.connectionState == ConnectionState .waiting) {
302
- return CircularProgressIndicator ();
303
- } else if (snapshot.hasError) {
304
- return Text ("Error: ${snapshot .error }" );
305
- } else {
306
- if (historyRatings.isNotEmpty) {
307
- return CongestionGraphs .buildCongestionHistoryGraph (historyRatings);
308
- } else {
309
- return Text ("No data available" );
310
- }
311
- }
312
- },
313
- ),
263
+ CongestionPointView (cameraId: congestionRating.camera.id)
314
264
],
315
265
const SizedBox (height: 20 ),
316
266
TextButton (
0 commit comments