added base homescreen-widget setup, working on Android, iOS in progress

This commit is contained in:
2026-05-09 18:01:05 +02:00
parent 0ff5eb7bc9
commit 00664c66a8
66 changed files with 5600 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
import 'dart:developer';
import 'package:flutter/services.dart';
/// Android-only bridge: MainActivity stashes `widget_open_timetable=true`
/// from the launch Intent extra when a widget is tapped, Dart polls once
/// per app-resume to consume and route. iOS widgets simply launch the app
/// without a navigation hint (no widgetURL set) so this returns `false`
/// there via MissingPluginException.
class WidgetNavigation {
static const MethodChannel _channel = MethodChannel('eu.mhsl.marianum.widget');
static Future<bool> consumePendingTimetableTap() async {
try {
final raw = await _channel.invokeMethod<bool>('consumePendingNavigation');
return raw ?? false;
} on MissingPluginException {
return false;
} on PlatformException catch (e) {
log('WidgetNavigation channel error: $e');
return false;
}
}
}