💄 Optimize the notification snackbar position

This commit is contained in:
LittleSheep 2025-06-27 22:18:16 +08:00
parent 5939a1dc5b
commit 536375729f

View File

@ -32,7 +32,9 @@ StreamSubscription<WebSocketPacket> setupNotificationListener(
var uri = notification.meta['action_uri'] as String; var uri = notification.meta['action_uri'] as String;
if (uri.startsWith('/')) { if (uri.startsWith('/')) {
// In-app routes // In-app routes
rootNavigatorKey.currentContext?.push(notification.meta['action_uri']); rootNavigatorKey.currentContext?.push(
notification.meta['action_uri'],
);
} else { } else {
// External URLs // External URLs
launchUrlString(uri); launchUrlString(uri);
@ -46,8 +48,14 @@ StreamSubscription<WebSocketPacket> setupNotificationListener(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 16, left: 16,
right: 16, right: 16,
// ignore: use_build_context_synchronously top:
top: MediaQuery.of(context).padding.top + 24, (!kIsWeb &&
(Platform.isMacOS ||
Platform.isWindows ||
Platform.isLinux))
? 24
// ignore: use_build_context_synchronously
: MediaQuery.of(context).padding.top + 8,
bottom: 16, bottom: 16,
), ),
); );