🐛 Bug fixes on daily check in
This commit is contained in:
parent
23301764ee
commit
2261528580
@ -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",
|
||||||
|
@ -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(),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user