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

View File

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

View File

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

View File

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

View File

@@ -26,7 +26,6 @@ class AnonymityInterceptor extends Interceptor {
Api.getSeasonDetailApi, Api.getSeasonDetailApi,
]; ];
@override @override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) { void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (MineController.anonymity) { if (MineController.anonymity) {

View File

@@ -107,10 +107,15 @@ class MineController extends GetxController {
return ColoredBox( return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
child: Padding( child: Padding(
padding: padding: EdgeInsets.only(
const EdgeInsets.symmetric(vertical: 15, horizontal: 20), top: 15,
child: left: 20,
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[ right: 20,
bottom: MediaQuery.paddingOf(context).bottom + 15,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
@@ -157,13 +162,18 @@ class MineController extends GetxController {
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
)), ),
]), ),
])), ],
),
],
),
),
// duration: const Duration(seconds: 2), // duration: const Duration(seconds: 2),
// showCloseIcon: true, // showCloseIcon: true,
); );
}); },
);
} else { } else {
setting.put(SettingBoxKey.anonymity, false); setting.put(SettingBoxKey.anonymity, false);
SmartDialog.show( SmartDialog.show(
@@ -175,7 +185,12 @@ class MineController extends GetxController {
return ColoredBox( return ColoredBox(
color: Theme.of(context).colorScheme.secondaryContainer, color: Theme.of(context).colorScheme.secondaryContainer,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 20), padding: EdgeInsets.only(
top: 15,
left: 20,
right: 20,
bottom: MediaQuery.paddingOf(context).bottom + 15,
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
@@ -186,8 +201,11 @@ class MineController extends GetxController {
Text('已退出无痕模式', Text('已退出无痕模式',
style: Theme.of(context).textTheme.titleMedium), style: Theme.of(context).textTheme.titleMedium),
], ],
))); ),
}); ),
);
},
);
} }
} }