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