From b25419f76f1b325319d7d303d69eca6de77b8fb0 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Mon, 20 Nov 2023 14:17:52 +0200 Subject: Modified the routes UI and added a simple cart page --- lib/main.dart | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'lib/main.dart') 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( + onChanged: (String? route) { + if (route != null) { + Navigator.pushNamed(context, route); + } + }, + items: [ + '/login', + '/routes', + '/cart', + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + ); + } +} -- cgit v1.2.3