♻️ Refactor riverpod pagination loading

This commit is contained in:
LittleSheep 2025-05-15 23:29:37 +08:00
parent 2759c009ad
commit dfd216b84b
28 changed files with 1018 additions and 360 deletions

View File

@ -206,5 +206,11 @@
"developerBadgeName": "Developer", "developerBadgeName": "Developer",
"developerBadgeDescription": "Contributing to Solar Network's development", "developerBadgeDescription": "Contributing to Solar Network's development",
"translatorBadgeName": "Translator", "translatorBadgeName": "Translator",
"translatorBadgeDescription": "Helping translate Solar Network into different languages" "translatorBadgeDescription": "Helping translate Solar Network into different languages",
"wallet": "Wallet",
"walletCurrencyPoints": "New Solar Points",
"walletCurrencyShortPoints": "NSP",
"walletCurrencyGolds": "The Solar Dollars",
"walletCurrencyShortGolds": "TSD",
"retry": "Retry"
} }

View File

@ -21,7 +21,7 @@ abstract class SnAuthChallenge with _$SnAuthChallenge {
required DateTime expiredAt, required DateTime expiredAt,
required int stepRemain, required int stepRemain,
required int stepTotal, required int stepTotal,
required List<int> blacklistFactors, required List<String> blacklistFactors,
required List<String> audiences, required List<String> audiences,
required List<String> scopes, required List<String> scopes,
required String ipAddress, required String ipAddress,

View File

@ -152,7 +152,7 @@ as String,
/// @nodoc /// @nodoc
mixin _$SnAuthChallenge { mixin _$SnAuthChallenge {
String get id; DateTime get expiredAt; int get stepRemain; int get stepTotal; List<int> get blacklistFactors; List<String> get audiences; List<String> get scopes; String get ipAddress; String get userAgent; String? get deviceId; String? get nonce; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String get id; DateTime get expiredAt; int get stepRemain; int get stepTotal; List<String> get blacklistFactors; List<String> get audiences; List<String> get scopes; String get ipAddress; String get userAgent; String? get deviceId; String? get nonce; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
/// Create a copy of SnAuthChallenge /// Create a copy of SnAuthChallenge
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@ -185,7 +185,7 @@ abstract mixin class $SnAuthChallengeCopyWith<$Res> {
factory $SnAuthChallengeCopyWith(SnAuthChallenge value, $Res Function(SnAuthChallenge) _then) = _$SnAuthChallengeCopyWithImpl; factory $SnAuthChallengeCopyWith(SnAuthChallenge value, $Res Function(SnAuthChallenge) _then) = _$SnAuthChallengeCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String id, DateTime expiredAt, int stepRemain, int stepTotal, List<int> blacklistFactors, List<String> audiences, List<String> scopes, String ipAddress, String userAgent, String? deviceId, String? nonce, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt String id, DateTime expiredAt, int stepRemain, int stepTotal, List<String> blacklistFactors, List<String> audiences, List<String> scopes, String ipAddress, String userAgent, String? deviceId, String? nonce, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
}); });
@ -209,7 +209,7 @@ as String,expiredAt: null == expiredAt ? _self.expiredAt : expiredAt // ignore:
as DateTime,stepRemain: null == stepRemain ? _self.stepRemain : stepRemain // ignore: cast_nullable_to_non_nullable as DateTime,stepRemain: null == stepRemain ? _self.stepRemain : stepRemain // ignore: cast_nullable_to_non_nullable
as int,stepTotal: null == stepTotal ? _self.stepTotal : stepTotal // ignore: cast_nullable_to_non_nullable as int,stepTotal: null == stepTotal ? _self.stepTotal : stepTotal // ignore: cast_nullable_to_non_nullable
as int,blacklistFactors: null == blacklistFactors ? _self.blacklistFactors : blacklistFactors // ignore: cast_nullable_to_non_nullable as int,blacklistFactors: null == blacklistFactors ? _self.blacklistFactors : blacklistFactors // ignore: cast_nullable_to_non_nullable
as List<int>,audiences: null == audiences ? _self.audiences : audiences // ignore: cast_nullable_to_non_nullable as List<String>,audiences: null == audiences ? _self.audiences : audiences // ignore: cast_nullable_to_non_nullable
as List<String>,scopes: null == scopes ? _self.scopes : scopes // ignore: cast_nullable_to_non_nullable as List<String>,scopes: null == scopes ? _self.scopes : scopes // ignore: cast_nullable_to_non_nullable
as List<String>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable as List<String>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable
@ -229,15 +229,15 @@ as DateTime?,
@JsonSerializable() @JsonSerializable()
class _SnAuthChallenge implements SnAuthChallenge { class _SnAuthChallenge implements SnAuthChallenge {
const _SnAuthChallenge({required this.id, required this.expiredAt, required this.stepRemain, required this.stepTotal, required final List<int> blacklistFactors, required final List<String> audiences, required final List<String> scopes, required this.ipAddress, required this.userAgent, required this.deviceId, required this.nonce, required this.createdAt, required this.updatedAt, required this.deletedAt}): _blacklistFactors = blacklistFactors,_audiences = audiences,_scopes = scopes; const _SnAuthChallenge({required this.id, required this.expiredAt, required this.stepRemain, required this.stepTotal, required final List<String> blacklistFactors, required final List<String> audiences, required final List<String> scopes, required this.ipAddress, required this.userAgent, required this.deviceId, required this.nonce, required this.createdAt, required this.updatedAt, required this.deletedAt}): _blacklistFactors = blacklistFactors,_audiences = audiences,_scopes = scopes;
factory _SnAuthChallenge.fromJson(Map<String, dynamic> json) => _$SnAuthChallengeFromJson(json); factory _SnAuthChallenge.fromJson(Map<String, dynamic> json) => _$SnAuthChallengeFromJson(json);
@override final String id; @override final String id;
@override final DateTime expiredAt; @override final DateTime expiredAt;
@override final int stepRemain; @override final int stepRemain;
@override final int stepTotal; @override final int stepTotal;
final List<int> _blacklistFactors; final List<String> _blacklistFactors;
@override List<int> get blacklistFactors { @override List<String> get blacklistFactors {
if (_blacklistFactors is EqualUnmodifiableListView) return _blacklistFactors; if (_blacklistFactors is EqualUnmodifiableListView) return _blacklistFactors;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_blacklistFactors); return EqualUnmodifiableListView(_blacklistFactors);
@ -298,7 +298,7 @@ abstract mixin class _$SnAuthChallengeCopyWith<$Res> implements $SnAuthChallenge
factory _$SnAuthChallengeCopyWith(_SnAuthChallenge value, $Res Function(_SnAuthChallenge) _then) = __$SnAuthChallengeCopyWithImpl; factory _$SnAuthChallengeCopyWith(_SnAuthChallenge value, $Res Function(_SnAuthChallenge) _then) = __$SnAuthChallengeCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String id, DateTime expiredAt, int stepRemain, int stepTotal, List<int> blacklistFactors, List<String> audiences, List<String> scopes, String ipAddress, String userAgent, String? deviceId, String? nonce, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt String id, DateTime expiredAt, int stepRemain, int stepTotal, List<String> blacklistFactors, List<String> audiences, List<String> scopes, String ipAddress, String userAgent, String? deviceId, String? nonce, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
}); });
@ -322,7 +322,7 @@ as String,expiredAt: null == expiredAt ? _self.expiredAt : expiredAt // ignore:
as DateTime,stepRemain: null == stepRemain ? _self.stepRemain : stepRemain // ignore: cast_nullable_to_non_nullable as DateTime,stepRemain: null == stepRemain ? _self.stepRemain : stepRemain // ignore: cast_nullable_to_non_nullable
as int,stepTotal: null == stepTotal ? _self.stepTotal : stepTotal // ignore: cast_nullable_to_non_nullable as int,stepTotal: null == stepTotal ? _self.stepTotal : stepTotal // ignore: cast_nullable_to_non_nullable
as int,blacklistFactors: null == blacklistFactors ? _self._blacklistFactors : blacklistFactors // ignore: cast_nullable_to_non_nullable as int,blacklistFactors: null == blacklistFactors ? _self._blacklistFactors : blacklistFactors // ignore: cast_nullable_to_non_nullable
as List<int>,audiences: null == audiences ? _self._audiences : audiences // ignore: cast_nullable_to_non_nullable as List<String>,audiences: null == audiences ? _self._audiences : audiences // ignore: cast_nullable_to_non_nullable
as List<String>,scopes: null == scopes ? _self._scopes : scopes // ignore: cast_nullable_to_non_nullable as List<String>,scopes: null == scopes ? _self._scopes : scopes // ignore: cast_nullable_to_non_nullable
as List<String>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable as List<String>,ipAddress: null == ipAddress ? _self.ipAddress : ipAddress // ignore: cast_nullable_to_non_nullable
as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable as String,userAgent: null == userAgent ? _self.userAgent : userAgent // ignore: cast_nullable_to_non_nullable

View File

@ -26,7 +26,7 @@ _SnAuthChallenge _$SnAuthChallengeFromJson(Map<String, dynamic> json) =>
stepTotal: (json['step_total'] as num).toInt(), stepTotal: (json['step_total'] as num).toInt(),
blacklistFactors: blacklistFactors:
(json['blacklist_factors'] as List<dynamic>) (json['blacklist_factors'] as List<dynamic>)
.map((e) => (e as num).toInt()) .map((e) => e as String)
.toList(), .toList(),
audiences: audiences:
(json['audiences'] as List<dynamic>).map((e) => e as String).toList(), (json['audiences'] as List<dynamic>).map((e) => e as String).toList(),

View File

