Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
operational_hours_view.dart
Go to the documentation of this file.
1import 'package:connect/core/ui/widgets/custom_card.dart';
2import 'package:connect/features/co2_emmissions/screens/widgets/step_brogress_bar.dart';
3import 'package:flutter/material.dart';
4import 'package:flutter_screenutil/flutter_screenutil.dart';
5import 'package:hugeicons/hugeicons.dart';
6
7class OpertaionalHoursView extends StatefulWidget {
8 const OpertaionalHoursView({super.key});
9
10 @override
11 State<OpertaionalHoursView> createState() => _OpertaionalHoursViewState();
12}
13
14class _OpertaionalHoursViewState extends State<OpertaionalHoursView> {
15 List<String> options = [
16 'Morning (6:00 AM - 12:00 PM)',
17 'Afternoon (12:00 PM - 6:00 PM)',
18 'Evening (6:00 PM - 12:00 AM)',
19 'Late Night (12:00 AM - 6:00 AM)',
20 ];
21 List<String> selectedOption = [];
22
23 void onSelect(String option) {
24 if (selectedOption.contains(option)) {
25 selectedOption.remove(option);
26 } else {
27 selectedOption.add(option);
28 }
29 setState(() {});
30 }
31
32 bool isSelected(String option) {
33 return selectedOption.contains(option);
34 }
35
36 @override
37 Widget build(BuildContext context) {
38 return SingleChildScrollView(
39 padding: EdgeInsets.all(15.sp),
40 child: Column(
41 crossAxisAlignment: CrossAxisAlignment.start,
42 children: [
43 Container(
44 width: double.infinity,
45 padding: EdgeInsets.all(15.sp),
46 decoration: BoxDecoration(
47 color: Colors.blue.withOpacity(0.11),
48 borderRadius: BorderRadius.circular(10)),
49 child: Center(
50 child: Text(
51 'Operational Details',
52 style: Theme.of(context)
53 .textTheme
54 .bodySmall
55 ?.copyWith(color: Colors.blue),
56 ),
57 ),
58 ),
59 SizedBox(height: 10.sp),
61 padding: EdgeInsets.all(15.sp),
62 child: Column(
63 crossAxisAlignment: CrossAxisAlignment.start,
64 children: [
65 SimpleProgressBar(
66 totalSteps: 2,
67 currentStep: 1,
68 ),
69 SizedBox(height: 10.sp),
70 Text(
71 'What are your operating hours?',
72 style: Theme.of(context).textTheme.displaySmall?.copyWith(
73 fontSize: 12.sp,
74 ),
75 ),
76 SizedBox(height: 5.sp),
77 Text(
78 '(Select all that apply):',
79 style: Theme.of(context).textTheme.displaySmall?.copyWith(
80 color: Theme.of(context).hintColor,
81 fontSize: 10.sp,
82 ),
83 ),
84 SizedBox(height: 20.sp),
85 ListView.separated(
86 physics: NeverScrollableScrollPhysics(),
87 shrinkWrap: true,
88 itemCount: options.length,
89 separatorBuilder: (context, index) => SizedBox(height: 10.sp),
90 itemBuilder: (BuildContext context, int index) {
91 return CustomOptionButton(
92 option: options[index],
93 onPressed: () {
94 onSelect(options[index]);
95 },
97 );
98 },
99 ),
100 ],
101 ),
102 ),
103 ],
104 ),
105 );
106 }
107}
108
109class CustomOptionButton extends StatelessWidget {
111 super.key,
112 required this.option,
113 required this.onPressed,
114 required this.isSelected,
115 });
116
117 final String option;
119 final bool isSelected;
120
121 @override
122 Widget build(BuildContext context) {
123 return ElevatedButton(
124 style: ElevatedButton.styleFrom(
126 ? Theme.of(context).colorScheme.primary.withOpacity(0.11)
127 : Theme.of(context).colorScheme.surface,
128 padding: EdgeInsets.all(15.sp),
129 ),
131 child: Row(
132 children: [
133 Container(
134 height: isSelected ? 25.sp : 20.sp,
135 width: isSelected ? 25.sp : 20.sp,
136 decoration: BoxDecoration(
138 ? Theme.of(context).colorScheme.primary.withOpacity(0.11)
139 : Theme.of(context).colorScheme.surface,
140 shape: BoxShape.circle,
141 border: Border.all(
142 width: 1,
144 ? Theme.of(context).colorScheme.primary
145 : Theme.of(context).hintColor,
146 ),
147 ),
148 child: Icon(
149 HugeIcons.strokeRoundedCheckmarkBadge04,
150 size: 15.sp,
152 ? Theme.of(context).colorScheme.primary
153 : Theme.of(context).colorScheme.surface,
154 ),
155 ),
156 SizedBox(width: 10.sp),
157 Flexible(
158 child: Text(
159 option,
160 style: Theme.of(context).textTheme.bodySmall?.copyWith(
162 ? Theme.of(context).colorScheme.primary
163 : Theme.of(context)
164 .textTheme
165 .displaySmall
166 ?.color
167 ?.withOpacity(0.7),
168 ),
169 ),
170 ),
171 ],
172 ),
173 );
174 }
175}
const OpertaionalHoursView({super.key})
override State< OpertaionalHoursView > createState()
final Function() onPressed
final VoidCallback onPressed
final Widget child
override Widget build(BuildContext context)
Definition app_view.dart:19
const CustomOptionButton({ super.key, required this.option, required this.onPressed, required this.isSelected, })
const CustomCard({ super.key, required this.child, this.padding, this.bgColor, })
final Widget child
final EdgeInsets padding
final Color backgroundColor
final bool isSelected
class EnergySavingsMeasure extends StatefulWidget options
List< String > selectedOption
void onSelect(String option)
final Color color
Definition failures.dart:1
override Widget build(BuildContext context)