mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-26 11:08:44 +00:00
feat: add copy/move support to fav/later search results (#1822)
* feat: add copy/move support to fav/later search results * update Signed-off-by: dom <githubaccount56556@proton.me> --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/http/fav.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/fav_order_type.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_detail/data.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_detail/media.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_folder/list.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
@@ -305,64 +304,48 @@ class _FavDetailPageState extends State<FavDetailPage> with GridMixin {
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> _selectActions(ThemeData theme) => [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
List<Widget> _selectActions(ThemeData theme) {
|
||||
final btnStyle = TextButton.styleFrom(visualDensity: .compact);
|
||||
final textStyle = TextStyle(color: theme.colorScheme.onSurfaceVariant);
|
||||
return [
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => _favDetailController.handleSelect(checked: true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
onPressed: () => _favDetailController.handleSelect(checked: true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.account.mid,
|
||||
),
|
||||
child: Text('复制', style: textStyle),
|
||||
),
|
||||
onPressed: () =>
|
||||
RequestUtils.onCopyOrMove<FavDetailData, FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.account.mid,
|
||||
),
|
||||
child: Text(
|
||||
'复制',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.account.mid,
|
||||
),
|
||||
child: Text('移动', style: textStyle),
|
||||
),
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: _favDetailController.onRemove,
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
onPressed: () =>
|
||||
RequestUtils.onCopyOrMove<FavDetailData, FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.account.mid,
|
||||
),
|
||||
child: Text(
|
||||
'移动',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
onPressed: _favDetailController.onRemove,
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
];
|
||||
const SizedBox(width: 10),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _flexibleSpace(ThemeData theme) {
|
||||
final style = TextStyle(
|
||||
|
||||
@@ -4,7 +4,9 @@ import 'package:PiliPlus/models_new/fav/fav_detail/media.dart';
|
||||
import 'package:PiliPlus/pages/common/search/common_search_page.dart';
|
||||
import 'package:PiliPlus/pages/fav_detail/widget/fav_video_card.dart';
|
||||
import 'package:PiliPlus/pages/fav_search/controller.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -29,6 +31,38 @@ class _FavSearchPageState
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
@override
|
||||
List<Widget>? get multiSelectActions {
|
||||
final btnStyle = TextButton.styleFrom(visualDensity: .compact);
|
||||
final textStyle = TextStyle(
|
||||
color: ColorScheme.of(context).onSurfaceVariant,
|
||||
);
|
||||
return [
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: controller,
|
||||
mediaId: controller.mediaId,
|
||||
mid: Accounts.main.mid,
|
||||
),
|
||||
child: Text('复制', style: textStyle),
|
||||
),
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<FavDetailItemModel>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: controller,
|
||||
mediaId: controller.mediaId,
|
||||
mid: Accounts.main.mid,
|
||||
),
|
||||
child: Text('移动', style: textStyle),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
List<Widget>? get extraActions => [
|
||||
Obx(
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:PiliPlus/common/widgets/gesture/horizontal_drag_gesture_recogniz
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/models/common/later_view_type.dart';
|
||||
import 'package:PiliPlus/models_new/later/data.dart';
|
||||
import 'package:PiliPlus/models_new/later/list.dart';
|
||||
import 'package:PiliPlus/pages/fav_detail/view.dart';
|
||||
import 'package:PiliPlus/pages/later/base_controller.dart';
|
||||
@@ -154,16 +153,17 @@ class _LaterPageState extends State<LaterPage>
|
||||
PreferredSizeWidget _buildAppbar(bool enableMultiSelect) {
|
||||
final theme = Theme.of(context);
|
||||
Color color = theme.colorScheme.secondary;
|
||||
|
||||
final btnStyle = TextButton.styleFrom(visualDensity: .compact);
|
||||
final textStyle = TextStyle(color: theme.colorScheme.onSurfaceVariant);
|
||||
return MultiSelectAppBarWidget(
|
||||
visible: enableMultiSelect,
|
||||
ctr: currCtr(),
|
||||
actions: [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(visualDensity: .compact),
|
||||
style: btnStyle,
|
||||
onPressed: () {
|
||||
final ctr = currCtr();
|
||||
RequestUtils.onCopyOrMove<LaterData, LaterItemModel>(
|
||||
RequestUtils.onCopyOrMove<LaterItemModel>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: ctr,
|
||||
@@ -171,16 +171,13 @@ class _LaterPageState extends State<LaterPage>
|
||||
mid: ctr.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'复制',
|
||||
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
child: Text('复制', style: textStyle),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(visualDensity: .compact),
|
||||
style: btnStyle,
|
||||
onPressed: () {
|
||||
final ctr = currCtr();
|
||||
RequestUtils.onCopyOrMove<LaterData, LaterItemModel>(
|
||||
RequestUtils.onCopyOrMove<LaterItemModel>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: ctr,
|
||||
@@ -188,10 +185,7 @@ class _LaterPageState extends State<LaterPage>
|
||||
mid: ctr.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'移动',
|
||||
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
child: Text('移动', style: textStyle),
|
||||
),
|
||||
],
|
||||
child: AppBar(
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/pages/later/widgets/video_card_h_later.dart';
|
||||
import 'package:PiliPlus/pages/later_search/controller.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -25,6 +26,38 @@ class _LaterSearchPageState
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
|
||||
@override
|
||||
List<Widget>? get multiSelectActions {
|
||||
final btnStyle = TextButton.styleFrom(visualDensity: .compact);
|
||||
final textStyle = TextStyle(
|
||||
color: ColorScheme.of(context).onSurfaceVariant,
|
||||
);
|
||||
return [
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<LaterItemModel>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: controller,
|
||||
mediaId: null,
|
||||
mid: controller.mid,
|
||||
),
|
||||
child: Text('复制', style: textStyle),
|
||||
),
|
||||
TextButton(
|
||||
style: btnStyle,
|
||||
onPressed: () => RequestUtils.onCopyOrMove<LaterItemModel>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: controller,
|
||||
mediaId: null,
|
||||
mid: controller.mid,
|
||||
),
|
||||
child: Text('移动', style: textStyle),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
late final gridDelegate = Grid.videoCardHDelegate(context, minHeight: 110);
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user