Golden points

This commit is contained in:
LittleSheep 2025-03-23 18:23:18 +08:00
parent 16c07c2133
commit dd196b7754
8 changed files with 168 additions and 173 deletions

View File

@ -897,5 +897,12 @@
"albumDescription": "View albums and manage attachments.",
"stickers": "Stickers",
"stickersDescription": "View sticker packs and manage stickers.",
"navBottomUnauthorizedCaption": "Or create an account"
"navBottomUnauthorizedCaption": "Or create an account",
"walletCurrencyGoldenShort": "GDP",
"walletCurrencyGolden": {
"one": "{} Golden Point",
"other": "{} Golden Points"
},
"walletTransactionTypeNormal": "Source Point",
"walletTransactionTypeGolden": "Golden Point"
}

View File

@ -895,5 +895,12 @@
"albumDescription": "查看相册与管理上传附件。",
"stickers": "贴图",
"stickersDescription": "查看贴图包与管理贴图。",
"navBottomUnauthorizedCaption": "或者注册一个账号"
"navBottomUnauthorizedCaption": "或者注册一个账号",
"walletCurrencyGoldenShort": "金点",
"walletCurrencyGolden": {
"one": "{} 金点",
"other": "{} 金点"
},
"walletTransactionTypeNormal": "源点",
"walletTransactionTypeGolden": "金点"
}

View File

