Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
request_details.dart
Go to the documentation of this file.
1import 'package:aidra_drive/mocked_screens/models/driver_request.dart';
2import 'package:aidra_drive/mocked_screens/presentation/request_details/widgets/action_buttons.dart';
3import 'package:aidra_drive/mocked_screens/presentation/request_details/widgets/confirmation_dialogs.dart';
4import 'package:aidra_drive/mocked_screens/presentation/request_details/widgets/request_header.dart';
5import 'package:aidra_drive/mocked_screens/presentation/request_details/widgets/route_info_card.dart';
6import 'package:aidra_drive/mocked_screens/presentation/request_details/widgets/station_card.dart';
7import 'package:aidra_drive/mocked_screens/presentation/stations_map_view/stations_map_view.dart';
8import 'package:flutter/material.dart';
9import 'package:flutter_screenutil/flutter_screenutil.dart';
10
11import '../../../core/UI/widgets/custom_scaffold.dart';
12import '../../../core/UI/theme/color_palette.dart';
13
16
18 super.key,
19 required this.request,
20 });
21
22 @override
23 State<RequestDetailsScreen> createState() => _RequestDetailsScreenState();
24}
25
26class _RequestDetailsScreenState extends State<RequestDetailsScreen> {
27 @override
28 Widget build(BuildContext context) {
29 return CustomScaffold(
30 title: 'Request Details',
31 backgroundColor: ColorPalette.antiFlashWhite,
32 actions: [
33 TextButton.icon(
34 icon: Icon(
35 Icons.map_outlined,
37 size: 16.sp,
38 ),
39 label: Text(
40 'View on Map',
41 style: TextStyle(
43 fontSize: 10.sp,
44 fontWeight: FontWeight.w600,
45 ),
46 ),
47 onPressed: () {
48 Navigator.push(
49 context,
50 MaterialPageRoute(
51 builder: (context) => StationsMapViewScreen(
52 stations: widget.request.stations,
53 ),
54 ),
55 );
56 },
57 ),
58 ],
59 body: _buildBody(),
60 );
61 }
62
63 Widget _buildBody() {
64 return Stack(
65 children: [
66 SingleChildScrollView(
67 padding: EdgeInsets.all(16.sp),
69 crossAxisAlignment: CrossAxisAlignment.start,
70 children: [
71 RequestHeader(request: widget.request),
72 SizedBox(height: 10.h),
73 RouteInfoCard(request: widget.request),
75 SizedBox(height: 100.h), // Space for bottom buttons
76 ],
77 ),
78 ),
79 // Bottom action buttons
80 Positioned(
81 bottom: 0,
82 left: 0,
83 right: 0,
84 child: ActionButtons(
85 onAccept: _showAcceptDialog,
86 onDecline: _showDeclineDialog,
87 ),
88 ),
89 ],
90 );
91 }
92
94 return Container(
95 padding: EdgeInsets.all(16.sp),
96 decoration: BoxDecoration(
98 borderRadius: BorderRadius.circular(12.r),
99 boxShadow: [
100 BoxShadow(
101 color: Colors.grey.withValues(alpha: 0.1),
102 blurRadius: 8,
103 offset: const Offset(0, 2),
104 ),
105 ],
106 ),
107 child: Column(
108 crossAxisAlignment: CrossAxisAlignment.start,
109 children: [
110 Text(
111 'Oil Stations (${widget.request.stations.length})',
112 style: TextStyle(
113 fontSize: 16.sp,
114 fontWeight: FontWeight.bold,
116 ),
117 ),
118 SizedBox(height: 16.h),
119 ...widget.request.stations
120 .map((station) => StationCard(station: station)),
121 ],
122 ),
123 );
124 }
125
129
133
135 ScaffoldMessenger.of(context).showSnackBar(
136 SnackBar(
137 content: Row(
138 children: [
139 Icon(
140 Icons.check_circle,
141 color: Colors.white,
142 size: 20.sp,
143 ),
144 SizedBox(width: 12.w),
145 Text(
146 'Request accepted successfully!',
147 style: TextStyle(fontSize: 14.sp),
148 ),
149 ],
150 ),
151 backgroundColor: ColorPalette.lightGreen,
152 duration: const Duration(seconds: 3),
153 behavior: SnackBarBehavior.floating,
154 shape: RoundedRectangleBorder(
155 borderRadius: BorderRadius.circular(8.r),
156 ),
157 ),
158 );
159
160 Future.delayed(const Duration(seconds: 2), () {
161 if (!mounted) return;
162 Navigator.of(context).pop();
163 });
164 }
165
167 ScaffoldMessenger.of(context).showSnackBar(
168 SnackBar(
169 content: Row(
170 children: [
171 Icon(
172 Icons.cancel,
173 color: Colors.white,
174 size: 20.sp,
175 ),
176 SizedBox(width: 12.w),
177 Text(
178 'Request declined',
179 style: TextStyle(fontSize: 14.sp),
180 ),
181 ],
182 ),
183 backgroundColor: Colors.red,
184 duration: const Duration(seconds: 3),
185 behavior: SnackBarBehavior.floating,
186 shape: RoundedRectangleBorder(
187 borderRadius: BorderRadius.circular(8.r),
188 ),
189 ),
190 );
191 Future.delayed(const Duration(seconds: 2), () {
192 if (!mounted) return;
193 Navigator.of(context).pop();
194 });
195 }
196}
class App extends StatefulWidget build(BuildContext context)
Definition app.dart:31
static const darkGrey
static const lightGreen
static const white
static const antiFlashWhite
static const grey
static void showDeclineDialog(BuildContext context, VoidCallback onConfirm)
static void showAcceptDialog(BuildContext context, VoidCallback onConfirm)
override State< RequestDetailsScreen > createState()
const RequestDetailsScreen({ super.key, required this.request, })
abstract class CollectionsToScheduleEvent extends Equatable request
Widget _buildBody(ElearningV2State state)
final Widget child
final EdgeInsets padding
DriverRequest({ required this.id, required this.driverName, required this.creationDate, required this.stations, required this.startPoint, required this.endPoint, })
Widget _buildBody()
final Color color
Definition failures.dart:1
final VoidCallback onPressed
void _handleDeclineRequest()
void _showDeclineDialog()
void _handleAcceptRequest()
Widget _buildStationsList()
void _showAcceptDialog()
const RequestDetailsScreen({ super.key, required this.request, })
final String title
final String label
style Text( '${ 'scheduling.reference'.tr()}:${collection.internalCode}', style:Theme.of(context).textTheme.bodySmall,)
style SizedBox(height:2.h)
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)