fix: member status on video intro

This commit is contained in:
bggRGjQaUbCoE
2024-10-24 10:37:13 +08:00
parent 61a0a498bb
commit 4431ed09c0
2 changed files with 45 additions and 28 deletions

View File

@@ -507,6 +507,20 @@ class VideoIntroController extends GetxController
SmartDialog.showToast('账号未登录'); SmartDialog.showToast('账号未登录');
return; return;
} }
int attr = followStatus['attribute'] ?? 0;
if (attr == 128) {
dynamic res = await VideoHttp.relationMod(
mid: videoDetail.value.owner?.mid ?? -1,
act: attr != 128 ? 5 : 6,
reSrc: 11,
);
if (res['status']) {
followStatus['attribute'] = 0;
followStatus.refresh();
}
return;
}
if (context.mounted) {
Utils.actionRelationMod( Utils.actionRelationMod(
context: context, context: context,
mid: videoDetail.value.owner?.mid, mid: videoDetail.value.owner?.mid,
@@ -516,6 +530,7 @@ class VideoIntroController extends GetxController
followStatus.refresh(); followStatus.refresh();
}, },
); );
}
// MemberController _ = Get.put<MemberController>(MemberController(mid: mid), // MemberController _ = Get.put<MemberController>(MemberController(mid: mid),
// tag: mid.toString()); // tag: mid.toString());

View File

@@ -545,26 +545,28 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
Obx followButton(BuildContext context, ThemeData t) { Obx followButton(BuildContext context, ThemeData t) {
return Obx( return Obx(
() => TextButton( () {
int attr = videoIntroController.followStatus['attribute'] ?? 0;
return TextButton(
onPressed: () => videoIntroController.actionRelationMod(context), onPressed: () => videoIntroController.actionRelationMod(context),
style: TextButton.styleFrom( style: TextButton.styleFrom(
visualDensity: const VisualDensity(horizontal: -2, vertical: -3), visualDensity: const VisualDensity(horizontal: -2, vertical: -3),
foregroundColor: foregroundColor:
(videoIntroController.followStatus['attribute'] ?? 0) != 0 attr != 0 ? t.colorScheme.outline : t.colorScheme.onPrimary,
? t.colorScheme.outline backgroundColor: attr != 0
: t.colorScheme.onPrimary,
backgroundColor:
(videoIntroController.followStatus['attribute'] ?? 0) != 0
? t.colorScheme.onInverseSurface ? t.colorScheme.onInverseSurface
: t.colorScheme.primary, // 设置按钮背景色 : t.colorScheme.primary, // 设置按钮背景色
), ),
child: Text( child: Text(
((videoIntroController.followStatus['attribute'] ?? 0) != 0) attr == 128
? '已拉黑'
: attr != 0
? '已关注' ? '已关注'
: '关注', : '关注',
style: TextStyle(fontSize: t.textTheme.labelMedium!.fontSize), style: TextStyle(fontSize: t.textTheme.labelMedium!.fontSize),
), ),
), );
},
); );
} }