@ -46,9 +46,7 @@ class _FriendScreenState extends State<FriendScreen> {
try {
final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.get('/cgi/id/users/me/relations?status=1');
_relations = List<SnRelationship>.from(
resp.data?.map((e) => SnRelationship.fromJson(e)) ?? [],
);
_relations = List<SnRelationship>.from(resp.data?.map((e) => SnRelationship.fromJson(e)) ?? []);
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
@ -66,9 +64,7 @@ class _FriendScreenState extends State<FriendScreen> {
try {
final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.get('/cgi/id/users/me/relations?status=0,3');
_requests = List<SnRelationship>.from(
resp.data?.map((e) => SnRelationship.fromJson(e)) ?? [],
);
_requests = List<SnRelationship>.from(resp.data?.map((e) => SnRelationship.fromJson(e)) ?? []);
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
@ -86,9 +82,7 @@ class _FriendScreenState extends State<FriendScreen> {
try {
final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.get('/cgi/id/users/me/relations?status=2');
_blocks = List<SnRelationship>.from(
resp.data?.map((e) => SnRelationship.fromJson(e)) ?? [],
);
_blocks = List<SnRelationship>.from(resp.data?.map((e) => SnRelationship.fromJson(e)) ?? []);
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
@ -104,11 +98,7 @@ class _FriendScreenState extends State<FriendScreen> {
try {
final rel = context.read<SnRelationshipProvider>();
await rel.updateRelationship(
relation.relatedId,
dstStatus,
relation.permNodes,
);
await rel.updateRelationship(relation.relatedId, dstStatus, relation.permNodes);
if (!mounted) return;
_fetchRelations();
} catch (err) {
@ -122,9 +112,7 @@ class _FriendScreenState extends State<FriendScreen> {
Future<void> _deleteRelation(SnRelationship relation) async {
final confirm = await context.showConfirmDialog(
'friendDelete'.tr(args: [relation.related?.nick ?? 'unknown'.tr()]),
'friendDeleteDescription'.tr(args: [
relation.related?.nick ?? 'unknown'.tr(),
]),
'friendDeleteDescription'.tr(args: [relation.related?.nick ?? 'unknown'.tr()]),
);
if (!confirm) return;
if (!mounted) return;
@ -145,10 +133,9 @@ class _FriendScreenState extends State<FriendScreen> {
}
void _showRequests() {
showModalBottomSheet(
context: context,
builder: (context) => _FriendshipListWidget(relations: _requests),
).then((value) {
showModalBottomSheet(context: context, builder: (context) => _FriendshipListWidget(relations: _requests)).then((
value,
) {
if (value != null) {
_fetchRequests();
_fetchRelations();
@ -157,10 +144,9 @@ class _FriendScreenState extends State<FriendScreen> {
}
void _showBlocks() {
showModalBottomSheet(
context: context,
builder: (context) => _FriendshipListWidget(relations: _blocks),
).then((value) {
showModalBottomSheet(context: context, builder: (context) => _FriendshipListWidget(relations: _blocks)).then((
value,
) {
if (value != null) {
_fetchBlocks();
_fetchRelations();
@ -173,9 +159,7 @@ class _FriendScreenState extends State<FriendScreen> {
try {
final sn = context.read<SnNetworkProvider>();
await sn.client.post('/cgi/id/users/me/relations', data: {
'related': user.name,
});
await sn.client.post('/cgi/id/users/me/relations', data: {'related': user.name});
if (!mounted) return;
context.showSnackbar('friendRequestSent'.tr());
} catch (err) {
@ -200,29 +184,19 @@ class _FriendScreenState extends State<FriendScreen> {
if (!ua.isAuthorized) {
return AppScaffold(
appBar: AppBar(
leading: PageBackButton(),
title: Text('screenFriend').tr(),
),
body: Center(
child: UnauthorizedHint(),
),
appBar: AppBar(leading: PageBackButton(), title: Text('screenFriend').tr()),
body: Center(child: UnauthorizedHint()),
);
}
return AppScaffold(
appBar: AppBar(
leading: AutoAppBarLeading(),
title: Text('screenFriend').tr(),
),
appBar: AppBar(leading: AutoAppBarLeading(), title: Text('screenFriend').tr()),
floatingActionButton: FloatingActionButton(
child: const Icon(Symbols.add),
onPressed: () async {
final user = await showModalBottomSheet<SnAccount?>(
context: context,
builder: (context) => AccountSelect(
title: 'friendNew'.tr(),
),
builder: (context) => AccountSelect(title: 'friendNew'.tr()),
);
if (!mounted) return;
if (user == null) return;
@ -235,9 +209,7 @@ class _FriendScreenState extends State<FriendScreen> {
if (_requests.isNotEmpty)
ListTile(
title: Text('friendRequests').tr(),
subtitle: Text(
'friendRequestsDescription',
).plural(_requests.length),
subtitle: Text('friendRequestsDescription').plural(_requests.length),
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Symbols.group_add),
trailing: const Icon(Symbols.chevron_right),
@ -246,25 +218,19 @@ class _FriendScreenState extends State<FriendScreen> {
if (_blocks.isNotEmpty)
ListTile(
title: Text('friendBlocklist').tr(),
subtitle: Text(
'friendBlocklistDescription',
).plural(_blocks.length),
subtitle: Text('friendBlocklistDescription').plural(_blocks.length),
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Symbols.block),
trailing: const Icon(Symbols.chevron_right),
onTap: _showBlocks,
),
if (_requests.isNotEmpty || _blocks.isNotEmpty)
const Divider(height: 1),
if (_requests.isNotEmpty || _blocks.isNotEmpty) const Divider(height: 1),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: RefreshIndicator(
onRefresh: () => Future.wait([
_fetchRelations(),
_fetchRequests(),
]),
onRefresh: () => Future.wait([_fetchRelations(), _fetchRequests()]),
child: ListView.builder(
itemCount: _relations.length,
itemBuilder: (context, index) {
@ -288,16 +254,12 @@ class _FriendScreenState extends State<FriendScreen> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
onTap: _isUpdating
? null
: () => _changeRelation(relation, 2),
onTap: _isUpdating ? null : () => _changeRelation(relation, 2),
child: Text('friendBlock').tr(),
),
const Gap(8),
InkWell(
onTap: _isUpdating
? null
: () => _deleteRelation(relation),
onTap: _isUpdating ? null : () => _deleteRelation(relation),
child: Text('friendDeleteAction').tr(),
),
],
@ -366,11 +328,7 @@ class _FriendshipListWidgetState extends State<_FriendshipListWidget> {
try {
final rel = context.read<SnRelationshipProvider>();
await rel.updateRelationship(
relation.relatedId,
dstStatus,
relation.permNodes,
);
await rel.updateRelationship(relation.relatedId, dstStatus, relation.permNodes);
if (!mounted) return;
Navigator.pop(context, true);
} catch (err) {
@ -384,9 +342,7 @@ class _FriendshipListWidgetState extends State<_FriendshipListWidget> {
Future<void> _deleteRelation(SnRelationship relation) async {
final confirm = await context.showConfirmDialog(
'friendDelete'.tr(args: [relation.related?.nick ?? 'unknown'.tr()]),
'friendDeleteDescription'.tr(args: [
relation.related?.nick ?? 'unknown'.tr(),
]),
'friendDeleteDescription'.tr(args: [relation.related?.nick ?? 'unknown'.tr()]),
);
if (!confirm) return;
if (!mounted) return;
@ -426,9 +382,7 @@ class _FriendshipListWidgetState extends State<_FriendshipListWidget> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(kFriendStatus[relation.status] ?? 'unknown')
.tr()
.opacity(0.75),
Text(kFriendStatus[relation.status] ?? 'unknown').tr().opacity(0.75),
if (relation.status == 0)
Row(
mainAxisAlignment: MainAxisAlignment.end,
@ -449,8 +403,7 @@ class _FriendshipListWidgetState extends State<_FriendshipListWidget> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
onTap:
_isBusy ? null : () => _changeRelation(relation, 1),
onTap: _isBusy ? null : () => _changeRelation(relation, 1),
child: Text('friendUnblock').tr(),
),
const Gap(8),

View File

@ -28,11 +28,7 @@ class _PostShuffleScreenState extends State<PostShuffleScreen> {
setState(() => _isBusy = true);
try {
final pt = context.read<SnPostContentProvider>();
final result = await pt.listPosts(
take: 10,
offset: _posts.length,
isShuffle: true,
);
final result = await pt.listPosts(take: 10, offset: _posts.length, isShuffle: true);
_posts.addAll(result.$1);
} catch (err) {
if (!mounted) return;
@ -57,19 +53,13 @@ class _PostShuffleScreenState extends State<PostShuffleScreen> {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBar: AppBar(
title: Text('postShuffle').tr(),
),
appBar: AppBar(title: Text('postShuffle').tr()),
body: Stack(
children: [
Column(
children: [
if (_isBusy || _posts.isEmpty)
const Expanded(
child: Center(
child: CircularProgressIndicator(),
),
)
const Expanded(child: Center(child: CircularProgressIndicator()))
else
Expanded(
child: CardSwiper(
@ -81,21 +71,19 @@ class _PostShuffleScreenState extends State<PostShuffleScreen> {
final ele = _posts[idx];
return SingleChildScrollView(
child: Center(
child: OpenablePostItem(
key: ValueKey(ele),
data: ele,
maxWidth: 640,
onChanged: (ele) {
_posts[idx] = ele;
setState(() {});
},
onDeleted: () {
_fetchPosts();
},
).padding(
all: 24,
bottom:
MediaQuery.of(context).padding.bottom + 16 + 50,
child: Card(
child: OpenablePostItem(
key: ValueKey(ele),
data: ele,
maxWidth: 640,
onChanged: (ele) {
_posts[idx] = ele;
setState(() {});
},
onDeleted: () {
_fetchPosts();
},
).padding(all: 24, bottom: MediaQuery.of(context).padding.bottom + 16 + 50),
),
),
);

View File

@ -45,10 +45,7 @@ class _WalletScreenState extends State<WalletScreen> {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBar: AppBar(
leading: PageBackButton(),
title: Text('screenAccountWallet').tr(),
),
appBar: AppBar(leading: PageBackButton(), title: Text('screenAccountWallet').tr()),
body: Column(
children: [
LoadingIndicator(isActive: _isBusy),
@ -66,11 +63,6 @@ class _WalletScreenState extends State<WalletScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
radius: 28,
child: Icon(Symbols.wallet, size: 28),
),
const Gap(12),
SizedBox(width: double.infinity),
Text(
NumberFormat.compactCurrency(
@ -81,6 +73,16 @@ class _WalletScreenState extends State<WalletScreen> {
style: Theme.of(context).textTheme.titleLarge,
),
Text('walletCurrency'.plural(double.parse(_wallet!.balance))),
const Gap(16),
Text(
NumberFormat.compactCurrency(
locale: EasyLocalization.of(context)!.currentLocale.toString(),
symbol: '${'walletCurrencyGoldenShort'.tr()} ',
decimalDigits: 2,
).format(double.parse(_wallet!.goldenBalance)),
style: Theme.of(context).textTheme.titleLarge,
),
Text('walletCurrencyGolden'.plural(double.parse(_wallet!.goldenBalance))),
],
).padding(horizontal: 20, vertical: 24),
).padding(horizontal: 8, top: 16, bottom: 4),
@ -109,14 +111,12 @@ class _WalletTransactionListState extends State<_WalletTransactionList> {
try {
setState(() => _isBusy = true);
final sn = context.read<SnNetworkProvider>();
final resp = await sn.client.get('/cgi/wa/transactions/me', queryParameters: {
'take': 10,
'offset': _transactions.length,
});
_totalCount = resp.data['count'];
_transactions.addAll(
resp.data['data']?.map((e) => SnTransaction.fromJson(e)).cast<SnTransaction>() ?? [],
final resp = await sn.client.get(
'/cgi/wa/transactions/me',
queryParameters: {'take': 10, 'offset': _transactions.length},
);
_totalCount = resp.data['count'];
_transactions.addAll(resp.data['data']?.map((e) => SnTransaction.fromJson(e)).cast<SnTransaction>() ?? []);
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
@ -159,12 +159,18 @@ class _WalletTransactionListState extends State<_WalletTransactionList> {
children: [
Text(ele.remark),
const Gap(2),
Text(
DateFormat(
null,
EasyLocalization.of(context)!.currentLocale.toString(),
).format(ele.createdAt),
style: Theme.of(context).textTheme.labelSmall,
Row(
children: [
Text(
'walletTransactionType${ele.currency.capitalize()}'.tr(),
style: Theme.of(context).textTheme.labelSmall,
),
Text(' · ').textStyle(Theme.of(context).textTheme.labelSmall!).padding(right: 4),
Text(
DateFormat(null, EasyLocalization.of(context)!.currentLocale.toString()).format(ele.createdAt),
style: Theme.of(context).textTheme.labelSmall,
),
],
),
],
),
@ -193,37 +199,33 @@ class _CreateWalletWidgetState extends State<_CreateWalletWidget> {
final TextEditingController passwordController = TextEditingController();
final password = await showDialog<String?>(
context: context,
builder: (ctx) => AlertDialog(
title: Text('walletCreate').tr(),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('walletCreatePassword').tr(),
const Gap(8),
TextField(
autofocus: true,
obscureText: true,
controller: passwordController,
decoration: InputDecoration(
labelText: 'fieldPassword'.tr(),
),
builder:
(ctx) => AlertDialog(
title: Text('walletCreate').tr(),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('walletCreatePassword').tr(),
const Gap(8),
TextField(
autofocus: true,
obscureText: true,
controller: passwordController,
decoration: InputDecoration(labelText: 'fieldPassword'.tr()),
),
],
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
child: Text('cancel').tr(),
actions: [
TextButton(onPressed: () => Navigator.of(ctx).pop(), child: Text('cancel').tr()),
TextButton(
onPressed: () {
Navigator.of(ctx).pop(passwordController.text);
},
child: Text('next').tr(),
),
],
),
TextButton(
onPressed: () {
Navigator.of(ctx).pop(passwordController.text);
},
child: Text('next').tr(),
),
],
),
);
WidgetsBinding.instance.addPostFrameCallback((_) {
passwordController.dispose();
@ -234,9 +236,7 @@ class _CreateWalletWidgetState extends State<_CreateWalletWidget> {
try {
setState(() => _isBusy = true);
final sn = context.read<SnNetworkProvider>();
await sn.client.post('/cgi/wa/wallets/me', data: {
'password': password,
});
await sn.client.post('/cgi/wa/wallets/me', data: {'password': password});
} catch (err) {
if (!mounted) return;
context.showErrorDialog(err);
@ -255,20 +255,14 @@ class _CreateWalletWidgetState extends State<_CreateWalletWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CircleAvatar(
radius: 28,
child: Icon(Symbols.add, size: 28),
),
CircleAvatar(radius: 28, child: Icon(Symbols.add, size: 28)),
const Gap(12),
Text('walletCreate', style: Theme.of(context).textTheme.titleLarge).tr(),
Text('walletCreateSubtitle', style: Theme.of(context).textTheme.bodyMedium).tr(),
const Gap(8),
Align(
alignment: Alignment.centerRight,
child: TextButton(
onPressed: _isBusy ? null : () => _createWallet(),
child: Text('next').tr(),
),
child: TextButton(onPressed: _isBusy ? null : () => _createWallet(), child: Text('next').tr()),
),
],
).padding(horizontal: 20, vertical: 24),

View File

@ -11,6 +11,7 @@ abstract class SnWallet with _$SnWallet {
required DateTime updatedAt,
required DateTime? deletedAt,
required String balance,
required String goldenBalance,
required String password,
required int accountId,
}) = _SnWallet;
@ -27,6 +28,7 @@ abstract class SnTransaction with _$SnTransaction {
required DateTime? deletedAt,
required String remark,
required String amount,
required String currency,
required SnWallet? payer,
required SnWallet? payee,
required int? payerId,

View File

@ -20,6 +20,7 @@ mixin _$SnWallet {
DateTime get updatedAt;
DateTime? get deletedAt;
String get balance;
String get goldenBalance;
String get password;
int get accountId;
@ -46,6 +47,8 @@ mixin _$SnWallet {
(identical(other.deletedAt, deletedAt) ||
other.deletedAt == deletedAt) &&
(identical(other.balance, balance) || other.balance == balance) &&
(identical(other.goldenBalance, goldenBalance) ||
other.goldenBalance == goldenBalance) &&
(identical(other.password, password) ||
other.password == password) &&
(identical(other.accountId, accountId) ||
@ -55,11 +58,11 @@ mixin _$SnWallet {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, createdAt, updatedAt,
deletedAt, balance, password, accountId);
deletedAt, balance, goldenBalance, password, accountId);
@override
String toString() {
return 'SnWallet(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, balance: $balance, password: $password, accountId: $accountId)';
return 'SnWallet(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, balance: $balance, goldenBalance: $goldenBalance, password: $password, accountId: $accountId)';
}
}
@ -74,6 +77,7 @@ abstract mixin class $SnWalletCopyWith<$Res> {
DateTime updatedAt,
DateTime? deletedAt,
String balance,
String goldenBalance,
String password,
int accountId});
}
@ -95,6 +99,7 @@ class _$SnWalletCopyWithImpl<$Res> implements $SnWalletCopyWith<$Res> {
Object? updatedAt = null,
Object? deletedAt = freezed,
Object? balance = null,
Object? goldenBalance = null,
Object? password = null,
Object? accountId = null,
}) {
@ -119,6 +124,10 @@ class _$SnWalletCopyWithImpl<$Res> implements $SnWalletCopyWith<$Res> {
? _self.balance
: balance // ignore: cast_nullable_to_non_nullable
as String,
goldenBalance: null == goldenBalance
? _self.goldenBalance
: goldenBalance // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _self.password
: password // ignore: cast_nullable_to_non_nullable
@ -140,6 +149,7 @@ class _SnWallet implements SnWallet {
required this.updatedAt,
required this.deletedAt,
required this.balance,
required this.goldenBalance,
required this.password,
required this.accountId});
factory _SnWallet.fromJson(Map<String, dynamic> json) =>
@ -156,6 +166,8 @@ class _SnWallet implements SnWallet {
@override
final String balance;
@override
final String goldenBalance;
@override
final String password;
@override
final int accountId;
@ -188,6 +200,8 @@ class _SnWallet implements SnWallet {
(identical(other.deletedAt, deletedAt) ||
other.deletedAt == deletedAt) &&
(identical(other.balance, balance) || other.balance == balance) &&
(identical(other.goldenBalance, goldenBalance) ||
other.goldenBalance == goldenBalance) &&
(identical(other.password, password) ||
other.password == password) &&
(identical(other.accountId, accountId) ||
@ -197,11 +211,11 @@ class _SnWallet implements SnWallet {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, createdAt, updatedAt,
deletedAt, balance, password, accountId);
deletedAt, balance, goldenBalance, password, accountId);
@override
String toString() {
return 'SnWallet(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, balance: $balance, password: $password, accountId: $accountId)';
return 'SnWallet(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, balance: $balance, goldenBalance: $goldenBalance, password: $password, accountId: $accountId)';
}
}
@ -218,6 +232,7 @@ abstract mixin class _$SnWalletCopyWith<$Res>
DateTime updatedAt,
DateTime? deletedAt,
String balance,
String goldenBalance,
String password,
int accountId});
}
@ -239,6 +254,7 @@ class __$SnWalletCopyWithImpl<$Res> implements _$SnWalletCopyWith<$Res> {
Object? updatedAt = null,
Object? deletedAt = freezed,
Object? balance = null,
Object? goldenBalance = null,
Object? password = null,
Object? accountId = null,
}) {
@ -263,6 +279,10 @@ class __$SnWalletCopyWithImpl<$Res> implements _$SnWalletCopyWith<$Res> {
? _self.balance
: balance // ignore: cast_nullable_to_non_nullable
as String,
goldenBalance: null == goldenBalance
? _self.goldenBalance
: goldenBalance // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _self.password
: password // ignore: cast_nullable_to_non_nullable
@ -283,6 +303,7 @@ mixin _$SnTransaction {
DateTime? get deletedAt;
String get remark;
String get amount;
String get currency;
SnWallet? get payer;
SnWallet? get payee;
int? get payerId;
@ -313,6 +334,8 @@ mixin _$SnTransaction {
other.deletedAt == deletedAt) &&
(identical(other.remark, remark) || other.remark == remark) &&
(identical(other.amount, amount) || other.amount == amount) &&
(identical(other.currency, currency) ||
other.currency == currency) &&
(identical(other.payer, payer) || other.payer == payer) &&
(identical(other.payee, payee) || other.payee == payee) &&
(identical(other.payerId, payerId) || other.payerId == payerId) &&
@ -322,11 +345,11 @@ mixin _$SnTransaction {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, createdAt, updatedAt,
deletedAt, remark, amount, payer, payee, payerId, payeeId);
deletedAt, remark, amount, currency, payer, payee, payerId, payeeId);
@override
String toString() {
return 'SnTransaction(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, remark: $remark, amount: $amount, payer: $payer, payee: $payee, payerId: $payerId, payeeId: $payeeId)';
return 'SnTransaction(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, remark: $remark, amount: $amount, currency: $currency, payer: $payer, payee: $payee, payerId: $payerId, payeeId: $payeeId)';
}
}
@ -343,6 +366,7 @@ abstract mixin class $SnTransactionCopyWith<$Res> {
DateTime? deletedAt,
String remark,
String amount,
String currency,
SnWallet? payer,
SnWallet? payee,
int? payerId,
@ -371,6 +395,7 @@ class _$SnTransactionCopyWithImpl<$Res>
Object? deletedAt = freezed,
Object? remark = null,
Object? amount = null,
Object? currency = null,
Object? payer = freezed,
Object? payee = freezed,
Object? payerId = freezed,
@ -401,6 +426,10 @@ class _$SnTransactionCopyWithImpl<$Res>
? _self.amount
: amount // ignore: cast_nullable_to_non_nullable
as String,
currency: null == currency
? _self.currency
: currency // ignore: cast_nullable_to_non_nullable
as String,
payer: freezed == payer
? _self.payer
: payer // ignore: cast_nullable_to_non_nullable
@ -459,6 +488,7 @@ class _SnTransaction implements SnTransaction {
required this.deletedAt,
required this.remark,
required this.amount,
required this.currency,
required this.payer,
required this.payee,
required this.payerId,
@ -479,6 +509,8 @@ class _SnTransaction implements SnTransaction {
@override
final String amount;
@override
final String currency;
@override
final SnWallet? payer;
@override
final SnWallet? payee;
@ -516,6 +548,8 @@ class _SnTransaction implements SnTransaction {
other.deletedAt == deletedAt) &&
(identical(other.remark, remark) || other.remark == remark) &&
(identical(other.amount, amount) || other.amount == amount) &&
(identical(other.currency, currency) ||
other.currency == currency) &&
(identical(other.payer, payer) || other.payer == payer) &&
(identical(other.payee, payee) || other.payee == payee) &&
(identical(other.payerId, payerId) || other.payerId == payerId) &&
@ -525,11 +559,11 @@ class _SnTransaction implements SnTransaction {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, createdAt, updatedAt,
deletedAt, remark, amount, payer, payee, payerId, payeeId);
deletedAt, remark, amount, currency, payer, payee, payerId, payeeId);
@override
String toString() {
return 'SnTransaction(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, remark: $remark, amount: $amount, payer: $payer, payee: $payee, payerId: $payerId, payeeId: $payeeId)';
return 'SnTransaction(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, remark: $remark, amount: $amount, currency: $currency, payer: $payer, payee: $payee, payerId: $payerId, payeeId: $payeeId)';
}
}
@ -548,6 +582,7 @@ abstract mixin class _$SnTransactionCopyWith<$Res>
DateTime? deletedAt,
String remark,
String amount,
String currency,
SnWallet? payer,
SnWallet? payee,
int? payerId,
@ -578,6 +613,7 @@ class __$SnTransactionCopyWithImpl<$Res>
Object? deletedAt = freezed,
Object? remark = null,
Object? amount = null,
Object? currency = null,
Object? payer = freezed,
Object? payee = freezed,
Object? payerId = freezed,
@ -608,6 +644,10 @@ class __$SnTransactionCopyWithImpl<$Res>
? _self.amount
: amount // ignore: cast_nullable_to_non_nullable
as String,
currency: null == currency
? _self.currency
: currency // ignore: cast_nullable_to_non_nullable
as String,
payer: freezed == payer
? _self.payer
: payer // ignore: cast_nullable_to_non_nullable

View File

@ -14,6 +14,7 @@ _SnWallet _$SnWalletFromJson(Map<String, dynamic> json) => _SnWallet(
? null
: DateTime.parse(json['deleted_at'] as String),
balance: json['balance'] as String,
goldenBalance: json['golden_balance'] as String,
password: json['password'] as String,
accountId: (json['account_id'] as num).toInt(),
);
@ -24,6 +25,7 @@ Map<String, dynamic> _$SnWalletToJson(_SnWallet instance) => <String, dynamic>{
'updated_at': instance.updatedAt.toIso8601String(),
'deleted_at': instance.deletedAt?.toIso8601String(),
'balance': instance.balance,
'golden_balance': instance.goldenBalance,
'password': instance.password,
'account_id': instance.accountId,
};
@ -38,6 +40,7 @@ _SnTransaction _$SnTransactionFromJson(Map<String, dynamic> json) =>
: DateTime.parse(json['deleted_at'] as String),
remark: json['remark'] as String,
amount: json['amount'] as String,
currency: json['currency'] as String,
payer: json['payer'] == null
? null
: SnWallet.fromJson(json['payer'] as Map<String, dynamic>),
@ -56,6 +59,7 @@ Map<String, dynamic> _$SnTransactionToJson(_SnTransaction instance) =>
'deleted_at': instance.deletedAt?.toIso8601String(),
'remark': instance.remark,
'amount': instance.amount,
'currency': instance.currency,
'payer': instance.payer?.toJson(),
'payee': instance.payee?.toJson(),
'payer_id': instance.payerId,