mod: 视频详情页简介查看&操作栏
This commit is contained in:
@ -15,6 +15,7 @@ import 'package:pilipala/pages/video/detail/widgets/ai_detail.dart';
|
|||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
import '../widgets/expandable_section.dart';
|
||||||
import 'widgets/action_item.dart';
|
import 'widgets/action_item.dart';
|
||||||
import 'widgets/fav_panel.dart';
|
import 'widgets/fav_panel.dart';
|
||||||
import 'widgets/intro_detail.dart';
|
import 'widgets/intro_detail.dart';
|
||||||
@ -137,6 +138,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
late String memberHeroTag;
|
late String memberHeroTag;
|
||||||
late bool enableAi;
|
late bool enableAi;
|
||||||
bool isProcessing = false;
|
bool isProcessing = false;
|
||||||
|
RxBool isExpand = false.obs;
|
||||||
void Function()? handleState(Future Function() action) {
|
void Function()? handleState(Future Function() action) {
|
||||||
return isProcessing
|
return isProcessing
|
||||||
? null
|
? null
|
||||||
@ -212,13 +214,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
// 视频介绍
|
// 视频介绍
|
||||||
showIntroDetail() {
|
showIntroDetail() {
|
||||||
feedBack();
|
feedBack();
|
||||||
showBottomSheet(
|
isExpand.value = !(isExpand.value);
|
||||||
context: context,
|
|
||||||
enableDrag: true,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return IntroDetail(videoDetail: widget.videoDetail!);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户主页
|
// 用户主页
|
||||||
@ -330,6 +326,16 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
/// 视频简介
|
||||||
|
Obx(
|
||||||
|
() => ExpandedSection(
|
||||||
|
expand: isExpand.value,
|
||||||
|
begin: 0,
|
||||||
|
end: 1,
|
||||||
|
child: IntroDetail(videoDetail: widget.videoDetail!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
/// 点赞收藏转发
|
/// 点赞收藏转发
|
||||||
actionGrid(context, videoIntroController),
|
actionGrid(context, videoIntroController),
|
||||||
// 合集
|
// 合集
|
||||||
@ -438,6 +444,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
margin: const EdgeInsets.only(top: 6, bottom: 4),
|
margin: const EdgeInsets.only(top: 6, bottom: 4),
|
||||||
height: constraints.maxWidth / 5 * 0.8,
|
height: constraints.maxWidth / 5 * 0.8,
|
||||||
child: GridView.count(
|
child: GridView.count(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
primary: false,
|
primary: false,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
crossAxisCount: 5,
|
crossAxisCount: 5,
|
||||||
@ -451,12 +458,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
selectStatus: videoIntroController.hasLike.value,
|
selectStatus: videoIntroController.hasLike.value,
|
||||||
text: widget.videoDetail!.stat!.like!.toString()),
|
text: widget.videoDetail!.stat!.like!.toString()),
|
||||||
),
|
),
|
||||||
// ActionItem(
|
|
||||||
// icon: const Icon(FontAwesomeIcons.clock),
|
|
||||||
// onTap: () => videoIntroController.actionShareVideo(),
|
|
||||||
// selectStatus: false,
|
|
||||||
// loadingStatus: loadingStatus,
|
|
||||||
// text: '稍后再看'),
|
|
||||||
Obx(
|
Obx(
|
||||||
() => ActionItem(
|
() => ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.b),
|
icon: const Icon(FontAwesomeIcons.b),
|
||||||
@ -477,10 +478,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.comment),
|
icon: const Icon(FontAwesomeIcons.clock),
|
||||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
onTap: () => videoIntroController.actionShareVideo(),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
text: widget.videoDetail!.stat!.reply!.toString(),
|
text: '稍后看',
|
||||||
),
|
),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
|
||||||
import 'package:pilipala/utils/storage.dart';
|
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
Box localCache = GStrorage.localCache;
|
|
||||||
late double sheetHeight;
|
|
||||||
|
|
||||||
class IntroDetail extends StatelessWidget {
|
class IntroDetail extends StatelessWidget {
|
||||||
const IntroDetail({
|
const IntroDetail({
|
||||||
super.key,
|
super.key,
|
||||||
@ -20,105 +14,39 @@ class IntroDetail extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
sheetHeight = localCache.get('sheetHeight');
|
return SizedBox(
|
||||||
return Container(
|
width: double.infinity,
|
||||||
color: Theme.of(context).colorScheme.background,
|
child: SelectableRegion(
|
||||||
padding: EdgeInsets.only(
|
focusNode: FocusNode(),
|
||||||
left: 14,
|
selectionControls: MaterialTextSelectionControls(),
|
||||||
right: 14,
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 20),
|
|
||||||
height: sheetHeight,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
InkWell(
|
children: <Widget>[
|
||||||
onTap: () => Get.back(),
|
const SizedBox(height: 4),
|
||||||
child: Container(
|
GestureDetector(
|
||||||
height: 35,
|
onTap: () {
|
||||||
padding: const EdgeInsets.only(bottom: 2),
|
Clipboard.setData(ClipboardData(text: videoDetail!.bvid!));
|
||||||
child: Center(
|
SmartDialog.showToast('已复制');
|
||||||
child: Container(
|
},
|
||||||
width: 32,
|
child: Text(
|
||||||
height: 3,
|
videoDetail!.bvid!,
|
||||||
decoration: BoxDecoration(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
fontSize: 13, color: Theme.of(context).colorScheme.primary),
|
||||||
borderRadius:
|
|
||||||
const BorderRadius.all(Radius.circular(3))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
const SizedBox(height: 4),
|
||||||
child: SingleChildScrollView(
|
Text.rich(
|
||||||
child: Column(
|
style: const TextStyle(height: 1.4),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
buildContent(context, videoDetail!),
|
||||||
videoDetail!.title,
|
],
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
StatView(
|
|
||||||
theme: 'gray',
|
|
||||||
view: videoDetail!.stat!.view,
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
StatDanMu(
|
|
||||||
theme: 'gray',
|
|
||||||
danmu: videoDetail!.stat!.danmaku,
|
|
||||||
size: 'medium',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Text(
|
|
||||||
Utils.dateFormat(videoDetail!.pubdate,
|
|
||||||
formatType: 'detail'),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: SelectableRegion(
|
|
||||||
focusNode: FocusNode(),
|
|
||||||
selectionControls: MaterialTextSelectionControls(),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
videoDetail!.bvid!,
|
|
||||||
style: const TextStyle(fontSize: 13),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Text.rich(
|
|
||||||
style: const TextStyle(
|
|
||||||
height: 1.4,
|
|
||||||
// fontSize: 13,
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
children: [
|
|
||||||
buildContent(context, videoDetail!),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
InlineSpan buildContent(BuildContext context, content) {
|
InlineSpan buildContent(BuildContext context, content) {
|
||||||
|
@ -32,28 +32,14 @@ class _ExpandedSectionState extends State<ExpandedSection>
|
|||||||
_runExpandCheck();
|
_runExpandCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
///Setting up the animation
|
|
||||||
// void prepareAnimations() {
|
|
||||||
// expandController = AnimationController(
|
|
||||||
// vsync: this, duration: const Duration(milliseconds: 500));
|
|
||||||
// animation = CurvedAnimation(
|
|
||||||
// parent: expandController,
|
|
||||||
// curve: Curves.fastOutSlowIn,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
void prepareAnimations() {
|
void prepareAnimations() {
|
||||||
expandController = AnimationController(
|
expandController = AnimationController(
|
||||||
vsync: this, duration: const Duration(milliseconds: 400));
|
vsync: this, duration: const Duration(milliseconds: 400));
|
||||||
Animation<double> curve = CurvedAnimation(
|
Animation<double> curve = CurvedAnimation(
|
||||||
parent: expandController,
|
parent: expandController,
|
||||||
curve: Curves.fastOutSlowIn,
|
curve: Curves.linear,
|
||||||
);
|
);
|
||||||
animation = Tween(begin: widget.begin, end: widget.end).animate(curve);
|
animation = Tween(begin: widget.begin, end: widget.end).animate(curve);
|
||||||
// animation = CurvedAnimation(
|
|
||||||
// parent: expandController,
|
|
||||||
// curve: Curves.fastOutSlowIn,
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _runExpandCheck() {
|
void _runExpandCheck() {
|
||||||
@ -67,7 +53,9 @@ class _ExpandedSectionState extends State<ExpandedSection>
|
|||||||
@override
|
@override
|
||||||
void didUpdateWidget(ExpandedSection oldWidget) {
|
void didUpdateWidget(ExpandedSection oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
_runExpandCheck();
|
if (widget.expand != oldWidget.expand) {
|
||||||
|
_runExpandCheck();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Reference in New Issue
Block a user