four_scene

This commit is contained in:
mohammad
2024-11-19 11:31:17 +03:00
parent f1bb454429
commit 1be6d71e89
7 changed files with 151 additions and 10 deletions
@@ -25,6 +25,11 @@ class FourSceneProfilePage extends StatelessWidget {
return DefaultScaffold(
title: 'Device Settings',
leading: IconButton(
onPressed: () {
Navigator.of(context).pop(true);
},
icon: const Icon(Icons.arrow_back_ios)),
child: BlocProvider(
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
..add(const FourSceneInitial())
@@ -93,7 +98,7 @@ class FourSceneProfilePage extends StatelessWidget {
controller: _bloc.nameController,
enabled: _bloc.editName,
onEditingComplete: () {
// sensor.add(SaveNameEvent(context: context));
_bloc.add(const SaveNameEvent());
},
decoration: const InputDecoration(
hintText: "Your Name",
@@ -131,19 +136,22 @@ class FourSceneProfilePage extends StatelessWidget {
DefaultContainer(
padding: const EdgeInsets.all(20),
child: InkWell(
onTap: () {
Navigator.of(context).push(
onTap: () async {
bool val = await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => LocationFourScenePage(
space: spaces!.first,
deviceId: device?.uuid ?? '',
)),
);
if (val == true) {
_bloc.add(FourSceneInitialInfo());
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
const SizedBox(
child: Text('Location'),
),
Row(
@@ -155,7 +163,7 @@ class FourSceneProfilePage extends StatelessWidget {
fontColor: ColorsManager.textGray,
),
),
Icon(
const Icon(
Icons.arrow_forward_ios,
size: 15,
color: ColorsManager.textGray,
@@ -69,14 +69,17 @@ class FourSceneSettings extends StatelessWidget {
vertical: 10,
),
child: InkWell(
onTap: () {
Navigator.of(context).push(
onTap: () async {
bool val = await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => FourSceneProfilePage(
device: device,
),
),
);
if (val == true) {
_bloc.add(FourSceneInitialInfo());
}
},
child: Stack(
children: [
@@ -161,7 +164,9 @@ class FourSceneSettings extends StatelessWidget {
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => FourSceneInfoPage( device: device!,)),
builder: (context) => FourSceneInfoPage(
device: device!,
)),
);
},
text: 'Device Information',
@@ -41,6 +41,12 @@ class LocationFourScenePage extends StatelessWidget {
scene_4: '',
scene_id_group_id: '',
switch_backlight: '');
if (state is SaveSelectionSuccessState) {
new Future.delayed(const Duration(microseconds: 500), () {
_bloc.add(FourSceneInitialInfo());
Navigator.of(context).pop(true);
});
}
return state is FourSceneLoadingState
? const Center(
child: DefaultContainer(
@@ -60,6 +66,7 @@ class LocationFourScenePage extends StatelessWidget {
? () {
context.read<FourSceneBloc>().add(
AssignRoomEvent(
context: context,
roomId: roomIdSelected,
unit: space!));
}
@@ -77,6 +84,7 @@ class LocationFourScenePage extends StatelessWidget {
),
const SizedBox(width: 20),
],
child: RefreshIndicator(
onRefresh: () async {
// sensor.add(const SosInitial());