|
1 |
| -import 'package:airqo/src/app/dashboard/bloc/forecast/forecast_bloc.dart'; |
2 |
| -import 'package:airqo/src/app/shared/widgets/loading_widget.dart'; |
3 |
| -import 'package:airqo/src/meta/utils/colors.dart'; |
4 |
| -import 'package:airqo/src/meta/utils/utils.dart'; |
5 |
| -import 'package:flutter/material.dart'; |
6 |
| -import 'package:flutter_bloc/flutter_bloc.dart'; |
7 |
| -import 'package:flutter_svg/flutter_svg.dart'; |
8 |
| -import 'package:intl/intl.dart'; |
| 1 | +// import 'package:airqo/src/app/dashboard/bloc/forecast/forecast_bloc.dart'; |
| 2 | +// import 'package:airqo/src/app/shared/widgets/loading_widget.dart'; |
| 3 | +// import 'package:airqo/src/meta/utils/colors.dart'; |
| 4 | +// import 'package:airqo/src/meta/utils/utils.dart'; |
| 5 | +// import 'package:flutter/material.dart'; |
| 6 | +// import 'package:flutter_bloc/flutter_bloc.dart'; |
| 7 | +// import 'package:flutter_svg/flutter_svg.dart'; |
| 8 | +// import 'package:intl/intl.dart'; |
9 | 9 |
|
10 |
| -class AnalyticsForecastWidget extends StatefulWidget { |
11 |
| - final String siteId; |
12 |
| - const AnalyticsForecastWidget({super.key, required this.siteId}); |
| 10 | +// class AnalyticsForecastWidget extends StatefulWidget { |
| 11 | +// final String siteId; |
| 12 | +// const AnalyticsForecastWidget({super.key, required this.siteId}); |
13 | 13 |
|
14 |
| - @override |
15 |
| - State<AnalyticsForecastWidget> createState() => |
16 |
| - _AnalyticsForecastWidgetState(); |
17 |
| -} |
| 14 | +// @override |
| 15 | +// State<AnalyticsForecastWidget> createState() => |
| 16 | +// _AnalyticsForecastWidgetState(); |
| 17 | +// } |
18 | 18 |
|
19 |
| -class _AnalyticsForecastWidgetState extends State<AnalyticsForecastWidget> { |
20 |
| - ForecastBloc? forecastBloc; |
| 19 | +// class _AnalyticsForecastWidgetState extends State<AnalyticsForecastWidget> { |
| 20 | +// ForecastBloc? forecastBloc; |
21 | 21 |
|
22 |
| - @override |
23 |
| - void initState() { |
24 |
| - forecastBloc = context.read<ForecastBloc>() |
25 |
| - ..add(LoadForecast(widget.siteId)); |
26 |
| - super.initState(); |
27 |
| - } |
| 22 | +// @override |
| 23 | +// void initState() { |
| 24 | +// forecastBloc = context.read<ForecastBloc>() |
| 25 | +// ..add(LoadForecast(widget.siteId)); |
| 26 | +// super.initState(); |
| 27 | +// } |
28 | 28 |
|
29 |
| - @override |
30 |
| - Widget build(BuildContext context) { |
31 |
| - return BlocBuilder<ForecastBloc, ForecastState>( |
32 |
| - builder: (context, state) { |
33 |
| - if (state is ForecastLoaded) { |
34 |
| - return Row( |
35 |
| - children: state.response.forecasts |
36 |
| - .map((e) => ForeCastChip( |
37 |
| - active: false, |
38 |
| - date: DateFormat.d().format(e.time), |
39 |
| - day: DateFormat.E().format(e.time)[0], |
40 |
| - imagePath: getAirQualityIcon(e.measurement, e.pm25), |
41 |
| - )) |
42 |
| - .toList()); |
43 |
| - } else if (state is ForecastLoading) { |
44 |
| - return Row( |
45 |
| - mainAxisAlignment: MainAxisAlignment.spaceAround, |
46 |
| - children: List.generate(7, (index) { |
47 |
| - return ShimmerContainer( |
48 |
| - height: 47 + 45, borderRadius: 22, width: 40); |
49 |
| - })); |
50 |
| - } |
| 29 | +// @override |
| 30 | +// Widget build(BuildContext context) { |
| 31 | +// return BlocBuilder<ForecastBloc, ForecastState>( |
| 32 | +// builder: (context, state) { |
| 33 | +// if (state is ForecastLoaded) { |
| 34 | +// return Row( |
| 35 | +// children: state.response.forecasts |
| 36 | +// .map((e) => ForeCastChip( |
| 37 | +// active: false, |
| 38 | +// date: DateFormat.d().format(e.time), |
| 39 | +// day: DateFormat.E().format(e.time)[0], |
| 40 | +// imagePath: getAirQualityIcon(e.measurement, e.pm25), |
| 41 | +// )) |
| 42 | +// .toList()); |
| 43 | +// } else if (state is ForecastLoading) { |
| 44 | +// return Row( |
| 45 | +// mainAxisAlignment: MainAxisAlignment.spaceAround, |
| 46 | +// children: List.generate(7, (index) { |
| 47 | +// return ShimmerContainer( |
| 48 | +// height: 47 + 45, borderRadius: 22, width: 40); |
| 49 | +// })); |
| 50 | +// } |
51 | 51 |
|
52 |
| - return Container( |
53 |
| - child: Center( |
54 |
| - child: Text(state.toString()), |
55 |
| - ), |
56 |
| - ); |
57 |
| - }, |
58 |
| - ); |
59 |
| - } |
60 |
| -} |
| 52 | +// return Container( |
| 53 | +// child: Center( |
| 54 | +// child: Text(state.toString()), |
| 55 | +// ), |
| 56 | +// ); |
| 57 | +// }, |
| 58 | +// ); |
| 59 | +// } |
| 60 | +// } |
61 | 61 |
|
62 |
| -class ForeCastChip extends StatelessWidget { |
63 |
| - final bool active; |
64 |
| - final String day; |
65 |
| - final String imagePath; |
66 |
| - final String date; |
67 |
| - const ForeCastChip( |
68 |
| - {super.key, |
69 |
| - required this.active, |
70 |
| - required this.imagePath, |
71 |
| - required this.date, |
72 |
| - required this.day}); |
| 62 | +// class ForeCastChip extends StatelessWidget { |
| 63 | +// final bool active; |
| 64 | +// final String day; |
| 65 | +// final String imagePath; |
| 66 | +// final String date; |
| 67 | +// const ForeCastChip( |
| 68 | +// {super.key, |
| 69 | +// required this.active, |
| 70 | +// required this.imagePath, |
| 71 | +// required this.date, |
| 72 | +// required this.day}); |
73 | 73 |
|
74 |
| - @override |
75 |
| - Widget build(BuildContext context) { |
76 |
| - return Expanded( |
77 |
| - child: Container( |
78 |
| - decoration: BoxDecoration( |
79 |
| - color: active |
80 |
| - ? AppColors.primaryColor |
81 |
| - : Theme.of(context).highlightColor, |
82 |
| - borderRadius: BorderRadius.circular(22)), |
83 |
| - padding: const EdgeInsets.symmetric(vertical: 8), |
84 |
| - margin: const EdgeInsets.symmetric(horizontal: 5), |
85 |
| - height: 47 + 45, |
86 |
| - child: Column( |
87 |
| - mainAxisAlignment: MainAxisAlignment.spaceBetween, |
88 |
| - children: [ |
89 |
| - Text(day), |
90 |
| - Text(date), |
91 |
| - SizedBox( |
92 |
| - child: Center( |
93 |
| - child: SvgPicture.asset( |
94 |
| - imagePath, |
95 |
| - height: 26, |
96 |
| - width: 26, |
97 |
| - ), |
98 |
| - ), |
99 |
| - ), |
100 |
| - ])), |
101 |
| - ); |
102 |
| - } |
103 |
| -} |
| 74 | +// @override |
| 75 | +// Widget build(BuildContext context) { |
| 76 | +// return Expanded( |
| 77 | +// child: Container( |
| 78 | +// decoration: BoxDecoration( |
| 79 | +// color: active |
| 80 | +// ? AppColors.primaryColor |
| 81 | +// : Theme.of(context).highlightColor, |
| 82 | +// borderRadius: BorderRadius.circular(22)), |
| 83 | +// padding: const EdgeInsets.symmetric(vertical: 8), |
| 84 | +// margin: const EdgeInsets.symmetric(horizontal: 5), |
| 85 | +// height: 47 + 45, |
| 86 | +// child: Column( |
| 87 | +// mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 88 | +// children: [ |
| 89 | +// Text(day), |
| 90 | +// Text(date), |
| 91 | +// SizedBox( |
| 92 | +// child: Center( |
| 93 | +// child: SvgPicture.asset( |
| 94 | +// imagePath, |
| 95 | +// height: 26, |
| 96 | +// width: 26, |
| 97 | +// ), |
| 98 | +// ), |
| 99 | +// ), |
| 100 | +// ])), |
| 101 | +// ); |
| 102 | +// } |
| 103 | +// } |
0 commit comments