summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2023-11-20 18:20:37 +0200
committeromagdy7 <omar.professional8777@gmail.com>2023-11-20 18:20:37 +0200
commit6fa08163ed9c794482f27d17bf0e0508b474f239 (patch)
tree76122e4d180dee1bbca4a60393a1a223ddb53afd
parentd1d281cb45422186325d8db706c794798eff7315 (diff)
downloadcarpool-6fa08163ed9c794482f27d17bf0e0508b474f239.tar.xz
carpool-6fa08163ed9c794482f27d17bf0e0508b474f239.zip
Added a simpler drawer for different routes
-rw-r--r--lib/main.dart102
1 files changed, 82 insertions, 20 deletions
diff --git a/lib/main.dart b/lib/main.dart
index 82a55d8..61dfcf0 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'routes.dart';
import 'login.dart';
import 'cart.dart';
+import 'payement_order.dart';
import 'order_history.dart';
void main() {
@@ -22,13 +23,14 @@ class MyApp extends StatelessWidget {
'/login': (context) => LoginPage(),
'/routes': (context) => RoutesPage(),
'/order_history': (context) => OrderHistoryPage(),
+ '/payment': (context) => PaymentOrderTrackingPage(),
'/cart': (context) => CartPage(
selectedRide: Ride(
name: 'Sample Ride',
startLocation: 'Sample Start',
endLocation: 'Sample End',
time: 'Sample Time',
- )), // Assuming a sample ride is passed to the CartPage for testing
+ )),
},
);
}
@@ -39,28 +41,88 @@ class HomePage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
- title: Text('Select Page for Testing'),
+ title: const Text('Home'),
),
- body: Center(
- child: DropdownButton<String>(
- onChanged: (String? route) {
- if (route != null) {
- Navigator.pushNamed(context, route);
- }
- },
- items: <String>[
- '/login',
- '/routes',
- '/cart',
- '/order_history',
- ].map<DropdownMenuItem<String>>((String value) {
- return DropdownMenuItem<String>(
- value: value,
- child: Text(value),
- );
- }).toList(),
+ drawer: Drawer(
+ child: ListView(
+ padding: EdgeInsets.zero,
+ children: <Widget>[
+ const DrawerHeader(
+ decoration: BoxDecoration(
+ color: Colors.blue,
+ ),
+ child: Text(
+ 'Menu',
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 24,
+ ),
+ ),
+ ),
+ _buildDrawerItem(
+ icon: Icons.login,
+ text: 'Login',
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.pushNamed(context, '/login');
+ },
+ ),
+ _buildDrawerItem(
+ icon: Icons.map,
+ text: 'Routes',
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.pushNamed(context, '/routes');
+ },
+ ),
+ _buildDrawerItem(
+ icon: Icons.shopping_cart,
+ text: 'Cart',
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.pushNamed(context, '/cart');
+ },
+ ),
+ _buildDrawerItem(
+ icon: Icons.history,
+ text: 'Order History',
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.pushNamed(context, '/order_history');
+ },
+ ),
+ _buildDrawerItem(
+ icon: Icons.payment,
+ text: 'Payment & Order Tracking',
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.pushNamed(context, '/payment');
+ },
+ ),
+ ],
),
),
+ body: const Center(
+ child: Text(
+ 'Welcome to Carpool App!',
+ style: TextStyle(
+ fontSize: 24,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _buildDrawerItem({
+ required IconData icon,
+ required String text,
+ required VoidCallback onTap,
+ }) {
+ return ListTile(
+ leading: Icon(icon),
+ title: Text(text),
+ onTap: onTap,
);
}
}