Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
saved_locations_list.dart
Go to the documentation of this file.
1import 'package:easy_localization/easy_localization.dart';
2import 'package:flutter/material.dart';
3import 'package:flutter_screenutil/flutter_screenutil.dart';
4import 'package:fluentui_system_icons/fluentui_system_icons.dart';
5
6import '../../../../../../core/ui/theme/color_palette.dart';
7import '../models/saved_location.dart';
8
9class SavedLocationsList extends StatelessWidget {
10 final List<SavedLocation> savedLocations;
11 final Function(SavedLocation) onLocationSelected;
12 final bool isExpanded;
13 final VoidCallback onToggle;
14 final VoidCallback onClose;
15
17 super.key,
18 required this.savedLocations,
19 required this.onLocationSelected,
20 required this.isExpanded,
21 required this.onToggle,
22 required this.onClose,
23 });
24
25 @override
26 Widget build(BuildContext context) {
27 return Container(
28 decoration: BoxDecoration(
29 color: Colors.white,
30 borderRadius: BorderRadius.only(
31 topLeft: Radius.circular(20.r),
32 topRight: Radius.circular(20.r),
33 ),
34 boxShadow: [
35 BoxShadow(
36 color: Colors.black.withValues(alpha: 0.1),
37 blurRadius: 10,
38 offset: const Offset(0, -2),
39 ),
40 ],
41 ),
43 mainAxisSize: MainAxisSize.min,
44 children: [
45 GestureDetector(
47 child: Container(
48 width: double.infinity,
49 padding: EdgeInsets.symmetric(vertical: 10.h),
51 mainAxisSize: MainAxisSize.min,
52 children: [
53 Container(
54 width: 40.w,
55 height: 4.h,
56 decoration: BoxDecoration(
57 color: Colors.grey[300],
58 borderRadius: BorderRadius.circular(2.r),
59 ),
60 ),
61 if (!isExpanded) ...[
62 SizedBox(height: 6.h),
63 Text(
64 'scheduling.saved_locations'.tr(),
65 style: TextStyle(
66 fontSize: 15.sp,
67 fontWeight: FontWeight.w600,
68 color: Colors.black87,
69 ),
70 ),
71 ],
72 ],
73 ),
74 ),
75 ),
76 if (isExpanded)
77 Expanded(
78 child: GestureDetector(
80 behavior: HitTestBehavior.opaque,
81 child: SingleChildScrollView(
82 child: Padding(
83 padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
85 crossAxisAlignment: CrossAxisAlignment.start,
86 mainAxisSize: MainAxisSize.min,
87 children: [
88 GestureDetector(
89 onTap: () {}, // Prevent tap from bubbling up
91 crossAxisAlignment: CrossAxisAlignment.start,
92 children: [
93 Row(
94 mainAxisAlignment: MainAxisAlignment.spaceBetween,
95 children: [
96 Text(
97 'scheduling.saved_locations'.tr(),
98 style: TextStyle(
99 fontSize: 18.sp,
100 fontWeight: FontWeight.w600,
101 color: Colors.black87,
102 ),
103 ),
104 GestureDetector(
105 onTap: onClose,
106 child: Container(
107 padding: EdgeInsets.all(4.w),
108 decoration: BoxDecoration(
109 color: Colors.grey[100],
110 borderRadius: BorderRadius.circular(16.r),
111 ),
112 child: Icon(
113 FluentIcons.dismiss_16_regular,
114 size: 16.sp,
115 color: Colors.grey[600],
116 ),
117 ),
118 ),
119 ],
120 ),
121 SizedBox(height: 16.h),
122 ListView.separated(
123 shrinkWrap: true,
124 physics: const NeverScrollableScrollPhysics(),
125 itemCount: savedLocations.length,
126 separatorBuilder: (context, index) => SizedBox(height: 8.h),
127 itemBuilder: (context, index) {
129 return _SavedLocationTile(
131 onTap: () => onLocationSelected(location),
132 );
133 },
134 ),
135 // SizedBox(height: 16.h),
136 // _AddLocationTile(),
137 ],
138 ),
139 ),
140 ],
141 ),
142 ),
143 ),
144 ),
145 ),
146 ],
147 ),
148 );
149 }
150}
151
154 final VoidCallback onTap;
155
157 required this.location,
158 required this.onTap,
159 });
160
161 @override
162 Widget build(BuildContext context) {
163 return InkWell(
164 onTap: onTap,
165 borderRadius: BorderRadius.circular(12.r),
166 child: Container(
167 padding: EdgeInsets.all(12.w),
168 decoration: BoxDecoration(
170 borderRadius: BorderRadius.circular(12.r),
171 border: Border.all(
172 color: Colors.grey[200]!,
173 width: 1,
174 ),
175 ),
176 child: Row(
177 children: [
178 Container(
179 width: 40.w,
180 height: 40.w,
181 decoration: BoxDecoration(
182 color: ColorPalette.lightGreen.withValues(alpha: 0.1),
183 borderRadius: BorderRadius.circular(8.r),
184 ),
185 child: Icon(
186 location.icon,
188 size: 20.sp,
189 ),
190 ),
191 SizedBox(width: 12.w),
192 Expanded(
193 child: Column(
194 crossAxisAlignment: CrossAxisAlignment.start,
195 children: [
196 Text(
197 location.name,
198 style: TextStyle(
199 fontSize: 16.sp,
200 fontWeight: FontWeight.w600,
201 color: Colors.black87,
202 ),
203 ),
204 SizedBox(height: 2.h),
205 Text(
206 location.address,
207 style: TextStyle(
208 fontSize: 14.sp,
209 color: Colors.grey[600],
210 ),
211 maxLines: 1,
212 overflow: TextOverflow.ellipsis,
213 ),
214 ],
215 ),
216 ),
217 Icon(
218 FluentIcons.chevron_right_16_regular,
219 color: Colors.grey[400],
220 size: 16.sp,
221 ),
222 ],
223 ),
224 ),
225 );
226 }
227}
228
229// class _AddLocationTile extends StatelessWidget {
230// @override
231// Widget build(BuildContext context) {
232// return InkWell(
233// onTap: () {
234// // Handle add new location
235// ScaffoldMessenger.of(context).showSnackBar(
236// const SnackBar(
237// content: Text('Add new location feature coming soon'),
238// ),
239// );
240// },
241// borderRadius: BorderRadius.circular(12.r),
242// child: Container(
243// padding: EdgeInsets.all(12.w),
244// decoration: BoxDecoration(
245// color: Colors.white,
246// borderRadius: BorderRadius.circular(12.r),
247// border: Border.all(
248// color: ColorPalette.lightGreen.withValues(alpha: 0.3),
249// width: 1,
250// ),
251// ),
252// child: Row(
253// children: [
254// Container(
255// width: 40.w,
256// height: 40.w,
257// decoration: BoxDecoration(
258// color: ColorPalette.lightGreen.withValues(alpha: 0.1),
259// borderRadius: BorderRadius.circular(8.r),
260// ),
261// child: Icon(
262// FluentIcons.add_16_regular,
263// color: ColorPalette.lightGreen,
264// size: 20.sp,
265// ),
266// ),
267// SizedBox(width: 12.w),
268// Expanded(
269// child: Text(
270// 'Add new location',
271// style: TextStyle(
272// fontSize: 16.sp,
273// fontWeight: FontWeight.w500,
274// color: ColorPalette.lightGreen,
275// ),
276// ),
277// ),
278// Icon(
279// FluentIcons.chevron_right_16_regular,
280// color: ColorPalette.lightGreen.withValues(alpha: 0.7),
281// size: 16.sp,
282// ),
283// ],
284// ),
285// ),
286// );
287// }
288// }
static const lightGreen
static const antiFlashWhite
final VoidCallback onToggle
final VoidCallback onTap
final Widget child
const SavedLocationsList({ super.key, required this.savedLocations, required this.onLocationSelected, required this.isExpanded, required this.onToggle, required this.onClose, })
override Widget build(BuildContext context)
final VoidCallback onClose
final List< SavedLocation > savedLocations
final EdgeInsets padding
final Function(SavedLocation) onLocationSelected
final Widget child
final EdgeInsets padding
final Color color
Definition failures.dart:1
class UpdateLocationEvent extends LocationSelectionEvent location
const _SavedLocationTile({ required this.location, required this.onTap, })
final VoidCallback onTap
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,),),),],)