forked from eatvio/eatvio_app
feat(video_calls): call ended push, recall button for message
This commit is contained in:
@@ -9,12 +9,67 @@ abstract final class VideoCallTopOverlay {
|
||||
'assets/icons/video_call/poor_connection.svg';
|
||||
static const String warningSvg = 'assets/icons/video_call/warning.svg';
|
||||
|
||||
static const double _poorConnectionIconSize = 44;
|
||||
static const double _poorConnectionGlyphSize = 22;
|
||||
|
||||
static OverlayEntry? _poorConnectionEntry;
|
||||
|
||||
static bool get isPoorConnectionIconVisible =>
|
||||
_poorConnectionEntry?.mounted ?? false;
|
||||
|
||||
static OverlayState? _resolveOverlayState(BuildContext context) {
|
||||
return VideoCallBannerOverlay.overlayState ??
|
||||
AppRouter.navigatorKey.currentState?.overlay ??
|
||||
Overlay.maybeOf(context, rootOverlay: true);
|
||||
}
|
||||
|
||||
/// Compact poor-connection indicator: red square with icon only.
|
||||
static void showPoorConnectionIcon(BuildContext context) {
|
||||
if (isPoorConnectionIconVisible) return;
|
||||
|
||||
hidePoorConnectionIcon();
|
||||
|
||||
final overlayState = _resolveOverlayState(context);
|
||||
late OverlayEntry entry;
|
||||
entry = OverlayEntry(
|
||||
builder: (ctx) {
|
||||
final topInset = MediaQuery.viewPaddingOf(ctx).top;
|
||||
return Positioned(
|
||||
left: 16,
|
||||
top: topInset + 8,
|
||||
width: _poorConnectionIconSize,
|
||||
height: _poorConnectionIconSize,
|
||||
child: Material(
|
||||
color: appTheme.strongRed,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
elevation: 6,
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
poorConnectionSvg,
|
||||
width: _poorConnectionGlyphSize,
|
||||
height: _poorConnectionGlyphSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
_poorConnectionEntry = entry;
|
||||
if (overlayState == null) {
|
||||
_poorConnectionEntry = null;
|
||||
return;
|
||||
}
|
||||
overlayState.insert(entry);
|
||||
}
|
||||
|
||||
static void hidePoorConnectionIcon() {
|
||||
final entry = _poorConnectionEntry;
|
||||
_poorConnectionEntry = null;
|
||||
if (entry != null && entry.mounted) {
|
||||
entry.remove();
|
||||
}
|
||||
}
|
||||
|
||||
static OverlayEntry insertBanner(
|
||||
BuildContext context, {
|
||||
|
||||
Reference in New Issue
Block a user