mod: 关注按钮

This commit is contained in:
guozhigq
2024-04-30 15:49:00 +08:00
parent 935073ce75
commit bab0985e86

View File

@ -134,7 +134,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;
@ -163,7 +162,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);
} }
@ -434,47 +432,39 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
const Spacer(), const Spacer(),
Obx(() => AnimatedOpacity( Obx(
opacity: () {
videoIntroController.followStatus.isEmpty ? 0 : 1, final bool isFollowed =
duration: const Duration(milliseconds: 50), videoIntroController.followStatus['attribute'] != 0;
child: SizedBox( return videoIntroController.followStatus.isEmpty
height: 32, ? const SizedBox()
child: Obx( : SizedBox(
() => videoIntroController.followStatus.isNotEmpty height: 32,
? TextButton( child: TextButton(
onPressed: onPressed:
videoIntroController.actionRelationMod, videoIntroController.actionRelationMod,
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8, right: 8), left: 8,
foregroundColor: right: 8,
followStatus['attribute'] != 0
? outline
: t.colorScheme.onPrimary,
backgroundColor:
followStatus['attribute'] != 0
? t.colorScheme.onInverseSurface
: t.colorScheme
.primary, // 设置按钮背景色
),
child: Text(
followStatus['attribute'] != 0
? '已关注'
: '关注',
style: TextStyle(
fontSize: t
.textTheme.labelMedium!.fontSize),
),
)
: ElevatedButton(
onPressed:
videoIntroController.actionRelationMod,
child: const Text('关注'),
), ),
), foregroundColor: isFollowed
), ? outline
)), : t.colorScheme.onPrimary,
backgroundColor: isFollowed
? t.colorScheme.onInverseSurface
: t.colorScheme.primary, // 设置按钮背景色
),
child: Text(
isFollowed ? '已关注' : '关注',
style: TextStyle(
fontSize: t.textTheme.labelMedium!.fontSize,
),
),
),
);
},
)
], ],
), ),
), ),