mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Refactor visibility logic in Energy Clamp Dialog to handle empty functions list more elegantly
This commit is contained in:
@ -100,24 +100,26 @@ class _EnergyClampDialogState extends State<EnergyClampDialog> {
|
||||
children: [
|
||||
const DialogHeader('Energy Clamp Conditions'),
|
||||
Expanded(
|
||||
child: _functions.isEmpty
|
||||
? SizedBox(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'You Cant add\n the Power Clamp to Then Section',
|
||||
textAlign: TextAlign.center,
|
||||
style: context.textTheme.bodyMedium!.copyWith(
|
||||
color: ColorsManager.red,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
: _buildMainContent(context, state)),
|
||||
child: Visibility(
|
||||
visible: _functions.isNotEmpty,
|
||||
replacement: SizedBox(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'You Cant add\n the Power Clamp to Then Section',
|
||||
textAlign: TextAlign.center,
|
||||
style: context.textTheme.bodyMedium!.copyWith(
|
||||
color: ColorsManager.red,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: _buildMainContent(context, state),
|
||||
)),
|
||||
_buildDialogFooter(context, state),
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user