Wallet update for correct name and symbol appearance

This commit is contained in:
Arseni
2025-12-16 19:37:28 +03:00
parent 67b52af150
commit 9a90e6a03b
12 changed files with 111 additions and 117 deletions

View File

@@ -1,10 +1,10 @@
import 'package:pshared/models/currency.dart';
import 'package:pshared/models/describable.dart';
class Wallet {
class Wallet implements Describable {
final String id;
final String walletUserID; // ID or number that we show the user
final String name;
final double balance;
final Currency currency;
final bool isHidden;
@@ -13,14 +13,21 @@ class Wallet {
final String? network;
final String? tokenSymbol;
final String? contractAddress;
final Describable describable;
@override
String get name => describable.name;
@override
String? get description => describable.description;
Wallet({
required this.id,
required this.walletUserID,
required this.name,
required this.balance,
required this.currency,
required this.calculatedAt,
required this.describable,
this.isHidden = true,
this.depositAddress,
this.network,
@@ -30,7 +37,6 @@ class Wallet {
Wallet copyWith({
String? id,
String? name,
double? balance,
Currency? currency,
String? walletUserID,
@@ -39,9 +45,11 @@ class Wallet {
String? network,
String? tokenSymbol,
String? contractAddress,
Describable? describable,
String? name,
String? Function()? description,
}) => Wallet(
id: id ?? this.id,
name: name ?? this.name,
balance: balance ?? this.balance,
currency: currency ?? this.currency,
walletUserID: walletUserID ?? this.walletUserID,
@@ -51,5 +59,9 @@ class Wallet {
network: network ?? this.network,
tokenSymbol: tokenSymbol ?? this.tokenSymbol,
contractAddress: contractAddress ?? this.contractAddress,
describable: describable
?? (name != null || description != null
? this.describable.copyWith(name: name, description: description)
: this.describable),
);
}