Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
local_ingredients_percentage_view.dart
Go to the documentation of this file.
1import 'package:connect/features/co2_emmissions/screens/operational_details_screen/views/operational_hours_view.dart';
2import 'package:flutter/material.dart';
3import 'package:connect/core/ui/widgets/custom_card.dart';
4import 'package:connect/features/co2_emmissions/screens/energy/energy_screen.dart';
5import 'package:connect/features/co2_emmissions/screens/widgets/step_brogress_bar.dart';
6import 'package:flutter/material.dart';
7import 'package:flutter_screenutil/flutter_screenutil.dart';
8
9class LocalIngredientsPercentageView extends StatefulWidget {
11
12 @override
13 State<LocalIngredientsPercentageView> createState() =>
14 _LocalIngredientsPercentageViewState();
15}
16
17class _LocalIngredientsPercentageViewState
18 extends State<LocalIngredientsPercentageView> {
19 List<String> options = [
20 '<25%',
21 '25-50%',
22 '50-75%',
23 '>75%',
24 ];
25
26 List<String> selectedOption = [];
27
28 void onSelect(String option) {
29 if (selectedOption.contains(option)) {
30 selectedOption.remove(option);
31 } else {
32 selectedOption.add(option);
33 }
34 setState(() {});
35 }
36
37 bool isSelected(String option) {
38 return selectedOption.contains(option);
39 }
40
41 @override
42 Widget build(BuildContext context) {
43 return SingleChildScrollView(
44 padding: EdgeInsets.all(15.sp),
45 child: Column(
46 crossAxisAlignment: CrossAxisAlignment.start,
47 children: [
48 Container(
49 width: double.infinity,
50 padding: EdgeInsets.all(15.sp),
51 decoration: BoxDecoration(
52 color: Colors.green.withOpacity(0.11),
53 borderRadius: BorderRadius.circular(10)),
54 child: Center(
55 child: Text(
56 'Food',
57 style: Theme.of(context)
58 .textTheme
59 .bodySmall
60 ?.copyWith(color: Colors.green),
61 ),
62 ),
63 ),
64 SizedBox(height: 10.sp),
66 padding: EdgeInsets.all(15.sp),
67 child: Column(
68 crossAxisAlignment: CrossAxisAlignment.start,
69 children: [
70 SimpleProgressBar(
71 totalSteps: 5,
72 currentStep: 3,
73 ),
74 SizedBox(height: 10.sp),
75 Text(
76 'What percentage of your ingredients are sourced locally (<100 km)?',
77 style: Theme.of(context).textTheme.displaySmall?.copyWith(
78 fontSize: 12.sp,
79 ),
80 ),
81 SizedBox(height: 10.sp),
82 SizedBox(height: 10.sp),
83 ListView.separated(
84 physics: NeverScrollableScrollPhysics(),
85 shrinkWrap: true,
86 itemCount: options.length,
87 separatorBuilder: (context, index) => SizedBox(height: 10.sp),
88 itemBuilder: (BuildContext context, int index) {
89 return CustomOptionButton(
90 option: options[index],
91 onPressed: () {
92 onSelect(options[index]);
93 },
95 );
96 },
97 ),
98 ],
99 ),
100 ),
101 ],
102 ),
103 );
104 }
105}
const LocalIngredientsPercentageView({super.key})
override State< LocalIngredientsPercentageView > 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)