Refactor visibility handling for scenes and automations in FetchRoutineScenesAutomation

This commit is contained in:
Faris Armoush
2025-04-17 13:12:09 +03:00
parent 977875f1f2
commit f912b41fd8

View File

@ -17,10 +17,6 @@ class FetchRoutineScenesAutomation extends StatefulWidget {
class _FetchRoutineScenesState extends State<FetchRoutineScenesAutomation>
with HelperResponsiveLayout {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
@ -45,15 +41,15 @@ class _FetchRoutineScenesState extends State<FetchRoutineScenesAutomation>
),
),
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<FetchRoutineScenesAutomation>
);
}),
),
),
const SizedBox(height: 10),
Text(
"Automations",
@ -119,15 +116,15 @@ class _FetchRoutineScenesState extends State<FetchRoutineScenesAutomation>
),
),
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<FetchRoutineScenesAutomation>
},
),
),
)
],
),
),