Check-in basis

This commit is contained in:
LittleSheep 2025-05-08 23:04:06 +08:00
parent 039f5b202f
commit ec2233fbaf
9 changed files with 755 additions and 158 deletions

View File

@ -106,5 +106,12 @@
"reactionNeutral": "Neutral",
"connectionConnected": "Connected",
"connectionDisconnected": "Disconnected",
"connectionReconnecting": "Reconnecting"
"connectionReconnecting": "Reconnecting",
"checkInNone": "Not checked-in yet",
"checkInNoneHint": "Get your fortune tips and daily rewards by checking in.",
"checkInResultLevel0": "Wrost Luck",
"checkInResultLevel1": "Bad Luck",
"checkInResultLevel2": "A Normal Day",
"checkInResultLevel3": "Good Luck",
"checkInResultLevel4": "Best Luck"
}

View File

@ -22,3 +22,32 @@ abstract class SnActivity with _$SnActivity {
factory SnActivity.fromJson(Map<String, dynamic> json) =>
_$SnActivityFromJson(json);
}
@freezed
abstract class SnCheckInResult with _$SnCheckInResult {
const factory SnCheckInResult({
required String id,
required int level,
required List<SnFortuneTip> tips,
required int accountId,
required SnAccount? account,
required DateTime createdAt,
required DateTime updatedAt,
required DateTime? deletedAt,
}) = _SnCheckInResult;
factory SnCheckInResult.fromJson(Map<String, dynamic> json) =>
_$SnCheckInResultFromJson(json);
}
@freezed
abstract class SnFortuneTip with _$SnFortuneTip {
const factory SnFortuneTip({
required bool isPositive,
required String title,
required String content,
}) = _SnFortuneTip;
factory SnFortuneTip.fromJson(Map<String, dynamic> json) =>
_$SnFortuneTipFromJson(json);
}

View File

