opt: fav: validate ownership

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-29 16:53:46 +08:00
parent a6cb49fd02
commit 90176a4787
2 changed files with 61 additions and 59 deletions

View File

@@ -339,20 +339,22 @@ class _FavDetailPageState extends State<FavDetailPage> {
loadingState.response[index].id, loadingState.response[index].id,
loadingState.response[index].type, loadingState.response[index].type,
), ),
onTap: onTap: _favDetailController.enableMultiSelect.value
_favDetailController.enableMultiSelect.value.not ? () {
? null
: () {
_favDetailController.onSelect(index);
},
onLongPress: () {
if (_favDetailController
.enableMultiSelect.value.not) {
_favDetailController.enableMultiSelect.value =
true;
_favDetailController.onSelect(index); _favDetailController.onSelect(index);
} }
}, : null,
onLongPress: _favDetailController.isOwner.value
? () {
if (_favDetailController
.enableMultiSelect.value.not) {
_favDetailController
.enableMultiSelect.value = true;
_favDetailController.onSelect(index);
}
}
: null,
isOwner: _favDetailController.isOwner.value,
), ),
), ),
Positioned( Positioned(

View File

@@ -20,6 +20,7 @@ class FavVideoCardH extends StatelessWidget {
final int? searchType; final int? searchType;
final GestureTapCallback? onTap; final GestureTapCallback? onTap;
final GestureLongPressCallback? onLongPress; final GestureLongPressCallback? onLongPress;
final bool isOwner;
const FavVideoCardH({ const FavVideoCardH({
super.key, super.key,
@@ -28,6 +29,7 @@ class FavVideoCardH extends StatelessWidget {
this.searchType, this.searchType,
this.onTap, this.onTap,
this.onLongPress, this.onLongPress,
this.isOwner = false,
}); });
@override @override
@@ -211,8 +213,8 @@ class FavVideoCardH extends StatelessWidget {
), ),
], ],
), ),
searchType != 1 if (searchType != 1 && isOwner)
? Positioned( Positioned(
right: 0, right: 0,
bottom: -4, bottom: -4,
child: IconButton( child: IconButton(
@@ -233,9 +235,8 @@ class FavVideoCardH extends StatelessWidget {
child: Text( child: Text(
'取消', '取消',
style: TextStyle( style: TextStyle(
color: Theme.of(context) color:
.colorScheme Theme.of(context).colorScheme.outline),
.outline),
), ),
), ),
TextButton( TextButton(
@@ -256,8 +257,7 @@ class FavVideoCardH extends StatelessWidget {
size: 18, size: 18,
), ),
), ),
) ),
: const SizedBox(),
], ],
), ),
), ),