mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 20:14:54 +00:00
Bug fixes
This commit is contained in:
@ -24,14 +24,13 @@ class CreateSceneSaveButton extends StatefulWidget {
|
||||
State<CreateSceneSaveButton> createState() => _CreateSceneSaveButtonState();
|
||||
}
|
||||
|
||||
class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
||||
with SceneLogicHelper {
|
||||
class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton> with SceneLogicHelper {
|
||||
late TextEditingController sceneNameController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sceneNameController = TextEditingController(
|
||||
text: widget.sceneName.isNotEmpty ? widget.sceneName : '');
|
||||
sceneNameController =
|
||||
TextEditingController(text: widget.sceneName.isNotEmpty ? widget.sceneName : '');
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@ -58,8 +57,24 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
||||
return DefaultButton(
|
||||
onPressed: () {
|
||||
final sceneBloc = context.read<CreateSceneBloc>();
|
||||
final isAutomation =
|
||||
sceneBloc.sceneType == CreateSceneEnum.deviceStatusChanges;
|
||||
if (sceneBloc.tasksList.isEmpty && sceneBloc.automationTasksList.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final isAutomation = sceneBloc.sceneType == CreateSceneEnum.deviceStatusChanges;
|
||||
|
||||
if (isAutomation && sceneBloc.automationTasksList.isEmpty) {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'Conditions Must not be empty!',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAutomation && sceneBloc.tasksList.isEmpty) {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'Actions Must not be empty!',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (widget.sceneName.isNotEmpty) {
|
||||
handleSaveButtonPress(
|
||||
@ -82,13 +97,11 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
||||
elevation: WidgetStateProperty.all(0),
|
||||
textStyle: WidgetStateProperty.all(context.bodyMedium),
|
||||
hintStyle: WidgetStateProperty.all(
|
||||
context.bodyMedium.copyWith(
|
||||
fontSize: 14,
|
||||
color: ColorsManager.secondaryTextColor),
|
||||
context.bodyMedium
|
||||
.copyWith(fontSize: 14, color: ColorsManager.secondaryTextColor),
|
||||
),
|
||||
hintText: 'Enter scene name',
|
||||
backgroundColor: WidgetStateProperty.all(
|
||||
ColorsManager.backgroundColor),
|
||||
backgroundColor: WidgetStateProperty.all(ColorsManager.backgroundColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user