fix: failed to remove when showing multi popup dialogs

This commit is contained in:
bggRGjQaUbCoE
2024-08-30 22:20:04 +08:00
parent 1864fa29bf
commit 40cfce3501
10 changed files with 74 additions and 47 deletions

View File

@@ -128,12 +128,19 @@ class _LivePageState extends State<LivePage>
);
}
void _removePopupDialog() {
_liveController.popupDialog.last?.remove();
_liveController.popupDialog.removeLast();
}
OverlayEntry _createPopupDialog(liveItem) {
return OverlayEntry(
builder: (context) => AnimatedDialog(
closeFn: _liveController.popupDialog?.remove,
closeFn: _removePopupDialog,
child: OverlayPop(
videoItem: liveItem, closeFn: _liveController.popupDialog?.remove),
videoItem: liveItem,
closeFn: _removePopupDialog,
),
),
);
}
@@ -153,13 +160,12 @@ class _LivePageState extends State<LivePage>
? LiveCardV(
liveItem: liveList[index],
longPress: () {
_liveController.popupDialog =
_createPopupDialog(liveList[index]);
Overlay.of(context).insert(_liveController.popupDialog!);
},
longPressEnd: () {
_liveController.popupDialog?.remove();
_liveController.popupDialog
.add(_createPopupDialog(liveList[index]));
Overlay.of(context)
.insert(_liveController.popupDialog.last!);
},
longPressEnd: _removePopupDialog,
)
: const VideoCardVSkeleton();
},