Skip to content

Commit 5ff4b1c

Browse files
committed
update screen
1 parent 1eae7ee commit 5ff4b1c

File tree

1 file changed

+41
-18
lines changed

1 file changed

+41
-18
lines changed

lib/screens/congestionRating.dart

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ class _CongestionRatingScreenState extends State<CongestionRatingScreen> {
351351
);
352352
}
353353

354+
int? selectedIndex;
354355
Widget _buildCongestionPointsBox(List<String> congestionPoints) {
355356
return Container(
356357
padding: EdgeInsets.all(10),
@@ -393,7 +394,13 @@ class _CongestionRatingScreenState extends State<CongestionRatingScreen> {
393394
child: SingleChildScrollView(
394395
child: Column(
395396
children: List.generate(congestionPoints.length, (index) {
396-
return Column(
397+
return GestureDetector(
398+
onTap: () {
399+
setState(() {
400+
selectedIndex = index; // Update selected congestion point
401+
});
402+
},
403+
child: Column(
397404
children: [
398405
Padding(
399406
padding: const EdgeInsets.symmetric(horizontal: 8.0),
@@ -415,12 +422,15 @@ class _CongestionRatingScreenState extends State<CongestionRatingScreen> {
415422
endIndent: 25,
416423
),
417424
],
418-
);
425+
));
419426
}),
420427
),
421428
),
422429
),
423-
],
430+
if (selectedIndex != null)
431+
_buildHourlyCongestionRatingGraph(congestionPoints[selectedIndex!]),
432+
_buildCongestionHistoryGraph(congestionPoints[selectedIndex!]),
433+
_buildImageViewer(congestionPoints[selectedIndex!])],
424434
),
425435
);
426436
}
@@ -478,35 +488,48 @@ class _CongestionRatingScreenState extends State<CongestionRatingScreen> {
478488
);
479489
}
480490

481-
482-
// Placeholder methods for graphs
483-
Widget _buildHourlyCongestionRatingGraph() {
484-
return Container(
485-
height: 200,
486-
color: Colors.redAccent[100],
487-
child: Center(
488-
child: Text('Hourly Congestion Rating Graph'),
489-
),
491+
// Placeholder methods for graphs and image viewer
492+
Widget _buildHourlyCongestionRatingGraph(String congestionPoint) {
493+
return Column(
494+
children: [
495+
Text(
496+
congestionPoint,
497+
style: TextStyle(
498+
fontSize: 16,
499+
fontWeight: FontWeight.bold,
500+
),
501+
),
502+
SizedBox(height: 8),
503+
Container(
504+
height: 200,
505+
color: Colors.redAccent[100],
506+
child: Center(
507+
child: Text('Hourly Congestion Rating'),
508+
),
509+
),
510+
],
490511
);
491512
}
492513

493-
Widget _buildCongestionHistoryGraph() {
514+
Widget _buildCongestionHistoryGraph(String congestionPoint) {
494515
return Container(
495516
height: 150,
496517
color: Colors.blueAccent[100],
497518
child: Center(
498-
child: Text('Congestion Rating History Graph'),
519+
child: Text('Congestion Rating History'),
499520
),
500521
);
501522
}
502523

503-
Widget _buildTotalCongestionTimeGraph() {
524+
Widget _buildImageViewer(String congestionPoint) {
504525
return Container(
505-
height: 150,
506-
color: Colors.greenAccent[100],
526+
height: 200,
527+
color: Colors.redAccent[100],
507528
child: Center(
508-
child: Text('Total Congestion Time Graph'),
529+
child: Text('Congestion History Captures'),
509530
),
510531
);
511532
}
533+
534+
512535
}

0 commit comments

Comments
 (0)