💄 Recommendation post indicator
This commit is contained in:
parent
365f330629
commit
54a59aa470
@ -650,5 +650,10 @@
|
|||||||
"realmIsCommunity": "Community Realm",
|
"realmIsCommunity": "Community Realm",
|
||||||
"realmIsCommunityDescription": "Community realm will be displayed on the discover page.",
|
"realmIsCommunityDescription": "Community realm will be displayed on the discover page.",
|
||||||
"realmLeave": "Leave Realm",
|
"realmLeave": "Leave Realm",
|
||||||
"realmLeaveDescription": "Leave the current realm and delete the realm's identity."
|
"realmLeaveDescription": "Leave the current realm and delete the realm's identity.",
|
||||||
|
"checkInResultTier1": "Worst",
|
||||||
|
"checkInResultTier2": "Worse",
|
||||||
|
"checkInResultTier3": "Normal",
|
||||||
|
"checkInResultTier4": "Better",
|
||||||
|
"checkInResultTier5": "Best"
|
||||||
}
|
}
|
||||||
|
@ -649,5 +649,10 @@
|
|||||||
"realmIsCommunity": "社区领域",
|
"realmIsCommunity": "社区领域",
|
||||||
"realmIsCommunityDescription": "社区领域会显示在发现页面上。",
|
"realmIsCommunityDescription": "社区领域会显示在发现页面上。",
|
||||||
"realmLeave": "离开领域",
|
"realmLeave": "离开领域",
|
||||||
"realmLeaveDescription": "离开当前领域,并且删除领域中的身份。"
|
"realmLeaveDescription": "离开当前领域,并且删除领域中的身份。",
|
||||||
|
"checkInResultTier1": "大凶",
|
||||||
|
"checkInResultTier2": "凶",
|
||||||
|
"checkInResultTier3": "中平",
|
||||||
|
"checkInResultTier4": "吉",
|
||||||
|
"checkInResultTier5": "大吉"
|
||||||
}
|
}
|
||||||
|
@ -663,10 +663,24 @@ class _HomeDashRecommendationPostWidgetState extends State<_HomeDashRecommendati
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _currentPage = 0;
|
||||||
|
final PageController _pageController = PageController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_fetchRecommendationPosts();
|
_fetchRecommendationPosts();
|
||||||
|
_pageController.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
_currentPage = _pageController.page?.round() ?? 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_pageController.dispose();
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -684,17 +698,24 @@ class _HomeDashRecommendationPostWidgetState extends State<_HomeDashRecommendati
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Symbols.star),
|
Row(
|
||||||
const Gap(8),
|
children: [
|
||||||
Text(
|
const Icon(Symbols.star),
|
||||||
'postRecommendation',
|
const Gap(8),
|
||||||
style: Theme.of(context).textTheme.titleLarge,
|
Text(
|
||||||
).tr()
|
'postRecommendation',
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
).tr(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text('${_currentPage + 1}/${_posts?.length ?? 0}', style: GoogleFonts.robotoMono())
|
||||||
],
|
],
|
||||||
).padding(horizontal: 18, top: 12, bottom: 8),
|
).padding(horizontal: 18, top: 12, bottom: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PageView.builder(
|
child: PageView.builder(
|
||||||
|
controller: _pageController,
|
||||||
scrollBehavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
|
scrollBehavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
|
||||||
PointerDeviceKind.mouse,
|
PointerDeviceKind.mouse,
|
||||||
PointerDeviceKind.touch,
|
PointerDeviceKind.touch,
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'check_in.freezed.dart';
|
part 'check_in.freezed.dart';
|
||||||
|
|
||||||
part 'check_in.g.dart';
|
part 'check_in.g.dart';
|
||||||
|
|
||||||
const List<String> kCheckInResultTierSymbols = ['Bad', 'Poor', 'Medium', 'Good', 'Great'];
|
final List<String> kCheckInResultTierSymbols = [
|
||||||
|
'checkInResultTier1',
|
||||||
|
'checkInResultTier2',
|
||||||
|
'checkInResultTier3',
|
||||||
|
'checkInResultTier4',
|
||||||
|
'checkInResultTier5'
|
||||||
|
].map((e) => e.tr()).toList();
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class SnCheckInRecord with _$SnCheckInRecord {
|
class SnCheckInRecord with _$SnCheckInRecord {
|
||||||
@ -21,8 +29,7 @@ class SnCheckInRecord with _$SnCheckInRecord {
|
|||||||
required int accountId,
|
required int accountId,
|
||||||
}) = _SnCheckInRecord;
|
}) = _SnCheckInRecord;
|
||||||
|
|
||||||
factory SnCheckInRecord.fromJson(Map<String, dynamic> json) =>
|
factory SnCheckInRecord.fromJson(Map<String, dynamic> json) => _$SnCheckInRecordFromJson(json);
|
||||||
_$SnCheckInRecordFromJson(json);
|
|
||||||
|
|
||||||
String get symbol => kCheckInResultTierSymbols[resultTier];
|
String get symbol => kCheckInResultTierSymbols[resultTier];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user