fix inncorrect parent in automation screen by removing Expanded

This commit is contained in:
Rafeek-Khoudare
2025-07-21 13:21:02 +03:00
parent 09dc8cc330
commit d5321a9ca0

View File

@ -27,12 +27,15 @@ class RoutinesView extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
final selectedSpace = HomeCubit.getInstance().selectedSpace; final selectedSpace = HomeCubit.getInstance().selectedSpace;
if (state is DeleteSceneSuccess) { if (state is DeleteSceneSuccess) {
if (state.success) _loadScenesAndAutomations(context, selectedSpace); if (state.success)
_loadScenesAndAutomations(context, selectedSpace);
} }
if (state is CreateSceneWithTasks) { if (state is CreateSceneWithTasks) {
if (state.success) { if (state.success) {
_loadScenesAndAutomations(context, selectedSpace); _loadScenesAndAutomations(context, selectedSpace);
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent()); context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent());
} }
} }
return BlocListener<SceneBloc, SceneState>( return BlocListener<SceneBloc, SceneState>(
@ -72,30 +75,28 @@ class RoutinesView extends StatelessWidget {
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
), ),
child: Expanded( child: ListView(
child: ListView( children: [
children: [ RoutinesExpansionTile(
RoutinesExpansionTile( title: 'Tap to run automations',
title: 'Tap to run routines', emptyRoutinesMessage:
emptyRoutinesMessage: 'No scenes have been added yet',
'No scenes have been added yet', routines: state.scenes,
routines: state.scenes, loadingStates: state.loadingStates,
loadingStates: state.loadingStates, loadingSceneId: state.loadingSceneId,
loadingSceneId: state.loadingSceneId, disablePlayButton: false,
disablePlayButton: false, ),
), RoutinesExpansionTile(
RoutinesExpansionTile( title: 'Automation',
title: 'Automation', emptyRoutinesMessage:
emptyRoutinesMessage: 'No automations have been added yet',
'No automations have been added yet', routines: state.automationList,
routines: state.automationList, loadingStates: state.loadingStates,
loadingStates: state.loadingStates, loadingSceneId: state.loadingSceneId,
loadingSceneId: state.loadingSceneId, disablePlayButton: true,
disablePlayButton: true, ),
), const SizedBox(height: 15),
const SizedBox(height: 15), ],
],
),
), ),
); );
} }
@ -111,7 +112,8 @@ class RoutinesView extends StatelessWidget {
); );
} }
void _loadScenesAndAutomations(BuildContext context, SpaceModel? selectedSpace) { void _loadScenesAndAutomations(
BuildContext context, SpaceModel? selectedSpace) {
context.read<SceneBloc>() context.read<SceneBloc>()
..add(LoadScenes(selectedSpace!.id, selectedSpace, showInDevice: false)) ..add(LoadScenes(selectedSpace!.id, selectedSpace, showInDevice: false))
..add(LoadAutomation(selectedSpace.id, selectedSpace.community.uuid)); ..add(LoadAutomation(selectedSpace.id, selectedSpace.community.uuid));