mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
- Refactor the code in _RoutinesViewState to improve readability and maintainability.
- Update the indentation and add padding to the child widgets in the Column. - Add a bottom padding to the empty state text in _buildEmptyState.
This commit is contained in:
@ -16,7 +16,8 @@ class FetchRoutineScenesAutomation extends StatelessWidget
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, state) {
|
||||
if (state.isLoading) return const Center(child: CircularProgressIndicator());
|
||||
if (state.isLoading)
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
@ -40,7 +41,8 @@ class FetchRoutineScenesAutomation extends StatelessWidget
|
||||
const SizedBox(height: 3),
|
||||
Visibility(
|
||||
visible: state.automations.isNotEmpty,
|
||||
replacement: _buildEmptyState(context, "No automations found"),
|
||||
replacement:
|
||||
_buildEmptyState(context, "No automations found"),
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: _buildAutomations(state),
|
||||
@ -59,7 +61,8 @@ class FetchRoutineScenesAutomation extends StatelessWidget
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: state.automations.length,
|
||||
itemBuilder: (context, index) {
|
||||
final isLoading = state.automations.contains(state.automations[index].id);
|
||||
final isLoading =
|
||||
state.automations.contains(state.automations[index].id);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@ -179,10 +182,13 @@ class FetchRoutineScenesAutomation extends StatelessWidget
|
||||
}
|
||||
|
||||
Widget _buildEmptyState(BuildContext context, String title) {
|
||||
return Text(
|
||||
title,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
color: ColorsManager.grayColor,
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
child: Text(
|
||||
title,
|
||||
style: context.textTheme.bodyMedium?.copyWith(
|
||||
color: ColorsManager.grayColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user