Improve back button function in all screens

This commit is contained in:
hanie.khodkari
2025-03-19 18:38:40 +03:30
parent d99ecb2783
commit 58cd3d9f3f
35 changed files with 4715 additions and 5007 deletions
@@ -47,63 +47,56 @@ class _PackageDetailScreenState extends State<PackageDetailScreen> {
final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pop();
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: PackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
goToAddLabelPage: () {
Navigator.pushNamed(
context,
Routes.labelAddScreen,
arguments: {
"id": datas!.id,
"name": datas!.name
},
);
},
)
: ConnectionErrorBox();
},
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: PackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
goToAddLabelPage: () {
Navigator.pushNamed(
context,
Routes.labelAddScreen,
arguments: {
"id": datas!.id,
"name": datas!.name
},
);
},
)
: ConnectionErrorBox();
},
),
),
);
}