Skip to content

Commit

Permalink
Comment out non functional widgets in analytics forecast and specifics
Browse files Browse the repository at this point in the history
  • Loading branch information
Mozart299 committed Dec 23, 2024
1 parent 33fb4e3 commit deb0417
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 128 deletions.
190 changes: 95 additions & 95 deletions mobile-v3/lib/src/app/dashboard/widgets/analytics_forecast_widget.dart
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
import 'package:airqo/src/app/dashboard/bloc/forecast/forecast_bloc.dart';
import 'package:airqo/src/app/shared/widgets/loading_widget.dart';
import 'package:airqo/src/meta/utils/colors.dart';
import 'package:airqo/src/meta/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:intl/intl.dart';
// import 'package:airqo/src/app/dashboard/bloc/forecast/forecast_bloc.dart';
// import 'package:airqo/src/app/shared/widgets/loading_widget.dart';
// import 'package:airqo/src/meta/utils/colors.dart';
// import 'package:airqo/src/meta/utils/utils.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_bloc/flutter_bloc.dart';
// import 'package:flutter_svg/flutter_svg.dart';
// import 'package:intl/intl.dart';

class AnalyticsForecastWidget extends StatefulWidget {
final String siteId;
const AnalyticsForecastWidget({super.key, required this.siteId});
// class AnalyticsForecastWidget extends StatefulWidget {
// final String siteId;
// const AnalyticsForecastWidget({super.key, required this.siteId});

@override
State<AnalyticsForecastWidget> createState() =>
_AnalyticsForecastWidgetState();
}
// @override
// State<AnalyticsForecastWidget> createState() =>
// _AnalyticsForecastWidgetState();
// }

class _AnalyticsForecastWidgetState extends State<AnalyticsForecastWidget> {
ForecastBloc? forecastBloc;
// class _AnalyticsForecastWidgetState extends State<AnalyticsForecastWidget> {
// ForecastBloc? forecastBloc;

@override
void initState() {
forecastBloc = context.read<ForecastBloc>()
..add(LoadForecast(widget.siteId));
super.initState();
}
// @override
// void initState() {
// forecastBloc = context.read<ForecastBloc>()
// ..add(LoadForecast(widget.siteId));
// super.initState();
// }

@override
Widget build(BuildContext context) {
return BlocBuilder<ForecastBloc, ForecastState>(
builder: (context, state) {
if (state is ForecastLoaded) {
return Row(
children: state.response.forecasts
.map((e) => ForeCastChip(
active: false,
date: DateFormat.d().format(e.time),
day: DateFormat.E().format(e.time)[0],
imagePath: getAirQualityIcon(e.measurement, e.pm25),
))
.toList());
} else if (state is ForecastLoading) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: List.generate(7, (index) {
return ShimmerContainer(
height: 47 + 45, borderRadius: 22, width: 40);
}));
}
// @override
// Widget build(BuildContext context) {
// return BlocBuilder<ForecastBloc, ForecastState>(
// builder: (context, state) {
// if (state is ForecastLoaded) {
// return Row(
// children: state.response.forecasts
// .map((e) => ForeCastChip(
// active: false,
// date: DateFormat.d().format(e.time),
// day: DateFormat.E().format(e.time)[0],
// imagePath: getAirQualityIcon(e.measurement, e.pm25),
// ))
// .toList());
// } else if (state is ForecastLoading) {
// return Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: List.generate(7, (index) {
// return ShimmerContainer(
// height: 47 + 45, borderRadius: 22, width: 40);
// }));
// }

return Container(
child: Center(
child: Text(state.toString()),
),
);
},
);
}
}
// return Container(
// child: Center(
// child: Text(state.toString()),
// ),
// );
// },
// );
// }
// }

class ForeCastChip extends StatelessWidget {
final bool active;
final String day;
final String imagePath;
final String date;
const ForeCastChip(
{super.key,
required this.active,
required this.imagePath,
required this.date,
required this.day});
// class ForeCastChip extends StatelessWidget {
// final bool active;
// final String day;
// final String imagePath;
// final String date;
// const ForeCastChip(
// {super.key,
// required this.active,
// required this.imagePath,
// required this.date,
// required this.day});

@override
Widget build(BuildContext context) {
return Expanded(
child: Container(
decoration: BoxDecoration(
color: active
? AppColors.primaryColor
: Theme.of(context).highlightColor,
borderRadius: BorderRadius.circular(22)),
padding: const EdgeInsets.symmetric(vertical: 8),
margin: const EdgeInsets.symmetric(horizontal: 5),
height: 47 + 45,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(day),
Text(date),
SizedBox(
child: Center(
child: SvgPicture.asset(
imagePath,
height: 26,
width: 26,
),
),
),
])),
);
}
}
// @override
// Widget build(BuildContext context) {
// return Expanded(
// child: Container(
// decoration: BoxDecoration(
// color: active
// ? AppColors.primaryColor
// : Theme.of(context).highlightColor,
// borderRadius: BorderRadius.circular(22)),
// padding: const EdgeInsets.symmetric(vertical: 8),
// margin: const EdgeInsets.symmetric(horizontal: 5),
// height: 47 + 45,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(day),
// Text(date),
// SizedBox(
// child: Center(
// child: SvgPicture.asset(
// imagePath,
// height: 26,
// width: 26,
// ),
// ),
// ),
// ])),
// );
// }
// }
66 changes: 33 additions & 33 deletions mobile-v3/lib/src/app/dashboard/widgets/analytics_specifics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,44 +104,44 @@ class _AnalyticsSpecificsState extends State<AnalyticsSpecifics> {
],
),
SizedBox(height: 16),
AnalyticsForecastWidget(
siteId: widget.measurement.siteDetails!.id!,
),
// AnalyticsForecastWidget(
// siteId: widget.measurement.siteDetails!.id!,
// ),
SizedBox(height: 16),
],
),
),
AnalyticsCard(widget.measurement),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
height: 41,
color: Theme.of(context).highlightColor,
child: Row(
children: [
SizedBox(
child: Row(
children: [
SvgPicture.asset("assets/icons/share-icon.svg"),
SizedBox(width: 6),
Text("Share"),
],
),
),
SizedBox(width: 24),
SizedBox(
child: Row(
children: [
SvgPicture.asset("assets/icons/save-icon.svg"),
SizedBox(width: 6),
Text("Save"),
],
),
),
Spacer(),
Icon(Icons.more_vert)
],
),
),
// Container(
// padding: const EdgeInsets.symmetric(horizontal: 16),
// height: 41,
// color: Theme.of(context).highlightColor,
// child: Row(
// children: [
// SizedBox(
// child: Row(
// children: [
// SvgPicture.asset("assets/icons/share-icon.svg"),
// SizedBox(width: 6),
// Text("Share"),
// ],
// ),
// ),
// SizedBox(width: 24),
// SizedBox(
// child: Row(
// children: [
// SvgPicture.asset("assets/icons/save-icon.svg"),
// SizedBox(width: 6),
// Text("Save"),
// ],
// ),
// ),
// Spacer(),
// Icon(Icons.more_vert)
// ],
// ),
// ),
// SizedBox(height: 8 + 4),
// InkWell(
// onTap: () => toggleContainer(),
Expand Down

0 comments on commit deb0417

Please sign in to comment.