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].type,
),
onTap:
_favDetailController.enableMultiSelect.value.not
? null
: () {
_favDetailController.onSelect(index);
},
onLongPress: () {
if (_favDetailController
.enableMultiSelect.value.not) {
_favDetailController.enableMultiSelect.value =
true;
onTap: _favDetailController.enableMultiSelect.value
? () {
_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(

View File

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