feat: 点赞投币状态刷新
This commit is contained in:
@ -199,7 +199,7 @@ class VideoHttp {
|
|||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
return {'status': true, 'data': [], 'msg': ''};
|
return {'status': false, 'data': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,9 +184,11 @@ class VideoIntroController extends GetxController {
|
|||||||
if (!hasLike.value) {
|
if (!hasLike.value) {
|
||||||
SmartDialog.showToast('点赞成功 👍');
|
SmartDialog.showToast('点赞成功 👍');
|
||||||
hasLike.value = true;
|
hasLike.value = true;
|
||||||
|
videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1;
|
||||||
} else if (hasLike.value) {
|
} else if (hasLike.value) {
|
||||||
SmartDialog.showToast('取消赞');
|
SmartDialog.showToast('取消赞');
|
||||||
hasLike.value = false;
|
hasLike.value = false;
|
||||||
|
videoDetail.value.stat!.like = videoDetail.value.stat!.like! - 1;
|
||||||
}
|
}
|
||||||
hasLike.refresh();
|
hasLike.refresh();
|
||||||
} else {
|
} else {
|
||||||
@ -238,12 +240,14 @@ class VideoIntroController extends GetxController {
|
|||||||
var res = await VideoHttp.coinVideo(
|
var res = await VideoHttp.coinVideo(
|
||||||
bvid: bvid, multiply: _tempThemeValue);
|
bvid: bvid, multiply: _tempThemeValue);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('投币成功');
|
SmartDialog.showToast('投币成功 👏');
|
||||||
|
hasCoin.value = true;
|
||||||
|
videoDetail.value.stat!.coin =
|
||||||
|
videoDetail.value.stat!.coin! + _tempThemeValue;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
queryHasCoinVideo();
|
|
||||||
},
|
},
|
||||||
child: const Text('确定'))
|
child: const Text('确定'))
|
||||||
],
|
],
|
||||||
|
@ -44,14 +44,22 @@ class ActionRowItem extends StatelessWidget {
|
|||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
opacity: loadingStatus! ? 0 : 1,
|
opacity: loadingStatus! ? 0 : 1,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Text(
|
child: AnimatedSwitcher(
|
||||||
text ?? '',
|
duration: const Duration(milliseconds: 300),
|
||||||
style: TextStyle(
|
transitionBuilder:
|
||||||
color: selectStatus
|
(Widget child, Animation<double> animation) {
|
||||||
? Theme.of(context).colorScheme.primary
|
return ScaleTransition(scale: animation, child: child);
|
||||||
: null,
|
},
|
||||||
fontSize:
|
child: Text(
|
||||||
Theme.of(context).textTheme.labelMedium?.fontSize),
|
text ?? '',
|
||||||
|
key: ValueKey<String>(text ?? ''),
|
||||||
|
style: TextStyle(
|
||||||
|
color: selectStatus
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: null,
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.labelSmall!.fontSize),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user