Merge branch 'dev' into cw-1497-transaction-history-improved-layout

# Conflicts:
#	lib/new-ui/widgets/coins_page/assets_history/history_section.dart
#	lib/new-ui/widgets/coins_page/assets_history/transaction_details_modal.dart
This commit is contained in:
Robert Malikowski
2026-07-01 16:53:59 +02:00
263 changed files with 6371 additions and 4762 deletions
+3 -1
View File
@@ -1,9 +1,11 @@
import 'package:cw_core/amount/amount_sanitizer.dart';
String calculateFiatAmount({double? price, String? cryptoAmount, bool raw = false}) {
if (price == null || cryptoAmount == null) {
return '0.00';
}
cryptoAmount = cryptoAmount.replaceAll(',', '.');
cryptoAmount = cryptoAmount.sanitized();
final _amount = double.tryParse(cryptoAmount);
if (_amount == null || _amount.isNaN) return '0.00';
+7 -7
View File
@@ -3,9 +3,9 @@ import 'package:cw_core/hive_type_ids.dart';
import 'package:cw_core/keyable.dart';
import 'package:hive/hive.dart';
part 'contact.g.dart';
part 'contact.part.dart';
@HiveType(typeId: Contact.typeId)
// @HiveType(typeId: Contact.typeId)
class Contact extends HiveObject with Keyable {
Contact({required this.name, required this.address, CryptoCurrency? type, DateTime? lastChange, this.displayName = ""})
: lastChange = lastChange ?? DateTime.now() {
@@ -17,19 +17,19 @@ class Contact extends HiveObject with Keyable {
static const typeId = CONTACT_TYPE_ID;
static const boxName = 'Contacts';
@HiveField(0, defaultValue: '')
// @HiveField(0, defaultValue: '')
String name;
@HiveField(1, defaultValue: '')
// @HiveField(1, defaultValue: '')
String address;
@HiveField(2, defaultValue: 0)
// @HiveField(2, defaultValue: 0)
late int raw;
@HiveField(3)
// @HiveField(3)
DateTime lastChange;
@HiveField(4, defaultValue: "")
// @HiveField(4, defaultValue: "")
String displayName;
CryptoCurrency get type => CryptoCurrency.deserialize(raw: raw);
+52
View File
@@ -0,0 +1,52 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'contact.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ContactAdapter extends TypeAdapter<Contact> {
@override
final int typeId = 0;
@override
Contact read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Contact(
name: fields[0] == null ? '' : fields[0] as String,
address: fields[1] == null ? '' : fields[1] as String,
lastChange: fields[3] as DateTime?,
displayName: fields[4] == null ? '' : fields[4] as String,
)..raw = fields[2] == null ? 0 : fields[2] as int;
}
@override
void write(BinaryWriter writer, Contact obj) {
writer
..writeByte(5)
..writeByte(0)
..write(obj.name)
..writeByte(1)
..write(obj.address)
..writeByte(2)
..write(obj.raw)
..writeByte(3)
..write(obj.lastChange)
..writeByte(4)
..write(obj.displayName);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ContactAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
+15 -1
View File
@@ -1,18 +1,26 @@
import 'package:cw_core/amount/money.dart';
import 'package:cw_core/currency.dart';
import 'package:cw_core/enumerable_item.dart';
class FiatCurrency extends EnumerableItem<String> with Serializable<String> implements Currency {
const FiatCurrency({
required String symbol,
required this.symbol,
required this.countryCode,
required this.fullName,
this.decimals = 2,
}) : super(title: symbol, raw: symbol);
final String countryCode;
@override
final String fullName;
@override
final int decimals;
@override
final String symbol;
static List<FiatCurrency> get all => _all.values.toList();
static List<FiatCurrency> get currenciesAvailableToBuyWith => [
@@ -182,4 +190,10 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
@override
String get iconPath => "assets/images/flags/$countryCode.png";
@override
Money parseAmount(String value) => Money.parse(value, this);
@override
Money? tryParseAmount(String value) => Money.tryParse(value, this);
}
+4 -4
View File
@@ -1,9 +1,9 @@
import 'package:cw_core/hive_type_ids.dart';
import 'package:hive/hive.dart';
part 'haven_seed_store.g.dart';
part 'haven_seed_store.part.dart';
@HiveType(typeId: HavenSeedStore.typeId)
// @HiveType(typeId: HavenSeedStore.typeId)
class HavenSeedStore extends HiveObject {
HavenSeedStore({required this.id, this.seed});
@@ -11,9 +11,9 @@ class HavenSeedStore extends HiveObject {
static const boxName = 'HavenSeedStore';
static const boxKey = 'havenSeedStoreKey';
@HiveField(0, defaultValue: '')
// @HiveField(0, defaultValue: '')
String id;
@HiveField(2)
// @HiveField(2)
String? seed;
}
+44
View File
@@ -0,0 +1,44 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'haven_seed_store.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class HavenSeedStoreAdapter extends TypeAdapter<HavenSeedStore> {
@override
final int typeId = 21;
@override
HavenSeedStore read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HavenSeedStore(
id: fields[0] == null ? '' : fields[0] as String,
seed: fields[2] as String?,
);
}
@override
void write(BinaryWriter writer, HavenSeedStore obj) {
writer
..writeByte(2)
..writeByte(0)
..write(obj.id)
..writeByte(2)
..write(obj.seed);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is HavenSeedStoreAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
+10 -10
View File
@@ -1,9 +1,9 @@
import 'package:cw_core/hive_type_ids.dart';
import 'package:hive/hive.dart';
part 'template.g.dart';
part 'template.part.dart';
@HiveType(typeId: Template.typeId)
// @HiveType(typeId: Template.typeId)
class Template extends HiveObject {
Template(
{required this.nameRaw,
@@ -18,28 +18,28 @@ class Template extends HiveObject {
static const typeId = TEMPLATE_TYPE_ID;
static const boxName = 'Template';
@HiveField(0)
// @HiveField(0)
String? nameRaw;
@HiveField(1)
// @HiveField(1)
String? addressRaw;
@HiveField(2)
// @HiveField(2)
String? cryptoCurrencyRaw;
@HiveField(3)
// @HiveField(3)
String? amountRaw;
@HiveField(4)
// @HiveField(4)
String? fiatCurrencyRaw;
@HiveField(5)
// @HiveField(5)
bool? isCurrencySelectedRaw;
@HiveField(6)
// @HiveField(6)
String? amountFiatRaw;
@HiveField(7)
// @HiveField(7)
List<Template>? additionalRecipientsRaw;
bool get isCurrencySelected => isCurrencySelectedRaw ?? false;
+62
View File
@@ -0,0 +1,62 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'template.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class TemplateAdapter extends TypeAdapter<Template> {
@override
final int typeId = 6;
@override
Template read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Template(
nameRaw: fields[0] as String?,
isCurrencySelectedRaw: fields[5] as bool?,
addressRaw: fields[1] as String?,
cryptoCurrencyRaw: fields[2] as String?,
amountRaw: fields[3] as String?,
fiatCurrencyRaw: fields[4] as String?,
amountFiatRaw: fields[6] as String?,
additionalRecipientsRaw: (fields[7] as List?)?.cast<Template>(),
);
}
@override
void write(BinaryWriter writer, Template obj) {
writer
..writeByte(8)
..writeByte(0)
..write(obj.nameRaw)
..writeByte(1)
..write(obj.addressRaw)
..writeByte(2)
..write(obj.cryptoCurrencyRaw)
..writeByte(3)
..write(obj.amountRaw)
..writeByte(4)
..write(obj.fiatCurrencyRaw)
..writeByte(5)
..write(obj.isCurrencySelectedRaw)
..writeByte(6)
..write(obj.amountFiatRaw)
..writeByte(7)
..write(obj.additionalRecipientsRaw);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TemplateAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
+6 -6
View File
@@ -1,9 +1,9 @@
import 'package:cw_core/hive_type_ids.dart';
import 'package:hive/hive.dart';
part 'transaction_description.g.dart';
part 'transaction_description.part.dart';
@HiveType(typeId: TransactionDescription.typeId)
// @HiveType(typeId: TransactionDescription.typeId)
class TransactionDescription extends HiveObject {
TransactionDescription({required this.id, this.recipientAddress, this.transactionNote, this.transactionKey});
@@ -11,16 +11,16 @@ class TransactionDescription extends HiveObject {
static const boxName = 'TransactionDescriptions';
static const boxKey = 'transactionDescriptionsBoxKey';
@HiveField(0, defaultValue: '')
// @HiveField(0, defaultValue: '')
String id;
@HiveField(1)
// @HiveField(1)
String? recipientAddress;
@HiveField(2)
// @HiveField(2)
String? transactionNote;
@HiveField(3)
// @HiveField(3)
String? transactionKey;
String get note => transactionNote ?? '';
@@ -0,0 +1,51 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'transaction_description.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class TransactionDescriptionAdapter
extends TypeAdapter<TransactionDescription> {
@override
final int typeId = 2;
@override
TransactionDescription read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return TransactionDescription(
id: fields[0] == null ? '' : fields[0] as String,
recipientAddress: fields[1] as String?,
transactionNote: fields[2] as String?,
transactionKey: fields[3] as String?,
);
}
@override
void write(BinaryWriter writer, TransactionDescription obj) {
writer
..writeByte(4)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.recipientAddress)
..writeByte(2)
..write(obj.transactionNote)
..writeByte(3)
..write(obj.transactionKey);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TransactionDescriptionAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}