Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-31 12:30:03 +08:00
parent de3edcfa13
commit 273e5649c3
6 changed files with 127 additions and 113 deletions

View File

@@ -1,6 +1,5 @@
import 'package:PiliPalaX/common/widgets/image_save.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../http/search.dart';
@@ -42,18 +41,16 @@ class VideoCardH extends StatelessWidget {
try {
type = videoItem.type;
} catch (_) {}
List<VideoCustomAction> actions =
VideoCustomActions(videoItem, context).actions;
final String heroTag = Utils.makeHeroTag(aid);
return Stack(children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
customSemanticsActions: <CustomSemanticsAction, void Function()>{
for (var item in actions)
CustomSemanticsAction(
label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
},
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
@@ -152,7 +149,7 @@ class VideoCardH extends StatelessWidget {
child: VideoPopupMenu(
size: 29,
iconSize: 17,
actions: actions,
videoItem: videoItem,
),
),
]);

View File

@@ -110,7 +110,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
child: VideoPopupMenu(
size: 29,
iconSize: 17,
actions: VideoCustomActions(videoItem, context).actions,
videoItem: videoItem,
),
),
],

View File

@@ -145,16 +145,14 @@ class VideoCardV extends StatelessWidget {
@override
Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(videoItem.id);
List<VideoCustomAction> actions =
VideoCustomActions(videoItem, context).actions;
return Stack(children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
customSemanticsActions: <CustomSemanticsAction, void Function()>{
for (var item in actions)
CustomSemanticsAction(label: item.title): item.onTap!,
},
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(label: item.title): item.onTap!,
// },
child: Card(
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero,
@@ -204,13 +202,14 @@ class VideoCardV extends StatelessWidget {
),
if (videoItem.goto == 'av')
Positioned(
right: -5,
bottom: -2,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
actions: actions,
)),
right: -5,
bottom: -2,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
),
),
]);
}

View File

@@ -270,14 +270,14 @@ class VideoCustomActions {
class VideoPopupMenu extends StatelessWidget {
final double? size;
final double? iconSize;
final List<VideoCustomAction> actions;
final double menuItemHeight = 45;
final dynamic videoItem;
const VideoPopupMenu({
super.key,
required this.size,
required this.iconSize,
required this.actions,
required this.videoItem,
});
@override
@@ -295,7 +295,8 @@ class VideoPopupMenu extends StatelessWidget {
),
position: PopupMenuPosition.under,
onSelected: (String type) {},
itemBuilder: (BuildContext context) => actions.map((e) {
itemBuilder: (BuildContext context) =>
VideoCustomActions(videoItem, context).actions.map((e) {
return PopupMenuItem<String>(
value: e.value,
height: menuItemHeight,

View File

@@ -26,7 +26,6 @@ class AnonymityInterceptor extends Interceptor {
Api.getSeasonDetailApi,
];
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (MineController.anonymity) {
@@ -39,7 +38,7 @@ class AnonymityInterceptor extends Interceptor {
if (uri.lastIndexOf('/') >= index + i.length) continue;
//SmartDialog.showToast('触发无痕模式\n\n$i\n\n${options.uri}');
options.headers[HttpHeaders.cookieHeader] = "";
if(options.data != null && options.data.csrf != null) {
if (options.data != null && options.data.csrf != null) {
options.data.csrf = "";
}
break;

View File

@@ -99,95 +99,113 @@ class MineController extends GetxController {
anonymity = !anonymity;
if (anonymity) {
SmartDialog.show(
clickMaskDismiss: false,
usePenetrate: true,
displayTime: const Duration(seconds: 2),
alignment: Alignment.bottomCenter,
builder: (context) {
return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer,
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 15, horizontal: 20),
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
Row(
children: <Widget>[
Icon(
MdiIcons.incognito,
clickMaskDismiss: false,
usePenetrate: true,
displayTime: const Duration(seconds: 2),
alignment: Alignment.bottomCenter,
builder: (context) {
return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer,
child: Padding(
padding: EdgeInsets.only(
top: 15,
left: 20,
right: 20,
bottom: MediaQuery.paddingOf(context).bottom + 15,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: <Widget>[
Icon(
MdiIcons.incognito,
),
const SizedBox(width: 10),
Text('已进入无痕模式',
style: Theme.of(context).textTheme.titleMedium)
],
),
const SizedBox(height: 10),
Text(
'搜索、观看视频/直播不携带身份信息(包含大会员)\n'
'不产生查询或播放记录\n'
'点赞等其它操作不受影响\n'
'(前往隐私设置了解详情)',
style: Theme.of(context).textTheme.bodySmall),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton(
onPressed: () {
SmartDialog.dismiss();
setting.put(SettingBoxKey.anonymity, true);
anonymity = true;
SmartDialog.showToast('已设为永久无痕模式');
},
child: Text(
'保存为永久',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
)),
const SizedBox(width: 10),
TextButton(
onPressed: () {
SmartDialog.dismiss();
setting.put(SettingBoxKey.anonymity, false);
anonymity = true;
SmartDialog.showToast('已设为临时无痕模式');
},
child: Text(
'仅本次(默认)',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
const SizedBox(width: 10),
Text('已进入无痕模式',
style: Theme.of(context).textTheme.titleMedium)
],
),
const SizedBox(height: 10),
Text(
'搜索、观看视频/直播不携带身份信息(包含大会员)\n'
'不产生查询或播放记录\n'
'点赞等其它操作不受影响\n'
'(前往隐私设置了解详情)',
style: Theme.of(context).textTheme.bodySmall),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton(
onPressed: () {
SmartDialog.dismiss();
setting.put(SettingBoxKey.anonymity, true);
anonymity = true;
SmartDialog.showToast('已设为永久无痕模式');
},
child: Text(
'保存为永久',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
)),
const SizedBox(width: 10),
TextButton(
onPressed: () {
SmartDialog.dismiss();
setting.put(SettingBoxKey.anonymity, false);
anonymity = true;
SmartDialog.showToast('已设为临时无痕模式');
},
child: Text(
'仅本次(默认)',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
)),
]),
])),
// duration: const Duration(seconds: 2),
// showCloseIcon: true,
);
});
),
],
),
],
),
),
// duration: const Duration(seconds: 2),
// showCloseIcon: true,
);
},
);
} else {
setting.put(SettingBoxKey.anonymity, false);
SmartDialog.show(
clickMaskDismiss: false,
usePenetrate: true,
displayTime: const Duration(seconds: 1),
alignment: Alignment.bottomCenter,
builder: (context) {
return ColoredBox(
color: Theme.of(context).colorScheme.secondaryContainer,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
MdiIcons.incognitoOff,
),
const SizedBox(width: 10),
Text('已退出无痕模式',
style: Theme.of(context).textTheme.titleMedium),
],
)));
});
clickMaskDismiss: false,
usePenetrate: true,
displayTime: const Duration(seconds: 1),
alignment: Alignment.bottomCenter,
builder: (context) {
return ColoredBox(
color: Theme.of(context).colorScheme.secondaryContainer,
child: Padding(
padding: EdgeInsets.only(
top: 15,
left: 20,
right: 20,
bottom: MediaQuery.paddingOf(context).bottom + 15,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
MdiIcons.incognitoOff,
),
const SizedBox(width: 10),
Text('已退出无痕模式',
style: Theme.of(context).textTheme.titleMedium),
],
),
),
);
},
);
}
}