diff options
Diffstat (limited to 'lib/routes.dart')
| -rw-r--r-- | lib/routes.dart | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/lib/routes.dart b/lib/routes.dart index 8898922..a1136c9 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'cart.dart'; +import 'package:intl/intl.dart'; class Route { final String name; @@ -15,12 +17,12 @@ class RoutesPage extends StatelessWidget { final List<Route> dummyRoutes = [ Route( name: 'Morning Ride - Gate 3 to Abdu-Basha', - startLocation: 'Gate 3', - endLocation: 'Abdu-Basha'), + startLocation: 'Abassyia', + endLocation: 'Abdu-Basha Gate-3'), Route( name: 'Afternoon Ride - Abdu-Basha to Gate 3', - startLocation: 'Abdu-Basha', - endLocation: 'Gate 3'), + startLocation: 'Hadayek Elkoba', + endLocation: 'Abdu-Basha Gate-6'), ]; @override @@ -31,14 +33,60 @@ class RoutesPage extends StatelessWidget { itemCount: dummyRoutes.length, itemBuilder: (BuildContext context, int index) { final Route route = dummyRoutes[index]; - return ListTile( - title: Text(route.name), - subtitle: - Text('From: ${route.startLocation} - To: ${route.endLocation}'), + return GestureDetector( onTap: () { - // Handle route selection here, if needed - print('Selected route: ${route.name}'); + DateTime now = DateTime.now(); + String formattedDateTime = + DateFormat('EEEE dd/MM/yyyy hh:mm a').format(now); + Ride selectedRide = Ride( + name: route.name, + startLocation: route.startLocation, + endLocation: route.endLocation, + time: formattedDateTime, // Get current time + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartPage(selectedRide: selectedRide), + ), + ); }, + child: Card( + elevation: 3, + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: ListTile( + title: Text( + route.name, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.location_on, color: Colors.blue), + SizedBox(width: 4), + Flexible(child: Text(route.startLocation)), + ], + ), + Row( + children: [ + Icon(Icons.arrow_forward, color: Colors.blue), + SizedBox(width: 4), + Flexible(child: Text(route.endLocation)), + ], + ), + ], + ), + leading: Icon(Icons.directions_car), + ), + ), ); }, ), |
