mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: failed to remove when showing multi popup dialogs
This commit is contained in:
@@ -11,7 +11,7 @@ class HotController extends GetxController {
|
||||
RxList<HotVideoItemModel> videoList = <HotVideoItemModel>[].obs;
|
||||
bool isLoadingMore = false;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
|
||||
// 获取推荐
|
||||
Future queryHotFeed(type) async {
|
||||
|
||||
@@ -102,14 +102,12 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
||||
videoItem: _hotController.videoList[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_hotController.popupDialog = _createPopupDialog(
|
||||
_hotController.videoList[index]);
|
||||
_hotController.popupDialog
|
||||
.add(_createPopupDialog(videoList[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_hotController.popupDialog!);
|
||||
},
|
||||
longPressEnd: () {
|
||||
_hotController.popupDialog?.remove();
|
||||
.insert(_hotController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
);
|
||||
}, childCount: _hotController.videoList.length),
|
||||
),
|
||||
@@ -151,12 +149,19 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
||||
);
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_hotController.popupDialog.last?.remove();
|
||||
_hotController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _hotController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem, closeFn: _hotController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class LiveController extends GetxController {
|
||||
RxInt crossAxisCount = 2.obs;
|
||||
RxList<LiveItemModel> liveList = <LiveItemModel>[].obs;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ class ZoneController extends GetxController {
|
||||
RxList<HotVideoItemModel> videoList = <HotVideoItemModel>[].obs;
|
||||
bool isLoadingMore = false;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
int zoneID = 0;
|
||||
|
||||
// 获取推荐
|
||||
|
||||
@@ -104,14 +104,13 @@ class _ZonePageState extends State<ZonePage>
|
||||
videoItem: _zoneController.videoList[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_zoneController.popupDialog = _createPopupDialog(
|
||||
_zoneController.videoList[index]);
|
||||
_zoneController.popupDialog.add(
|
||||
_createPopupDialog(
|
||||
_zoneController.videoList[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_zoneController.popupDialog!);
|
||||
},
|
||||
longPressEnd: () {
|
||||
_zoneController.popupDialog?.remove();
|
||||
.insert(_zoneController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
);
|
||||
}, childCount: _zoneController.videoList.length),
|
||||
),
|
||||
@@ -154,12 +153,19 @@ class _ZonePageState extends State<ZonePage>
|
||||
);
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_zoneController.popupDialog.last?.remove();
|
||||
_zoneController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _zoneController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem, closeFn: _zoneController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class RcmdController extends GetxController {
|
||||
int _currentPage = 0;
|
||||
// RxList<RecVideoItemAppModel> appVideoList = <RecVideoItemAppModel>[].obs;
|
||||
// RxList<RecVideoItemModel> webVideoList = <RecVideoItemModel>[].obs;
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
Box setting = GStorage.setting;
|
||||
RxInt crossAxisCount = 2.obs;
|
||||
late bool enableSaveLastData;
|
||||
|
||||
@@ -128,12 +128,19 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
);
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_rcmdController.popupDialog.last?.remove();
|
||||
_rcmdController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _rcmdController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem, closeFn: _rcmdController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -156,13 +163,12 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
? VideoCardV(
|
||||
videoItem: videoList[index],
|
||||
longPress: () {
|
||||
_rcmdController.popupDialog =
|
||||
_createPopupDialog(videoList[index]);
|
||||
Overlay.of(context).insert(_rcmdController.popupDialog!);
|
||||
},
|
||||
longPressEnd: () {
|
||||
_rcmdController.popupDialog?.remove();
|
||||
_rcmdController.popupDialog
|
||||
.add(_createPopupDialog(videoList[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_rcmdController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
)
|
||||
: const VideoCardVSkeleton();
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ class RelatedController extends GetxController {
|
||||
// 推荐视频列表
|
||||
RxList relatedVideoList = <HotVideoItemModel>[].obs;
|
||||
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
|
||||
Future<dynamic> queryRelatedVideo() async {
|
||||
return VideoHttp.relatedVideoList(bvid: bvid).then((value) {
|
||||
|
||||
@@ -65,18 +65,16 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
try {
|
||||
_relatedController.popupDialog =
|
||||
_relatedController.popupDialog.add(
|
||||
_createPopupDialog(_relatedController
|
||||
.relatedVideoList[index]);
|
||||
Overlay.of(context)
|
||||
.insert(_relatedController.popupDialog!);
|
||||
.relatedVideoList[index]));
|
||||
Overlay.of(context).insert(
|
||||
_relatedController.popupDialog.last!);
|
||||
} catch (err) {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
longPressEnd: () {
|
||||
_relatedController.popupDialog?.remove();
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -110,13 +108,19 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
));
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_relatedController.popupDialog.last?.remove();
|
||||
_relatedController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (BuildContext context) => AnimatedDialog(
|
||||
closeFn: _relatedController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem,
|
||||
closeFn: _relatedController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user