Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
track_energy_consumption.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 TrackenergyConsumptionTrend extends StatefulWidget {
10 const TrackenergyConsumptionTrend({super.key});
11
12 @override
13 State<TrackenergyConsumptionTrend> createState() =>
14 _TrackenergyConsumptionTrendState();
15}
16
17class _TrackenergyConsumptionTrendState
18 extends State<TrackenergyConsumptionTrend> {
19 List<String> options = [
20 'Yes',
21 'No',
22 ];
23
24 List<String> selectedOption = [];
25
26 void onSelect(String option) {
27 if (selectedOption.contains(option)) {
28 selectedOption.remove(option);
29 } else {
30 selectedOption.add(option);
31 }
32 setState(() {});
33 }
34
35 bool isSelected(String option) {
36 return selectedOption.contains(option);
37 }
38
39 @override
40 Widget build(BuildContext context) {
41 return SingleChildScrollView(
42 padding: EdgeInsets.all(15.sp),
43 child: Column(
44 crossAxisAlignment: CrossAxisAlignment.start,
45 children: [
46 Container(
47 width: double.infinity,
48 padding: EdgeInsets.all(15.sp),
49 decoration: BoxDecoration(
50 color: Colors.red.withOpacity(0.11),
51 borderRadius: BorderRadius.circular(10)),
52 child: Center(
53 child: Text(
54 'Energy',
55 style: Theme.of(context)
56 .textTheme
57 .bodySmall
58 ?.copyWith(color: Colors.red),
59 ),
60 ),
61 ),
62 SizedBox(height: 10.sp),
64 padding: EdgeInsets.all(15.sp),
65 child: Column(
66 crossAxisAlignment: CrossAxisAlignment.start,
67 children: [
68 SimpleProgressBar(
69 totalSteps: 6,
70 currentStep: 6,
71 ),
72 SizedBox(height: 10.sp),
73 Text(
74 'Do you actively track energy consumption trends (e.g., peak usage times)?',
75 style: Theme.of(context).textTheme.displaySmall?.copyWith(
76 fontSize: 12.sp,
77 ),
78 ),
79 SizedBox(height: 10.sp),
80 ListView.separated(
81 physics: NeverScrollableScrollPhysics(),
82 shrinkWrap: true,
83 itemCount: options.length + 1,
84 separatorBuilder: (context, index) {
85 if (index == 0) return SizedBox();
86 return SizedBox(height: 10.sp);
87 },
88 itemBuilder: (BuildContext context, int index) {
89 if (index == 1) {
90 return Padding(
91 padding: EdgeInsets.all(10.sp),
92 child: CustomTextFormField(
93 hintText: 'Input',
94 fillColor: Theme.of(context)
95 .highlightColor
96 .withOpacity(0.11),
97 controller: TextEditingController(),
98 ),
99 );
100 }
101
102 final adjustedIndex = index > 1 ? index - 1 : index;
103
104 return CustomOptionButton(
105 option: options[adjustedIndex],
106 onPressed: () {
107 onSelect(options[adjustedIndex]);
108 },
109 isSelected: isSelected(options[adjustedIndex]),
110 );
111 },
112 ),
113 ],
114 ),
115 ),
116 ],
117 ),
118 );
119 }
120}
override State< TrackenergyConsumptionTrend > createState()
const TrackenergyConsumptionTrend({super.key})
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)