by using 'SystemNavigator.pop()' on the top level page when pressing the
back button. On Android this minimizes/closes the app an presents
whatever was shown before.

This fixes an issue where we would show a blank screen when pressing the
back button on the dashboard.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
not sure if this is the fix that we want, but i did not find any other
way. It seems that using PopScope does not really handle popping the
last route correctly. Also, this will not work for iOS (but since we
don't provide the app there, probably irrelevant)

 lib/pages/main_layout_slim.dart | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/pages/main_layout_slim.dart b/lib/pages/main_layout_slim.dart
index ec80dba..1761b26 100644
--- a/lib/pages/main_layout_slim.dart
+++ b/lib/pages/main_layout_slim.dart
@@ -1,5 +1,6 @@
 import 'package:built_collection/built_collection.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
 import 'package:font_awesome_flutter/font_awesome_flutter.dart';
 import 'package:intl/intl.dart';
 import 'package:provider/provider.dart';
@@ -74,7 +75,8 @@ class _MainLayoutSlimState extends State<MainLayoutSlim> {
             if (pageSelector.value != 0) pageSelector.add(0);
             return;
           }
-          if (mounted) Navigator.of(context).pop();
+          // minimize/return from the app
+          SystemNavigator.pop();
         },
         child: StreamBuilder<int>(
           stream: pageSelector.stream,
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to