Responsiveness of RangeOfAqiChartTitle.

This commit is contained in:
Faris Armoush
2025-05-26 15:33:31 +03:00
parent 171dc52e28
commit 177c7f1030
2 changed files with 46 additions and 27 deletions

View File

@ -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(),

View File

@ -19,25 +19,44 @@ 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(
child: IntrinsicHeight(
child: FittedBox(
fit: BoxFit.fitWidth,
alignment: AlignmentDirectional.centerStart,
child: Padding(
padding: const EdgeInsetsDirectional.only(end: 16), padding: const EdgeInsetsDirectional.only(end: 16),
child: ChartInformativeCell( child: ChartInformativeCell(
title: Text(title), title: Text(title),
color: color, color: color,
hasBorder: hasBorder, hasBorder: hasBorder,
), ),
),
),
),
); );
}, },
), ),
const SizedBox(width: 34), const Spacer(),
AqiTypeDropdown( Expanded(
flex: 2,
child: FittedBox(
fit: BoxFit.scaleDown,
alignment: AlignmentDirectional.centerEnd,
child: AqiTypeDropdown(
onChanged: (value) { onChanged: (value) {
final spaceTreeState = context.read<SpaceTreeBloc>().state; final spaceTreeState = context.read<SpaceTreeBloc>().state;
final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull; final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull;
@ -52,6 +71,8 @@ class RangeOfAqiChartTitle extends StatelessWidget {
); );
}, },
), ),
),
),
], ],
); );
} }