mod: 关注按钮

This commit is contained in:
guozhigq
2024-04-30 15:49:00 +08:00
parent 538cc1a530
commit 828c913199

View File

@ -135,7 +135,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
late double sheetHeight; late double sheetHeight;
late final dynamic owner; late final dynamic owner;
late final dynamic follower; late final dynamic follower;
late final dynamic followStatus;
late int mid; late int mid;
late String memberHeroTag; late String memberHeroTag;
late bool enableAi; late bool enableAi;
@ -164,7 +163,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
owner = widget.videoDetail!.owner; owner = widget.videoDetail!.owner;
follower = Utils.numFormat(videoIntroController.userStat['follower']); follower = Utils.numFormat(videoIntroController.userStat['follower']);
followStatus = videoIntroController.followStatus;
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true); enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
_expandableCtr = ExpandableController(initialExpanded: false); _expandableCtr = ExpandableController(initialExpanded: false);
} }
@ -429,60 +427,41 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
fadeInDuration: Duration.zero, fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero, fadeOutDuration: Duration.zero,
), ),
const SizedBox(width: 10),
Text(owner.name, style: const TextStyle(fontSize: 13)),
const SizedBox(width: 6),
Text(
follower,
style: TextStyle(
fontSize: t.textTheme.labelSmall!.fontSize,
color: outline,
),
),
const Spacer(), const Spacer(),
Obx( Obx(
() => AnimatedOpacity( () {
opacity: final bool isFollowed =
videoIntroController.followStatus.isEmpty ? 0 : 1, videoIntroController.followStatus['attribute'] != 0;
duration: const Duration(milliseconds: 50), return videoIntroController.followStatus.isEmpty
child: SizedBox( ? const SizedBox()
height: 32, : SizedBox(
child: Obx( height: 32,
() => videoIntroController.followStatus.isNotEmpty child: TextButton(
? TextButton( onPressed:
onPressed: videoIntroController.actionRelationMod,
videoIntroController.actionRelationMod, style: TextButton.styleFrom(
style: TextButton.styleFrom( padding: const EdgeInsets.only(
padding: const EdgeInsets.only( left: 8,
left: 8, right: 8), right: 8,
foregroundColor:
followStatus['attribute'] != 0
? outline
: t.colorScheme.onPrimary,
backgroundColor:
followStatus['attribute'] != 0
? t.colorScheme.onInverseSurface
: t.colorScheme
.primary, // 设置按钮背景色
), ),
child: Text( foregroundColor: isFollowed
followStatus['attribute'] != 0 ? outline
? '已关注' : t.colorScheme.onPrimary,
: '关注', backgroundColor: isFollowed
style: TextStyle( ? t.colorScheme.onInverseSurface
fontSize: t : t.colorScheme.primary, // 设置按钮背景色
.textTheme.labelMedium!.fontSize),
),
)
: ElevatedButton(
onPressed:
videoIntroController.actionRelationMod,
child: const Text('关注'),
), ),
), child: Text(
), isFollowed ? '已关注' : '关注',
), style: TextStyle(
), fontSize:
t.textTheme.labelMedium!.fontSize,
),
),
),
);
},
)
], ],
), ),
), ),