From f912b41fd8c93e8c072fe444b9f702adcf3e7bc1 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 17 Apr 2025 13:12:09 +0300 Subject: [PATCH] Refactor visibility handling for scenes and automations in FetchRoutineScenesAutomation --- .../fetch_routine_scenes_automation.dart | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/pages/routines/widgets/main_routine_view/fetch_routine_scenes_automation.dart b/lib/pages/routines/widgets/main_routine_view/fetch_routine_scenes_automation.dart index 0e25dcea..c46ba377 100644 --- a/lib/pages/routines/widgets/main_routine_view/fetch_routine_scenes_automation.dart +++ b/lib/pages/routines/widgets/main_routine_view/fetch_routine_scenes_automation.dart @@ -17,10 +17,6 @@ class FetchRoutineScenesAutomation extends StatefulWidget { class _FetchRoutineScenesState extends State with HelperResponsiveLayout { - @override - void initState() { - super.initState(); - } @override Widget build(BuildContext context) { @@ -45,15 +41,15 @@ class _FetchRoutineScenesState extends State ), ), const SizedBox(height: 10), - if (state.scenes.isEmpty) - Text( + Visibility( + visible: state.scenes.isNotEmpty, + replacement: Text( "No scenes found", style: context.textTheme.bodyMedium?.copyWith( color: ColorsManager.grayColor, ), ), - if (state.scenes.isNotEmpty) - SizedBox( + child: SizedBox( height: 200, child: ListView.builder( scrollDirection: Axis.horizontal, @@ -110,6 +106,7 @@ class _FetchRoutineScenesState extends State ); }), ), + ), const SizedBox(height: 10), Text( "Automations", @@ -119,15 +116,15 @@ class _FetchRoutineScenesState extends State ), ), const SizedBox(height: 3), - if (state.automations.isEmpty) - Text( + Visibility( + visible: state.automations.isNotEmpty, + replacement: Text( "No automations found", style: context.textTheme.bodyMedium?.copyWith( color: ColorsManager.grayColor, ), ), - if (state.automations.isNotEmpty) - SizedBox( + child: SizedBox( height: 200, child: ListView.builder( scrollDirection: Axis.horizontal, @@ -192,6 +189,7 @@ class _FetchRoutineScenesState extends State }, ), ), + ) ], ), ),