Ver Fonte

Fix swipe to go back interaction for iOS

Neeraj Gupta há 3 anos atrás
pai
commit
6a884b7bd0
1 ficheiros alterados com 15 adições e 3 exclusões
  1. 15 3
      lib/utils/navigation_util.dart

+ 15 - 3
lib/utils/navigation_util.dart

@@ -1,9 +1,21 @@
+import 'dart:io';
+
 import 'package:flutter/material.dart';
 
 Future<T> routeToPage<T extends Object>(BuildContext context, Widget page) {
-  return Navigator.of(context).push(
-    _buildPageRoute(page),
-  );
+  if (Platform.isAndroid) {
+    return Navigator.of(context).push(
+      _buildPageRoute(page),
+    );
+  } else {
+    return Navigator.of(context).push(
+      MaterialPageRoute(
+        builder: (BuildContext context) {
+          return page;
+        },
+      ),
+    );
+  }
 }
 
 void replacePage(BuildContext context, Widget page) {