Back button of other pages navigate to home

This commit is contained in:
fhkhd
2024-04-20 22:16:35 +04:30
parent 34e3f76845
commit c99cf569cf
20 changed files with 1455 additions and 1279 deletions
+17 -8
View File
@@ -23,6 +23,7 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
TextEditingController testCodeCTRL = new TextEditingController();
bool isInit = true;
@override
void didChangeDependencies() {
if (isInit) {
@@ -48,19 +49,27 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope(
onWillPop: () async {
Navigator.pushReplacementNamed(
context,
Routes.testResultScreen,
);
return true;
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
if (didPop) return;
Navigator.of(context).pushNamed(Routes.homePage);
// Navigator.pushReplacementNamed(
// context,
// Routes.testResultScreen,
// );
// return true;
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(