Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-01 15:17:42 +08:00
parent 5c28376210
commit dd5c2229b3
22 changed files with 182 additions and 177 deletions

View File

@@ -81,10 +81,11 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
fadeCurve: Curves.ease,
sizeCurve: Curves.linear,
);
final isPortrait = context.isPortrait;
return SliverLayoutBuilder(
builder: (context, constraints) {
bool isHorizontal =
context.orientation == Orientation.landscape &&
!isPortrait &&
constraints.crossAxisExtent >
constraints.viewportMainAxisExtent * 1.25;
return SliverPadding(
@@ -125,8 +126,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
() {
if (mid != null) {
feedBack();
if (context.orientation ==
Orientation.landscape &&
if (!isPortrait &&
introController
.horizontalMemberPage) {
widget.onShowMemberPage(mid);
@@ -151,7 +151,14 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
child: Row(
spacing: 25,
children: videoDetail.staff!
.map((e) => _buildStaff(theme, mid, e))
.map(
(e) => _buildStaff(
theme,
isPortrait,
mid,
e,
),
)
.toList(),
),
),
@@ -304,11 +311,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
// 合集
if (!isLoading &&
videoDetail.ugcSeason != null &&
(context.orientation != Orientation.landscape ||
(context.orientation == Orientation.landscape &&
!videoDetailCtr
.plPlayerController
.horizontalSeasonPanel)))
(isPortrait ||
!videoDetailCtr
.plPlayerController
.horizontalSeasonPanel))
SeasonPanel(
heroTag: widget.heroTag,
changeFuc: introController.changeSeasonOrbangu,
@@ -318,11 +324,10 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
if (!isLoading &&
videoDetail.pages != null &&
videoDetail.pages!.length > 1 &&
(context.orientation != Orientation.landscape ||
(context.orientation == Orientation.landscape &&
!videoDetailCtr
.plPlayerController
.horizontalSeasonPanel))) ...[
(isPortrait ||
!videoDetailCtr
.plPlayerController
.horizontalSeasonPanel)) ...[
PagesPanel(
heroTag: widget.heroTag,
videoIntroController: introController,
@@ -701,12 +706,17 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
return TextSpan(children: spanChildren);
}
Widget _buildStaff(ThemeData theme, int? ownerMid, Staff item) {
Widget _buildStaff(
ThemeData theme,
bool isPortrait,
int? ownerMid,
Staff item,
) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (item.mid == ownerMid &&
context.orientation == Orientation.landscape &&
!isPortrait &&
introController.horizontalMemberPage) {
widget.onShowMemberPage(ownerMid);
} else {

View File

@@ -14,6 +14,7 @@ import 'package:PiliPlus/pages/common/common_collapse_slide_page.dart';
import 'package:PiliPlus/pages/video/controller.dart';
import 'package:PiliPlus/plugin/pl_player/controller.dart';
import 'package:PiliPlus/utils/duration_util.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart' show kDebugMode;
@@ -39,10 +40,10 @@ class PostPanel extends CommonCollapseSlidePage {
}
class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
VideoDetailController get videoDetailController =>
late final VideoDetailController videoDetailController =
widget.videoDetailController;
PlPlayerController get plPlayerController => widget.plPlayerController;
List<PostSegmentModel>? get list => videoDetailController.postList;
late final PlPlayerController plPlayerController = widget.plPlayerController;
late final List<PostSegmentModel>? list = videoDetailController.postList;
late final double videoDuration =
plPlayerController.durationSeconds.value.inMilliseconds / 1000;
@@ -95,60 +96,58 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
@override
Widget buildList(ThemeData theme) {
return list?.isNotEmpty == true
? Stack(
clipBehavior: Clip.none,
children: [
SingleChildScrollView(
controller: ScrollController(),
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only(
bottom: 88 + MediaQuery.paddingOf(context).bottom,
),
child: Column(
children: List.generate(
list!.length,
(index) {
return _buildItem(theme, index, list![index]);
},
),
),
),
Positioned(
right: 16,
bottom: 16 + MediaQuery.paddingOf(context).bottom,
child: FloatingActionButton(
tooltip: '提交',
onPressed: () => showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('确定无误再提交'),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(
color: theme.colorScheme.outline,
),
),
),
TextButton(
onPressed: () {
Get.back();
_onPost();
},
child: const Text('确定提交'),
),
],
if (list.isNullOrEmpty) {
return errorWidget();
}
final bottom = MediaQuery.paddingOf(context).bottom;
return Stack(
clipBehavior: Clip.none,
children: [
SingleChildScrollView(
controller: ScrollController(),
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 88 + bottom),
child: Column(
children: List.generate(
list!.length,
(index) {
return _buildItem(theme, index, list![index]);
},
),
),
),
Positioned(
right: 16,
bottom: 16 + bottom,
child: FloatingActionButton(
tooltip: '提交',
onPressed: () => showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('确定无误再提交'),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: theme.colorScheme.outline),
),
),
child: const Icon(Icons.check),
),
TextButton(
onPressed: () {
Get.back();
_onPost();
},
child: const Text('确定提交'),
),
],
),
],
)
: errorWidget();
),
child: const Icon(Icons.check),
),
),
],
);
}
void updateSegment({
@@ -225,9 +224,7 @@ class _PostPanelState extends CommonCollapseSlidePageState<PostPanel> {
content: TextFormField(
initialValue: value,
autofocus: true,
onChanged: (value) {
initV = value;
},
onChanged: (value) => initV = value,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[\d:.]+')),
],

View File

@@ -97,6 +97,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
Widget build(BuildContext context) {
super.build(context);
final theme = Theme.of(context);
final bottom = MediaQuery.paddingOf(context).bottom;
return refreshIndicator(
onRefresh: _videoReplyController.onRefresh,
child: Stack(
@@ -158,13 +159,16 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
),
),
Obx(
() =>
_buildBody(theme, _videoReplyController.loadingState.value),
() => _buildBody(
theme,
bottom,
_videoReplyController.loadingState.value,
),
),
],
),
Positioned(
bottom: MediaQuery.paddingOf(context).bottom + 14,
bottom: bottom + 14,
right: 14,
child: SlideTransition(
position: _videoReplyController.anim,
@@ -188,7 +192,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
);
}
Widget _buildBody(ThemeData theme, LoadingState loadingState) {
Widget _buildBody(ThemeData theme, double bottom, LoadingState loadingState) {
return switch (loadingState) {
Loading() => SliverList.builder(
itemBuilder: (BuildContext context, index) {
@@ -200,7 +204,6 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
response?.isNotEmpty == true
? SliverList.builder(
itemBuilder: (context, index) {
double bottom = MediaQuery.paddingOf(context).bottom;
if (index == response.length) {
_videoReplyController.onLoadMore();
return Container(

View File

@@ -57,9 +57,8 @@ class _VideoReplyReplyPanelState
ReplyInfo? get firstFloor => widget.firstFloor ?? _controller.firstFloor;
bool get _horizontalPreview =>
_controller.horizontalPreview &&
context.orientation == Orientation.landscape;
late Function(List<String> imgList, int index)? _imageCallback;
_controller.horizontalPreview && context.isLandscape;
Function(List<String> imgList, int index)? _imageCallback;
Animation<Color?>? colorAnimation;

View File

@@ -104,12 +104,12 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
return videoDetailController.plPlayerController.horizontalSeasonPanel &&
(videoDetail.ugcSeason != null ||
((videoDetail.pages?.length ?? 0) > 1)) &&
context.orientation == Orientation.landscape;
context.isLandscape;
}
bool get _horizontalPreview =>
videoDetailController.plPlayerController.horizontalPreview &&
context.orientation == Orientation.landscape;
context.isLandscape;
StreamSubscription? _listenerFS;