mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: image save dialog
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -9,13 +9,9 @@ class BangumiCardV extends StatelessWidget {
|
||||
const BangumiCardV({
|
||||
super.key,
|
||||
required this.bangumiItem,
|
||||
this.longPress,
|
||||
this.longPressEnd,
|
||||
});
|
||||
|
||||
final dynamic bangumiItem;
|
||||
final Function()? longPress;
|
||||
final Function()? longPressEnd;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -9,13 +9,9 @@ class BangumiCardVMemberHome extends StatelessWidget {
|
||||
const BangumiCardVMemberHome({
|
||||
super.key,
|
||||
required this.bangumiItem,
|
||||
this.longPress,
|
||||
this.longPressEnd,
|
||||
});
|
||||
|
||||
final Item bangumiItem;
|
||||
final Function()? longPress;
|
||||
final Function()? longPressEnd;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class PopupController extends CommonController {
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
|
||||
void removePopupDialog() {
|
||||
popupDialog.last?.remove();
|
||||
popupDialog.removeLast();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
|
||||
class HotController extends PopupController {
|
||||
class HotController extends CommonController {
|
||||
// int idx = 0;
|
||||
|
||||
@override
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
import 'package:PiliPalaX/common/widgets/animated_dialog.dart';
|
||||
import 'package:PiliPalaX/common/skeleton/video_card_h.dart';
|
||||
import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
import 'package:PiliPalaX/pages/home/index.dart';
|
||||
@@ -82,15 +81,6 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
||||
);
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _hotController.removePopupDialog,
|
||||
videoItem: videoItem,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSkeleton() {
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
@@ -125,13 +115,6 @@ class _HotPageState extends State<HotPage> with AutomaticKeepAliveClientMixin {
|
||||
return VideoCardH(
|
||||
videoItem: loadingState.response[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_hotController.popupDialog.add(
|
||||
_createPopupDialog(loadingState.response[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_hotController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _hotController.removePopupDialog,
|
||||
);
|
||||
},
|
||||
childCount: loadingState.response.length,
|
||||
|
||||
@@ -158,7 +158,7 @@ class _LaterPageState extends State<LaterPage> {
|
||||
: () {
|
||||
_laterController.onSelect(index);
|
||||
},
|
||||
longPress: () {
|
||||
onLongPress: () {
|
||||
if (_laterController.enableMultiSelect.value.not) {
|
||||
_laterController.enableMultiSelect.value = true;
|
||||
_laterController.onSelect(index);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/http/live.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
|
||||
class LiveController extends PopupController {
|
||||
class LiveController extends CommonController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/common/widgets/image_save.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
@@ -8,14 +9,10 @@ import 'package:PiliPalaX/common/widgets/network_img_layer.dart';
|
||||
// 视频卡片 - 垂直布局
|
||||
class LiveCardV extends StatelessWidget {
|
||||
final LiveItemModel liveItem;
|
||||
final Function()? longPress;
|
||||
final Function()? longPressEnd;
|
||||
|
||||
const LiveCardV({
|
||||
super.key,
|
||||
required this.liveItem,
|
||||
this.longPress,
|
||||
this.longPressEnd,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -29,7 +26,11 @@ class LiveCardV extends StatelessWidget {
|
||||
Get.toNamed('/liveRoom?roomid=${liveItem.roomId}',
|
||||
arguments: {'liveItem': liveItem, 'heroTag': heroTag});
|
||||
},
|
||||
onLongPress: longPress,
|
||||
onLongPress: () => imageSaveDialog(
|
||||
context: context,
|
||||
title: liveItem.title,
|
||||
cover: liveItem.cover,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
|
||||
class ZoneController extends PopupController {
|
||||
class ZoneController extends CommonController {
|
||||
ZoneController({required this.zoneID});
|
||||
int zoneID;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
import 'package:PiliPalaX/common/widgets/animated_dialog.dart';
|
||||
import 'package:PiliPalaX/common/skeleton/video_card_h.dart';
|
||||
import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
import 'package:PiliPalaX/common/widgets/video_card_h.dart';
|
||||
@@ -98,15 +97,6 @@ class _ZonePageState extends State<ZonePage>
|
||||
);
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _zoneController.removePopupDialog,
|
||||
videoItem: videoItem,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSkeleton() {
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
@@ -135,12 +125,6 @@ class _ZonePageState extends State<ZonePage>
|
||||
return VideoCardH(
|
||||
videoItem: loadingState.response[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_zoneController.popupDialog
|
||||
.add(_createPopupDialog(loadingState.response[index]));
|
||||
Overlay.of(context).insert(_zoneController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _zoneController.removePopupDialog,
|
||||
);
|
||||
},
|
||||
childCount: loadingState.response.length,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
|
||||
class RcmdController extends PopupController {
|
||||
class RcmdController extends CommonController {
|
||||
late bool enableSaveLastData;
|
||||
late String defaultRcmdType = 'app';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:PiliPalaX/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/models/common/tab_type.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
import 'package:PiliPalaX/pages/live/controller.dart';
|
||||
import 'package:PiliPalaX/pages/live/widgets/live_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -11,7 +11,6 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
import 'package:PiliPalaX/common/skeleton/video_card_v.dart';
|
||||
import 'package:PiliPalaX/common/widgets/animated_dialog.dart';
|
||||
import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
import 'package:PiliPalaX/common/widgets/video_card_v.dart';
|
||||
import 'package:PiliPalaX/pages/home/index.dart';
|
||||
@@ -31,7 +30,7 @@ class RcmdPage extends StatefulWidget {
|
||||
|
||||
class _RcmdPageState extends State<RcmdPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late final PopupController _controller = widget.tabType == TabType.rcmd
|
||||
late final CommonController _controller = widget.tabType == TabType.rcmd
|
||||
? Get.put<RcmdController>(RcmdController())
|
||||
: Get.put<LiveController>(LiveController());
|
||||
|
||||
@@ -104,15 +103,6 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
);
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _controller.removePopupDialog,
|
||||
videoItem: videoItem,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contentGrid(LoadingState loadingState) {
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
@@ -135,23 +125,9 @@ class _RcmdPageState extends State<RcmdPage>
|
||||
? widget.tabType == TabType.rcmd
|
||||
? VideoCardV(
|
||||
videoItem: loadingState.response[index],
|
||||
longPress: () {
|
||||
_controller.popupDialog.add(
|
||||
_createPopupDialog(loadingState.response[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_controller.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _controller.removePopupDialog,
|
||||
)
|
||||
: LiveCardV(
|
||||
liveItem: loadingState.response[index],
|
||||
longPress: () {
|
||||
_controller.popupDialog.add(
|
||||
_createPopupDialog(loadingState.response[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_controller.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _controller.removePopupDialog,
|
||||
)
|
||||
: const VideoCardVSkeleton();
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/pages/common/popup_controller.dart';
|
||||
import 'package:PiliPalaX/pages/common/common_controller.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/http/video.dart';
|
||||
|
||||
class RelatedController extends PopupController {
|
||||
class RelatedController extends CommonController {
|
||||
// 视频aid
|
||||
String bvid = Get.parameters['bvid'] ?? "";
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/common/skeleton/video_card_h.dart';
|
||||
import 'package:PiliPalaX/common/widgets/animated_dialog.dart';
|
||||
import 'package:PiliPalaX/common/widgets/http_error.dart';
|
||||
import 'package:PiliPalaX/common/widgets/video_card_h.dart';
|
||||
import '../../../../common/constants.dart';
|
||||
@@ -33,15 +32,6 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
);
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (BuildContext context) => AnimatedDialog(
|
||||
closeFn: _relatedController.removePopupDialog,
|
||||
videoItem: videoItem,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverGrid(
|
||||
@@ -74,13 +64,6 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
child: VideoCardH(
|
||||
videoItem: loadingState.response[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_relatedController.popupDialog.add(
|
||||
_createPopupDialog(loadingState.response[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_relatedController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _relatedController.removePopupDialog,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user