diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-12-20 19:40:11 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-12-20 19:40:11 +0200 |
| commit | b84fe9a9c4c18a3f4e957f76ead34403c4316f76 (patch) | |
| tree | 14e4b37ae137ed538eaa14af4228c41033facac8 /mobile/lib/main.dart | |
| parent | 953b5ce3ad7e933c6f008202346fe5bf2985bf9e (diff) | |
| download | carpool-b84fe9a9c4c18a3f4e957f76ead34403c4316f76.tar.xz carpool-b84fe9a9c4c18a3f4e957f76ead34403c4316f76.zip | |
Added a simple Login and SignUp page for the web driver app
Diffstat (limited to 'mobile/lib/main.dart')
| -rw-r--r-- | mobile/lib/main.dart | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart new file mode 100644 index 0000000..5fd2374 --- /dev/null +++ b/mobile/lib/main.dart @@ -0,0 +1,200 @@ +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/material.dart'; +import 'firebase_options.dart'; +import 'routes.dart'; +import 'login.dart'; +import 'cart.dart'; +import 'payement_order.dart'; +import 'signup.dart'; +import 'order_history.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Carpool App', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: HomePage(), + routes: { + '/signup': (context) => const SignUpPage(), + '/login': (context) => const 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', + )), + }, + ); + } +} + +class HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Home'), + ), + 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.app_registration_rounded, + text: 'Signup', + onTap: () { + Navigator.pop(context); + Navigator.pushNamed(context, '/signup'); + }, + ), + _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: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const SizedBox(height: 20), + const Text( + 'Hello there', + style: TextStyle( + fontSize: 48, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 20), + const Text( + 'Welcome to Carpool', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 20), + Image.asset( + 'assets/logo.png', + width: 200, + height: 200, + ), + const SizedBox(height: 40), + ElevatedButton( + onPressed: () { + Navigator.pushNamed(context, '/login'); + }, + style: ElevatedButton.styleFrom( + primary: Colors.blue, + ), + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 40, vertical: 16), + child: Text( + 'Login', + style: TextStyle( + fontSize: 18, + color: Colors.white, + ), + ), + ), + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () { + Navigator.pushNamed(context, '/signup'); + }, + style: ElevatedButton.styleFrom( + primary: Colors.green, + ), + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 40, vertical: 16), + child: Text( + 'Signup', + style: TextStyle( + fontSize: 18, + color: Colors.white, + ), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildDrawerItem({ + required IconData icon, + required String text, + required VoidCallback onTap, + }) { + return ListTile( + leading: Icon(icon), + title: Text(text), + onTap: onTap, + ); + } +} |
