mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-27 11:38:40 +00:00
feat: copy/move fav
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/radio_widget.dart';
|
||||
import 'package:PiliPlus/http/index.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/member/view.dart' show radioWidget;
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
@@ -17,6 +17,8 @@ class FavDetailController extends MultiSelectController {
|
||||
RxBool isOwner = false.obs;
|
||||
RxBool titleCtr = false.obs;
|
||||
|
||||
dynamic mid;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// item = Get.arguments;
|
||||
@@ -26,6 +28,8 @@ class FavDetailController extends MultiSelectController {
|
||||
}
|
||||
super.onInit();
|
||||
|
||||
mid = GStorage.userInfo.get('userInfoCache')?.mid;
|
||||
|
||||
queryData();
|
||||
}
|
||||
|
||||
@@ -33,8 +37,7 @@ class FavDetailController extends MultiSelectController {
|
||||
bool customHandleResponse(Success response) {
|
||||
if (currentPage == 1) {
|
||||
item.value = response.response.info;
|
||||
isOwner.value = response.response.info.mid ==
|
||||
GStorage.userInfo.get('userInfoCache')?.mid;
|
||||
isOwner.value = response.response.info.mid == mid;
|
||||
}
|
||||
if (response.response.medias.isEmpty) {
|
||||
isEnd = true;
|
||||
|
||||
@@ -111,11 +111,57 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
actions: _favDetailController.enableMultiSelect.value
|
||||
? [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.handleSelect(true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => Utils.onCopyOrMove(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
),
|
||||
child: Text(
|
||||
'复制到',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => Utils.onCopyOrMove(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
),
|
||||
child: Text(
|
||||
'移动到',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.onDelChecked(context),
|
||||
child: Text(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/radio_widget.dart';
|
||||
import 'package:PiliPlus/http/member.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
@@ -649,27 +650,3 @@ Widget _checkBoxWidget(
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget radioWidget<T>({
|
||||
required T value,
|
||||
T? groupValue,
|
||||
required ValueChanged onChanged,
|
||||
required String title,
|
||||
double? paddingStart,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () => onChanged(value),
|
||||
child: Row(
|
||||
children: [
|
||||
if (paddingStart != null) SizedBox(width: paddingStart),
|
||||
Radio(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: onChanged,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
Text(title),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user