push automation

This commit is contained in:
ashrafzarkanisala
2024-07-25 01:25:16 +03:00
parent 3e20ba8f42
commit 91421c117e
2 changed files with 70 additions and 61 deletions

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart'; import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/scene_listview.dart';
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart'; import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
@ -72,66 +73,75 @@ class SceneView extends StatelessWidget {
final scenes = state.scenes; final scenes = state.scenes;
final automationList = state.automationList; final automationList = state.automationList;
return Expanded( return pageType
child: ListView( ? Expanded(
children: [ child: SceneListview(
ExpansionTile( scenes: state.scenes,
tilePadding: const EdgeInsets.symmetric( loadingSceneId: state.loadingSceneId,
horizontal: 6), ))
initiallyExpanded: true, : Expanded(
iconColor: ColorsManager.grayColor, child: ListView(
title: const BodySmall( children: [
text: 'Tap to run routines'), ExpansionTile(
children: [ tilePadding:
scenes.isNotEmpty const EdgeInsets.symmetric(
? SceneGrid( horizontal: 6),
scenes: scenes, initiallyExpanded: true,
loadingSceneId: iconColor: ColorsManager.grayColor,
state.loadingSceneId, title: const BodySmall(
disablePLayButton: false, text: 'Tap to run routines'),
) children: [
: const Center( scenes.isNotEmpty
child: BodyMedium( ? SceneGrid(
text: scenes: scenes,
'No scenes have been added yet', loadingSceneId:
), state.loadingSceneId,
disablePLayButton: false,
)
: const Center(
child: BodyMedium(
text:
'No scenes have been added yet',
),
),
const SizedBox(
height: 10,
), ),
const SizedBox( ],
height: 10, ),
), ExpansionTile(
], initiallyExpanded: true,
), iconColor: ColorsManager.grayColor,
ExpansionTile( tilePadding:
initiallyExpanded: true, const EdgeInsets.symmetric(
iconColor: ColorsManager.grayColor, horizontal: 6),
tilePadding: const EdgeInsets.symmetric( title: const BodySmall(
horizontal: 6), text: 'Automation'),
title: const BodySmall(text: 'Automation'), children: [
children: [ automationList.isNotEmpty
automationList.isNotEmpty ? SceneGrid(
? SceneGrid( scenes: automationList,
scenes: automationList, loadingSceneId:
loadingSceneId: state.loadingSceneId,
state.loadingSceneId, disablePLayButton: true,
disablePLayButton: true, )
) : const Center(
: const Center( child: BodyMedium(
child: BodyMedium( text:
text: 'No automations have been added yet',
'No automations have been added yet', ),
), ),
const SizedBox(
height: 10,
), ),
const SizedBox( ],
height: 10, ),
), const SizedBox(
], height: 15,
), ),
const SizedBox( ],
height: 15, ),
), );
],
),
);
} }
return const SizedBox(); return const SizedBox();
}, },

View File

@ -13,6 +13,7 @@ import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class ThenAddedTasksContainer extends StatelessWidget class ThenAddedTasksContainer extends StatelessWidget
@ -146,9 +147,7 @@ class ThenAddedTasksContainer extends StatelessWidget
String removeFunction = String removeFunction =
"${taskItem.operationName} with value ${taskItem.operationalValues.first.value}"; "${taskItem.operationName} with value ${taskItem.operationalValues.first.value}";
ScaffoldMessenger.of(context).showSnackBar( CustomSnackBar.displaySnackBar('$removeFunction removed');
SnackBar(content: Text('$removeFunction removed')),
);
}, },
child: SceneListTile( child: SceneListTile(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,