Erweiterungen
This commit is contained in:
1 parent
e41008147f
commit
b0dd1afb43
4 files changed
+68
-79
No files matched your search
+10
-5
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:stadtbote/messages/PopContentViewMessage.dart';
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
@@ -165,7 +166,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
_leftButtonVisible = false;
|
||||
_leftIconButton = const Icon(Icons.arrow_back, size: 20.0, color: Colors.white);
|
||||
_leftButtonOnPressed = () {
|
||||
_popContentView();
|
||||
_popContentView(1);
|
||||
};
|
||||
|
||||
_rightButtonVisible = headerInfo.rightButtonVisible;
|
||||
@@ -191,7 +192,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
child: WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (contentStack.isNotEmpty) {
|
||||
_popContentView();
|
||||
_popContentView(1);
|
||||
|
||||
return false;
|
||||
} else {
|
||||
@@ -314,8 +315,8 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
MessageService().subscribe<ContentViewWidget>(Constants.messageTopicPushContentView, this, (ContentViewWidget widget) {
|
||||
_pushContentView(widget);
|
||||
});
|
||||
MessageService().subscribe<ContentViewWidget>(Constants.messageTopicPopContentView, this, (ContentViewWidget widget) {
|
||||
_popContentView();
|
||||
MessageService().subscribe<PopContentViewMessage>(Constants.messageTopicPopContentView, this, (PopContentViewMessage message) {
|
||||
_popContentView(message.count);
|
||||
});
|
||||
MessageService().subscribe<ContentViewWidget>(Constants.messageTopicReplaceContentView, this, (ContentViewWidget widget) {
|
||||
_replaceContentView(widget);
|
||||
@@ -354,8 +355,12 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
||||
});
|
||||
}
|
||||
|
||||
void _popContentView() {
|
||||
void _popContentView(int count) {
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
for (int i = 0; i < count - 1; i++) {
|
||||
contentStack.pop();
|
||||
}
|
||||
|
||||
var previousContentView = contentStack.pop();
|
||||
|
||||
_currentContent = previousContentView;
|
||||
|
||||
Reference in new issue
Block a user