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