Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
own_vehicles_view.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3
4import '../../../../../core/ui/widgets/custom_card.dart';
5import '../../../../../core/ui/widgets/custom_text_form_field.dart';
6import '../../operational_details_screen/views/operational_hours_view.dart';
7import '../../widgets/step_brogress_bar.dart';
8
9class OwnVehiclesView extends StatefulWidget {
10 const OwnVehiclesView({super.key});
11
12 @override
13 State<OwnVehiclesView> createState() => _OwnVehiclesViewState();
14}
15
16class _OwnVehiclesViewState extends State<OwnVehiclesView> {
18 final Set<String> selectedVehicleTypes = {};
19
20 final List<String> yesNoOptions = ['Yes', 'No'];
21 final List<String> vehicleTypes = [
22 'Petrol cars/vans',
23 'Diesel cars/vans',
24 'Electric or hybrid vehicles',
25 'Other (specify)',
26 ];
27
28 void _onSelectUseOwnVehicles(String option) {
29 setState(() {
30 useOwnVehicles = option;
31 });
32 }
33
34 void _onSelectVehicleType(String option) {
35 setState(() {
36 if (selectedVehicleTypes.contains(option)) {
37 selectedVehicleTypes.remove(option);
38 } else {
39 selectedVehicleTypes.add(option);
40 }
41 });
42 }
43
44 @override
45 Widget build(BuildContext context) {
46 return SingleChildScrollView(
47 padding: EdgeInsets.all(15.sp),
48 child: Column(
49 crossAxisAlignment: CrossAxisAlignment.start,
50 children: [
51 Container(
52 width: double.infinity,
53 padding: EdgeInsets.all(15.sp),
54 decoration: BoxDecoration(
55 color: Colors.blue.withOpacity(0.11),
56 borderRadius: BorderRadius.circular(10),
57 ),
58 child: Center(
59 child: Text(
60 'Transport',
61 style: Theme.of(context)
62 .textTheme
63 .bodySmall
64 ?.copyWith(color: Colors.blue),
65 ),
66 ),
67 ),
68 SizedBox(height: 10.sp),
70 padding: EdgeInsets.all(15.sp),
71 child: Column(
72 crossAxisAlignment: CrossAxisAlignment.start,
73 children: [
74 SimpleProgressBar(
75 totalSteps: 6,
76 currentStep: 5,
77 ),
78 SizedBox(height: 10.sp),
79 Text(
80 'Do You Use Your Own Vehicles For Deliveries Or Business Operations?',
81 style: Theme.of(context).textTheme.displaySmall?.copyWith(
82 fontSize: 12.sp,
83 ),
84 ),
85 SizedBox(height: 20.sp),
86 ...yesNoOptions.map((option) => Padding(
87 padding: const EdgeInsets.only(bottom: 10),
88 child: CustomOptionButton(
89 isSelected: useOwnVehicles == option,
90 onPressed: () => _onSelectUseOwnVehicles(option),
91 option: option,
92 ),
93 )),
94 if (useOwnVehicles == 'Yes') ...[
95 SizedBox(height: 20.sp),
96 Text(
97 '(If Yes) What Type Of Vehicles Do You Use For Deliveries And Business Operations?',
98 style: Theme.of(context).textTheme.displaySmall?.copyWith(
99 fontSize: 12.sp,
100 ),
101 ),
102 Text(
103 '(Select All That Apply)',
104 style: Theme.of(context).textTheme.displaySmall?.copyWith(
105 color: Theme.of(context).hintColor,
106 fontSize: 10.sp,
107 ),
108 ),
109 SizedBox(height: 20.sp),
110 ...vehicleTypes.map((option) => Padding(
111 padding: const EdgeInsets.only(bottom: 10),
112 child: CustomOptionButton(
113 isSelected: selectedVehicleTypes.contains(option),
114 onPressed: () => _onSelectVehicleType(option),
115 option: option,
116 ),
117 )),
118 if (selectedVehicleTypes.contains('Other (specify)'))
119 CustomTextFormField(
120 hintText: 'Type...',
121 maxLines: 4,
122 fillColor:
123 Theme.of(context).highlightColor.withOpacity(0.11),
124 controller: TextEditingController(),
125 ),
126 ],
127 ],
128 ),
129 ),
130 ],
131 ),
132 );
133 }
134}
const OwnVehiclesView({super.key})
override State< OwnVehiclesView > createState()
const CustomCard({ super.key, required this.child, this.padding, this.bgColor, })
final Widget child
final EdgeInsets padding
final bool isSelected
final Color color
Definition failures.dart:1
override Widget build(BuildContext context)
final List< String > yesNoOptions
final Set< String > selectedVehicleTypes
void _onSelectUseOwnVehicles(String option)
void _onSelectVehicleType(String option)
class OwnVehiclesView extends StatefulWidget useOwnVehicles
final List< String > vehicleTypes