summaryrefslogtreecommitdiff
path: root/lib/main.dart
blob: 82a55d8e688ca1c84800f509b26e34b7f566fdf7 (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
63
64
65
66
import 'package:flutter/material.dart';
import 'routes.dart';
import 'login.dart';
import 'cart.dart';
import 'order_history.dart';

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(),
        '/order_history': (context) => OrderHistoryPage(),
        '/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',
            '/order_history',
          ].map<DropdownMenuItem<String>>((String value) {
            return DropdownMenuItem<String>(
              value: value,
              child: Text(value),
            );
          }).toList(),
        ),
      ),
    );
  }
}