diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-11-20 14:17:52 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-11-20 14:17:52 +0200 |
| commit | b25419f76f1b325319d7d303d69eca6de77b8fb0 (patch) | |
| tree | 86fd013007a7d61bd28e875dfa5a7789cd091d13 /lib/main.dart | |
| parent | 868ac401d5e0a45d6b66bea813dda4241d93dbcc (diff) | |
| download | carpool-b25419f76f1b325319d7d303d69eca6de77b8fb0.tar.xz carpool-b25419f76f1b325319d7d303d69eca6de77b8fb0.zip | |
Modified the routes UI and added a simple cart page
Diffstat (limited to 'lib/main.dart')
| -rw-r--r-- | lib/main.dart | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/lib/main.dart b/lib/main.dart index dc8ba74..4aea560 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'routes.dart'; -import 'login.dart'; +import 'routes.dart'; // Import your RoutesPage file +import 'login.dart'; // Import your LoginPage file +import 'cart.dart'; // Import your CartPage file void main() { runApp(MyApp()); @@ -15,11 +16,47 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), - initialRoute: '/routes', // Set the initial route to the login page + home: HomePage(), // Set the home page to a custom HomePage widget routes: { '/login': (context) => LoginPage(), '/routes': (context) => RoutesPage(), + '/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 }, ); } } + +class HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Select Page for Testing'), + ), + body: Center( + child: DropdownButton<String>( + onChanged: (String? route) { + if (route != null) { + Navigator.pushNamed(context, route); + } + }, + items: <String>[ + '/login', + '/routes', + '/cart', + ].map<DropdownMenuItem<String>>((String value) { + return DropdownMenuItem<String>( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + ); + } +} |