@ -190,4 +190,327 @@ $SnAccountCopyWith<$Res> get account {
}
}
/// @nodoc
mixin _$SnCheckInResult {
String get id; int get level; List<SnFortuneTip> get tips; int get accountId; SnAccount? get account; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SnCheckInResultCopyWith<SnCheckInResult> get copyWith => _$SnCheckInResultCopyWithImpl<SnCheckInResult>(this as SnCheckInResult, _$identity);
/// Serializes this SnCheckInResult to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCheckInResult&&(identical(other.id, id) || other.id == id)&&(identical(other.level, level) || other.level == level)&&const DeepCollectionEquality().equals(other.tips, tips)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.account, account) || other.account == account)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,level,const DeepCollectionEquality().hash(tips),accountId,account,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnCheckInResult(id: $id, level: $level, tips: $tips, accountId: $accountId, account: $account, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class $SnCheckInResultCopyWith<$Res> {
factory $SnCheckInResultCopyWith(SnCheckInResult value, $Res Function(SnCheckInResult) _then) = _$SnCheckInResultCopyWithImpl;
@useResult
$Res call({
String id, int level, List<SnFortuneTip> tips, int accountId, SnAccount? account, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
$SnAccountCopyWith<$Res>? get account;
}
/// @nodoc
class _$SnCheckInResultCopyWithImpl<$Res>
implements $SnCheckInResultCopyWith<$Res> {
_$SnCheckInResultCopyWithImpl(this._self, this._then);
final SnCheckInResult _self;
final $Res Function(SnCheckInResult) _then;
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? level = null,Object? tips = null,Object? accountId = null,Object? account = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,level: null == level ? _self.level : level // ignore: cast_nullable_to_non_nullable
as int,tips: null == tips ? _self.tips : tips // ignore: cast_nullable_to_non_nullable
as List<SnFortuneTip>,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
as int,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
as SnAccount?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
));
}
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SnAccountCopyWith<$Res>? get account {
if (_self.account == null) {
return null;
}
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
return _then(_self.copyWith(account: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _SnCheckInResult implements SnCheckInResult {
const _SnCheckInResult({required this.id, required this.level, required final List<SnFortuneTip> tips, required this.accountId, required this.account, required this.createdAt, required this.updatedAt, required this.deletedAt}): _tips = tips;
factory _SnCheckInResult.fromJson(Map<String, dynamic> json) => _$SnCheckInResultFromJson(json);
@override final String id;
@override final int level;
final List<SnFortuneTip> _tips;
@override List<SnFortuneTip> get tips {
if (_tips is EqualUnmodifiableListView) return _tips;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_tips);
}
@override final int accountId;
@override final SnAccount? account;
@override final DateTime createdAt;
@override final DateTime updatedAt;
@override final DateTime? deletedAt;
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SnCheckInResultCopyWith<_SnCheckInResult> get copyWith => __$SnCheckInResultCopyWithImpl<_SnCheckInResult>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SnCheckInResultToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCheckInResult&&(identical(other.id, id) || other.id == id)&&(identical(other.level, level) || other.level == level)&&const DeepCollectionEquality().equals(other._tips, _tips)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.account, account) || other.account == account)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,level,const DeepCollectionEquality().hash(_tips),accountId,account,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnCheckInResult(id: $id, level: $level, tips: $tips, accountId: $accountId, account: $account, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class _$SnCheckInResultCopyWith<$Res> implements $SnCheckInResultCopyWith<$Res> {
factory _$SnCheckInResultCopyWith(_SnCheckInResult value, $Res Function(_SnCheckInResult) _then) = __$SnCheckInResultCopyWithImpl;
@override @useResult
$Res call({
String id, int level, List<SnFortuneTip> tips, int accountId, SnAccount? account, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
@override $SnAccountCopyWith<$Res>? get account;
}
/// @nodoc
class __$SnCheckInResultCopyWithImpl<$Res>
implements _$SnCheckInResultCopyWith<$Res> {
__$SnCheckInResultCopyWithImpl(this._self, this._then);
final _SnCheckInResult _self;
final $Res Function(_SnCheckInResult) _then;
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? level = null,Object? tips = null,Object? accountId = null,Object? account = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_SnCheckInResult(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,level: null == level ? _self.level : level // ignore: cast_nullable_to_non_nullable
as int,tips: null == tips ? _self._tips : tips // ignore: cast_nullable_to_non_nullable
as List<SnFortuneTip>,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
as int,account: freezed == account ? _self.account : account // ignore: cast_nullable_to_non_nullable
as SnAccount?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
));
}
/// Create a copy of SnCheckInResult
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SnAccountCopyWith<$Res>? get account {
if (_self.account == null) {
return null;
}
return $SnAccountCopyWith<$Res>(_self.account!, (value) {
return _then(_self.copyWith(account: value));
});
}
}
/// @nodoc
mixin _$SnFortuneTip {
bool get isPositive; String get title; String get content;
/// Create a copy of SnFortuneTip
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SnFortuneTipCopyWith<SnFortuneTip> get copyWith => _$SnFortuneTipCopyWithImpl<SnFortuneTip>(this as SnFortuneTip, _$identity);
/// Serializes this SnFortuneTip to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnFortuneTip&&(identical(other.isPositive, isPositive) || other.isPositive == isPositive)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isPositive,title,content);
@override
String toString() {
return 'SnFortuneTip(isPositive: $isPositive, title: $title, content: $content)';
}
}
/// @nodoc
abstract mixin class $SnFortuneTipCopyWith<$Res> {
factory $SnFortuneTipCopyWith(SnFortuneTip value, $Res Function(SnFortuneTip) _then) = _$SnFortuneTipCopyWithImpl;
@useResult
$Res call({
bool isPositive, String title, String content
});
}
/// @nodoc
class _$SnFortuneTipCopyWithImpl<$Res>
implements $SnFortuneTipCopyWith<$Res> {
_$SnFortuneTipCopyWithImpl(this._self, this._then);
final SnFortuneTip _self;
final $Res Function(SnFortuneTip) _then;
/// Create a copy of SnFortuneTip
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isPositive = null,Object? title = null,Object? content = null,}) {
return _then(_self.copyWith(
isPositive: null == isPositive ? _self.isPositive : isPositive // ignore: cast_nullable_to_non_nullable
as bool,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _SnFortuneTip implements SnFortuneTip {
const _SnFortuneTip({required this.isPositive, required this.title, required this.content});
factory _SnFortuneTip.fromJson(Map<String, dynamic> json) => _$SnFortuneTipFromJson(json);
@override final bool isPositive;
@override final String title;
@override final String content;
/// Create a copy of SnFortuneTip
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SnFortuneTipCopyWith<_SnFortuneTip> get copyWith => __$SnFortuneTipCopyWithImpl<_SnFortuneTip>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SnFortuneTipToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnFortuneTip&&(identical(other.isPositive, isPositive) || other.isPositive == isPositive)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isPositive,title,content);
@override
String toString() {
return 'SnFortuneTip(isPositive: $isPositive, title: $title, content: $content)';
}
}
/// @nodoc
abstract mixin class _$SnFortuneTipCopyWith<$Res> implements $SnFortuneTipCopyWith<$Res> {
factory _$SnFortuneTipCopyWith(_SnFortuneTip value, $Res Function(_SnFortuneTip) _then) = __$SnFortuneTipCopyWithImpl;
@override @useResult
$Res call({
bool isPositive, String title, String content
});
}
/// @nodoc
class __$SnFortuneTipCopyWithImpl<$Res>
implements _$SnFortuneTipCopyWith<$Res> {
__$SnFortuneTipCopyWithImpl(this._self, this._then);
final _SnFortuneTip _self;
final $Res Function(_SnFortuneTip) _then;
/// Create a copy of SnFortuneTip
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isPositive = null,Object? title = null,Object? content = null,}) {
return _then(_SnFortuneTip(
isPositive: null == isPositive ? _self.isPositive : isPositive // ignore: cast_nullable_to_non_nullable
as bool,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@ -32,3 +32,50 @@ Map<String, dynamic> _$SnActivityToJson(_SnActivity instance) =>
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt,
};
_SnCheckInResult _$SnCheckInResultFromJson(Map<String, dynamic> json) =>
_SnCheckInResult(
id: json['id'] as String,
level: (json['level'] as num).toInt(),
tips:
(json['tips'] as List<dynamic>)
.map((e) => SnFortuneTip.fromJson(e as Map<String, dynamic>))
.toList(),
accountId: (json['account_id'] as num).toInt(),
account:
json['account'] == null
? null
: SnAccount.fromJson(json['account'] as Map<String, dynamic>),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
deletedAt:
json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
);
Map<String, dynamic> _$SnCheckInResultToJson(_SnCheckInResult instance) =>
<String, dynamic>{
'id': instance.id,
'level': instance.level,
'tips': instance.tips.map((e) => e.toJson()).toList(),
'account_id': instance.accountId,
'account': instance.account?.toJson(),
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt?.toIso8601String(),
};
_SnFortuneTip _$SnFortuneTipFromJson(Map<String, dynamic> json) =>
_SnFortuneTip(
isPositive: json['is_positive'] as bool,
title: json['title'] as String,
content: json['content'] as String,
);
Map<String, dynamic> _$SnFortuneTipToJson(_SnFortuneTip instance) =>
<String, dynamic>{
'is_positive': instance.isPositive,
'title': instance.title,
'content': instance.content,
};

View File

@ -9,33 +9,50 @@
// coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:auto_route/auto_route.dart' as _i17;
import 'package:flutter/material.dart' as _i18;
import 'package:island/models/post.dart' as _i19;
import 'package:island/screens/account.dart' as _i2;
import 'package:island/screens/account/me.dart' as _i11;
import 'package:island/screens/account/me/publishers.dart' as _i7;
import 'package:island/screens/account/me/update.dart' as _i16;
import 'package:island/screens/account/profile.dart' as _i1;
import 'package:island/screens/auth/create_account.dart' as _i6;
import 'package:island/screens/auth/login.dart' as _i10;
import 'package:island/screens/auth/tabs.dart' as _i15;
import 'package:island/screens/chat/chat.dart' as _i4;
import 'package:island/screens/chat/room.dart' as _i5;
import 'package:island/screens/chat/room_detail.dart' as _i3;
import 'package:island/screens/explore.dart' as _i9;
import 'package:island/screens/posts/compose.dart' as _i12;
import 'package:island/screens/posts/detail.dart' as _i13;
import 'package:island/screens/realm/detail.dart' as _i14;
import 'package:island/screens/realm/realms.dart' as _i8;
import 'package:auto_route/auto_route.dart' as _i18;
import 'package:flutter/material.dart' as _i19;
import 'package:island/models/post.dart' as _i20;
import 'package:island/screens/account.dart' as _i3;
import 'package:island/screens/account/me.dart' as _i12;
import 'package:island/screens/account/me/event_calendar.dart' as _i1;
import 'package:island/screens/account/me/publishers.dart' as _i8;
import 'package:island/screens/account/me/update.dart' as _i17;
import 'package:island/screens/account/profile.dart' as _i2;
import 'package:island/screens/auth/create_account.dart' as _i7;
import 'package:island/screens/auth/login.dart' as _i11;
import 'package:island/screens/auth/tabs.dart' as _i16;
import 'package:island/screens/chat/chat.dart' as _i5;
import 'package:island/screens/chat/room.dart' as _i6;
import 'package:island/screens/chat/room_detail.dart' as _i4;
import 'package:island/screens/explore.dart' as _i10;
import 'package:island/screens/posts/compose.dart' as _i13;
import 'package:island/screens/posts/detail.dart' as _i14;
import 'package:island/screens/realm/detail.dart' as _i15;
import 'package:island/screens/realm/realms.dart' as _i9;
/// generated route for
/// [_i1.AccountProfileScreen]
class AccountProfileRoute extends _i17.PageRouteInfo<AccountProfileRouteArgs> {
/// [_i1.AccountEventCalendar]
class AccountEventCalendar extends _i18.PageRouteInfo<void> {
const AccountEventCalendar({List<_i18.PageRouteInfo>? children})
: super(AccountEventCalendar.name, initialChildren: children);
static const String name = 'AccountEventCalendar';
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i1.AccountEventCalendar();
},
);
}
/// generated route for
/// [_i2.AccountProfileScreen]
class AccountProfileRoute extends _i18.PageRouteInfo<AccountProfileRouteArgs> {
AccountProfileRoute({
_i18.Key? key,
_i19.Key? key,
required String name,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
AccountProfileRoute.name,
args: AccountProfileRouteArgs(key: key, name: name),
@ -45,7 +62,7 @@ class AccountProfileRoute extends _i17.PageRouteInfo<AccountProfileRouteArgs> {
static const String name = 'AccountProfileRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
@ -53,7 +70,7 @@ class AccountProfileRoute extends _i17.PageRouteInfo<AccountProfileRouteArgs> {
orElse:
() => AccountProfileRouteArgs(name: pathParams.getString('name')),
);
return _i1.AccountProfileScreen(key: args.key, name: args.name);
return _i2.AccountProfileScreen(key: args.key, name: args.name);
},
);
}
@ -61,7 +78,7 @@ class AccountProfileRoute extends _i17.PageRouteInfo<AccountProfileRouteArgs> {
class AccountProfileRouteArgs {
const AccountProfileRouteArgs({this.key, required this.name});
final _i18.Key? key;
final _i19.Key? key;
final String name;
@ -72,28 +89,28 @@ class AccountProfileRouteArgs {
}
/// generated route for
/// [_i2.AccountScreen]
class AccountRoute extends _i17.PageRouteInfo<void> {
const AccountRoute({List<_i17.PageRouteInfo>? children})
/// [_i3.AccountScreen]
class AccountRoute extends _i18.PageRouteInfo<void> {
const AccountRoute({List<_i18.PageRouteInfo>? children})
: super(AccountRoute.name, initialChildren: children);
static const String name = 'AccountRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i2.AccountScreen();
return const _i3.AccountScreen();
},
);
}
/// generated route for
/// [_i3.ChatDetailScreen]
class ChatDetailRoute extends _i17.PageRouteInfo<ChatDetailRouteArgs> {
/// [_i4.ChatDetailScreen]
class ChatDetailRoute extends _i18.PageRouteInfo<ChatDetailRouteArgs> {
ChatDetailRoute({
_i18.Key? key,
_i19.Key? key,
required int id,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
ChatDetailRoute.name,
args: ChatDetailRouteArgs(key: key, id: id),
@ -103,14 +120,14 @@ class ChatDetailRoute extends _i17.PageRouteInfo<ChatDetailRouteArgs> {
static const String name = 'ChatDetailRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<ChatDetailRouteArgs>(
orElse: () => ChatDetailRouteArgs(id: pathParams.getInt('id')),
);
return _i3.ChatDetailScreen(key: args.key, id: args.id);
return _i4.ChatDetailScreen(key: args.key, id: args.id);
},
);
}
@ -118,7 +135,7 @@ class ChatDetailRoute extends _i17.PageRouteInfo<ChatDetailRouteArgs> {
class ChatDetailRouteArgs {
const ChatDetailRouteArgs({this.key, required this.id});
final _i18.Key? key;
final _i19.Key? key;
final int id;
@ -129,28 +146,28 @@ class ChatDetailRouteArgs {
}
/// generated route for
/// [_i4.ChatListScreen]
class ChatListRoute extends _i17.PageRouteInfo<void> {
const ChatListRoute({List<_i17.PageRouteInfo>? children})
/// [_i5.ChatListScreen]
class ChatListRoute extends _i18.PageRouteInfo<void> {
const ChatListRoute({List<_i18.PageRouteInfo>? children})
: super(ChatListRoute.name, initialChildren: children);
static const String name = 'ChatListRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i4.ChatListScreen();
return const _i5.ChatListScreen();
},
);
}
/// generated route for
/// [_i5.ChatRoomScreen]
class ChatRoomRoute extends _i17.PageRouteInfo<ChatRoomRouteArgs> {
/// [_i6.ChatRoomScreen]
class ChatRoomRoute extends _i18.PageRouteInfo<ChatRoomRouteArgs> {
ChatRoomRoute({
_i18.Key? key,
_i19.Key? key,
required int id,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
ChatRoomRoute.name,
args: ChatRoomRouteArgs(key: key, id: id),
@ -160,14 +177,14 @@ class ChatRoomRoute extends _i17.PageRouteInfo<ChatRoomRouteArgs> {
static const String name = 'ChatRoomRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<ChatRoomRouteArgs>(
orElse: () => ChatRoomRouteArgs(id: pathParams.getInt('id')),
);
return _i5.ChatRoomScreen(key: args.key, id: args.id);
return _i6.ChatRoomScreen(key: args.key, id: args.id);
},
);
}
@ -175,7 +192,7 @@ class ChatRoomRoute extends _i17.PageRouteInfo<ChatRoomRouteArgs> {
class ChatRoomRouteArgs {
const ChatRoomRouteArgs({this.key, required this.id});
final _i18.Key? key;
final _i19.Key? key;
final int id;
@ -186,25 +203,25 @@ class ChatRoomRouteArgs {
}
/// generated route for
/// [_i6.CreateAccountScreen]
class CreateAccountRoute extends _i17.PageRouteInfo<void> {
const CreateAccountRoute({List<_i17.PageRouteInfo>? children})
/// [_i7.CreateAccountScreen]
class CreateAccountRoute extends _i18.PageRouteInfo<void> {
const CreateAccountRoute({List<_i18.PageRouteInfo>? children})
: super(CreateAccountRoute.name, initialChildren: children);
static const String name = 'CreateAccountRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i6.CreateAccountScreen();
return const _i7.CreateAccountScreen();
},
);
}
/// generated route for
/// [_i4.EditChatScreen]
class EditChatRoute extends _i17.PageRouteInfo<EditChatRouteArgs> {
EditChatRoute({_i18.Key? key, int? id, List<_i17.PageRouteInfo>? children})
/// [_i5.EditChatScreen]
class EditChatRoute extends _i18.PageRouteInfo<EditChatRouteArgs> {
EditChatRoute({_i19.Key? key, int? id, List<_i18.PageRouteInfo>? children})
: super(
EditChatRoute.name,
args: EditChatRouteArgs(key: key, id: id),
@ -214,14 +231,14 @@ class EditChatRoute extends _i17.PageRouteInfo<EditChatRouteArgs> {
static const String name = 'EditChatRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<EditChatRouteArgs>(
orElse: () => EditChatRouteArgs(id: pathParams.optInt('id')),
);
return _i4.EditChatScreen(key: args.key, id: args.id);
return _i5.EditChatScreen(key: args.key, id: args.id);
},
);
}
@ -229,7 +246,7 @@ class EditChatRoute extends _i17.PageRouteInfo<EditChatRouteArgs> {
class EditChatRouteArgs {
const EditChatRouteArgs({this.key, this.id});
final _i18.Key? key;
final _i19.Key? key;
final int? id;
@ -240,12 +257,12 @@ class EditChatRouteArgs {
}
/// generated route for
/// [_i7.EditPublisherScreen]
class EditPublisherRoute extends _i17.PageRouteInfo<EditPublisherRouteArgs> {
/// [_i8.EditPublisherScreen]
class EditPublisherRoute extends _i18.PageRouteInfo<EditPublisherRouteArgs> {
EditPublisherRoute({
_i18.Key? key,
_i19.Key? key,
String? name,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
EditPublisherRoute.name,
args: EditPublisherRouteArgs(key: key, name: name),
@ -255,14 +272,14 @@ class EditPublisherRoute extends _i17.PageRouteInfo<EditPublisherRouteArgs> {
static const String name = 'EditPublisherRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<EditPublisherRouteArgs>(
orElse: () => EditPublisherRouteArgs(name: pathParams.optString('id')),
);
return _i7.EditPublisherScreen(key: args.key, name: args.name);
return _i8.EditPublisherScreen(key: args.key, name: args.name);
},
);
}
@ -270,7 +287,7 @@ class EditPublisherRoute extends _i17.PageRouteInfo<EditPublisherRouteArgs> {
class EditPublisherRouteArgs {
const EditPublisherRouteArgs({this.key, this.name});
final _i18.Key? key;
final _i19.Key? key;
final String? name;
@ -281,12 +298,12 @@ class EditPublisherRouteArgs {
}
/// generated route for
/// [_i8.EditRealmScreen]
class EditRealmRoute extends _i17.PageRouteInfo<EditRealmRouteArgs> {
/// [_i9.EditRealmScreen]
class EditRealmRoute extends _i18.PageRouteInfo<EditRealmRouteArgs> {
EditRealmRoute({
_i18.Key? key,
_i19.Key? key,
String? slug,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
EditRealmRoute.name,
args: EditRealmRouteArgs(key: key, slug: slug),
@ -296,14 +313,14 @@ class EditRealmRoute extends _i17.PageRouteInfo<EditRealmRouteArgs> {
static const String name = 'EditRealmRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<EditRealmRouteArgs>(
orElse: () => EditRealmRouteArgs(slug: pathParams.optString('slug')),
);
return _i8.EditRealmScreen(key: args.key, slug: args.slug);
return _i9.EditRealmScreen(key: args.key, slug: args.slug);
},
);
}
@ -311,7 +328,7 @@ class EditRealmRoute extends _i17.PageRouteInfo<EditRealmRouteArgs> {
class EditRealmRouteArgs {
const EditRealmRouteArgs({this.key, this.slug});
final _i18.Key? key;
final _i19.Key? key;
final String? slug;
@ -322,124 +339,124 @@ class EditRealmRouteArgs {
}
/// generated route for
/// [_i9.ExploreScreen]
class ExploreRoute extends _i17.PageRouteInfo<void> {
const ExploreRoute({List<_i17.PageRouteInfo>? children})
/// [_i10.ExploreScreen]
class ExploreRoute extends _i18.PageRouteInfo<void> {
const ExploreRoute({List<_i18.PageRouteInfo>? children})
: super(ExploreRoute.name, initialChildren: children);
static const String name = 'ExploreRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i9.ExploreScreen();
return const _i10.ExploreScreen();
},
);
}
/// generated route for
/// [_i10.LoginScreen]
class LoginRoute extends _i17.PageRouteInfo<void> {
const LoginRoute({List<_i17.PageRouteInfo>? children})
/// [_i11.LoginScreen]
class LoginRoute extends _i18.PageRouteInfo<void> {
const LoginRoute({List<_i18.PageRouteInfo>? children})
: super(LoginRoute.name, initialChildren: children);
static const String name = 'LoginRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i10.LoginScreen();
return const _i11.LoginScreen();
},
);
}
/// generated route for
/// [_i7.ManagedPublisherScreen]
class ManagedPublisherRoute extends _i17.PageRouteInfo<void> {
const ManagedPublisherRoute({List<_i17.PageRouteInfo>? children})
/// [_i8.ManagedPublisherScreen]
class ManagedPublisherRoute extends _i18.PageRouteInfo<void> {
const ManagedPublisherRoute({List<_i18.PageRouteInfo>? children})
: super(ManagedPublisherRoute.name, initialChildren: children);
static const String name = 'ManagedPublisherRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i7.ManagedPublisherScreen();
return const _i8.ManagedPublisherScreen();
},
);
}
/// generated route for
/// [_i11.MyselfProfileScreen]
class MyselfProfileRoute extends _i17.PageRouteInfo<void> {
const MyselfProfileRoute({List<_i17.PageRouteInfo>? children})
/// [_i12.MyselfProfileScreen]
class MyselfProfileRoute extends _i18.PageRouteInfo<void> {
const MyselfProfileRoute({List<_i18.PageRouteInfo>? children})
: super(MyselfProfileRoute.name, initialChildren: children);
static const String name = 'MyselfProfileRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i11.MyselfProfileScreen();
return const _i12.MyselfProfileScreen();
},
);
}
/// generated route for
/// [_i4.NewChatScreen]
class NewChatRoute extends _i17.PageRouteInfo<void> {
const NewChatRoute({List<_i17.PageRouteInfo>? children})
/// [_i5.NewChatScreen]
class NewChatRoute extends _i18.PageRouteInfo<void> {
const NewChatRoute({List<_i18.PageRouteInfo>? children})
: super(NewChatRoute.name, initialChildren: children);
static const String name = 'NewChatRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i4.NewChatScreen();
return const _i5.NewChatScreen();
},
);
}
/// generated route for
/// [_i7.NewPublisherScreen]
class NewPublisherRoute extends _i17.PageRouteInfo<void> {
const NewPublisherRoute({List<_i17.PageRouteInfo>? children})
/// [_i8.NewPublisherScreen]
class NewPublisherRoute extends _i18.PageRouteInfo<void> {
const NewPublisherRoute({List<_i18.PageRouteInfo>? children})
: super(NewPublisherRoute.name, initialChildren: children);
static const String name = 'NewPublisherRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i7.NewPublisherScreen();
return const _i8.NewPublisherScreen();
},
);
}
/// generated route for
/// [_i8.NewRealmScreen]
class NewRealmRoute extends _i17.PageRouteInfo<void> {
const NewRealmRoute({List<_i17.PageRouteInfo>? children})
/// [_i9.NewRealmScreen]
class NewRealmRoute extends _i18.PageRouteInfo<void> {
const NewRealmRoute({List<_i18.PageRouteInfo>? children})
: super(NewRealmRoute.name, initialChildren: children);
static const String name = 'NewRealmRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i8.NewRealmScreen();
return const _i9.NewRealmScreen();
},
);
}
/// generated route for
/// [_i12.PostComposeScreen]
class PostComposeRoute extends _i17.PageRouteInfo<PostComposeRouteArgs> {
/// [_i13.PostComposeScreen]
class PostComposeRoute extends _i18.PageRouteInfo<PostComposeRouteArgs> {
PostComposeRoute({
_i18.Key? key,
_i19.SnPost? originalPost,
List<_i17.PageRouteInfo>? children,
_i19.Key? key,
_i20.SnPost? originalPost,
List<_i18.PageRouteInfo>? children,
}) : super(
PostComposeRoute.name,
args: PostComposeRouteArgs(key: key, originalPost: originalPost),
@ -448,13 +465,13 @@ class PostComposeRoute extends _i17.PageRouteInfo<PostComposeRouteArgs> {
static const String name = 'PostComposeRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final args = data.argsAs<PostComposeRouteArgs>(
orElse: () => const PostComposeRouteArgs(),
);
return _i12.PostComposeScreen(
return _i13.PostComposeScreen(
key: args.key,
originalPost: args.originalPost,
);
@ -465,9 +482,9 @@ class PostComposeRoute extends _i17.PageRouteInfo<PostComposeRouteArgs> {
class PostComposeRouteArgs {
const PostComposeRouteArgs({this.key, this.originalPost});
final _i18.Key? key;
final _i19.Key? key;
final _i19.SnPost? originalPost;
final _i20.SnPost? originalPost;
@override
String toString() {
@ -476,12 +493,12 @@ class PostComposeRouteArgs {
}
/// generated route for
/// [_i13.PostDetailScreen]
class PostDetailRoute extends _i17.PageRouteInfo<PostDetailRouteArgs> {
/// [_i14.PostDetailScreen]
class PostDetailRoute extends _i18.PageRouteInfo<PostDetailRouteArgs> {
PostDetailRoute({
_i18.Key? key,
_i19.Key? key,
required int id,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
PostDetailRoute.name,
args: PostDetailRouteArgs(key: key, id: id),
@ -491,14 +508,14 @@ class PostDetailRoute extends _i17.PageRouteInfo<PostDetailRouteArgs> {
static const String name = 'PostDetailRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<PostDetailRouteArgs>(
orElse: () => PostDetailRouteArgs(id: pathParams.getInt('id')),
);
return _i13.PostDetailScreen(key: args.key, id: args.id);
return _i14.PostDetailScreen(key: args.key, id: args.id);
},
);
}
@ -506,7 +523,7 @@ class PostDetailRoute extends _i17.PageRouteInfo<PostDetailRouteArgs> {
class PostDetailRouteArgs {
const PostDetailRouteArgs({this.key, required this.id});
final _i18.Key? key;
final _i19.Key? key;
final int id;
@ -517,12 +534,12 @@ class PostDetailRouteArgs {
}
/// generated route for
/// [_i12.PostEditScreen]
class PostEditRoute extends _i17.PageRouteInfo<PostEditRouteArgs> {
/// [_i13.PostEditScreen]
class PostEditRoute extends _i18.PageRouteInfo<PostEditRouteArgs> {
PostEditRoute({
_i18.Key? key,
_i19.Key? key,
required int id,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
PostEditRoute.name,
args: PostEditRouteArgs(key: key, id: id),
@ -532,14 +549,14 @@ class PostEditRoute extends _i17.PageRouteInfo<PostEditRouteArgs> {
static const String name = 'PostEditRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<PostEditRouteArgs>(
orElse: () => PostEditRouteArgs(id: pathParams.getInt('id')),
);
return _i12.PostEditScreen(key: args.key, id: args.id);
return _i13.PostEditScreen(key: args.key, id: args.id);
},
);
}
@ -547,7 +564,7 @@ class PostEditRoute extends _i17.PageRouteInfo<PostEditRouteArgs> {
class PostEditRouteArgs {
const PostEditRouteArgs({this.key, required this.id});
final _i18.Key? key;
final _i19.Key? key;
final int id;
@ -558,12 +575,12 @@ class PostEditRouteArgs {
}
/// generated route for
/// [_i14.RealmDetailScreen]
class RealmDetailRoute extends _i17.PageRouteInfo<RealmDetailRouteArgs> {
/// [_i15.RealmDetailScreen]
class RealmDetailRoute extends _i18.PageRouteInfo<RealmDetailRouteArgs> {
RealmDetailRoute({
_i18.Key? key,
_i19.Key? key,
required String slug,
List<_i17.PageRouteInfo>? children,
List<_i18.PageRouteInfo>? children,
}) : super(
RealmDetailRoute.name,
args: RealmDetailRouteArgs(key: key, slug: slug),
@ -573,14 +590,14 @@ class RealmDetailRoute extends _i17.PageRouteInfo<RealmDetailRouteArgs> {
static const String name = 'RealmDetailRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
final pathParams = data.inheritedPathParams;
final args = data.argsAs<RealmDetailRouteArgs>(
orElse: () => RealmDetailRouteArgs(slug: pathParams.getString('slug')),
);
return _i14.RealmDetailScreen(key: args.key, slug: args.slug);
return _i15.RealmDetailScreen(key: args.key, slug: args.slug);
},
);
}
@ -588,7 +605,7 @@ class RealmDetailRoute extends _i17.PageRouteInfo<RealmDetailRouteArgs> {
class RealmDetailRouteArgs {
const RealmDetailRouteArgs({this.key, required this.slug});
final _i18.Key? key;
final _i19.Key? key;
final String slug;
@ -599,49 +616,49 @@ class RealmDetailRouteArgs {
}
/// generated route for
/// [_i8.RealmListScreen]
class RealmListRoute extends _i17.PageRouteInfo<void> {
const RealmListRoute({List<_i17.PageRouteInfo>? children})
/// [_i9.RealmListScreen]
class RealmListRoute extends _i18.PageRouteInfo<void> {
const RealmListRoute({List<_i18.PageRouteInfo>? children})
: super(RealmListRoute.name, initialChildren: children);
static const String name = 'RealmListRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i8.RealmListScreen();
return const _i9.RealmListScreen();
},
);
}
/// generated route for
/// [_i15.TabsScreen]
class TabsRoute extends _i17.PageRouteInfo<void> {
const TabsRoute({List<_i17.PageRouteInfo>? children})
/// [_i16.TabsScreen]
class TabsRoute extends _i18.PageRouteInfo<void> {
const TabsRoute({List<_i18.PageRouteInfo>? children})
: super(TabsRoute.name, initialChildren: children);
static const String name = 'TabsRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i15.TabsScreen();
return const _i16.TabsScreen();
},
);
}
/// generated route for
/// [_i16.UpdateProfileScreen]
class UpdateProfileRoute extends _i17.PageRouteInfo<void> {
const UpdateProfileRoute({List<_i17.PageRouteInfo>? children})
/// [_i17.UpdateProfileScreen]
class UpdateProfileRoute extends _i18.PageRouteInfo<void> {
const UpdateProfileRoute({List<_i18.PageRouteInfo>? children})
: super(UpdateProfileRoute.name, initialChildren: children);
static const String name = 'UpdateProfileRoute';
static _i17.PageInfo page = _i17.PageInfo(
static _i18.PageInfo page = _i18.PageInfo(
name,
builder: (data) {
return const _i16.UpdateProfileScreen();
return const _i17.UpdateProfileScreen();
},
);
}

View File

@ -0,0 +1,13 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/widgets.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@RoutePage()
class AccountEventCalendar extends HookConsumerWidget {
const AccountEventCalendar({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
return const Placeholder();
}
}

View File

@ -3,9 +3,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gap/gap.dart';
import 'package:island/models/activity.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/route.gr.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/models/post.dart';
import 'package:island/widgets/check_in.dart';
import 'package:island/widgets/post/post_item.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:very_good_infinite_list/very_good_infinite_list.dart';
@ -18,6 +20,7 @@ class ExploreScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final user = ref.watch(userInfoProvider);
final posts = ref.watch(activityListProvider);
final postsNotifier = ref.watch(activityListProvider.notifier);
@ -39,6 +42,7 @@ class ExploreScreen extends ConsumerWidget {
onRefresh: () => postsNotifier.refresh(),
child: CustomScrollView(
slivers: [
if (user.hasValue) SliverToBoxAdapter(child: CheckInWidget()),
SliverInfiniteList(
itemCount: posts.length,
isLoading: postsNotifier.isLoading,

View File

@ -1,11 +1,138 @@
import 'package:flutter/widgets.dart';
import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/activity.dart';
import 'package:island/pods/network.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';
part 'check_in.g.dart';
@riverpod
Future<SnCheckInResult?> checkInResultToday(Ref ref) async {
final client = ref.watch(apiClientProvider);
try {
final resp = await client.get('/accounts/me/check-in');
return SnCheckInResult.fromJson(resp.data);
} catch (err) {
if (err is DioException) {
if (err.response?.statusCode == 404) {
return null;
}
}
rethrow;
}
}
class CheckInWidget extends HookConsumerWidget {
const CheckInWidget({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
return const Placeholder();
final todayResult = ref.watch(checkInResultTodayProvider);
return Card(
margin: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 16,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Container(
color: Theme.of(context).colorScheme.secondaryContainer,
width: 56,
height: 56,
child:
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(DateFormat('EEE').format(DateTime.now()))
.fontSize(16)
.bold()
.textColor(
Theme.of(context).colorScheme.onSecondaryContainer,
),
Text(DateFormat('MM/dd').format(DateTime.now()))
.fontSize(12)
.textColor(
Theme.of(context).colorScheme.onSecondaryContainer,
),
],
).center(),
),
),
Expanded(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
child: todayResult.when(
data: (result) {
if (result == null) return _CheckInNoneWidget();
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'checkInResultLevel${result.level}',
).tr().fontSize(15).bold(),
Text(
result.tips
.map(
(e) => '${e.isPositive ? '' : ''} ${e.title}',
)
.join(' · '),
).tr().fontSize(11),
],
);
},
loading: () => _CheckInNoneWidget(),
error:
(err, stack) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('error').tr().fontSize(15).bold(),
Text(err.toString()).fontSize(11),
],
),
),
),
),
IconButton.outlined(
onPressed: () {},
icon: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
child: todayResult.when(
data:
(result) => Icon(
result == null
? Symbols.local_fire_department
: Symbols.event,
key: ValueKey(result != null),
),
loading: () => const Icon(Symbols.refresh),
error: (_, __) => const Icon(Symbols.error),
),
),
),
],
).padding(horizontal: 16, vertical: 12),
);
}
}
class _CheckInNoneWidget extends StatelessWidget {
const _CheckInNoneWidget();
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('checkInNone').tr().fontSize(15).bold(),
Text('checkInNoneHint').tr().fontSize(11),
],
);
}
}

View File

@ -0,0 +1,30 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'check_in.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$checkInResultTodayHash() =>
r'0e2af6c1f419b2ee74ee38b6fb5d8071498e75c8';
/// See also [checkInResultToday].
@ProviderFor(checkInResultToday)
final checkInResultTodayProvider =
AutoDisposeFutureProvider<SnCheckInResult?>.internal(
checkInResultToday,
name: r'checkInResultTodayProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$checkInResultTodayHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef CheckInResultTodayRef = AutoDisposeFutureProviderRef<SnCheckInResult?>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package