Umstellung auf UTC Timestamp
This commit is contained in:
1 parent
ac6c468870
commit
0a9f1e63c2
1 file changed
+18
-1
+18
-1
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:dart_mq/dart_mq.dart';
|
||||
import 'package:synchronized/synchronized.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
@@ -202,6 +203,7 @@ class Main extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MainState extends State<Main> with SingleTickerProviderStateMixin, ProducerMixin, ConsumerMixin {
|
||||
DateTime? _lastBackPressed;
|
||||
late ContentViewWidget _currentContent;
|
||||
late WidgetStack<ContentViewWidget> contentStack = WidgetStack();
|
||||
|
||||
@@ -274,12 +276,27 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin, Produc
|
||||
return ColoredSafeArea(
|
||||
key: GlobalKey(),
|
||||
child: PopScope(
|
||||
canPop: contentStack.isNotEmpty,
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) async {
|
||||
if (didPop) return;
|
||||
|
||||
if (contentStack.isNotEmpty) {
|
||||
_popContentView(1); // alten Inhalt entfernen
|
||||
} else {
|
||||
final now = DateTime.now();
|
||||
if (_lastBackPressed == null || now.difference(_lastBackPressed!) > const Duration(seconds: 2)) {
|
||||
_lastBackPressed = now;
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Zum Beenden erneut Zurück drücken'), duration: Duration(seconds: 2)),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Zweiter Zurück-Klick innerhalb des Zeitfensters: App beenden
|
||||
// ignore: use_build_context_synchronously
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
|
||||
Reference in new issue
Block a user