mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 01:56:24 +00:00
Extracted EnergyConsumptionByPhasesTitle
into its own widget to improve readability and assert separation of concerns.
This commit is contained in:
@ -39,34 +39,7 @@ class _EnergyConsumptionByPhasesChartBoxState
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
spacing: 20,
|
spacing: 20,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
const EnergyConsumptionByPhasesTitle(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 4,
|
|
||||||
child: FittedBox(
|
|
||||||
fit: BoxFit.scaleDown,
|
|
||||||
child: ChartTitle(
|
|
||||||
title: Text(
|
|
||||||
'Energy Consumption by Phases',
|
|
||||||
style: context.textTheme.titleLarge?.copyWith(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
color: ColorsManager.textPrimaryColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
...<(String title, double opacity)>[
|
|
||||||
('A', 0.8),
|
|
||||||
('B', 0.4),
|
|
||||||
('C', 0.15),
|
|
||||||
].map((phase) => _buildPhaseCell(context, phase)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: EnergyConsumptionByPhasesChart(
|
child: EnergyConsumptionByPhasesChart(
|
||||||
energyData: state.chartData,
|
energyData: state.chartData,
|
||||||
@ -78,6 +51,42 @@ class _EnergyConsumptionByPhasesChartBoxState
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnergyConsumptionByPhasesTitle extends StatelessWidget {
|
||||||
|
const EnergyConsumptionByPhasesTitle({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
child: ChartTitle(
|
||||||
|
title: Text(
|
||||||
|
'Energy Consumption by Phases',
|
||||||
|
style: context.textTheme.titleLarge?.copyWith(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: ColorsManager.textPrimaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
...<(String title, double opacity)>[
|
||||||
|
('A', 0.8),
|
||||||
|
('B', 0.4),
|
||||||
|
('C', 0.15),
|
||||||
|
].map((phase) => _buildPhaseCell(context, phase)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildPhaseCell(
|
Widget _buildPhaseCell(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
|
Reference in New Issue
Block a user