add PopScope to setting page

This commit is contained in:
mohammad
2025-05-15 12:35:47 +03:00
parent a04beb32f2
commit 5d1b8e39b0

View File

@ -22,7 +22,15 @@ class SettingProfilePage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var spaces = HomeCubit.getInstance().spaces; var spaces = HomeCubit.getInstance().spaces;
return DefaultScaffold( return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) {
return;
}
Navigator.of(context).pop(true);
},
child: DefaultScaffold(
title: 'Device Settings', title: 'Device Settings',
leading: IconButton( leading: IconButton(
onPressed: () { onPressed: () {
@ -86,15 +94,18 @@ class SettingProfilePage extends StatelessWidget {
const SizedBox(width: 5), const SizedBox(width: 5),
InkWell( InkWell(
onTap: () { onTap: () {
_bloc.add(const ChangeNameEvent(value: true)); _bloc.add(
const ChangeNameEvent(value: true));
}, },
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10), padding:
EdgeInsets.symmetric(horizontal: 10),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.sosEditProfile, Assets.sosEditProfile,
color: Colors.grey, color: Colors.grey,
fit: BoxFit.contain, fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * height:
MediaQuery.of(context).size.height *
0.02, 0.02,
), ),
), ),
@ -117,7 +128,8 @@ class SettingProfilePage extends StatelessWidget {
if (HomeCubit.visitorPasswordManagement) { if (HomeCubit.visitorPasswordManagement) {
bool? val = await Navigator.of(context).push( bool? val = await Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => LocationSettingPage( builder: (context) =>
LocationSettingPage(
space: spaces!.first, space: spaces!.first,
deviceId: device?.uuid ?? '', deviceId: device?.uuid ?? '',
)), )),
@ -128,7 +140,8 @@ class SettingProfilePage extends StatelessWidget {
} }
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
const SizedBox( const SizedBox(
child: Text('Location'), child: Text('Location'),
@ -159,6 +172,7 @@ class SettingProfilePage extends StatelessWidget {
}, },
), ),
), ),
),
); );
} }