mod: tabbar样式&增加评论数

This commit is contained in:
guozhigq
2024-03-20 00:07:00 +08:00
parent 3701fdef97
commit c216c9bd65
2 changed files with 73 additions and 58 deletions

View File

@ -85,10 +85,9 @@ class VideoIntroController extends GetxController {
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) { if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
lastPlayCid.value = videoDetail.value.pages!.first.cid!; lastPlayCid.value = videoDetail.value.pages!.first.cid!;
} }
// Get.find<VideoDetailController>(tag: heroTag).tabs.value = [ final VideoDetailController videoDetailCtr =
// '简介', Get.find<VideoDetailController>(tag: heroTag);
// '评论 ${result['data']!.stat!.reply}' videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
// ];
// 获取到粉丝数再返回 // 获取到粉丝数再返回
await queryUserStat(); await queryUserStat();
} }

View File

@ -319,18 +319,31 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
child: Material(
child: Row( child: Row(
children: [ children: [
const SizedBox(width: 20), Flexible(
Expanded( flex: 1,
child: TabBar( child: Obx(
() => TabBar(
padding: EdgeInsets.zero,
controller: vdCtr.tabCtr, controller: vdCtr.tabCtr,
labelStyle: const TextStyle(fontSize: 13),
labelPadding:
const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
tabs: vdCtr.tabs.map((String name) => Tab(text: name)).toList(), tabs: vdCtr.tabs
.map(
(String name) => Flexible(
child: Tab(text: name),
),
)
.toList(),
), ),
), ),
SizedBox( ),
width: 220, Flexible(
flex: 1,
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -342,7 +355,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
padding: MaterialStateProperty.all(EdgeInsets.zero), padding: MaterialStateProperty.all(EdgeInsets.zero),
), ),
onPressed: () => vdCtr.showShootDanmakuSheet(), onPressed: () => vdCtr.showShootDanmakuSheet(),
child: const Text('发弹幕', style: TextStyle(fontSize: 12)), child:
const Text('发弹幕', style: TextStyle(fontSize: 12)),
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
@ -355,13 +369,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
onPressed: () { onPressed: () {
plPlayerController?.isOpenDanmu.value = plPlayerController?.isOpenDanmu.value =
!(plPlayerController?.isOpenDanmu.value ?? false); !(plPlayerController?.isOpenDanmu.value ??
false);
}, },
child: Obx(() => Text( child: Obx(() => Text(
'', '',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: (plPlayerController?.isOpenDanmu.value ?? color: (plPlayerController
?.isOpenDanmu.value ??
false) false)
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline, : Theme.of(context).colorScheme.outline,
@ -372,10 +388,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
const SizedBox(width: 14), const SizedBox(width: 14),
], ],
), ),
), )),
),
], ],
), ),
),
); );
/// 手动播放 /// 手动播放