Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
opetrational_days_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 OpertaionalDaysView extends StatefulWidget {
8 const OpertaionalDaysView({super.key});
9
10 @override
11 State<OpertaionalDaysView> createState() => _OpertaionalDaysViewState();
12}
13
14class _OpertaionalDaysViewState extends State<OpertaionalDaysView> {
15 List<String> options = [
16 'Less than 20 days',
17 '20-25 days',
18 'More than 25 days',
19 ];
20 List<String> selectedOption = [];
21
22 void onSelect(String option) {
23 if (selectedOption.contains(option)) {
24 selectedOption.remove(option);
25 } else {
26 selectedOption.add(option);
27 }
28 setState(() {});
29 }
30
31 bool isSelected(String option) {
32 return selectedOption.contains(option);
33 }
34
35 @override
36 Widget build(BuildContext context) {
37 return SingleChildScrollView(
38 padding: EdgeInsets.all(15.sp),
39 child: Column(
40 crossAxisAlignment: CrossAxisAlignment.start,
41 children: [
42 Container(
43 width: double.infinity,
44 padding: EdgeInsets.all(15.sp),
45 decoration: BoxDecoration(
46 color: Colors.blue.withOpacity(0.11),
47 borderRadius: BorderRadius.circular(10)),
48 child: Center(
49 child: Text(
50 'Operational Details',
51 style: Theme.of(context)
52 .textTheme
53 .bodySmall
54 ?.copyWith(color: Colors.blue),
55 ),
56 ),
57 ),
58 SizedBox(height: 10.sp),
60 padding: EdgeInsets.all(15.sp),
61 child: Column(
62 crossAxisAlignment: CrossAxisAlignment.start,
63 children: [
64 SimpleProgressBar(
65 totalSteps: 2,
66 currentStep: 2,
67 ),
68 SizedBox(height: 10.sp),
69 Text(
70 'How many operational days per month?',
71 style: Theme.of(context).textTheme.displaySmall?.copyWith(
72 fontSize: 12.sp,
73 ),
74 ),
75 SizedBox(height: 20.sp),
76 ListView.separated(
77 shrinkWrap: true,
78 physics: NeverScrollableScrollPhysics(),
79 itemCount: options.length,
80 separatorBuilder: (context, index) => SizedBox(height: 10.sp),
81 itemBuilder: (BuildContext context, int index) {
82 return CustomOptionButton(
83 option: options[index],
84 onPressed: () {
85 onSelect(options[index]);
86 },
88 );
89 },
90 ),
91 ],
92 ),
93 ),
94 ],
95 ),
96 );
97 }
98}
99
100class CustomOptionButton extends StatelessWidget {
102 super.key,
103 required this.option,
104 required this.onPressed,
105 required this.isSelected,
106 });
107
108 final String option;
110 final bool isSelected;
111
112 @override
113 Widget build(BuildContext context) {
114 return ElevatedButton(
115 style: ElevatedButton.styleFrom(
117 ? Theme.of(context).colorScheme.primary.withOpacity(0.11)
118 : Theme.of(context).colorScheme.surface,
119 padding: EdgeInsets.all(15.sp),
120 ),
122 child: Row(
123 children: [
124 Container(
125 height: isSelected ? 25.sp : 20.sp,
126 width: isSelected ? 25.sp : 20.sp,
127 decoration: BoxDecoration(
129 ? Theme.of(context).colorScheme.primary.withOpacity(0.11)
130 : Theme.of(context).colorScheme.surface,
131 shape: BoxShape.circle,
132 border: Border.all(
133 width: 1,
135 ? Theme.of(context).colorScheme.primary
136 : Theme.of(context).hintColor,
137 ),
138 ),
139 child: Icon(
140 HugeIcons.strokeRoundedCheckmarkBadge04,
141 size: 15.sp,
143 ? Theme.of(context).colorScheme.primary
144 : Theme.of(context).colorScheme.surface,
145 ),
146 ),
147 SizedBox(width: 10.sp),
148 Flexible(
149 child: Text(
150 option,
151 style: Theme.of(context).textTheme.bodySmall?.copyWith(
153 ? Theme.of(context).colorScheme.primary
154 : Theme.of(context)
155 .textTheme
156 .displaySmall
157 ?.color
158 ?.withOpacity(0.7),
159 ),
160 ),
161 ),
162 ],
163 ),
164 );
165 }
166}
const OpertaionalDaysView({super.key})
override State< OpertaionalDaysView > 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)