mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: fav sheet
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -17,7 +17,6 @@ import 'package:PiliPlus/pages/bangumi/widgets/bangumi_panel.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/index.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/action_item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/action_row_item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/fav_panel.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
|
||||
import '../../../utils/utils.dart';
|
||||
@@ -185,42 +184,13 @@ class _BangumiInfoState extends State<BangumiInfo>
|
||||
if (type == 'tap') {
|
||||
bangumiIntroController.actionFavVideo(type: 'default');
|
||||
} else {
|
||||
_showFavBottomSheet();
|
||||
Utils.showFavBottomSheet(context: context, ctr: bangumiIntroController);
|
||||
}
|
||||
} else if (type != 'longPress') {
|
||||
_showFavBottomSheet();
|
||||
Utils.showFavBottomSheet(context: context, ctr: bangumiIntroController);
|
||||
}
|
||||
}
|
||||
|
||||
_showFavBottomSheet() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
transitionAnimationController: AnimationController(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: this,
|
||||
),
|
||||
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
||||
builder: (BuildContext context) {
|
||||
return DraggableScrollableSheet(
|
||||
minChildSize: 0,
|
||||
maxChildSize: 1,
|
||||
initialChildSize: 0.7,
|
||||
snap: true,
|
||||
expand: false,
|
||||
snapSizes: const [0.7],
|
||||
builder: (BuildContext context, ScrollController scrollController) {
|
||||
return FavPanel(
|
||||
ctr: bangumiIntroController,
|
||||
scrollController: scrollController,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 视频介绍
|
||||
showIntroDetail() {
|
||||
feedBack();
|
||||
|
||||
@@ -27,7 +27,6 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
|
||||
|
||||
import 'widgets/action_item.dart';
|
||||
import 'widgets/action_row_item.dart';
|
||||
import 'widgets/fav_panel.dart';
|
||||
import 'widgets/page.dart';
|
||||
import 'widgets/season.dart';
|
||||
|
||||
@@ -244,33 +243,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
}
|
||||
}
|
||||
|
||||
void _showFavBottomSheet() => showModalBottomSheet(
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
transitionAnimationController: AnimationController(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: this,
|
||||
),
|
||||
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
||||
builder: (BuildContext context) {
|
||||
return DraggableScrollableSheet(
|
||||
minChildSize: 0,
|
||||
maxChildSize: 1,
|
||||
initialChildSize: 0.7,
|
||||
snap: true,
|
||||
expand: false,
|
||||
snapSizes: const [0.7],
|
||||
builder: (BuildContext context, ScrollController scrollController) {
|
||||
return FavPanel(
|
||||
ctr: videoIntroController,
|
||||
scrollController: scrollController,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// 收藏
|
||||
showFavBottomSheet({type = 'tap'}) {
|
||||
if (videoIntroController.userInfo == null) {
|
||||
@@ -284,10 +256,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
if (type == 'tap') {
|
||||
videoIntroController.actionFavVideo(type: 'default');
|
||||
} else {
|
||||
_showFavBottomSheet();
|
||||
Utils.showFavBottomSheet(context: context, ctr: videoIntroController);
|
||||
}
|
||||
} else if (type != 'longPress') {
|
||||
_showFavBottomSheet();
|
||||
Utils.showFavBottomSheet(context: context, ctr: videoIntroController);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class _FavPanelState extends State<FavPanel> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_futureBuilderFuture = widget.ctr!.queryVideoInFolder();
|
||||
_futureBuilderFuture = widget.ctr.queryVideoInFolder();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -98,7 +98,7 @@ class _FavPanelState extends State<FavPanel> {
|
||||
isSliver: false,
|
||||
callback: () => setState(() {
|
||||
_futureBuilderFuture =
|
||||
widget.ctr!.queryVideoInFolder();
|
||||
widget.ctr.queryVideoInFolder();
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -108,33 +108,33 @@ class _FavPanelState extends State<FavPanel> {
|
||||
() => ListView.builder(
|
||||
controller: widget.scrollController,
|
||||
itemCount:
|
||||
widget.ctr!.favFolderData.value.list!.length,
|
||||
widget.ctr.favFolderData.value.list.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
onTap: () => widget.ctr!.onChoose(
|
||||
widget.ctr!.favFolderData.value.list![index]
|
||||
onTap: () => widget.ctr.onChoose(
|
||||
widget.ctr.favFolderData.value.list[index]
|
||||
.favState !=
|
||||
1,
|
||||
index),
|
||||
dense: true,
|
||||
leading: Utils.isPublic(widget.ctr!
|
||||
.favFolderData.value.list![index].attr)
|
||||
leading: Utils.isPublic(widget.ctr.favFolderData
|
||||
.value.list[index].attr)
|
||||
? const Icon(Icons.folder_outlined)
|
||||
: const Icon(Icons.lock_outline),
|
||||
minLeadingWidth: 0,
|
||||
title: Text(widget.ctr!.favFolderData.value
|
||||
.list![index].title!),
|
||||
title: Text(widget.ctr.favFolderData.value
|
||||
.list[index].title!),
|
||||
subtitle: Text(
|
||||
'${widget.ctr!.favFolderData.value.list![index].mediaCount}个内容 . ${Utils.isPublicText(widget.ctr!.favFolderData.value.list![index].attr)}',
|
||||
'${widget.ctr.favFolderData.value.list[index].mediaCount}个内容 . ${Utils.isPublicText(widget.ctr.favFolderData.value.list[index].attr)}',
|
||||
),
|
||||
trailing: Transform.scale(
|
||||
scale: 0.9,
|
||||
child: Checkbox(
|
||||
value: widget.ctr!.favFolderData.value
|
||||
.list![index].favState ==
|
||||
value: widget.ctr.favFolderData.value
|
||||
.list[index].favState ==
|
||||
1,
|
||||
onChanged: (bool? checkValue) => widget.ctr!
|
||||
.onChoose(checkValue!, index),
|
||||
onChanged: (bool? checkValue) =>
|
||||
widget.ctr.onChoose(checkValue!, index),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -149,7 +149,7 @@ class _FavPanelState extends State<FavPanel> {
|
||||
errMsg: data['msg'],
|
||||
callback: () => setState(() {
|
||||
_futureBuilderFuture =
|
||||
widget.ctr!.queryVideoInFolder();
|
||||
widget.ctr.queryVideoInFolder();
|
||||
}),
|
||||
)
|
||||
],
|
||||
@@ -198,7 +198,7 @@ class _FavPanelState extends State<FavPanel> {
|
||||
FilledButton.tonal(
|
||||
onPressed: () async {
|
||||
feedBack();
|
||||
await widget.ctr!.actionFavVideo();
|
||||
await widget.ctr.actionFavVideo();
|
||||
},
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'package:PiliPlus/models/bangumi/info.dart';
|
||||
import 'package:PiliPlus/models/common/search_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/models/live/item.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/fav_panel.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
@@ -38,6 +39,34 @@ class Utils {
|
||||
|
||||
static const channel = MethodChannel("PiliPlus");
|
||||
|
||||
static void showFavBottomSheet({
|
||||
required BuildContext context,
|
||||
required dynamic ctr,
|
||||
}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
||||
builder: (BuildContext context) {
|
||||
return DraggableScrollableSheet(
|
||||
minChildSize: 0,
|
||||
maxChildSize: 1,
|
||||
initialChildSize: 0.7,
|
||||
snap: true,
|
||||
expand: false,
|
||||
snapSizes: const [0.7],
|
||||
builder: (BuildContext context, ScrollController scrollController) {
|
||||
return FavPanel(
|
||||
ctr: ctr,
|
||||
scrollController: scrollController,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static String buildShadersAbsolutePath(
|
||||
String baseDirectory, List<String> shaders) {
|
||||
List<String> absolutePaths = shaders.map((shader) {
|
||||
@@ -402,10 +431,6 @@ class Utils {
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
// transitionAnimationController: AnimationController(
|
||||
// duration: const Duration(milliseconds: 200),
|
||||
// vsync: this,
|
||||
// ),
|
||||
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
||||
builder: (BuildContext context) {
|
||||
return DraggableScrollableSheet(
|
||||
|
||||
Reference in New Issue
Block a user