mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: more slide dismiss pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/pages/common/common_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/controller.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/models/video/ai.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/index.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
class AiDetail extends StatelessWidget {
|
||||
class AiDetail extends CommonSlidePage {
|
||||
final ModelResult modelResult;
|
||||
|
||||
const AiDetail({
|
||||
@@ -16,157 +17,10 @@ class AiDetail extends StatelessWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
// height: Utils.getSheetHeight(context),
|
||||
child: Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: Get.back,
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
if (modelResult.summary?.isNotEmpty == true) ...[
|
||||
SelectableText(
|
||||
'总结: ${modelResult.summary}',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
if (modelResult.outline?.isNotEmpty == true)
|
||||
Divider(
|
||||
height: 20,
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
thickness: 6,
|
||||
)
|
||||
],
|
||||
if (modelResult.outline?.isNotEmpty == true)
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: modelResult.outline!.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
SelectableText(
|
||||
modelResult.outline![index].title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
if (modelResult
|
||||
.outline![index].partOutline?.isNotEmpty ==
|
||||
true)
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: modelResult
|
||||
.outline![index].partOutline!.length,
|
||||
itemBuilder: (context, i) {
|
||||
return Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Wrap(
|
||||
children: [
|
||||
SelectableText.rich(
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface,
|
||||
height: 1.5,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: Utils.tampToSeektime(
|
||||
modelResult
|
||||
.outline![index]
|
||||
.partOutline![i]
|
||||
.timestamp!),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
recognizer:
|
||||
TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 跳转到指定位置
|
||||
try {
|
||||
Get.find<VideoDetailController>(
|
||||
tag: Get.arguments[
|
||||
'heroTag'])
|
||||
.plPlayerController
|
||||
.seekTo(
|
||||
Duration(
|
||||
seconds: Utils
|
||||
.duration(
|
||||
Utils.tampToSeektime(modelResult
|
||||
.outline![index]
|
||||
.partOutline![i]
|
||||
.timestamp!)
|
||||
.toString(),
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
const TextSpan(text: ' '),
|
||||
TextSpan(
|
||||
text: modelResult
|
||||
.outline![index]
|
||||
.partOutline![i]
|
||||
.content!),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
State<AiDetail> createState() => _AiDetailState();
|
||||
}
|
||||
|
||||
class _AiDetailState extends CommonSlidePageState<AiDetail> {
|
||||
InlineSpan buildContent(BuildContext context, content) {
|
||||
List descV2 = content.descV2;
|
||||
// type
|
||||
@@ -233,4 +87,158 @@ class AiDetail extends StatelessWidget {
|
||||
});
|
||||
return TextSpan(children: spanChildren);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget get buildPage => Container(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: Get.back,
|
||||
child: Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: enableSlide ? slideList() : buildList,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget get buildList => SingleChildScrollView(
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
if (widget.modelResult.summary?.isNotEmpty == true) ...[
|
||||
SelectableText(
|
||||
'总结: ${widget.modelResult.summary}',
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
if (widget.modelResult.outline?.isNotEmpty == true)
|
||||
Divider(
|
||||
height: 20,
|
||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||
thickness: 6,
|
||||
)
|
||||
],
|
||||
if (widget.modelResult.outline?.isNotEmpty == true)
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: widget.modelResult.outline!.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
SelectableText(
|
||||
widget.modelResult.outline![index].title!,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
if (widget.modelResult.outline![index].partOutline
|
||||
?.isNotEmpty ==
|
||||
true)
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: widget
|
||||
.modelResult.outline![index].partOutline!.length,
|
||||
itemBuilder: (context, i) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Wrap(
|
||||
children: [
|
||||
SelectableText.rich(
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurface,
|
||||
height: 1.5,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: Utils.tampToSeektime(widget
|
||||
.modelResult
|
||||
.outline![index]
|
||||
.partOutline![i]
|
||||
.timestamp!),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 跳转到指定位置
|
||||
try {
|
||||
Get.find<VideoDetailController>(
|
||||
tag: Get.arguments[
|
||||
'heroTag'])
|
||||
.plPlayerController
|
||||
.seekTo(
|
||||
Duration(
|
||||
seconds:
|
||||
Utils.duration(
|
||||
Utils.tampToSeektime(widget
|
||||
.modelResult
|
||||
.outline![
|
||||
index]
|
||||
.partOutline![
|
||||
i]
|
||||
.timestamp!)
|
||||
.toString(),
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
const TextSpan(text: ' '),
|
||||
TextSpan(
|
||||
text: widget
|
||||
.modelResult
|
||||
.outline![index]
|
||||
.partOutline![i]
|
||||
.content!),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
/// 设置面板
|
||||
void showSettingSheet() {
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
@@ -162,7 +162,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
widget.videoDetailCtr.showNoteList();
|
||||
widget.videoDetailCtr.showNoteList(context);
|
||||
},
|
||||
leading: const Icon(Icons.note_alt_outlined, size: 20),
|
||||
title: const Text('查看笔记', style: titleStyle),
|
||||
@@ -570,7 +570,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
void scheduleExit() async {
|
||||
const List<int> scheduleTimeChoices = [0, 15, 30, 45, 60];
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
return Container(
|
||||
@@ -778,7 +778,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
}
|
||||
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
@@ -882,7 +882,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
final AudioQuality currentAudioQa = widget.videoDetailCtr.currentAudioQa!;
|
||||
final List<AudioItem> audio = videoInfo.dash!.audio!;
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
@@ -973,7 +973,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
}
|
||||
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
@@ -1082,7 +1082,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
final DanmakuController? danmakuController =
|
||||
widget.controller.danmakuController;
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
padding: isFullScreen ? 70 : null,
|
||||
child: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
@@ -1702,7 +1702,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
/// 播放顺序
|
||||
void showSetRepeat() async {
|
||||
Utils.showFSSheet(
|
||||
isFullScreen: isFullScreen,
|
||||
isFullScreen: () => isFullScreen,
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/danmu.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/view.dart';
|
||||
import 'package:PiliPlus/pages/common/common_slide_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -14,7 +15,7 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
class MediaListPanel extends StatefulWidget {
|
||||
class MediaListPanel extends CommonSlidePage {
|
||||
const MediaListPanel({
|
||||
super.key,
|
||||
required this.mediaList,
|
||||
@@ -42,7 +43,7 @@ class MediaListPanel extends StatefulWidget {
|
||||
State<MediaListPanel> createState() => _MediaListPanelState();
|
||||
}
|
||||
|
||||
class _MediaListPanelState extends State<MediaListPanel> {
|
||||
class _MediaListPanelState extends CommonSlidePageState<MediaListPanel> {
|
||||
final _scrollController = ItemScrollController();
|
||||
late RxBool desc;
|
||||
|
||||
@@ -62,7 +63,7 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget get buildPage {
|
||||
return Column(
|
||||
children: [
|
||||
AppBar(
|
||||
@@ -92,19 +93,22 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: widget.loadPrevious != null
|
||||
? refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await widget.loadPrevious!();
|
||||
},
|
||||
child: _buildList,
|
||||
)
|
||||
: _buildList,
|
||||
child: enableSlide ? slideList() : buildList,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget get buildList => widget.loadPrevious != null
|
||||
? refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await widget.loadPrevious!();
|
||||
},
|
||||
child: _buildList,
|
||||
)
|
||||
: _buildList;
|
||||
|
||||
Widget get _buildList => Obx(
|
||||
() => ScrollablePositionedList.builder(
|
||||
itemScrollController: _scrollController,
|
||||
|
||||
Reference in New Issue
Block a user