summaryrefslogtreecommitdiff
path: root/lib/main.dart
blob: 4aea560800d48ed89bd9428a0d79cda9a89a620c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'package:flutter/material.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());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Carpool App',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      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(),
        ),
      ),
    );
  }
}