mod: 回退平板界面相关视频位置改动(置于右侧),使用Offstage避免全屏时组件尺寸调整到0

This commit is contained in:
orz12
2024-07-11 17:55:54 +08:00
parent c04a9a5eea
commit 712542e0a1

View File

@@ -592,24 +592,24 @@ class _VideoDetailPageState extends State<VideoDetailPage>
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Column( child: Column(
children: [ children: [
Opacity( // Opacity(
opacity: 0, // opacity: 0,
child: SizedBox( // child: SizedBox(
width: context.width, // width: context.width,
height: 0, // height: 0,
child: Obx( // child: Obx(
() => TabBar( // () => TabBar(
controller: videoDetailController.tabCtr, // controller: videoDetailController.tabCtr,
dividerColor: Colors.transparent, // dividerColor: Colors.transparent,
indicatorColor: // indicatorColor:
Theme.of(context).colorScheme.background, // Theme.of(context).colorScheme.background,
tabs: videoDetailController.tabs // tabs: videoDetailController.tabs
.map((String name) => Tab(text: name)) // .map((String name) => Tab(text: name))
.toList(), // .toList(),
), // ),
), // ),
), // ),
), // ),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
@@ -848,6 +848,20 @@ class _VideoDetailPageState extends State<VideoDetailPage>
final double videoWidth = videoHeight * 9 / 16; final double videoWidth = videoHeight * 9 / 16;
return Row( return Row(
children: [ children: [
Expanded(
child: CustomScrollView(
key: PageStorageKey<String>('简介${videoDetailController.bvid}'),
slivers: <Widget>[
if (videoDetailController.videoType == SearchType.video) ...[
VideoIntroPanel(heroTag: heroTag),
RelatedVideoPanel(heroTag: heroTag),
] else if (videoDetailController.videoType ==
SearchType.media_bangumi) ...[
Obx(() => BangumiIntroPanel(
heroTag: heroTag, cid: videoDetailController.cid.value)),
]
],
)),
SizedBox( SizedBox(
height: videoHeight, height: videoHeight,
width: isFullScreen.value == true ? context.width : videoWidth, width: isFullScreen.value == true ? context.width : videoWidth,
@@ -896,23 +910,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
Expanded(
child: Row(children: [
Expanded(
child: CustomScrollView(
key: PageStorageKey<String>('简介${videoDetailController.bvid}'),
slivers: <Widget>[
if (videoDetailController.videoType == SearchType.video) ...[
VideoIntroPanel(heroTag: heroTag),
RelatedVideoPanel(heroTag: heroTag),
] else if (videoDetailController.videoType ==
SearchType.media_bangumi) ...[
Obx(() => BangumiIntroPanel(
heroTag: heroTag,
cid: videoDetailController.cid.value)),
]
],
)),
Expanded( Expanded(
child: Obx( child: Obx(
() => VideoReplyPanel( () => VideoReplyPanel(
@@ -921,8 +918,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag, heroTag: heroTag,
), ),
), ),
) ),
]))
// Expanded( // Expanded(
// child: TabBarView( // child: TabBarView(
// physics: const BouncingScrollPhysics(), // physics: const BouncingScrollPhysics(),
@@ -1019,16 +1015,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
] ]
], ],
))), ))),
SizedBox( Offstage(
width: offstage: isFullScreen.value == true,
isFullScreen.value == true ? context.width : videoWidth, child: SizedBox(
height: isFullScreen.value == true width: videoWidth,
? 0 height: context.height -
: context.height -
videoHeight - videoHeight -
(removeSafeArea (removeSafeArea ? 0 : MediaQuery.of(context).padding.top),
? 0
: MediaQuery.of(context).padding.top),
child: CustomScrollView( child: CustomScrollView(
key: PageStorageKey<String>( key: PageStorageKey<String>(
'简介${videoDetailController.bvid}'), '简介${videoDetailController.bvid}'),
@@ -1036,7 +1029,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (videoDetailController.videoType == if (videoDetailController.videoType ==
SearchType.video) ...[ SearchType.video) ...[
VideoIntroPanel(heroTag: heroTag), VideoIntroPanel(heroTag: heroTag),
RelatedVideoPanel(heroTag: heroTag), // RelatedVideoPanel(heroTag: heroTag),
] else if (videoDetailController.videoType == ] else if (videoDetailController.videoType ==
SearchType.media_bangumi) ...[ SearchType.media_bangumi) ...[
Obx(() => BangumiIntroPanel( Obx(() => BangumiIntroPanel(
@@ -1044,13 +1037,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
cid: videoDetailController.cid.value)), cid: videoDetailController.cid.value)),
] ]
], ],
)) ),
),
),
], ],
), ),
SizedBox( Offstage(
width: isFullScreen.value == true offstage: isFullScreen.value == true,
? 0 child: SizedBox(
: (context.width - width: (context.width -
videoWidth - videoWidth -
(removeSafeArea (removeSafeArea
? 0 ? 0
@@ -1058,17 +1053,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
MediaQuery.of(context).padding.right))), MediaQuery.of(context).padding.right))),
height: context.height - height: context.height -
(removeSafeArea ? 0 : MediaQuery.of(context).padding.top), (removeSafeArea ? 0 : MediaQuery.of(context).padding.top),
child: child: TabBarView(
// TabBarView( physics: const BouncingScrollPhysics(),
// physics: const BouncingScrollPhysics(), controller: videoDetailController.tabCtr,
// controller: videoDetailController.tabCtr, children: <Widget>[
// children: <Widget>[ if (videoDetailController.videoType == SearchType.video)
// if (videoDetailController.videoType == SearchType.video) CustomScrollView(
// const CustomScrollView( slivers: [
// slivers: [ RelatedVideoPanel(heroTag: heroTag),
// RelatedVideoPanel(), ],
// ], ),
// ),
Obx( Obx(
() => VideoReplyPanel( () => VideoReplyPanel(
bvid: videoDetailController.bvid, bvid: videoDetailController.bvid,
@@ -1076,8 +1070,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
heroTag: heroTag, heroTag: heroTag,
), ),
) )
// ], ],
// ), ),
),
) )
], ],
); );