@ -46,7 +46,7 @@ abstract class SnPost with _$SnPost {
abstract class SnPublisher with _$SnPublisher { abstract class SnPublisher with _$SnPublisher {
const factory SnPublisher({ const factory SnPublisher({
required String id, required String id,
required int publisherType, required int type,
required String name, required String name,
required String nick, required String nick,
required String bio, required String bio,

View File

@ -370,7 +370,7 @@ $SnPublisherCopyWith<$Res> get publisher {
/// @nodoc /// @nodoc
mixin _$SnPublisher { mixin _$SnPublisher {
String get id; int get publisherType; String get name; String get nick; String get bio; String? get pictureId; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; String? get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String get id; int get type; String get name; String get nick; String get bio; String? get pictureId; SnCloudFile? get picture; String? get backgroundId; SnCloudFile? get background; String? get accountId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
/// Create a copy of SnPublisher /// Create a copy of SnPublisher
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@ -383,16 +383,16 @@ $SnPublisherCopyWith<SnPublisher> get copyWith => _$SnPublisherCopyWithImpl<SnPu
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.publisherType, publisherType) || other.publisherType == publisherType)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); return identical(this, other) || (other.runtimeType == runtimeType&&other is SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(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) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,publisherType,name,nick,bio,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt); int get hashCode => Object.hash(runtimeType,id,type,name,nick,bio,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt);
@override @override
String toString() { String toString() {
return 'SnPublisher(id: $id, publisherType: $publisherType, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
} }
@ -403,7 +403,7 @@ abstract mixin class $SnPublisherCopyWith<$Res> {
factory $SnPublisherCopyWith(SnPublisher value, $Res Function(SnPublisher) _then) = _$SnPublisherCopyWithImpl; factory $SnPublisherCopyWith(SnPublisher value, $Res Function(SnPublisher) _then) = _$SnPublisherCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String id, int publisherType, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt String id, int type, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
}); });
@ -420,10 +420,10 @@ class _$SnPublisherCopyWithImpl<$Res>
/// Create a copy of SnPublisher /// Create a copy of SnPublisher
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? publisherType = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,publisherType: null == publisherType ? _self.publisherType : publisherType // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable
as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable
@ -470,11 +470,11 @@ $SnCloudFileCopyWith<$Res>? get background {
@JsonSerializable() @JsonSerializable()
class _SnPublisher implements SnPublisher { class _SnPublisher implements SnPublisher {
const _SnPublisher({required this.id, required this.publisherType, required this.name, required this.nick, required this.bio, required this.pictureId, required this.picture, required this.backgroundId, required this.background, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt}); const _SnPublisher({required this.id, required this.type, required this.name, required this.nick, required this.bio, required this.pictureId, required this.picture, required this.backgroundId, required this.background, required this.accountId, required this.createdAt, required this.updatedAt, required this.deletedAt});
factory _SnPublisher.fromJson(Map<String, dynamic> json) => _$SnPublisherFromJson(json); factory _SnPublisher.fromJson(Map<String, dynamic> json) => _$SnPublisherFromJson(json);
@override final String id; @override final String id;
@override final int publisherType; @override final int type;
@override final String name; @override final String name;
@override final String nick; @override final String nick;
@override final String bio; @override final String bio;
@ -500,16 +500,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.publisherType, publisherType) || other.publisherType == publisherType)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnPublisher&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.name, name) || other.name == name)&&(identical(other.nick, nick) || other.nick == nick)&&(identical(other.bio, bio) || other.bio == bio)&&(identical(other.pictureId, pictureId) || other.pictureId == pictureId)&&(identical(other.picture, picture) || other.picture == picture)&&(identical(other.backgroundId, backgroundId) || other.backgroundId == backgroundId)&&(identical(other.background, background) || other.background == background)&&(identical(other.accountId, accountId) || other.accountId == accountId)&&(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) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,publisherType,name,nick,bio,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt); int get hashCode => Object.hash(runtimeType,id,type,name,nick,bio,pictureId,picture,backgroundId,background,accountId,createdAt,updatedAt,deletedAt);
@override @override
String toString() { String toString() {
return 'SnPublisher(id: $id, publisherType: $publisherType, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; return 'SnPublisher(id: $id, type: $type, name: $name, nick: $nick, bio: $bio, pictureId: $pictureId, picture: $picture, backgroundId: $backgroundId, background: $background, accountId: $accountId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
} }
@ -520,7 +520,7 @@ abstract mixin class _$SnPublisherCopyWith<$Res> implements $SnPublisherCopyWith
factory _$SnPublisherCopyWith(_SnPublisher value, $Res Function(_SnPublisher) _then) = __$SnPublisherCopyWithImpl; factory _$SnPublisherCopyWith(_SnPublisher value, $Res Function(_SnPublisher) _then) = __$SnPublisherCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String id, int publisherType, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt String id, int type, String name, String nick, String bio, String? pictureId, SnCloudFile? picture, String? backgroundId, SnCloudFile? background, String? accountId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
}); });
@ -537,10 +537,10 @@ class __$SnPublisherCopyWithImpl<$Res>
/// Create a copy of SnPublisher /// Create a copy of SnPublisher
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? publisherType = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? type = null,Object? name = null,Object? nick = null,Object? bio = null,Object? pictureId = freezed,Object? picture = freezed,Object? backgroundId = freezed,Object? background = freezed,Object? accountId = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_SnPublisher( return _then(_SnPublisher(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,publisherType: null == publisherType ? _self.publisherType : publisherType // ignore: cast_nullable_to_non_nullable as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable as String,nick: null == nick ? _self.nick : nick // ignore: cast_nullable_to_non_nullable
as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable as String,bio: null == bio ? _self.bio : bio // ignore: cast_nullable_to_non_nullable

View File

@ -96,7 +96,7 @@ Map<String, dynamic> _$SnPostToJson(_SnPost instance) => <String, dynamic>{
_SnPublisher _$SnPublisherFromJson(Map<String, dynamic> json) => _SnPublisher( _SnPublisher _$SnPublisherFromJson(Map<String, dynamic> json) => _SnPublisher(
id: json['id'] as String, id: json['id'] as String,
publisherType: (json['publisher_type'] as num).toInt(), type: (json['type'] as num).toInt(),
name: json['name'] as String, name: json['name'] as String,
nick: json['nick'] as String, nick: json['nick'] as String,
bio: json['bio'] as String, bio: json['bio'] as String,
@ -122,7 +122,7 @@ _SnPublisher _$SnPublisherFromJson(Map<String, dynamic> json) => _SnPublisher(
Map<String, dynamic> _$SnPublisherToJson(_SnPublisher instance) => Map<String, dynamic> _$SnPublisherToJson(_SnPublisher instance) =>
<String, dynamic>{ <String, dynamic>{
'id': instance.id, 'id': instance.id,
'publisher_type': instance.publisherType, 'type': instance.type,
'name': instance.name, 'name': instance.name,
'nick': instance.nick, 'nick': instance.nick,
'bio': instance.bio, 'bio': instance.bio,

37
lib/models/wallet.dart Normal file
View File

@ -0,0 +1,37 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:island/models/user.dart';
part 'wallet.freezed.dart';
part 'wallet.g.dart';
@freezed
abstract class SnWallet with _$SnWallet {
const factory SnWallet({
required String id,
required List<SnWalletPocket> pockets,
required String accountId,
required SnAccount? account,
required DateTime createdAt,
required DateTime updatedAt,
required DateTime? deletedAt,
}) = _SnWallet;
factory SnWallet.fromJson(Map<String, dynamic> json) =>
_$SnWalletFromJson(json);
}
@freezed
abstract class SnWalletPocket with _$SnWalletPocket {
const factory SnWalletPocket({
required String id,
required String currency,
required double amount,
required String walletId,
required DateTime createdAt,
required DateTime updatedAt,
required DateTime? deletedAt,
}) = _SnWalletPocket;
factory SnWalletPocket.fromJson(Map<String, dynamic> json) =>
_$SnWalletPocketFromJson(json);
}

View File

@ -0,0 +1,347 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'wallet.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SnWallet {
String get id; List<SnWalletPocket> get pockets; String get accountId; SnAccount? get account; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
/// Create a copy of SnWallet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SnWalletCopyWith<SnWallet> get copyWith => _$SnWalletCopyWithImpl<SnWallet>(this as SnWallet, _$identity);
/// Serializes this SnWallet to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnWallet&&(identical(other.id, id) || other.id == id)&&const DeepCollectionEquality().equals(other.pockets, pockets)&&(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,const DeepCollectionEquality().hash(pockets),accountId,account,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnWallet(id: $id, pockets: $pockets, accountId: $accountId, account: $account, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class $SnWalletCopyWith<$Res> {
factory $SnWalletCopyWith(SnWallet value, $Res Function(SnWallet) _then) = _$SnWalletCopyWithImpl;
@useResult
$Res call({
String id, List<SnWalletPocket> pockets, String accountId, SnAccount? account, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
$SnAccountCopyWith<$Res>? get account;
}
/// @nodoc
class _$SnWalletCopyWithImpl<$Res>
implements $SnWalletCopyWith<$Res> {
_$SnWalletCopyWithImpl(this._self, this._then);
final SnWallet _self;
final $Res Function(SnWallet) _then;
/// Create a copy of SnWallet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? pockets = 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,pockets: null == pockets ? _self.pockets : pockets // ignore: cast_nullable_to_non_nullable
as List<SnWalletPocket>,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
as String,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 SnWallet
/// 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 _SnWallet implements SnWallet {
const _SnWallet({required this.id, required final List<SnWalletPocket> pockets, required this.accountId, required this.account, required this.createdAt, required this.updatedAt, required this.deletedAt}): _pockets = pockets;
factory _SnWallet.fromJson(Map<String, dynamic> json) => _$SnWalletFromJson(json);
@override final String id;
final List<SnWalletPocket> _pockets;
@override List<SnWalletPocket> get pockets {
if (_pockets is EqualUnmodifiableListView) return _pockets;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_pockets);
}
@override final String accountId;
@override final SnAccount? account;
@override final DateTime createdAt;
@override final DateTime updatedAt;
@override final DateTime? deletedAt;
/// Create a copy of SnWallet
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SnWalletCopyWith<_SnWallet> get copyWith => __$SnWalletCopyWithImpl<_SnWallet>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SnWalletToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnWallet&&(identical(other.id, id) || other.id == id)&&const DeepCollectionEquality().equals(other._pockets, _pockets)&&(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,const DeepCollectionEquality().hash(_pockets),accountId,account,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnWallet(id: $id, pockets: $pockets, accountId: $accountId, account: $account, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class _$SnWalletCopyWith<$Res> implements $SnWalletCopyWith<$Res> {
factory _$SnWalletCopyWith(_SnWallet value, $Res Function(_SnWallet) _then) = __$SnWalletCopyWithImpl;
@override @useResult
$Res call({
String id, List<SnWalletPocket> pockets, String accountId, SnAccount? account, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
@override $SnAccountCopyWith<$Res>? get account;
}
/// @nodoc
class __$SnWalletCopyWithImpl<$Res>
implements _$SnWalletCopyWith<$Res> {
__$SnWalletCopyWithImpl(this._self, this._then);
final _SnWallet _self;
final $Res Function(_SnWallet) _then;
/// Create a copy of SnWallet
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? pockets = null,Object? accountId = null,Object? account = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_SnWallet(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,pockets: null == pockets ? _self._pockets : pockets // ignore: cast_nullable_to_non_nullable
as List<SnWalletPocket>,accountId: null == accountId ? _self.accountId : accountId // ignore: cast_nullable_to_non_nullable
as String,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 SnWallet
/// 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 _$SnWalletPocket {
String get id; String get currency; double get amount; String get walletId; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt;
/// Create a copy of SnWalletPocket
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SnWalletPocketCopyWith<SnWalletPocket> get copyWith => _$SnWalletPocketCopyWithImpl<SnWalletPocket>(this as SnWalletPocket, _$identity);
/// Serializes this SnWalletPocket to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SnWalletPocket&&(identical(other.id, id) || other.id == id)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(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,currency,amount,walletId,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnWalletPocket(id: $id, currency: $currency, amount: $amount, walletId: $walletId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class $SnWalletPocketCopyWith<$Res> {
factory $SnWalletPocketCopyWith(SnWalletPocket value, $Res Function(SnWalletPocket) _then) = _$SnWalletPocketCopyWithImpl;
@useResult
$Res call({
String id, String currency, double amount, String walletId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
}
/// @nodoc
class _$SnWalletPocketCopyWithImpl<$Res>
implements $SnWalletPocketCopyWith<$Res> {
_$SnWalletPocketCopyWithImpl(this._self, this._then);
final SnWalletPocket _self;
final $Res Function(SnWalletPocket) _then;
/// Create a copy of SnWalletPocket
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? currency = null,Object? amount = null,Object? walletId = null,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,currency: null == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable
as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
as double,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as String,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?,
));
}
}
/// @nodoc
@JsonSerializable()
class _SnWalletPocket implements SnWalletPocket {
const _SnWalletPocket({required this.id, required this.currency, required this.amount, required this.walletId, required this.createdAt, required this.updatedAt, required this.deletedAt});
factory _SnWalletPocket.fromJson(Map<String, dynamic> json) => _$SnWalletPocketFromJson(json);
@override final String id;
@override final String currency;
@override final double amount;
@override final String walletId;
@override final DateTime createdAt;
@override final DateTime updatedAt;
@override final DateTime? deletedAt;
/// Create a copy of SnWalletPocket
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SnWalletPocketCopyWith<_SnWalletPocket> get copyWith => __$SnWalletPocketCopyWithImpl<_SnWalletPocket>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SnWalletPocketToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnWalletPocket&&(identical(other.id, id) || other.id == id)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.amount, amount) || other.amount == amount)&&(identical(other.walletId, walletId) || other.walletId == walletId)&&(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,currency,amount,walletId,createdAt,updatedAt,deletedAt);
@override
String toString() {
return 'SnWalletPocket(id: $id, currency: $currency, amount: $amount, walletId: $walletId, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)';
}
}
/// @nodoc
abstract mixin class _$SnWalletPocketCopyWith<$Res> implements $SnWalletPocketCopyWith<$Res> {
factory _$SnWalletPocketCopyWith(_SnWalletPocket value, $Res Function(_SnWalletPocket) _then) = __$SnWalletPocketCopyWithImpl;
@override @useResult
$Res call({
String id, String currency, double amount, String walletId, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt
});
}
/// @nodoc
class __$SnWalletPocketCopyWithImpl<$Res>
implements _$SnWalletPocketCopyWith<$Res> {
__$SnWalletPocketCopyWithImpl(this._self, this._then);
final _SnWalletPocket _self;
final $Res Function(_SnWalletPocket) _then;
/// Create a copy of SnWalletPocket
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? currency = null,Object? amount = null,Object? walletId = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) {
return _then(_SnWalletPocket(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,currency: null == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable
as String,amount: null == amount ? _self.amount : amount // ignore: cast_nullable_to_non_nullable
as double,walletId: null == walletId ? _self.walletId : walletId // ignore: cast_nullable_to_non_nullable
as String,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?,
));
}
}
// dart format on

61
lib/models/wallet.g.dart Normal file
View File

@ -0,0 +1,61 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'wallet.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_SnWallet _$SnWalletFromJson(Map<String, dynamic> json) => _SnWallet(
id: json['id'] as String,
pockets:
(json['pockets'] as List<dynamic>)
.map((e) => SnWalletPocket.fromJson(e as Map<String, dynamic>))
.toList(),
accountId: json['account_id'] as String,
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> _$SnWalletToJson(_SnWallet instance) => <String, dynamic>{
'id': instance.id,
'pockets': instance.pockets.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(),
};
_SnWalletPocket _$SnWalletPocketFromJson(Map<String, dynamic> json) =>
_SnWalletPocket(
id: json['id'] as String,
currency: json['currency'] as String,
amount: (json['amount'] as num).toDouble(),
walletId: json['wallet_id'] as String,
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> _$SnWalletPocketToJson(_SnWalletPocket instance) =>
<String, dynamic>{
'id': instance.id,
'currency': instance.currency,
'amount': instance.amount,
'wallet_id': instance.walletId,
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt?.toIso8601String(),
};

View File

@ -19,6 +19,7 @@ class AppRouter extends RootStackRouter {
AutoRoute(page: ChatListRoute.page, path: 'chat'), AutoRoute(page: ChatListRoute.page, path: 'chat'),
], ],
), ),
AutoRoute(page: WalletRoute.page, path: '/wallet'),
AutoRoute(page: SettingsRoute.page, path: '/settings'), AutoRoute(page: SettingsRoute.page, path: '/settings'),
AutoRoute(page: LoginRoute.page, path: '/auth/login'), AutoRoute(page: LoginRoute.page, path: '/auth/login'),
AutoRoute(page: CreateAccountRoute.page, path: '/auth/create-account'), AutoRoute(page: CreateAccountRoute.page, path: '/auth/create-account'),

View File

@ -9,9 +9,9 @@
// coverage:ignore-file // coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:auto_route/auto_route.dart' as _i23; import 'package:auto_route/auto_route.dart' as _i24;
import 'package:flutter/material.dart' as _i24; import 'package:flutter/material.dart' as _i25;
import 'package:island/models/post.dart' as _i25; import 'package:island/models/post.dart' as _i26;
import 'package:island/screens/account.dart' as _i2; import 'package:island/screens/account.dart' as _i2;
import 'package:island/screens/account/me.dart' as _i15; import 'package:island/screens/account/me.dart' as _i15;
import 'package:island/screens/account/me/event_calendar.dart' as _i14; import 'package:island/screens/account/me/event_calendar.dart' as _i14;
@ -34,14 +34,15 @@ import 'package:island/screens/posts/pub_profile.dart' as _i18;
import 'package:island/screens/realm/detail.dart' as _i19; import 'package:island/screens/realm/detail.dart' as _i19;
import 'package:island/screens/realm/realms.dart' as _i9; import 'package:island/screens/realm/realms.dart' as _i9;
import 'package:island/screens/settings.dart' as _i20; import 'package:island/screens/settings.dart' as _i20;
import 'package:island/screens/wallet.dart' as _i23;
/// generated route for /// generated route for
/// [_i1.AccountProfileScreen] /// [_i1.AccountProfileScreen]
class AccountProfileRoute extends _i23.PageRouteInfo<AccountProfileRouteArgs> { class AccountProfileRoute extends _i24.PageRouteInfo<AccountProfileRouteArgs> {
AccountProfileRoute({ AccountProfileRoute({
_i24.Key? key, _i25.Key? key,
required String name, required String name,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
AccountProfileRoute.name, AccountProfileRoute.name,
args: AccountProfileRouteArgs(key: key, name: name), args: AccountProfileRouteArgs(key: key, name: name),
@ -51,7 +52,7 @@ class AccountProfileRoute extends _i23.PageRouteInfo<AccountProfileRouteArgs> {
static const String name = 'AccountProfileRoute'; static const String name = 'AccountProfileRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -67,7 +68,7 @@ class AccountProfileRoute extends _i23.PageRouteInfo<AccountProfileRouteArgs> {
class AccountProfileRouteArgs { class AccountProfileRouteArgs {
const AccountProfileRouteArgs({this.key, required this.name}); const AccountProfileRouteArgs({this.key, required this.name});
final _i24.Key? key; final _i25.Key? key;
final String name; final String name;
@ -79,13 +80,13 @@ class AccountProfileRouteArgs {
/// generated route for /// generated route for
/// [_i2.AccountScreen] /// [_i2.AccountScreen]
class AccountRoute extends _i23.PageRouteInfo<void> { class AccountRoute extends _i24.PageRouteInfo<void> {
const AccountRoute({List<_i23.PageRouteInfo>? children}) const AccountRoute({List<_i24.PageRouteInfo>? children})
: super(AccountRoute.name, initialChildren: children); : super(AccountRoute.name, initialChildren: children);
static const String name = 'AccountRoute'; static const String name = 'AccountRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i2.AccountScreen(); return const _i2.AccountScreen();
@ -95,11 +96,11 @@ class AccountRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i3.ChatDetailScreen] /// [_i3.ChatDetailScreen]
class ChatDetailRoute extends _i23.PageRouteInfo<ChatDetailRouteArgs> { class ChatDetailRoute extends _i24.PageRouteInfo<ChatDetailRouteArgs> {
ChatDetailRoute({ ChatDetailRoute({
_i24.Key? key, _i25.Key? key,
required String id, required String id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
ChatDetailRoute.name, ChatDetailRoute.name,
args: ChatDetailRouteArgs(key: key, id: id), args: ChatDetailRouteArgs(key: key, id: id),
@ -109,7 +110,7 @@ class ChatDetailRoute extends _i23.PageRouteInfo<ChatDetailRouteArgs> {
static const String name = 'ChatDetailRoute'; static const String name = 'ChatDetailRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -124,7 +125,7 @@ class ChatDetailRoute extends _i23.PageRouteInfo<ChatDetailRouteArgs> {
class ChatDetailRouteArgs { class ChatDetailRouteArgs {
const ChatDetailRouteArgs({this.key, required this.id}); const ChatDetailRouteArgs({this.key, required this.id});
final _i24.Key? key; final _i25.Key? key;
final String id; final String id;
@ -136,13 +137,13 @@ class ChatDetailRouteArgs {
/// generated route for /// generated route for
/// [_i4.ChatListScreen] /// [_i4.ChatListScreen]
class ChatListRoute extends _i23.PageRouteInfo<void> { class ChatListRoute extends _i24.PageRouteInfo<void> {
const ChatListRoute({List<_i23.PageRouteInfo>? children}) const ChatListRoute({List<_i24.PageRouteInfo>? children})
: super(ChatListRoute.name, initialChildren: children); : super(ChatListRoute.name, initialChildren: children);
static const String name = 'ChatListRoute'; static const String name = 'ChatListRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i4.ChatListScreen(); return const _i4.ChatListScreen();
@ -152,11 +153,11 @@ class ChatListRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i5.ChatRoomScreen] /// [_i5.ChatRoomScreen]
class ChatRoomRoute extends _i23.PageRouteInfo<ChatRoomRouteArgs> { class ChatRoomRoute extends _i24.PageRouteInfo<ChatRoomRouteArgs> {
ChatRoomRoute({ ChatRoomRoute({
_i24.Key? key, _i25.Key? key,
required String id, required String id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
ChatRoomRoute.name, ChatRoomRoute.name,
args: ChatRoomRouteArgs(key: key, id: id), args: ChatRoomRouteArgs(key: key, id: id),
@ -166,7 +167,7 @@ class ChatRoomRoute extends _i23.PageRouteInfo<ChatRoomRouteArgs> {
static const String name = 'ChatRoomRoute'; static const String name = 'ChatRoomRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -181,7 +182,7 @@ class ChatRoomRoute extends _i23.PageRouteInfo<ChatRoomRouteArgs> {
class ChatRoomRouteArgs { class ChatRoomRouteArgs {
const ChatRoomRouteArgs({this.key, required this.id}); const ChatRoomRouteArgs({this.key, required this.id});
final _i24.Key? key; final _i25.Key? key;
final String id; final String id;
@ -193,13 +194,13 @@ class ChatRoomRouteArgs {
/// generated route for /// generated route for
/// [_i6.CreateAccountScreen] /// [_i6.CreateAccountScreen]
class CreateAccountRoute extends _i23.PageRouteInfo<void> { class CreateAccountRoute extends _i24.PageRouteInfo<void> {
const CreateAccountRoute({List<_i23.PageRouteInfo>? children}) const CreateAccountRoute({List<_i24.PageRouteInfo>? children})
: super(CreateAccountRoute.name, initialChildren: children); : super(CreateAccountRoute.name, initialChildren: children);
static const String name = 'CreateAccountRoute'; static const String name = 'CreateAccountRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i6.CreateAccountScreen(); return const _i6.CreateAccountScreen();
@ -209,13 +210,13 @@ class CreateAccountRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i7.CreatorHubScreen] /// [_i7.CreatorHubScreen]
class CreatorHubRoute extends _i23.PageRouteInfo<void> { class CreatorHubRoute extends _i24.PageRouteInfo<void> {
const CreatorHubRoute({List<_i23.PageRouteInfo>? children}) const CreatorHubRoute({List<_i24.PageRouteInfo>? children})
: super(CreatorHubRoute.name, initialChildren: children); : super(CreatorHubRoute.name, initialChildren: children);
static const String name = 'CreatorHubRoute'; static const String name = 'CreatorHubRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i7.CreatorHubScreen(); return const _i7.CreatorHubScreen();
@ -225,8 +226,8 @@ class CreatorHubRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i4.EditChatScreen] /// [_i4.EditChatScreen]
class EditChatRoute extends _i23.PageRouteInfo<EditChatRouteArgs> { class EditChatRoute extends _i24.PageRouteInfo<EditChatRouteArgs> {
EditChatRoute({_i24.Key? key, String? id, List<_i23.PageRouteInfo>? children}) EditChatRoute({_i25.Key? key, String? id, List<_i24.PageRouteInfo>? children})
: super( : super(
EditChatRoute.name, EditChatRoute.name,
args: EditChatRouteArgs(key: key, id: id), args: EditChatRouteArgs(key: key, id: id),
@ -236,7 +237,7 @@ class EditChatRoute extends _i23.PageRouteInfo<EditChatRouteArgs> {
static const String name = 'EditChatRoute'; static const String name = 'EditChatRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -251,7 +252,7 @@ class EditChatRoute extends _i23.PageRouteInfo<EditChatRouteArgs> {
class EditChatRouteArgs { class EditChatRouteArgs {
const EditChatRouteArgs({this.key, this.id}); const EditChatRouteArgs({this.key, this.id});
final _i24.Key? key; final _i25.Key? key;
final String? id; final String? id;
@ -263,11 +264,11 @@ class EditChatRouteArgs {
/// generated route for /// generated route for
/// [_i8.EditPublisherScreen] /// [_i8.EditPublisherScreen]
class EditPublisherRoute extends _i23.PageRouteInfo<EditPublisherRouteArgs> { class EditPublisherRoute extends _i24.PageRouteInfo<EditPublisherRouteArgs> {
EditPublisherRoute({ EditPublisherRoute({
_i24.Key? key, _i25.Key? key,
String? name, String? name,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
EditPublisherRoute.name, EditPublisherRoute.name,
args: EditPublisherRouteArgs(key: key, name: name), args: EditPublisherRouteArgs(key: key, name: name),
@ -277,7 +278,7 @@ class EditPublisherRoute extends _i23.PageRouteInfo<EditPublisherRouteArgs> {
static const String name = 'EditPublisherRoute'; static const String name = 'EditPublisherRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -292,7 +293,7 @@ class EditPublisherRoute extends _i23.PageRouteInfo<EditPublisherRouteArgs> {
class EditPublisherRouteArgs { class EditPublisherRouteArgs {
const EditPublisherRouteArgs({this.key, this.name}); const EditPublisherRouteArgs({this.key, this.name});
final _i24.Key? key; final _i25.Key? key;
final String? name; final String? name;
@ -304,11 +305,11 @@ class EditPublisherRouteArgs {
/// generated route for /// generated route for
/// [_i9.EditRealmScreen] /// [_i9.EditRealmScreen]
class EditRealmRoute extends _i23.PageRouteInfo<EditRealmRouteArgs> { class EditRealmRoute extends _i24.PageRouteInfo<EditRealmRouteArgs> {
EditRealmRoute({ EditRealmRoute({
_i24.Key? key, _i25.Key? key,
String? slug, String? slug,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
EditRealmRoute.name, EditRealmRoute.name,
args: EditRealmRouteArgs(key: key, slug: slug), args: EditRealmRouteArgs(key: key, slug: slug),
@ -318,7 +319,7 @@ class EditRealmRoute extends _i23.PageRouteInfo<EditRealmRouteArgs> {
static const String name = 'EditRealmRoute'; static const String name = 'EditRealmRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -333,7 +334,7 @@ class EditRealmRoute extends _i23.PageRouteInfo<EditRealmRouteArgs> {
class EditRealmRouteArgs { class EditRealmRouteArgs {
const EditRealmRouteArgs({this.key, this.slug}); const EditRealmRouteArgs({this.key, this.slug});
final _i24.Key? key; final _i25.Key? key;
final String? slug; final String? slug;
@ -346,12 +347,12 @@ class EditRealmRouteArgs {
/// generated route for /// generated route for
/// [_i10.EditStickerPacksScreen] /// [_i10.EditStickerPacksScreen]
class EditStickerPacksRoute class EditStickerPacksRoute
extends _i23.PageRouteInfo<EditStickerPacksRouteArgs> { extends _i24.PageRouteInfo<EditStickerPacksRouteArgs> {
EditStickerPacksRoute({ EditStickerPacksRoute({
_i24.Key? key, _i25.Key? key,
required String pubName, required String pubName,
String? packId, String? packId,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
EditStickerPacksRoute.name, EditStickerPacksRoute.name,
args: EditStickerPacksRouteArgs( args: EditStickerPacksRouteArgs(
@ -365,7 +366,7 @@ class EditStickerPacksRoute
static const String name = 'EditStickerPacksRoute'; static const String name = 'EditStickerPacksRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -392,7 +393,7 @@ class EditStickerPacksRouteArgs {
this.packId, this.packId,
}); });
final _i24.Key? key; final _i25.Key? key;
final String pubName; final String pubName;
@ -406,12 +407,12 @@ class EditStickerPacksRouteArgs {
/// generated route for /// generated route for
/// [_i11.EditStickersScreen] /// [_i11.EditStickersScreen]
class EditStickersRoute extends _i23.PageRouteInfo<EditStickersRouteArgs> { class EditStickersRoute extends _i24.PageRouteInfo<EditStickersRouteArgs> {
EditStickersRoute({ EditStickersRoute({
_i24.Key? key, _i25.Key? key,
required String packId, required String packId,
required String? id, required String? id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
EditStickersRoute.name, EditStickersRoute.name,
args: EditStickersRouteArgs(key: key, packId: packId, id: id), args: EditStickersRouteArgs(key: key, packId: packId, id: id),
@ -421,7 +422,7 @@ class EditStickersRoute extends _i23.PageRouteInfo<EditStickersRouteArgs> {
static const String name = 'EditStickersRoute'; static const String name = 'EditStickersRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -448,7 +449,7 @@ class EditStickersRouteArgs {
required this.id, required this.id,
}); });
final _i24.Key? key; final _i25.Key? key;
final String packId; final String packId;
@ -462,13 +463,13 @@ class EditStickersRouteArgs {
/// generated route for /// generated route for
/// [_i12.ExploreScreen] /// [_i12.ExploreScreen]
class ExploreRoute extends _i23.PageRouteInfo<void> { class ExploreRoute extends _i24.PageRouteInfo<void> {
const ExploreRoute({List<_i23.PageRouteInfo>? children}) const ExploreRoute({List<_i24.PageRouteInfo>? children})
: super(ExploreRoute.name, initialChildren: children); : super(ExploreRoute.name, initialChildren: children);
static const String name = 'ExploreRoute'; static const String name = 'ExploreRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i12.ExploreScreen(); return const _i12.ExploreScreen();
@ -478,13 +479,13 @@ class ExploreRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i13.LoginScreen] /// [_i13.LoginScreen]
class LoginRoute extends _i23.PageRouteInfo<void> { class LoginRoute extends _i24.PageRouteInfo<void> {
const LoginRoute({List<_i23.PageRouteInfo>? children}) const LoginRoute({List<_i24.PageRouteInfo>? children})
: super(LoginRoute.name, initialChildren: children); : super(LoginRoute.name, initialChildren: children);
static const String name = 'LoginRoute'; static const String name = 'LoginRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i13.LoginScreen(); return const _i13.LoginScreen();
@ -494,13 +495,13 @@ class LoginRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i8.ManagedPublisherScreen] /// [_i8.ManagedPublisherScreen]
class ManagedPublisherRoute extends _i23.PageRouteInfo<void> { class ManagedPublisherRoute extends _i24.PageRouteInfo<void> {
const ManagedPublisherRoute({List<_i23.PageRouteInfo>? children}) const ManagedPublisherRoute({List<_i24.PageRouteInfo>? children})
: super(ManagedPublisherRoute.name, initialChildren: children); : super(ManagedPublisherRoute.name, initialChildren: children);
static const String name = 'ManagedPublisherRoute'; static const String name = 'ManagedPublisherRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i8.ManagedPublisherScreen(); return const _i8.ManagedPublisherScreen();
@ -510,13 +511,13 @@ class ManagedPublisherRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i14.MyselfEventCalendarScreen] /// [_i14.MyselfEventCalendarScreen]
class MyselfEventCalendarRoute extends _i23.PageRouteInfo<void> { class MyselfEventCalendarRoute extends _i24.PageRouteInfo<void> {
const MyselfEventCalendarRoute({List<_i23.PageRouteInfo>? children}) const MyselfEventCalendarRoute({List<_i24.PageRouteInfo>? children})
: super(MyselfEventCalendarRoute.name, initialChildren: children); : super(MyselfEventCalendarRoute.name, initialChildren: children);
static const String name = 'MyselfEventCalendarRoute'; static const String name = 'MyselfEventCalendarRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i14.MyselfEventCalendarScreen(); return const _i14.MyselfEventCalendarScreen();
@ -526,13 +527,13 @@ class MyselfEventCalendarRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i15.MyselfProfileScreen] /// [_i15.MyselfProfileScreen]
class MyselfProfileRoute extends _i23.PageRouteInfo<void> { class MyselfProfileRoute extends _i24.PageRouteInfo<void> {
const MyselfProfileRoute({List<_i23.PageRouteInfo>? children}) const MyselfProfileRoute({List<_i24.PageRouteInfo>? children})
: super(MyselfProfileRoute.name, initialChildren: children); : super(MyselfProfileRoute.name, initialChildren: children);
static const String name = 'MyselfProfileRoute'; static const String name = 'MyselfProfileRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i15.MyselfProfileScreen(); return const _i15.MyselfProfileScreen();
@ -542,13 +543,13 @@ class MyselfProfileRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i4.NewChatScreen] /// [_i4.NewChatScreen]
class NewChatRoute extends _i23.PageRouteInfo<void> { class NewChatRoute extends _i24.PageRouteInfo<void> {
const NewChatRoute({List<_i23.PageRouteInfo>? children}) const NewChatRoute({List<_i24.PageRouteInfo>? children})
: super(NewChatRoute.name, initialChildren: children); : super(NewChatRoute.name, initialChildren: children);
static const String name = 'NewChatRoute'; static const String name = 'NewChatRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i4.NewChatScreen(); return const _i4.NewChatScreen();
@ -558,13 +559,13 @@ class NewChatRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i8.NewPublisherScreen] /// [_i8.NewPublisherScreen]
class NewPublisherRoute extends _i23.PageRouteInfo<void> { class NewPublisherRoute extends _i24.PageRouteInfo<void> {
const NewPublisherRoute({List<_i23.PageRouteInfo>? children}) const NewPublisherRoute({List<_i24.PageRouteInfo>? children})
: super(NewPublisherRoute.name, initialChildren: children); : super(NewPublisherRoute.name, initialChildren: children);
static const String name = 'NewPublisherRoute'; static const String name = 'NewPublisherRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i8.NewPublisherScreen(); return const _i8.NewPublisherScreen();
@ -574,13 +575,13 @@ class NewPublisherRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i9.NewRealmScreen] /// [_i9.NewRealmScreen]
class NewRealmRoute extends _i23.PageRouteInfo<void> { class NewRealmRoute extends _i24.PageRouteInfo<void> {
const NewRealmRoute({List<_i23.PageRouteInfo>? children}) const NewRealmRoute({List<_i24.PageRouteInfo>? children})
: super(NewRealmRoute.name, initialChildren: children); : super(NewRealmRoute.name, initialChildren: children);
static const String name = 'NewRealmRoute'; static const String name = 'NewRealmRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i9.NewRealmScreen(); return const _i9.NewRealmScreen();
@ -591,11 +592,11 @@ class NewRealmRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i10.NewStickerPacksScreen] /// [_i10.NewStickerPacksScreen]
class NewStickerPacksRoute class NewStickerPacksRoute
extends _i23.PageRouteInfo<NewStickerPacksRouteArgs> { extends _i24.PageRouteInfo<NewStickerPacksRouteArgs> {
NewStickerPacksRoute({ NewStickerPacksRoute({
_i24.Key? key, _i25.Key? key,
required String pubName, required String pubName,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
NewStickerPacksRoute.name, NewStickerPacksRoute.name,
args: NewStickerPacksRouteArgs(key: key, pubName: pubName), args: NewStickerPacksRouteArgs(key: key, pubName: pubName),
@ -605,7 +606,7 @@ class NewStickerPacksRoute
static const String name = 'NewStickerPacksRoute'; static const String name = 'NewStickerPacksRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -622,7 +623,7 @@ class NewStickerPacksRoute
class NewStickerPacksRouteArgs { class NewStickerPacksRouteArgs {
const NewStickerPacksRouteArgs({this.key, required this.pubName}); const NewStickerPacksRouteArgs({this.key, required this.pubName});
final _i24.Key? key; final _i25.Key? key;
final String pubName; final String pubName;
@ -634,11 +635,11 @@ class NewStickerPacksRouteArgs {
/// generated route for /// generated route for
/// [_i11.NewStickersScreen] /// [_i11.NewStickersScreen]
class NewStickersRoute extends _i23.PageRouteInfo<NewStickersRouteArgs> { class NewStickersRoute extends _i24.PageRouteInfo<NewStickersRouteArgs> {
NewStickersRoute({ NewStickersRoute({
_i24.Key? key, _i25.Key? key,
required String packId, required String packId,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
NewStickersRoute.name, NewStickersRoute.name,
args: NewStickersRouteArgs(key: key, packId: packId), args: NewStickersRouteArgs(key: key, packId: packId),
@ -648,7 +649,7 @@ class NewStickersRoute extends _i23.PageRouteInfo<NewStickersRouteArgs> {
static const String name = 'NewStickersRoute'; static const String name = 'NewStickersRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -664,7 +665,7 @@ class NewStickersRoute extends _i23.PageRouteInfo<NewStickersRouteArgs> {
class NewStickersRouteArgs { class NewStickersRouteArgs {
const NewStickersRouteArgs({this.key, required this.packId}); const NewStickersRouteArgs({this.key, required this.packId});
final _i24.Key? key; final _i25.Key? key;
final String packId; final String packId;
@ -676,11 +677,11 @@ class NewStickersRouteArgs {
/// generated route for /// generated route for
/// [_i16.PostComposeScreen] /// [_i16.PostComposeScreen]
class PostComposeRoute extends _i23.PageRouteInfo<PostComposeRouteArgs> { class PostComposeRoute extends _i24.PageRouteInfo<PostComposeRouteArgs> {
PostComposeRoute({ PostComposeRoute({
_i24.Key? key, _i25.Key? key,
_i25.SnPost? originalPost, _i26.SnPost? originalPost,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
PostComposeRoute.name, PostComposeRoute.name,
args: PostComposeRouteArgs(key: key, originalPost: originalPost), args: PostComposeRouteArgs(key: key, originalPost: originalPost),
@ -689,7 +690,7 @@ class PostComposeRoute extends _i23.PageRouteInfo<PostComposeRouteArgs> {
static const String name = 'PostComposeRoute'; static const String name = 'PostComposeRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final args = data.argsAs<PostComposeRouteArgs>( final args = data.argsAs<PostComposeRouteArgs>(
@ -706,9 +707,9 @@ class PostComposeRoute extends _i23.PageRouteInfo<PostComposeRouteArgs> {
class PostComposeRouteArgs { class PostComposeRouteArgs {
const PostComposeRouteArgs({this.key, this.originalPost}); const PostComposeRouteArgs({this.key, this.originalPost});
final _i24.Key? key; final _i25.Key? key;
final _i25.SnPost? originalPost; final _i26.SnPost? originalPost;
@override @override
String toString() { String toString() {
@ -718,11 +719,11 @@ class PostComposeRouteArgs {
/// generated route for /// generated route for
/// [_i17.PostDetailScreen] /// [_i17.PostDetailScreen]
class PostDetailRoute extends _i23.PageRouteInfo<PostDetailRouteArgs> { class PostDetailRoute extends _i24.PageRouteInfo<PostDetailRouteArgs> {
PostDetailRoute({ PostDetailRoute({
_i24.Key? key, _i25.Key? key,
required String id, required String id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
PostDetailRoute.name, PostDetailRoute.name,
args: PostDetailRouteArgs(key: key, id: id), args: PostDetailRouteArgs(key: key, id: id),
@ -732,7 +733,7 @@ class PostDetailRoute extends _i23.PageRouteInfo<PostDetailRouteArgs> {
static const String name = 'PostDetailRoute'; static const String name = 'PostDetailRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -747,7 +748,7 @@ class PostDetailRoute extends _i23.PageRouteInfo<PostDetailRouteArgs> {
class PostDetailRouteArgs { class PostDetailRouteArgs {
const PostDetailRouteArgs({this.key, required this.id}); const PostDetailRouteArgs({this.key, required this.id});
final _i24.Key? key; final _i25.Key? key;
final String id; final String id;
@ -759,11 +760,11 @@ class PostDetailRouteArgs {
/// generated route for /// generated route for
/// [_i16.PostEditScreen] /// [_i16.PostEditScreen]
class PostEditRoute extends _i23.PageRouteInfo<PostEditRouteArgs> { class PostEditRoute extends _i24.PageRouteInfo<PostEditRouteArgs> {
PostEditRoute({ PostEditRoute({
_i24.Key? key, _i25.Key? key,
required String id, required String id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
PostEditRoute.name, PostEditRoute.name,
args: PostEditRouteArgs(key: key, id: id), args: PostEditRouteArgs(key: key, id: id),
@ -773,7 +774,7 @@ class PostEditRoute extends _i23.PageRouteInfo<PostEditRouteArgs> {
static const String name = 'PostEditRoute'; static const String name = 'PostEditRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -788,7 +789,7 @@ class PostEditRoute extends _i23.PageRouteInfo<PostEditRouteArgs> {
class PostEditRouteArgs { class PostEditRouteArgs {
const PostEditRouteArgs({this.key, required this.id}); const PostEditRouteArgs({this.key, required this.id});
final _i24.Key? key; final _i25.Key? key;
final String id; final String id;
@ -801,11 +802,11 @@ class PostEditRouteArgs {
/// generated route for /// generated route for
/// [_i18.PublisherProfileScreen] /// [_i18.PublisherProfileScreen]
class PublisherProfileRoute class PublisherProfileRoute
extends _i23.PageRouteInfo<PublisherProfileRouteArgs> { extends _i24.PageRouteInfo<PublisherProfileRouteArgs> {
PublisherProfileRoute({ PublisherProfileRoute({
_i24.Key? key, _i25.Key? key,
required String name, required String name,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
PublisherProfileRoute.name, PublisherProfileRoute.name,
args: PublisherProfileRouteArgs(key: key, name: name), args: PublisherProfileRouteArgs(key: key, name: name),
@ -815,7 +816,7 @@ class PublisherProfileRoute
static const String name = 'PublisherProfileRoute'; static const String name = 'PublisherProfileRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -831,7 +832,7 @@ class PublisherProfileRoute
class PublisherProfileRouteArgs { class PublisherProfileRouteArgs {
const PublisherProfileRouteArgs({this.key, required this.name}); const PublisherProfileRouteArgs({this.key, required this.name});
final _i24.Key? key; final _i25.Key? key;
final String name; final String name;
@ -843,11 +844,11 @@ class PublisherProfileRouteArgs {
/// generated route for /// generated route for
/// [_i19.RealmDetailScreen] /// [_i19.RealmDetailScreen]
class RealmDetailRoute extends _i23.PageRouteInfo<RealmDetailRouteArgs> { class RealmDetailRoute extends _i24.PageRouteInfo<RealmDetailRouteArgs> {
RealmDetailRoute({ RealmDetailRoute({
_i24.Key? key, _i25.Key? key,
required String slug, required String slug,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
RealmDetailRoute.name, RealmDetailRoute.name,
args: RealmDetailRouteArgs(key: key, slug: slug), args: RealmDetailRouteArgs(key: key, slug: slug),
@ -857,7 +858,7 @@ class RealmDetailRoute extends _i23.PageRouteInfo<RealmDetailRouteArgs> {
static const String name = 'RealmDetailRoute'; static const String name = 'RealmDetailRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -872,7 +873,7 @@ class RealmDetailRoute extends _i23.PageRouteInfo<RealmDetailRouteArgs> {
class RealmDetailRouteArgs { class RealmDetailRouteArgs {
const RealmDetailRouteArgs({this.key, required this.slug}); const RealmDetailRouteArgs({this.key, required this.slug});
final _i24.Key? key; final _i25.Key? key;
final String slug; final String slug;
@ -884,13 +885,13 @@ class RealmDetailRouteArgs {
/// generated route for /// generated route for
/// [_i9.RealmListScreen] /// [_i9.RealmListScreen]
class RealmListRoute extends _i23.PageRouteInfo<void> { class RealmListRoute extends _i24.PageRouteInfo<void> {
const RealmListRoute({List<_i23.PageRouteInfo>? children}) const RealmListRoute({List<_i24.PageRouteInfo>? children})
: super(RealmListRoute.name, initialChildren: children); : super(RealmListRoute.name, initialChildren: children);
static const String name = 'RealmListRoute'; static const String name = 'RealmListRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i9.RealmListScreen(); return const _i9.RealmListScreen();
@ -900,13 +901,13 @@ class RealmListRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i20.SettingsScreen] /// [_i20.SettingsScreen]
class SettingsRoute extends _i23.PageRouteInfo<void> { class SettingsRoute extends _i24.PageRouteInfo<void> {
const SettingsRoute({List<_i23.PageRouteInfo>? children}) const SettingsRoute({List<_i24.PageRouteInfo>? children})
: super(SettingsRoute.name, initialChildren: children); : super(SettingsRoute.name, initialChildren: children);
static const String name = 'SettingsRoute'; static const String name = 'SettingsRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i20.SettingsScreen(); return const _i20.SettingsScreen();
@ -917,12 +918,12 @@ class SettingsRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i11.StickerPackDetailScreen] /// [_i11.StickerPackDetailScreen]
class StickerPackDetailRoute class StickerPackDetailRoute
extends _i23.PageRouteInfo<StickerPackDetailRouteArgs> { extends _i24.PageRouteInfo<StickerPackDetailRouteArgs> {
StickerPackDetailRoute({ StickerPackDetailRoute({
_i24.Key? key, _i25.Key? key,
required String pubName, required String pubName,
required String id, required String id,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
StickerPackDetailRoute.name, StickerPackDetailRoute.name,
args: StickerPackDetailRouteArgs(key: key, pubName: pubName, id: id), args: StickerPackDetailRouteArgs(key: key, pubName: pubName, id: id),
@ -932,7 +933,7 @@ class StickerPackDetailRoute
static const String name = 'StickerPackDetailRoute'; static const String name = 'StickerPackDetailRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -959,7 +960,7 @@ class StickerPackDetailRouteArgs {
required this.id, required this.id,
}); });
final _i24.Key? key; final _i25.Key? key;
final String pubName; final String pubName;
@ -973,11 +974,11 @@ class StickerPackDetailRouteArgs {
/// generated route for /// generated route for
/// [_i10.StickersScreen] /// [_i10.StickersScreen]
class StickersRoute extends _i23.PageRouteInfo<StickersRouteArgs> { class StickersRoute extends _i24.PageRouteInfo<StickersRouteArgs> {
StickersRoute({ StickersRoute({
_i24.Key? key, _i25.Key? key,
required String pubName, required String pubName,
List<_i23.PageRouteInfo>? children, List<_i24.PageRouteInfo>? children,
}) : super( }) : super(
StickersRoute.name, StickersRoute.name,
args: StickersRouteArgs(key: key, pubName: pubName), args: StickersRouteArgs(key: key, pubName: pubName),
@ -987,7 +988,7 @@ class StickersRoute extends _i23.PageRouteInfo<StickersRouteArgs> {
static const String name = 'StickersRoute'; static const String name = 'StickersRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
final pathParams = data.inheritedPathParams; final pathParams = data.inheritedPathParams;
@ -1002,7 +1003,7 @@ class StickersRoute extends _i23.PageRouteInfo<StickersRouteArgs> {
class StickersRouteArgs { class StickersRouteArgs {
const StickersRouteArgs({this.key, required this.pubName}); const StickersRouteArgs({this.key, required this.pubName});
final _i24.Key? key; final _i25.Key? key;
final String pubName; final String pubName;
@ -1014,13 +1015,13 @@ class StickersRouteArgs {
/// generated route for /// generated route for
/// [_i21.TabsScreen] /// [_i21.TabsScreen]
class TabsRoute extends _i23.PageRouteInfo<void> { class TabsRoute extends _i24.PageRouteInfo<void> {
const TabsRoute({List<_i23.PageRouteInfo>? children}) const TabsRoute({List<_i24.PageRouteInfo>? children})
: super(TabsRoute.name, initialChildren: children); : super(TabsRoute.name, initialChildren: children);
static const String name = 'TabsRoute'; static const String name = 'TabsRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i21.TabsScreen(); return const _i21.TabsScreen();
@ -1030,16 +1031,32 @@ class TabsRoute extends _i23.PageRouteInfo<void> {
/// generated route for /// generated route for
/// [_i22.UpdateProfileScreen] /// [_i22.UpdateProfileScreen]
class UpdateProfileRoute extends _i23.PageRouteInfo<void> { class UpdateProfileRoute extends _i24.PageRouteInfo<void> {
const UpdateProfileRoute({List<_i23.PageRouteInfo>? children}) const UpdateProfileRoute({List<_i24.PageRouteInfo>? children})
: super(UpdateProfileRoute.name, initialChildren: children); : super(UpdateProfileRoute.name, initialChildren: children);
static const String name = 'UpdateProfileRoute'; static const String name = 'UpdateProfileRoute';
static _i23.PageInfo page = _i23.PageInfo( static _i24.PageInfo page = _i24.PageInfo(
name, name,
builder: (data) { builder: (data) {
return const _i22.UpdateProfileScreen(); return const _i22.UpdateProfileScreen();
}, },
); );
} }
/// generated route for
/// [_i23.WalletScreen]
class WalletRoute extends _i24.PageRouteInfo<void> {
const WalletRoute({List<_i24.PageRouteInfo>? children})
: super(WalletRoute.name, initialChildren: children);
static const String name = 'WalletRoute';
static _i24.PageInfo page = _i24.PageInfo(
name,
builder: (data) {
return const _i23.WalletScreen();
},
);
}

View File

@ -141,6 +141,16 @@ class AccountScreen extends HookConsumerWidget {
context.router.push(ManagedPublisherRoute()); context.router.push(ManagedPublisherRoute());
}, },
), ),
ListTile(
minTileHeight: 48,
leading: const Icon(Symbols.wallet),
trailing: const Icon(Symbols.chevron_right),
contentPadding: EdgeInsets.symmetric(horizontal: 24),
title: Text('wallet').tr(),
onTap: () {
context.router.push(WalletRoute());
},
),
ListTile( ListTile(
minTileHeight: 48, minTileHeight: 48,
leading: const Icon(Symbols.edit), leading: const Icon(Symbols.edit),

View File

@ -199,7 +199,10 @@ class EditPublisherScreen extends HookConsumerWidget {
CropAspectRatio(height: 1, width: 1), CropAspectRatio(height: 1, width: 1),
], ],
); );
if (result == null) return; if (result == null) {
if (context.mounted) hideLoadingModal(context);
return;
}
if (!context.mounted) return; if (!context.mounted) return;
showLoadingModal(context); showLoadingModal(context);

View File

@ -30,7 +30,10 @@ class UpdateProfileScreen extends HookConsumerWidget {
var result = await ref var result = await ref
.read(imagePickerProvider) .read(imagePickerProvider)
.pickImage(source: ImageSource.gallery); .pickImage(source: ImageSource.gallery);
if (result == null) return; if (result == null) {
if (context.mounted) hideLoadingModal(context);
return;
}
if (!context.mounted) return; if (!context.mounted) return;
hideLoadingModal(context); hideLoadingModal(context);
result = await cropImage( result = await cropImage(

View File

@ -265,7 +265,10 @@ class EditChatScreen extends HookConsumerWidget {
CropAspectRatio(height: 1, width: 1), CropAspectRatio(height: 1, width: 1),
], ],
); );
if (result == null) return; if (result == null) {
if (context.mounted) hideLoadingModal(context);
return;
}
if (!context.mounted) return; if (!context.mounted) return;
showLoadingModal(context); showLoadingModal(context);

View File

@ -12,10 +12,12 @@ import 'package:island/models/post.dart';
import 'package:island/widgets/check_in.dart'; import 'package:island/widgets/check_in.dart';
import 'package:island/widgets/post/post_item.dart'; import 'package:island/widgets/post/post_item.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:very_good_infinite_list/very_good_infinite_list.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:dio/dio.dart'; import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
part 'explore.g.dart';
@RoutePage() @RoutePage()
class ExploreScreen extends ConsumerWidget { class ExploreScreen extends ConsumerWidget {
const ExploreScreen({super.key}); const ExploreScreen({super.key});
@ -23,8 +25,7 @@ class ExploreScreen extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final user = ref.watch(userInfoProvider); final user = ref.watch(userInfoProvider);
final posts = ref.watch(activityListProvider); final activitiesNotifier = ref.watch(activityListNotifierProvider.notifier);
final postsNotifier = ref.watch(activityListProvider.notifier);
return AppScaffold( return AppScaffold(
appBar: AppBar(title: const Text('explore').tr()), appBar: AppBar(title: const Text('explore').tr()),
@ -33,7 +34,7 @@ class ExploreScreen extends ConsumerWidget {
onPressed: () { onPressed: () {
context.router.push(PostComposeRoute()).then((value) { context.router.push(PostComposeRoute()).then((value) {
if (value != null) { if (value != null) {
ref.invalidate(activityListProvider); activitiesNotifier.forceRefresh();
} }
}); });
}, },
@ -41,108 +42,110 @@ class ExploreScreen extends ConsumerWidget {
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
body: RefreshIndicator( body: RefreshIndicator(
onRefresh: () => postsNotifier.refresh(), onRefresh: () => Future.sync(activitiesNotifier.forceRefresh),
child: CustomScrollView( child: PagingHelperView(
provider: activityListNotifierProvider,
futureRefreshable: activityListNotifierProvider.future,
notifierRefreshable: activityListNotifierProvider.notifier,
contentBuilder:
(data, widgetCount, endItemView) => CustomScrollView(
slivers: [ slivers: [
if (user.hasValue) SliverToBoxAdapter(child: CheckInWidget()), if (user.hasValue) SliverToBoxAdapter(child: CheckInWidget()),
SliverInfiniteList( SliverList.builder(
itemCount: posts.length, itemCount: widgetCount,
isLoading: postsNotifier.isLoading,
hasReachedMax: postsNotifier.hasReachedMax,
onFetchData: postsNotifier.fetchMore,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final item = posts[index]; if (index == widgetCount - 1) {
return endItemView;
}
final item = data.items[index];
Widget itemWidget;
switch (item.type) { switch (item.type) {
case 'posts.new': case 'posts.new':
return PostItem( itemWidget = PostItem(
item: SnPost.fromJson(item.data), item: SnPost.fromJson(item.data),
onRefresh: (_) { onRefresh: (_) {
ref.invalidate(activityListProvider); activitiesNotifier.forceRefresh();
}, },
onUpdate: (post) { onUpdate: (post) {
postsNotifier.updateOne( activitiesNotifier.updateOne(
index, index,
item.copyWith(data: post.toJson()), item.copyWith(data: post.toJson()),
); );
}, },
); );
break;
case 'accounts.check-in': case 'accounts.check-in':
return CheckInActivityWidget(item: item); itemWidget = CheckInActivityWidget(item: item);
break;
case 'accounts.status': case 'accounts.status':
return StatusActivityWidget(item: item); itemWidget = StatusActivityWidget(item: item);
break;
default: default:
return Placeholder(); itemWidget = const Placeholder();
} }
return Column(
children: [itemWidget, const Divider(height: 1)],
);
}, },
separatorBuilder: (_, __) => const Divider(height: 1),
), ),
SliverGap(MediaQuery.of(context).padding.bottom + 16), SliverGap(MediaQuery.of(context).padding.bottom + 16),
], ],
), ),
), ),
),
); );
} }
} }
final activityListProvider = @riverpod
StateNotifierProvider<_ActivityListController, List<SnActivity>>((ref) { class ActivityListNotifier extends _$ActivityListNotifier
final client = ref.watch(apiClientProvider); with CursorPagingNotifierMixin<SnActivity> {
return _ActivityListController(client); @override
}); Future<CursorPagingData<SnActivity>> build() => fetch(cursor: null);
class _ActivityListController extends StateNotifier<List<SnActivity>> { @override
_ActivityListController(this._dio) : super([]); Future<CursorPagingData<SnActivity>> fetch({required String? cursor}) async {
final client = ref.read(apiClientProvider);
final offset = cursor == null ? 0 : int.parse(cursor);
final take = 20;
final Dio _dio; final response = await client.get(
bool isLoading = false;
bool hasReachedMax = false;
int offset = 0;
final int take = 20;
int total = 0;
Future<void> fetchMore() async {
if (isLoading || hasReachedMax) return;
isLoading = true;
try {
final response = await _dio.get(
'/activities', '/activities',
queryParameters: {'offset': offset, 'take': take}, queryParameters: {'offset': offset, 'take': take},
); );
final List<SnActivity> fetched = final List<SnActivity> items =
(response.data as List) (response.data as List)
.map((e) => SnActivity.fromJson(e as Map<String, dynamic>)) .map((e) => SnActivity.fromJson(e as Map<String, dynamic>))
.toList(); .toList();
final headerTotal = int.tryParse( final total = int.tryParse(response.headers['x-total']?.first ?? '') ?? 0;
response.headers['x-total']?.first ?? '', final hasMore = offset + items.length < total;
final nextCursor = hasMore ? (offset + items.length).toString() : null;
return CursorPagingData(
items: items,
hasMore: hasMore,
nextCursor: nextCursor,
); );
if (headerTotal != null) total = headerTotal;
if (!mounted) return; // Check if the notifier is still mounted
state = [...state, ...fetched];
offset += fetched.length;
if (state.length >= total) hasReachedMax = true;
} finally {
if (mounted) {
isLoading = false;
}
}
} }
Future<void> refresh() async { void updateOne(int index, SnActivity activity) {
offset = 0; final currentState = state.valueOrNull;
state = []; if (currentState == null) return;
hasReachedMax = false;
await fetchMore();
}
void updateOne(int index, SnActivity post) { final updatedItems = [...currentState.items];
if (!mounted) return; // Check if the notifier is still mounted updatedItems[index] = activity;
final updatedPosts = [...state];
updatedPosts[index] = post; state = AsyncData(
state = updatedPosts; CursorPagingData(
items: updatedItems,
hasMore: currentState.hasMore,
nextCursor: currentState.nextCursor,
),
);
} }
} }

View File

@ -0,0 +1,31 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'explore.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$activityListNotifierHash() =>
r'8a67d302e828408c7c4cf724d84c2c5958f2dc7e';
/// See also [ActivityListNotifier].
@ProviderFor(ActivityListNotifier)
final activityListNotifierProvider = AutoDisposeAsyncNotifierProvider<
ActivityListNotifier,
CursorPagingData<SnActivity>
>.internal(
ActivityListNotifier.new,
name: r'activityListNotifierProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$activityListNotifierHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$ActivityListNotifier =
AutoDisposeAsyncNotifier<CursorPagingData<SnActivity>>;
// 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

View File

@ -29,7 +29,7 @@ Future<SnPublisher> publisher(Ref ref, String uname) async {
@riverpod @riverpod
Future<List<SnAccountBadge>> publisherBadges(Ref ref, String pubName) async { Future<List<SnAccountBadge>> publisherBadges(Ref ref, String pubName) async {
final pub = await ref.watch(publisherProvider(pubName).future); final pub = await ref.watch(publisherProvider(pubName).future);
if (pub.publisherType != 0) return []; if (pub.type != 0) return [];
final apiClient = ref.watch(apiClientProvider); final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get("/accounts/${pub.name}/badges"); final resp = await apiClient.get("/accounts/${pub.name}/badges");
return List<SnAccountBadge>.from( return List<SnAccountBadge>.from(
@ -177,7 +177,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
).fontSize(14).opacity(0.85), ).fontSize(14).opacity(0.85),
], ],
), ),
if (data.publisherType == 0) if (data.type == 0)
AccountStatusWidget( AccountStatusWidget(
uname: name, uname: name,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,

View File

@ -145,7 +145,7 @@ class _PublisherProviderElement
String get uname => (origin as PublisherProvider).uname; String get uname => (origin as PublisherProvider).uname;
} }
String _$publisherBadgesHash() => r'69a5bbc9e1528da65ae8b1e5e6c4f57c3dcf4071'; String _$publisherBadgesHash() => r'b26d8804ddc9734c453bdf76af0a9336f166542c';
/// See also [publisherBadges]. /// See also [publisherBadges].
@ProviderFor(publisherBadges) @ProviderFor(publisherBadges)

View File

@ -163,7 +163,10 @@ class EditRealmScreen extends HookConsumerWidget {
var result = await ref var result = await ref
.read(imagePickerProvider) .read(imagePickerProvider)
.pickImage(source: ImageSource.gallery); .pickImage(source: ImageSource.gallery);
if (result == null) return; if (result == null) {
if (context.mounted) hideLoadingModal(context);
return;
}
if (!context.mounted) return; if (!context.mounted) return;
hideLoadingModal(context); hideLoadingModal(context);
result = await cropImage( result = await cropImage(

69
lib/screens/wallet.dart Normal file
View File

@ -0,0 +1,69 @@
import 'package:auto_route/annotations.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/wallet.dart';
import 'package:island/pods/network.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';
part 'wallet.g.dart';
@riverpod
Future<SnWallet> walletCurrent(Ref ref) async {
final apiClient = ref.watch(apiClientProvider);
final resp = await apiClient.get('/wallets');
return SnWallet.fromJson(resp.data);
}
const Map<String, IconData> kCurrencyIconData = {
'points': Symbols.toll,
'golds': Symbols.attach_money,
};
@RoutePage()
class WalletScreen extends HookConsumerWidget {
const WalletScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final wallet = ref.watch(walletCurrentProvider);
String getCurrencyTranslationKey(String currency, {bool isShort = false}) {
return 'walletCurrency${isShort ? 'Short' : ''}${currency[0].toUpperCase()}${currency.substring(1).toLowerCase()}';
}
return AppScaffold(
appBar: AppBar(title: Text('wallet').tr()),
body: wallet.when(
data: (data) {
return Column(
spacing: 8,
children: [
...data.pockets.map(
(pocket) => Card(
margin: EdgeInsets.zero,
child: ListTile(
leading: Icon(
kCurrencyIconData[pocket.currency] ??
Symbols.universal_currency_alt,
),
title:
Text(getCurrencyTranslationKey(pocket.currency)).tr(),
subtitle: Text(
'${pocket.amount.toStringAsFixed(2)} ${getCurrencyTranslationKey(pocket.currency, isShort: true).tr()}',
),
),
),
),
],
).padding(horizontal: 16, vertical: 16);
},
error: (error, stackTrace) => Center(child: Text('Error: $error')),
loading: () => const Center(child: CircularProgressIndicator()),
),
);
}
}

28
lib/screens/wallet.g.dart Normal file
View File

@ -0,0 +1,28 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'wallet.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$walletCurrentHash() => r'9123af148c4a27e079bbe90c7d4e41d08e408a39';
/// See also [walletCurrent].
@ProviderFor(walletCurrent)
final walletCurrentProvider = AutoDisposeFutureProvider<SnWallet>.internal(
walletCurrent,
name: r'walletCurrentProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$walletCurrentHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef WalletCurrentRef = AutoDisposeFutureProviderRef<SnWallet>;
// 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

View File

@ -1,108 +1,49 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:dio/dio.dart';
import 'package:island/models/post.dart'; import 'package:island/models/post.dart';
import 'package:island/pods/network.dart'; import 'package:island/pods/network.dart';
import 'package:island/widgets/post/post_item.dart'; import 'package:island/widgets/post/post_item.dart';
import 'package:very_good_infinite_list/very_good_infinite_list.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
// State class to hold posts and pagination info part 'post_list.g.dart';
class PostListState {
final List<SnPost> posts;
final bool isLoading;
final String? error;
final int total;
final bool hasMore;
const PostListState({ @riverpod
this.posts = const [], class PostListNotifier extends _$PostListNotifier
this.isLoading = false, with CursorPagingNotifierMixin<SnPost> {
this.error,
this.total = 0,
this.hasMore = true,
});
PostListState copyWith({
List<SnPost>? posts,
bool? isLoading,
String? error,
int? total,
bool? hasMore,
}) {
return PostListState(
posts: posts ?? this.posts,
isLoading: isLoading ?? this.isLoading,
error: error,
total: total ?? this.total,
hasMore: hasMore ?? this.hasMore,
);
}
}
// Provider for managing post list state
final postListProvider =
StateNotifierProvider.family<PostListNotifier, PostListState, String?>((
ref,
pubName,
) {
final dio = ref.watch(apiClientProvider);
return PostListNotifier(dio, pubName);
});
class PostListNotifier extends StateNotifier<PostListState> {
final Dio _dio;
final String? pubName;
static const int _pageSize = 20; static const int _pageSize = 20;
PostListNotifier(this._dio, this.pubName) : super(const PostListState()) { PostListNotifier({this.pubName});
loadInitialPosts();
}
Future<void> loadInitialPosts() async { final String? pubName;
state = state.copyWith(isLoading: true, error: null);
try {
final result = await _fetchPosts(0);
state = PostListState(
posts: result.posts,
total: result.total,
hasMore: result.posts.length < result.total,
isLoading: false,
);
} catch (e) {
state = state.copyWith(isLoading: false, error: e.toString());
}
}
Future<void> loadMorePosts() async { @override
if (state.isLoading || !state.hasMore) return; Future<CursorPagingData<SnPost>> build() => fetch(cursor: null);
state = state.copyWith(isLoading: true, error: null); @override
try { Future<CursorPagingData<SnPost>> fetch({required String? cursor}) async {
final result = await _fetchPosts(state.posts.length); final client = ref.read(apiClientProvider);
state = state.copyWith( final offset = cursor == null ? 0 : int.parse(cursor);
posts: [...state.posts, ...result.posts],
total: result.total,
hasMore: state.posts.length + result.posts.length < result.total,
isLoading: false,
);
} catch (e) {
state = state.copyWith(isLoading: false, error: e.toString());
}
}
Future<({List<SnPost> posts, int total})> _fetchPosts(int offset) async {
final queryParams = { final queryParams = {
'offset': offset, 'offset': offset,
'take': _pageSize, 'take': _pageSize,
if (pubName != null) 'pub': pubName, if (pubName != null) 'pub': pubName,
}; };
final response = await _dio.get('/posts', queryParameters: queryParams); final response = await client.get('/posts', queryParameters: queryParams);
final total = int.parse(response.headers.value('X-Total') ?? '0'); final total = int.parse(response.headers.value('X-Total') ?? '0');
final List<dynamic> data = response.data; final List<dynamic> data = response.data;
final posts = data.map((json) => SnPost.fromJson(json)).toList(); final posts = data.map((json) => SnPost.fromJson(json)).toList();
return (posts: posts, total: total); final hasMore = offset + posts.length < total;
final nextCursor = hasMore ? (offset + posts.length).toString() : null;
return CursorPagingData(
items: posts,
hasMore: hasMore,
nextCursor: nextCursor,
);
} }
} }
@ -112,18 +53,26 @@ class SliverPostList extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(postListProvider(pubName)); return PagingHelperView(
final notifier = ref.read(postListProvider(pubName).notifier); provider: postListNotifierProvider,
futureRefreshable: postListNotifierProvider.future,
return SliverInfiniteList( notifierRefreshable: postListNotifierProvider.notifier,
onFetchData: notifier.loadMorePosts, contentBuilder:
itemCount: state.posts.length, (data, widgetCount, endItemView) => SliverList.builder(
hasReachedMax: !state.hasMore, itemCount: widgetCount,
isLoading: state.isLoading,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return PostItem(item: state.posts[index]); if (index == widgetCount - 1) {
return endItemView;
}
return Column(
children: [
PostItem(item: data.items[index]),
const Divider(height: 1),
],
);
}, },
separatorBuilder: (_, __) => const Divider(height: 1), ),
); );
} }
} }

View File

@ -0,0 +1,29 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'post_list.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$postListNotifierHash() => r'88aab109f36c7489c336fea522bffafa10869253';
/// See also [PostListNotifier].
@ProviderFor(PostListNotifier)
final postListNotifierProvider = AutoDisposeAsyncNotifierProvider<
PostListNotifier,
CursorPagingData<SnPost>
>.internal(
PostListNotifier.new,
name: r'postListNotifierProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$postListNotifierHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$PostListNotifier = AutoDisposeAsyncNotifier<CursorPagingData<SnPost>>;
// 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

41
lib/widgets/response.dart Normal file
View File

@ -0,0 +1,41 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:material_symbols_icons/symbols.dart';
class ResponseErrorWidget extends StatelessWidget {
final Error error;
final VoidCallback onRetry;
const ResponseErrorWidget({
super.key,
required this.error,
required this.onRetry,
});
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Symbols.error_outline, size: 48),
const Gap(16),
Text(
error.toString(),
textAlign: TextAlign.center,
style: const TextStyle(color: Color(0xFF757575)),
),
const SizedBox(height: 16),
TextButton(onPressed: onRetry, child: const Text('retry').tr()),
],
);
}
}
class ResponseLoadingWidget extends StatelessWidget {
const ResponseLoadingWidget({super.key});
@override
Widget build(BuildContext context) {
return const Center(child: CircularProgressIndicator());
}
}

View File

@ -1461,6 +1461,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.6.5" version: "2.6.5"
riverpod_paging_utils:
dependency: "direct main"
description:
name: riverpod_paging_utils
sha256: "18f59960807835b1d3cb993e825442d7b09928d0f55ad50bda65c002b5893bdc"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
rxdart: rxdart:
dependency: transitive dependency: transitive
description: description:
@ -1947,6 +1955,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.9.0" version: "0.9.0"
visibility_detector:
dependency: transitive
description:
name: visibility_detector
sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420
url: "https://pub.dev"
source: hosted
version: "0.4.0+2"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:

View File

@ -94,6 +94,7 @@ dependencies:
table_calendar: ^3.1.3 table_calendar: ^3.1.3
relative_time: ^5.0.0 relative_time: ^5.0.0
dropdown_button2: ^2.3.9 dropdown_button2: ^2.3.9
riverpod_paging_utils: ^0.8.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: