enable predicvie back

This commit is contained in:
otsmr 2025-06-15 23:51:17 +02:00
parent 6ae05fbc59
commit 214ec6b368
3 changed files with 44 additions and 38 deletions

View file

@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:enableOnBackInvokedCallback="true"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
@ -33,10 +34,10 @@
android:value="2" />
<service
android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
android:foregroundServiceType="dataSync|remoteMessaging"
android:exported="false" />
<!-- <service
android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
android:foregroundServiceType="dataSync|remoteMessaging"
android:exported="false" /> -->
<meta-data
android:name="eu.twonly.service.TWONLY_LOGO"

View file

@ -119,10 +119,18 @@ class _AppState extends State<App> 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,

View file

@ -54,37 +54,34 @@ class PermissionHandlerViewState extends State<PermissionHandlerView> {
@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);
}
},
),
],
),
),
),