From 214ec6b36874e4ffcd2bdb03acba827fb2ec5298 Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 15 Jun 2025 23:51:17 +0200 Subject: [PATCH] enable predicvie back --- android/app/src/main/AndroidManifest.xml | 9 +-- lib/app.dart | 16 ++++-- .../permissions_view.dart | 57 +++++++++---------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2011490..1cb08c4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ android:icon="@mipmap/ic_launcher"> - + with WidgetsBindingObserver { ], onGenerateTitle: (BuildContext context) => "twonly", theme: ThemeData( - colorScheme: - ColorScheme.fromSeed(seedColor: const Color(0xFF57CC99)), - inputDecorationTheme: - const InputDecorationTheme(border: OutlineInputBorder())), + colorScheme: ColorScheme.fromSeed( + seedColor: const Color(0xFF57CC99), + ), + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: PredictiveBackPageTransitionsBuilder(), + }, + ), + inputDecorationTheme: const InputDecorationTheme( + border: OutlineInputBorder(), + ), + ), darkTheme: ThemeData.dark().copyWith( colorScheme: ColorScheme.fromSeed( brightness: Brightness.dark, diff --git a/lib/src/views/camera/camera_preview_components/permissions_view.dart b/lib/src/views/camera/camera_preview_components/permissions_view.dart index fc307cd..54fc6e1 100644 --- a/lib/src/views/camera/camera_preview_components/permissions_view.dart +++ b/lib/src/views/camera/camera_preview_components/permissions_view.dart @@ -54,37 +54,34 @@ class PermissionHandlerViewState extends State { @override Widget build(BuildContext context) { - return PopScope( - onPopInvokedWithResult: (bool didPop, Object? result) async {}, - child: Scaffold( - body: Center( - child: Container( - padding: EdgeInsets.all(100), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "twonly needs access to the camera and microphone.", - textAlign: TextAlign.center, - ), - SizedBox(height: 50), - FilledButton.icon( - label: Text("Request permissions"), - icon: const Icon(Icons.perm_camera_mic), - onPressed: () async { - try { - await permissionServices(); - if (await checkPermissions()) { - widget.onSuccess(); - } - } catch (e) { - Log.error(e); + return Scaffold( + body: Center( + child: Container( + padding: EdgeInsets.all(100), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "twonly needs access to the camera and microphone.", + textAlign: TextAlign.center, + ), + SizedBox(height: 50), + FilledButton.icon( + label: Text("Request permissions"), + icon: const Icon(Icons.perm_camera_mic), + onPressed: () async { + try { + await permissionServices(); + if (await checkPermissions()) { + widget.onSuccess(); } - }, - ), - ], - ), + } catch (e) { + Log.error(e); + } + }, + ), + ], ), ), ),