🐛 Bug fixes on daily check in

This commit is contained in:
LittleSheep 2024-11-28 13:15:15 +08:00
parent 23301764ee
commit 2261528580
3 changed files with 12 additions and 12 deletions

View File

@ -244,6 +244,8 @@
"dailyCheckAction": "Check in right now!", "dailyCheckAction": "Check in right now!",
"dailyCheckDetail": "Can't understand the symbol? Master, help me understand it!", "dailyCheckDetail": "Can't understand the symbol? Master, help me understand it!",
"dailyCheckDetailTitle": "{}'s fortune details", "dailyCheckDetailTitle": "{}'s fortune details",
"dailyCheckPositiveHint": "Good for {}",
"dailyCheckNegativeHint": "Bad for {}",
"dailyCheckPositiveHint1": "Making friends", "dailyCheckPositiveHint1": "Making friends",
"dailyCheckPositiveHint1Description": "Friendship lasts forever", "dailyCheckPositiveHint1Description": "Friendship lasts forever",
"dailyCheckPositiveHint2": "Drinking", "dailyCheckPositiveHint2": "Drinking",

View File

@ -168,7 +168,7 @@
"fieldChatBelongToRealm": "所属领域", "fieldChatBelongToRealm": "所属领域",
"fieldChatBelongToRealmUnset": "未设置频道所属领域", "fieldChatBelongToRealmUnset": "未设置频道所属领域",
"channelEditingNotice": "您正在编辑频道 {}", "channelEditingNotice": "您正在编辑频道 {}",
"channelDeleted": "聊天频道 {} 已被删除" , "channelDeleted": "聊天频道 {} 已被删除",
"channelDelete": "删除聊天频道 {}", "channelDelete": "删除聊天频道 {}",
"channelDeleteDescription": "你确定要删除这个聊天频道吗?该操作不可撤销,其频道内的所有消息将被永久删除。", "channelDeleteDescription": "你确定要删除这个聊天频道吗?该操作不可撤销,其频道内的所有消息将被永久删除。",
"fieldRealmAlias": "领域别名", "fieldRealmAlias": "领域别名",
@ -176,7 +176,7 @@
"fieldRealmName": "名称", "fieldRealmName": "名称",
"fieldRealmDescription": "描述", "fieldRealmDescription": "描述",
"realmEditingNotice": "您正在编辑领域 {}", "realmEditingNotice": "您正在编辑领域 {}",
"realmDeleted": "领域 {} 已被删除" , "realmDeleted": "领域 {} 已被删除",
"realmDelete": "删除领域 {}", "realmDelete": "删除领域 {}",
"realmDeleteDescription": "你确定要删除这个领域吗?该操作不可撤销,其隶属于该领域的所有资源(帖子、聊天频道、发布者、制品等)都将被永久删除。三思而后行!", "realmDeleteDescription": "你确定要删除这个领域吗?该操作不可撤销,其隶属于该领域的所有资源(帖子、聊天频道、发布者、制品等)都将被永久删除。三思而后行!",
"fieldChatMessage": "在 {} 中发消息", "fieldChatMessage": "在 {} 中发消息",
@ -194,7 +194,7 @@
}, },
"addAttachmentFromAlbum": "从相册中添加附件", "addAttachmentFromAlbum": "从相册中添加附件",
"addAttachmentFromClipboard": "粘贴附件", "addAttachmentFromClipboard": "粘贴附件",
"attachmentPastedImage" : "粘贴的图片", "attachmentPastedImage": "粘贴的图片",
"notificationUnread": "未读", "notificationUnread": "未读",
"notificationRead": "已读", "notificationRead": "已读",
"notificationMarkAllRead": "已读所有通知", "notificationMarkAllRead": "已读所有通知",
@ -244,8 +244,8 @@
"dailyCheckAction": "现在签到", "dailyCheckAction": "现在签到",
"dailyCheckDetail": "看不懂符?大师帮我解惑!", "dailyCheckDetail": "看不懂符?大师帮我解惑!",
"dailyCheckDetailTitle": "{} 的运势详情", "dailyCheckDetailTitle": "{} 的运势详情",
"dailyCheckPositiveHint": "宜 {}", "dailyCheckPositiveHint": "宜 {}",
"dailyCheckNegativeHint": "忌 {}", "dailyCheckNegativeHint": "忌 {}",
"dailyCheckPositiveHint1": "交友", "dailyCheckPositiveHint1": "交友",
"dailyCheckPositiveHint1Description": "友谊地久天长", "dailyCheckPositiveHint1Description": "友谊地久天长",
"dailyCheckPositiveHint2": "饮酒", "dailyCheckPositiveHint2": "饮酒",

View File

@ -1,3 +1,5 @@
import 'dart:math' as math;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
@ -140,9 +142,6 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> {
final sn = context.read<SnNetworkProvider>(); final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.get('/cgi/id/check-in/today'); final resp = await sn.client.get('/cgi/id/check-in/today');
_todayRecord = SnCheckInRecord.fromJson(resp.data); _todayRecord = SnCheckInRecord.fromJson(resp.data);
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
} finally { } finally {
setState(() => _isBusy = false); setState(() => _isBusy = false);
} }
@ -167,20 +166,19 @@ class _HomeDashCheckInWidgetState extends State<_HomeDashCheckInWidget> {
positive ? 'dailyCheckPositiveHint' : 'dailyCheckNegativeHint'; positive ? 'dailyCheckPositiveHint' : 'dailyCheckNegativeHint';
final mod = final mod =
positive ? kSuggestionPositiveHintCount : kSuggestionNegativeHintCount; positive ? kSuggestionPositiveHintCount : kSuggestionNegativeHintCount;
final pos = math.max(1, _todayRecord!.resultModifiers[index] % mod);
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
prefix.tr(args: [ prefix.tr(args: ['$prefix$pos'.tr()]),
'$prefix${_todayRecord!.resultModifiers[index] % mod}'.tr()
]),
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleMedium! .titleMedium!
.copyWith(fontWeight: FontWeight.bold), .copyWith(fontWeight: FontWeight.bold),
).tr(), ).tr(),
Text( Text(
'$prefix${_todayRecord!.resultModifiers[index] % kSuggestionPositiveHintCount}Description', '$prefix${pos}Description',
style: Theme.of(context).textTheme.bodyMedium, style: Theme.of(context).textTheme.bodyMedium,
).tr(), ).tr(),
], ],