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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
import 'package:flutter/material.dart';
// Define a Ride class to represent the selected ride
class Ride {
final String name;
final String startLocation;
final String endLocation;
final String time;
Ride({
required this.name,
required this.startLocation,
required this.endLocation,
required this.time,
});
}
class CartPage extends StatelessWidget {
final Ride selectedRide;
CartPage({required this.selectedRide});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Cart'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Card(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text(
'Selected Ride:',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 12),
ListTile(
leading: const Icon(Icons.directions_car, color: Colors.blue),
title: Text(selectedRide.name),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.location_on, color: Colors.blue),
const SizedBox(width: 4),
Text(selectedRide.startLocation),
],
),
const SizedBox(height: 4),
Row(
children: [
const Icon(Icons.arrow_forward, color: Colors.blue),
const SizedBox(width: 4),
Text(selectedRide.endLocation),
],
),
const SizedBox(height: 4),
Row(
children: [
const Icon(Icons.access_time, color: Colors.blue),
const SizedBox(width: 4),
Text(selectedRide.time),
],
),
],
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Implement payment or confirmation logic here
// For now, just print a message
print('Processing payment/confirmation...');
},
child: const Text('Proceed to Payment/Confirm'),
),
],
),
),
),
),
);
}
}
|