summaryrefslogtreecommitdiff
path: root/lib/routes.dart
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2023-11-20 14:17:52 +0200
committeromagdy7 <omar.professional8777@gmail.com>2023-11-20 14:17:52 +0200
commitb25419f76f1b325319d7d303d69eca6de77b8fb0 (patch)
tree86fd013007a7d61bd28e875dfa5a7789cd091d13 /lib/routes.dart
parent868ac401d5e0a45d6b66bea813dda4241d93dbcc (diff)
downloadcarpool-b25419f76f1b325319d7d303d69eca6de77b8fb0.tar.xz
carpool-b25419f76f1b325319d7d303d69eca6de77b8fb0.zip
Modified the routes UI and added a simple cart page
Diffstat (limited to 'lib/routes.dart')
-rw-r--r--lib/routes.dart68
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),
+ ),
+ ),
);
},
),