forked from eatvio/eatvio_app
feat(video_calls): fixed nullable overlay state handling
This commit is contained in:
@@ -2,12 +2,11 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
|
||||
abstract final class VideoCallTopOverlay {
|
||||
static const String poorConnectionSvg = 'assets/icons/video_call/poor_connection.svg';
|
||||
static const String poorConnectionSvg =
|
||||
'assets/icons/video_call/poor_connection.svg';
|
||||
static const String warningSvg = 'assets/icons/video_call/warning.svg';
|
||||
|
||||
|
||||
static OverlayEntry insertBanner(
|
||||
BuildContext context, {
|
||||
required String message,
|
||||
@@ -15,7 +14,7 @@ abstract final class VideoCallTopOverlay {
|
||||
required String svgAsset,
|
||||
Duration? autoRemoveAfter,
|
||||
}) {
|
||||
final overlayState = Overlay.of(context, rootOverlay: true);
|
||||
final overlayState = Overlay.maybeOf(context, rootOverlay: true);
|
||||
late OverlayEntry entry;
|
||||
entry = OverlayEntry(
|
||||
builder: (ctx) => Positioned(
|
||||
@@ -50,6 +49,9 @@ abstract final class VideoCallTopOverlay {
|
||||
),
|
||||
),
|
||||
);
|
||||
if (overlayState == null) {
|
||||
return entry;
|
||||
}
|
||||
overlayState.insert(entry);
|
||||
if (autoRemoveAfter != null) {
|
||||
Future<void>.delayed(autoRemoveAfter, () {
|
||||
|
||||
Reference in New Issue
Block a user