mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-10 03:00:13 +08:00
@@ -57,10 +57,10 @@ class _IntroDetailState extends State<PgcIntroPanel>
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
dividerHeight: 0,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabAlignment: .start,
|
||||
controller: _tabController,
|
||||
dividerColor: Colors.transparent,
|
||||
tabs: const [
|
||||
Tab(text: '详情'),
|
||||
|
||||
@@ -1079,53 +1079,51 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
);
|
||||
}
|
||||
|
||||
final flag = !needIndicator || tabs.length == 1;
|
||||
Widget tabBar() => TabBar(
|
||||
labelColor: flag ? themeData.colorScheme.onSurface : null,
|
||||
indicator: flag ? const BoxDecoration() : null,
|
||||
padding: EdgeInsets.zero,
|
||||
controller: videoDetailController.tabCtr,
|
||||
labelStyle:
|
||||
TabBarTheme.of(context).labelStyle?.copyWith(fontSize: 13) ??
|
||||
const TextStyle(fontSize: 13),
|
||||
labelPadding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
dividerColor: Colors.transparent,
|
||||
dividerHeight: 0,
|
||||
onTap: (value) {
|
||||
void animToTop() {
|
||||
if (onTap != null) {
|
||||
onTap();
|
||||
return;
|
||||
Widget tabBar() {
|
||||
final flag = !needIndicator || tabs.length == 1;
|
||||
return TabBar(
|
||||
padding: .zero,
|
||||
dividerHeight: 0,
|
||||
dividerColor: Colors.transparent,
|
||||
controller: videoDetailController.tabCtr,
|
||||
labelStyle: const TextStyle(fontSize: 13),
|
||||
labelColor: flag ? themeData.colorScheme.onSurface : null,
|
||||
onTap: (value) {
|
||||
void animToTop() {
|
||||
if (onTap != null) {
|
||||
onTap();
|
||||
return;
|
||||
}
|
||||
String text = tabs[value];
|
||||
if (videoDetailController.isFileSource ||
|
||||
text == '简介' ||
|
||||
text == '相关视频') {
|
||||
videoDetailController.introScrollCtr?.animToTop();
|
||||
} else if (text.startsWith('评论')) {
|
||||
_videoReplyController.animateToTop();
|
||||
}
|
||||
}
|
||||
String text = tabs[value];
|
||||
if (videoDetailController.isFileSource ||
|
||||
text == '简介' ||
|
||||
text == '相关视频') {
|
||||
videoDetailController.introScrollCtr?.animToTop();
|
||||
} else if (text.startsWith('评论')) {
|
||||
_videoReplyController.animateToTop();
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
animToTop();
|
||||
} else if (!videoDetailController.tabCtr.indexIsChanging) {
|
||||
animToTop();
|
||||
}
|
||||
},
|
||||
tabs: tabs.map((text) {
|
||||
if (text == '评论') {
|
||||
return Obx(() {
|
||||
final count = _videoReplyController.count.value;
|
||||
return Tab(
|
||||
text: '评论${count == -1 ? '' : ' ${NumUtils.numFormat(count)}'}',
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Tab(text: text);
|
||||
}
|
||||
}).toList(),
|
||||
);
|
||||
if (flag) {
|
||||
animToTop();
|
||||
} else if (!videoDetailController.tabCtr.indexIsChanging) {
|
||||
animToTop();
|
||||
}
|
||||
},
|
||||
tabs: tabs.map((text) {
|
||||
if (text == '评论') {
|
||||
return Obx(() {
|
||||
final count = _videoReplyController.count.value;
|
||||
return Tab(
|
||||
text: '评论${count == -1 ? '' : ' ${NumUtils.numFormat(count)}'}',
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Tab(text: text);
|
||||
}
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
@@ -1142,64 +1140,59 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (tabs.isEmpty)
|
||||
const Spacer()
|
||||
else
|
||||
Flexible(
|
||||
flex: tabs.length == 3 ? 2 : 1,
|
||||
SizedBox(
|
||||
width: tabs.length * 96,
|
||||
child: tabBar(),
|
||||
),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 32,
|
||||
child: TextButton(
|
||||
style: const ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: videoDetailController.showShootDanmakuSheet,
|
||||
child: Text(
|
||||
'发弹幕',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: themeData.colorScheme.onSurfaceVariant,
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: .end,
|
||||
children: [
|
||||
TextButton(
|
||||
style: const ButtonStyle(
|
||||
visualDensity: .compact,
|
||||
padding: WidgetStatePropertyAll(.zero),
|
||||
),
|
||||
onPressed: videoDetailController.showShootDanmakuSheet,
|
||||
child: Text(
|
||||
'发弹幕',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: themeData.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 38,
|
||||
height: 38,
|
||||
child: Obx(
|
||||
() {
|
||||
final ctr = videoDetailController.plPlayerController;
|
||||
final enableShowDanmaku = ctr.enableShowDanmaku.value;
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
final newVal = !enableShowDanmaku;
|
||||
ctr.enableShowDanmaku.value = newVal;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.enableShowDanmaku,
|
||||
newVal,
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
size: 22,
|
||||
enableShowDanmaku
|
||||
? BiliIcons.danmaku_opened
|
||||
: BiliIcons.danmaku_closed,
|
||||
color: enableShowDanmaku
|
||||
? themeData.colorScheme.secondary
|
||||
: themeData.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 38,
|
||||
height: 38,
|
||||
child: Obx(
|
||||
() {
|
||||
final ctr = videoDetailController.plPlayerController;
|
||||
final enableShowDanmaku = ctr.enableShowDanmaku.value;
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
final newVal = !enableShowDanmaku;
|
||||
ctr.enableShowDanmaku.value = newVal;
|
||||
GStorage.setting.put(
|
||||
SettingBoxKey.enableShowDanmaku,
|
||||
newVal,
|
||||
);
|
||||
},
|
||||
icon: Icon(
|
||||
size: 22,
|
||||
enableShowDanmaku
|
||||
? BiliIcons.danmaku_opened
|
||||
: BiliIcons.danmaku_closed,
|
||||
color: enableShowDanmaku
|
||||
? themeData.colorScheme.secondary
|
||||
: themeData.colorScheme.outline,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user