mod: tabbar样式&增加评论数

This commit is contained in:
guozhigq
2024-03-20 00:07:00 +08:00
parent 2985c624ab
commit 79fcd017ab
2 changed files with 73 additions and 58 deletions

View File

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