💄 The universal escape now can close the fade made dialog
This commit is contained in:
@@ -157,6 +157,9 @@ String _parseRemoteError(DioException err) {
|
||||
return message ?? err.toString();
|
||||
}
|
||||
|
||||
// Track active overlay dialogs for dismissal
|
||||
final List<void Function()> _activeOverlayDialogs = [];
|
||||
|
||||
Future<T?> showOverlayDialog<T>({
|
||||
required Widget Function(BuildContext context, void Function(T? result) close)
|
||||
builder,
|
||||
@@ -175,6 +178,7 @@ Future<T?> showOverlayDialog<T>({
|
||||
}
|
||||
|
||||
entry.remove();
|
||||
_activeOverlayDialogs.remove(close);
|
||||
completer.complete(result);
|
||||
}
|
||||
|
||||
@@ -215,10 +219,21 @@ Future<T?> showOverlayDialog<T>({
|
||||
),
|
||||
);
|
||||
|
||||
_activeOverlayDialogs.add(() => close(null));
|
||||
globalOverlay.currentState!.insert(entry);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
// Close the topmost overlay dialog if any exists
|
||||
bool closeTopmostOverlayDialog() {
|
||||
if (_activeOverlayDialogs.isNotEmpty) {
|
||||
final closeFunc = _activeOverlayDialogs.last;
|
||||
closeFunc();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const kDialogMaxWidth = 480.0;
|
||||
|
||||
void showErrorAlert(dynamic err, {IconData? icon}) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:island/route.dart';
|
||||
import 'package:island/pods/userinfo.dart';
|
||||
import 'package:island/pods/websocket.dart';
|
||||
import 'package:island/services/responsive.dart';
|
||||
import 'package:island/widgets/alert.dart';
|
||||
import 'package:island/widgets/upload_overlay.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
@@ -364,6 +365,12 @@ class PopAction extends Action<PopIntent> {
|
||||
|
||||
@override
|
||||
void invoke(PopIntent intent) {
|
||||
// First, try to close any overlay dialogs
|
||||
if (closeTopmostOverlayDialog()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If no overlay to close, pop the route
|
||||
if (ref.watch(routerProvider).canPop()) {
|
||||
ref.read(routerProvider).pop();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class NetworkStatusSheet extends HookConsumerWidget {
|
||||
final wsState = ref.watch(websocketStateProvider);
|
||||
|
||||
return SheetScaffold(
|
||||
heightFactor: 0.4,
|
||||
titleText:
|
||||
wsState == WebSocketState.connected()
|
||||
? 'Connection Status'
|
||||
|
||||
Reference in New Issue
Block a user