logOut show loading
This commit is contained in:
parent
8d23c11312
commit
715d837f54
@ -383,22 +383,23 @@ class OverlayDialogManager {
|
|||||||
"[OverlayDialogManager] Failed to show dialog, _overlayState is null, call [setOverlayState] first");
|
"[OverlayDialogManager] Failed to show dialog, _overlayState is null, call [setOverlayState] first");
|
||||||
}
|
}
|
||||||
|
|
||||||
final _tag;
|
final String dialogTag;
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
_tag = tag;
|
dialogTag = tag;
|
||||||
} else {
|
} else {
|
||||||
_tag = _tagCount.toString();
|
dialogTag = _tagCount.toString();
|
||||||
_tagCount++;
|
_tagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
final dialog = Dialog<T>();
|
final dialog = Dialog<T>();
|
||||||
_dialogs[_tag] = dialog;
|
_dialogs[dialogTag] = dialog;
|
||||||
|
|
||||||
final close = ([res]) {
|
close([res]) {
|
||||||
_dialogs.remove(_tag);
|
_dialogs.remove(dialogTag);
|
||||||
dialog.complete(res);
|
dialog.complete(res);
|
||||||
BackButtonInterceptor.removeByName(_tag);
|
BackButtonInterceptor.removeByName(dialogTag);
|
||||||
};
|
}
|
||||||
|
|
||||||
dialog.entry = OverlayEntry(builder: (_) {
|
dialog.entry = OverlayEntry(builder: (_) {
|
||||||
bool innerClicked = false;
|
bool innerClicked = false;
|
||||||
return Listener(
|
return Listener(
|
||||||
@ -423,14 +424,16 @@ class OverlayDialogManager {
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}, name: _tag);
|
}, name: dialogTag);
|
||||||
return dialog.completer.future;
|
return dialog.completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showLoading(String text,
|
String showLoading(String text,
|
||||||
{bool clickMaskDismiss = false,
|
{bool clickMaskDismiss = false,
|
||||||
bool showCancel = true,
|
bool showCancel = true,
|
||||||
VoidCallback? onCancel}) {
|
VoidCallback? onCancel}) {
|
||||||
|
final tag = _tagCount.toString();
|
||||||
|
_tagCount++;
|
||||||
show((setState, close) {
|
show((setState, close) {
|
||||||
cancel() {
|
cancel() {
|
||||||
dismissAll();
|
dismissAll();
|
||||||
@ -465,7 +468,8 @@ class OverlayDialogManager {
|
|||||||
])),
|
])),
|
||||||
onCancel: showCancel ? cancel : null,
|
onCancel: showCancel ? cancel : null,
|
||||||
);
|
);
|
||||||
});
|
}, tag: tag);
|
||||||
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetMobileActionsOverlay({FFI? ffi}) {
|
void resetMobileActionsOverlay({FFI? ffi}) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
@ -83,8 +82,7 @@ class UserModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> logOut() async {
|
Future<void> logOut() async {
|
||||||
// TODO show toast
|
final tag = gFFI.dialogManager.showLoading(translate('Waiting'));
|
||||||
debugPrint("start logout");
|
|
||||||
final url = await bind.mainGetApiServer();
|
final url = await bind.mainGetApiServer();
|
||||||
final _ = await http.post(Uri.parse("$url/api/logout"),
|
final _ = await http.post(Uri.parse("$url/api/logout"),
|
||||||
body: {
|
body: {
|
||||||
@ -99,6 +97,7 @@ class UserModel {
|
|||||||
]);
|
]);
|
||||||
parent.target?.abModel.clear();
|
parent.target?.abModel.clear();
|
||||||
userName.value = "";
|
userName.value = "";
|
||||||
|
gFFI.dialogManager.dismissByTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> login(String userName, String pass) async {
|
Future<Map<String, dynamic>> login(String userName, String pass) async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user