Skip to content

Commit

Permalink
mod: tabbar样式&增加评论数
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 21, 2024
1 parent 3701fde commit c216c9b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 56 deletions.
7 changes: 3 additions & 4 deletions lib/pages/video/detail/introduction/controller.dart
Expand Up @@ -85,10 +85,9 @@ class VideoIntroController extends GetxController {
if (videoDetail.value.pages!.isNotEmpty && lastPlayCid.value == 0) {
lastPlayCid.value = videoDetail.value.pages!.first.cid!;
}
// Get.find<VideoDetailController>(tag: heroTag).tabs.value = [
// '简介',
// '评论 ${result['data']!.stat!.reply}'
// ];
final VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: heroTag);
videoDetailCtr.tabs.value = ['简介', '评论 ${result['data']?.stat?.reply}'];
// 获取到粉丝数再返回
await queryUserStat();
}
Expand Down
120 changes: 68 additions & 52 deletions lib/pages/video/detail/view.dart
Expand Up @@ -319,62 +319,78 @@ class _VideoDetailPageState extends State<VideoDetailPage>
),
),
),
child: Row(
children: [
const SizedBox(width: 20),
Expanded(
child: TabBar(
controller: vdCtr.tabCtr,
dividerColor: Colors.transparent,
tabs: vdCtr.tabs.map((String name) => Tab(text: name)).toList(),
child: Material(
child: Row(
children: [
Flexible(
flex: 1,
child: Obx(
() => TabBar(
padding: EdgeInsets.zero,
controller: vdCtr.tabCtr,
labelStyle: const TextStyle(fontSize: 13),
labelPadding:
const EdgeInsets.symmetric(horizontal: 10.0), // 设置每个标签的宽度
dividerColor: Colors.transparent,
tabs: vdCtr.tabs
.map(
(String name) => Flexible(
child: Tab(text: name),
),
)
.toList(),
),
),
),
),
SizedBox(
width: 220,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 32,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
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)),
),
),
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),
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,
),
)),
),
),
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),
],
),
const SizedBox(width: 14),
],
),
),
),
],
)),
],
),
),
);

Expand Down

0 comments on commit c216c9b

Please sign in to comment.