Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
source_of_electricity_view.dart
Go to the documentation of this file.
1import 'package:connect/core/ui/widgets/custom_text_form_field.dart';
2import 'package:flutter/material.dart';
3import 'package:flutter_screenutil/flutter_screenutil.dart';
4import 'package:connect/core/ui/widgets/custom_card.dart';
5import 'package:connect/features/co2_emmissions/screens/widgets/step_brogress_bar.dart';
6
7import '../../operational_details_screen/views/operational_hours_view.dart';
8
9class SourceofElectricityView extends StatefulWidget {
10 const SourceofElectricityView({super.key});
11
12 @override
13 State<SourceofElectricityView> createState() =>
14 _SourceofElectricityViewState();
15}
16
17class _SourceofElectricityViewState extends State<SourceofElectricityView> {
18 List<String> options = [
19 'Grid electricity (provided by Saudi Electricity Company - SEC) (Allow API integration for direct data entry if using SEC smart meters)',
20 'Onsite solar panels or renewable sources',
21 'Diesel generator (backup or primary source)',
22 'Other (specify)',
23 ];
24
25 List<String> selectedOption = [];
26
27 void onSelect(String option) {
28 if (selectedOption.contains(option)) {
29 selectedOption.remove(option);
30 } else {
31 selectedOption.add(option);
32 }
33 setState(() {});
34 }
35
36 bool isSelected(String option) {
37 return selectedOption.contains(option);
38 }
39
40 @override
41 Widget build(BuildContext context) {
42 return SingleChildScrollView(
43 padding: EdgeInsets.all(15.sp),
44 child: Column(
45 crossAxisAlignment: CrossAxisAlignment.start,
46 children: [
47 Container(
48 width: double.infinity,
49 padding: EdgeInsets.all(15.sp),
50 decoration: BoxDecoration(
51 color: Colors.red.withOpacity(0.11),
52 borderRadius: BorderRadius.circular(10)),
53 child: Center(
54 child: Text(
55 'Energy',
56 style: Theme.of(context)
57 .textTheme
58 .bodySmall
59 ?.copyWith(color: Colors.red),
60 ),
61 ),
62 ),
63 SizedBox(height: 10.sp),
65 padding: EdgeInsets.all(15.sp),
66 child: Column(
67 crossAxisAlignment: CrossAxisAlignment.start,
68 children: [
69 SimpleProgressBar(
70 totalSteps: 6,
71 currentStep: 2,
72 ),
73 SizedBox(height: 10.sp),
74 Text(
75 'What is the source of your electricity?',
76 style: Theme.of(context).textTheme.displaySmall?.copyWith(
77 fontSize: 12.sp,
78 ),
79 ),
80 SizedBox(height: 5.sp),
81 Text(
82 '(Select all that apply):',
83 style: Theme.of(context).textTheme.displaySmall?.copyWith(
84 color: Theme.of(context).hintColor,
85 fontSize: 10.sp,
86 ),
87 ),
88 SizedBox(height: 10.sp),
89 ListView.separated(
90 physics: NeverScrollableScrollPhysics(),
91 shrinkWrap: true,
92 itemCount: options.length,
93 separatorBuilder: (context, index) => SizedBox(height: 10.sp),
94 itemBuilder: (BuildContext context, int index) {
95 return CustomOptionButton(
96 option: options[index],
97 onPressed: () {
98 onSelect(options[index]);
99 },
101 );
102 },
103 ),
104 SizedBox(height: 10.sp),
105 CustomTextFormField(
106 hintText: 'Type...',
107 maxLines: 4,
108 fillColor: Theme.of(context).highlightColor.withOpacity(0.11),
109 controller: TextEditingController(),
110 ),
111 ],
112 ),
113 ),
114 ],
115 ),
116 );
117 }
118}
const SourceofElectricityView({super.key})
override State< SourceofElectricityView > createState()
const CustomCard({ super.key, required this.child, this.padding, this.bgColor, })
final Widget child
final EdgeInsets padding
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)