mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-02 00:58:19 +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/index.dart';
|
||||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/action_item.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/action_row_item.dart';
|
||||||
import 'package:PiliPlus/pages/video/detail/introduction/widgets/fav_panel.dart';
|
|
||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
|
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
@@ -185,42 +184,13 @@ class _BangumiInfoState extends State<BangumiInfo>
|
|||||||
if (type == 'tap') {
|
if (type == 'tap') {
|
||||||
bangumiIntroController.actionFavVideo(type: 'default');
|
bangumiIntroController.actionFavVideo(type: 'default');
|
||||||
} else {
|
} else {
|
||||||
_showFavBottomSheet();
|
Utils.showFavBottomSheet(context: context, ctr: bangumiIntroController);
|
||||||
}
|
}
|
||||||
} else if (type != 'longPress') {
|
} 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() {
|
showIntroDetail() {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
|
|||||||
|
|
||||||
import 'widgets/action_item.dart';
|
import 'widgets/action_item.dart';
|
||||||
import 'widgets/action_row_item.dart';
|
import 'widgets/action_row_item.dart';
|
||||||
import 'widgets/fav_panel.dart';
|
|
||||||
import 'widgets/page.dart';
|
import 'widgets/page.dart';
|
||||||
import 'widgets/season.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'}) {
|
showFavBottomSheet({type = 'tap'}) {
|
||||||
if (videoIntroController.userInfo == null) {
|
if (videoIntroController.userInfo == null) {
|
||||||
@@ -284,10 +256,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
if (type == 'tap') {
|
if (type == 'tap') {
|
||||||
videoIntroController.actionFavVideo(type: 'default');
|
videoIntroController.actionFavVideo(type: 'default');
|
||||||
} else {
|
} else {
|
||||||
_showFavBottomSheet();
|
Utils.showFavBottomSheet(context: context, ctr: videoIntroController);
|
||||||
}
|
}
|
||||||
} else if (type != 'longPress') {
|
} else if (type != 'longPress') {
|
||||||
_showFavBottomSheet();
|
Utils.showFavBottomSheet(context: context, ctr: videoIntroController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_futureBuilderFuture = widget.ctr!.queryVideoInFolder();
|
_futureBuilderFuture = widget.ctr.queryVideoInFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -98,7 +98,7 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
isSliver: false,
|
isSliver: false,
|
||||||
callback: () => setState(() {
|
callback: () => setState(() {
|
||||||
_futureBuilderFuture =
|
_futureBuilderFuture =
|
||||||
widget.ctr!.queryVideoInFolder();
|
widget.ctr.queryVideoInFolder();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -108,33 +108,33 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
() => ListView.builder(
|
() => ListView.builder(
|
||||||
controller: widget.scrollController,
|
controller: widget.scrollController,
|
||||||
itemCount:
|
itemCount:
|
||||||
widget.ctr!.favFolderData.value.list!.length,
|
widget.ctr.favFolderData.value.list.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
onTap: () => widget.ctr!.onChoose(
|
onTap: () => widget.ctr.onChoose(
|
||||||
widget.ctr!.favFolderData.value.list![index]
|
widget.ctr.favFolderData.value.list[index]
|
||||||
.favState !=
|
.favState !=
|
||||||
1,
|
1,
|
||||||
index),
|
index),
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: Utils.isPublic(widget.ctr!
|
leading: Utils.isPublic(widget.ctr.favFolderData
|
||||||
.favFolderData.value.list![index].attr)
|
.value.list[index].attr)
|
||||||
? const Icon(Icons.folder_outlined)
|
? const Icon(Icons.folder_outlined)
|
||||||
: const Icon(Icons.lock_outline),
|
: const Icon(Icons.lock_outline),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
title: Text(widget.ctr!.favFolderData.value
|
title: Text(widget.ctr.favFolderData.value
|
||||||
.list![index].title!),
|
.list[index].title!),
|
||||||
subtitle: Text(
|
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(
|
trailing: Transform.scale(
|
||||||
scale: 0.9,
|
scale: 0.9,
|
||||||
child: Checkbox(
|
child: Checkbox(
|
||||||
value: widget.ctr!.favFolderData.value
|
value: widget.ctr.favFolderData.value
|
||||||
.list![index].favState ==
|
.list[index].favState ==
|
||||||
1,
|
1,
|
||||||
onChanged: (bool? checkValue) => widget.ctr!
|
onChanged: (bool? checkValue) =>
|
||||||
.onChoose(checkValue!, index),
|
widget.ctr.onChoose(checkValue!, index),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -149,7 +149,7 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
errMsg: data['msg'],
|
errMsg: data['msg'],
|
||||||
callback: () => setState(() {
|
callback: () => setState(() {
|
||||||
_futureBuilderFuture =
|
_futureBuilderFuture =
|
||||||
widget.ctr!.queryVideoInFolder();
|
widget.ctr.queryVideoInFolder();
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -198,7 +198,7 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
feedBack();
|
feedBack();
|
||||||
await widget.ctr!.actionFavVideo();
|
await widget.ctr.actionFavVideo();
|
||||||
},
|
},
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
padding: const EdgeInsets.symmetric(
|
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/common/search_type.dart';
|
||||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||||
import 'package:PiliPlus/models/live/item.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/pages/video/detail/introduction/widgets/group_panel.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:PiliPlus/utils/feed_back.dart';
|
import 'package:PiliPlus/utils/feed_back.dart';
|
||||||
@@ -38,6 +39,34 @@ class Utils {
|
|||||||
|
|
||||||
static const channel = MethodChannel("PiliPlus");
|
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(
|
static String buildShadersAbsolutePath(
|
||||||
String baseDirectory, List<String> shaders) {
|
String baseDirectory, List<String> shaders) {
|
||||||
List<String> absolutePaths = shaders.map((shader) {
|
List<String> absolutePaths = shaders.map((shader) {
|
||||||
@@ -402,10 +431,6 @@ class Utils {
|
|||||||
context: context,
|
context: context,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
// transitionAnimationController: AnimationController(
|
|
||||||
// duration: const Duration(milliseconds: 200),
|
|
||||||
// vsync: this,
|
|
||||||
// ),
|
|
||||||
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
sheetAnimationStyle: AnimationStyle(curve: Curves.ease),
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return DraggableScrollableSheet(
|
return DraggableScrollableSheet(
|
||||||
|
|||||||
Reference in New Issue
Block a user