mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Responsiveness of RangeOfAqiChartTitle
.
This commit is contained in:
@ -6,9 +6,10 @@ enum AqiType {
|
|||||||
aqi('AQI'),
|
aqi('AQI'),
|
||||||
pm25('PM2.5'),
|
pm25('PM2.5'),
|
||||||
pm10('PM10'),
|
pm10('PM10'),
|
||||||
|
hcho('HCHO'),
|
||||||
|
tvoc('TVOC'),
|
||||||
co2('CO2'),
|
co2('CO2'),
|
||||||
voc('VOC'),
|
c6h6('C6H6');
|
||||||
tvoc('TVOC');
|
|
||||||
|
|
||||||
final String value;
|
final String value;
|
||||||
const AqiType(this.value);
|
const AqiType(this.value);
|
||||||
@ -47,9 +48,6 @@ class _AqiTypeDropdownState extends State<AqiTypeDropdown> {
|
|||||||
value: _selectedItem,
|
value: _selectedItem,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
selectedItemBuilder: (context) => [
|
|
||||||
Text(_selectedItem?.value ?? ''),
|
|
||||||
],
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
dropdownColor: ColorsManager.whiteColors,
|
dropdownColor: ColorsManager.whiteColors,
|
||||||
underline: const SizedBox.shrink(),
|
underline: const SizedBox.shrink(),
|
||||||
|
@ -19,38 +19,59 @@ class RangeOfAqiChartTitle extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
children: [
|
||||||
const ChartTitle(title: Text('Range of AQI')),
|
const Expanded(
|
||||||
const Spacer(),
|
flex: 3,
|
||||||
|
child: FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: ChartTitle(title: Text('Range of AQI')),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(flex: 3),
|
||||||
..._colors.map(
|
..._colors.map(
|
||||||
(e) {
|
(e) {
|
||||||
final (color, title, hasBorder) = e;
|
final (color, title, hasBorder) = e;
|
||||||
return Padding(
|
return Expanded(
|
||||||
padding: const EdgeInsetsDirectional.only(end: 16),
|
child: IntrinsicHeight(
|
||||||
child: ChartInformativeCell(
|
child: FittedBox(
|
||||||
title: Text(title),
|
fit: BoxFit.fitWidth,
|
||||||
color: color,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
hasBorder: hasBorder,
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.only(end: 16),
|
||||||
|
child: ChartInformativeCell(
|
||||||
|
title: Text(title),
|
||||||
|
color: color,
|
||||||
|
hasBorder: hasBorder,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 34),
|
const Spacer(),
|
||||||
AqiTypeDropdown(
|
Expanded(
|
||||||
onChanged: (value) {
|
flex: 2,
|
||||||
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
child: FittedBox(
|
||||||
final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull;
|
fit: BoxFit.scaleDown,
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
|
child: AqiTypeDropdown(
|
||||||
|
onChanged: (value) {
|
||||||
|
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
||||||
|
final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull;
|
||||||
|
|
||||||
if (spaceUuid == null) return;
|
if (spaceUuid == null) return;
|
||||||
|
|
||||||
FetchAirQualityDataHelper.loadRangeOfAqi(
|
FetchAirQualityDataHelper.loadRangeOfAqi(
|
||||||
context,
|
context,
|
||||||
spaceUuid: spaceUuid,
|
spaceUuid: spaceUuid,
|
||||||
date: context.read<AnalyticsDatePickerBloc>().state.monthlyDate,
|
date: context.read<AnalyticsDatePickerBloc>().state.monthlyDate,
|
||||||
aqiType: value ?? AqiType.aqi,
|
aqiType: value ?? AqiType.aqi,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user