code style clean up and gen mocks

This commit is contained in:
julian 2024-05-27 17:56:22 -06:00
parent 8b523739d9
commit 9006de0f0a
605 changed files with 9126 additions and 6975 deletions

View file

@ -11,6 +11,8 @@
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_native_splash/cli_commands.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../exceptions/main_db/main_db_exception.dart'; import '../../exceptions/main_db/main_db_exception.dart';
import '../../models/isar/models/block_explorer.dart'; import '../../models/isar/models/block_explorer.dart';
import '../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../models/isar/models/blockchain_data/v2/transaction_v2.dart';
@ -26,7 +28,6 @@ import '../../wallets/isar/models/spark_coin.dart';
import '../../wallets/isar/models/token_wallet_info.dart'; import '../../wallets/isar/models/token_wallet_info.dart';
import '../../wallets/isar/models/wallet_info.dart'; import '../../wallets/isar/models/wallet_info.dart';
import '../../wallets/isar/models/wallet_info_meta.dart'; import '../../wallets/isar/models/wallet_info_meta.dart';
import 'package:tuple/tuple.dart';
part '../queries/queries.dart'; part '../queries/queries.dart';
@ -149,8 +150,9 @@ class MainDB {
} }
// tx block explorers // tx block explorers
TransactionBlockExplorer? getTransactionBlockExplorer( TransactionBlockExplorer? getTransactionBlockExplorer({
{required CryptoCurrency cryptoCurrency}) { required CryptoCurrency cryptoCurrency,
}) {
return isar.transactionBlockExplorers return isar.transactionBlockExplorers
.where() .where()
.tickerEqualTo(cryptoCurrency.ticker) .tickerEqualTo(cryptoCurrency.ticker)

View file

@ -207,7 +207,8 @@ Future<void> migrateWalletsToIsar({
} }
await _cleanupOnSuccess( await _cleanupOnSuccess(
walletIds: newInfo.map((e) => e.$1.walletId).toList()); walletIds: newInfo.map((e) => e.$1.walletId).toList(),
);
} }
Future<void> _cleanupOnSuccess({required List<String> walletIds}) async { Future<void> _cleanupOnSuccess({required List<String> walletIds}) async {

View file

@ -11,7 +11,6 @@
import 'dart:convert'; import 'dart:convert';
import '../../utilities/amount/amount.dart'; import '../../utilities/amount/amount.dart';
import '../../wallets/crypto_currency/coins/ethereum.dart';
import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/crypto_currency.dart';
class EthTokenTxExtraDTO { class EthTokenTxExtraDTO {

View file

@ -11,7 +11,6 @@
import 'dart:convert'; import 'dart:convert';
import '../../utilities/amount/amount.dart'; import '../../utilities/amount/amount.dart';
import '../../wallets/crypto_currency/coins/ethereum.dart';
import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/crypto_currency.dart';
class EthTxDTO { class EthTxDTO {

View file

@ -1,7 +1,8 @@
import 'litescribe_response.dart';
import 'inscription_data.dart'; import 'inscription_data.dart';
import 'litescribe_response.dart';
class AddressInscriptionResponse extends LitescribeResponse<AddressInscriptionResponse> { class AddressInscriptionResponse
extends LitescribeResponse<AddressInscriptionResponse> {
final int status; final int status;
final String message; final String message;
final AddressInscriptionResult result; final AddressInscriptionResult result;
@ -16,7 +17,8 @@ class AddressInscriptionResponse extends LitescribeResponse<AddressInscriptionRe
return AddressInscriptionResponse( return AddressInscriptionResponse(
status: json['status'] as int, status: json['status'] as int,
message: json['message'] as String, message: json['message'] as String,
result: AddressInscriptionResult.fromJson(json['result'] as Map<String, dynamic>), result: AddressInscriptionResult.fromJson(
json['result'] as Map<String, dynamic>),
); );
} }
} }
@ -32,7 +34,9 @@ class AddressInscriptionResult {
factory AddressInscriptionResult.fromJson(Map<String, dynamic> json) { factory AddressInscriptionResult.fromJson(Map<String, dynamic> json) {
return AddressInscriptionResult( return AddressInscriptionResult(
list: (json['list'] as List).map((item) => InscriptionData.fromJson(item as Map<String, dynamic>)).toList(), list: (json['list'] as List)
.map((item) => InscriptionData.fromJson(item as Map<String, dynamic>))
.toList(),
total: json['total'] as int, total: json['total'] as int,
); );
} }

View file

@ -11,11 +11,12 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:math'; import 'dart:math';
import 'package:string_validator/string_validator.dart';
import '../db/hive/db.dart'; import '../db/hive/db.dart';
import 'electrumx_client.dart';
import '../utilities/logger.dart'; import '../utilities/logger.dart';
import '../wallets/crypto_currency/crypto_currency.dart'; import '../wallets/crypto_currency/crypto_currency.dart';
import 'package:string_validator/string_validator.dart'; import 'electrumx_client.dart';
class CachedElectrumXClient { class CachedElectrumXClient {
final ElectrumXClient electrumXClient; final ElectrumXClient electrumXClient;
@ -331,8 +332,9 @@ class CachedElectrumXClient {
} }
/// Clear all cached transactions for the specified coin /// Clear all cached transactions for the specified coin
Future<void> clearSharedTransactionCache( Future<void> clearSharedTransactionCache({
{required CryptoCurrency cryptoCurrency}) async { required CryptoCurrency cryptoCurrency,
}) async {
await DB.instance.clearSharedTransactionCache(currency: cryptoCurrency); await DB.instance.clearSharedTransactionCache(currency: cryptoCurrency);
await DB.instance.closeAnonymitySetCacheBox(currency: cryptoCurrency); await DB.instance.closeAnonymitySetCacheBox(currency: cryptoCurrency);
} }

View file

@ -28,8 +28,6 @@ import '../services/event_bus/global_event_bus.dart';
import '../services/tor_service.dart'; import '../services/tor_service.dart';
import '../utilities/logger.dart'; import '../utilities/logger.dart';
import '../utilities/prefs.dart'; import '../utilities/prefs.dart';
import '../wallets/crypto_currency/coins/dogecoin.dart';
import '../wallets/crypto_currency/coins/firo.dart';
import '../wallets/crypto_currency/crypto_currency.dart'; import '../wallets/crypto_currency/crypto_currency.dart';
import 'package:stream_channel/stream_channel.dart'; import 'package:stream_channel/stream_channel.dart';

View file

@ -180,7 +180,8 @@ void main(List<String> args) async {
Hive.registerAdapter(UnspentCoinsInfoAdapter()); Hive.registerAdapter(UnspentCoinsInfoAdapter());
await Hive.initFlutter( await Hive.initFlutter(
(await StackFileSystem.applicationHiveDirectory()).path); (await StackFileSystem.applicationHiveDirectory()).path,
);
await Hive.openBox<dynamic>(DB.boxNameDBInfo); await Hive.openBox<dynamic>(DB.boxNameDBInfo);
await Hive.openBox<dynamic>(DB.boxNamePrefs); await Hive.openBox<dynamic>(DB.boxNamePrefs);
@ -202,8 +203,10 @@ void main(List<String> args) async {
// Desktop migrate handled elsewhere (currently desktop_login_view.dart) // Desktop migrate handled elsewhere (currently desktop_login_view.dart)
if (!Util.isDesktop) { if (!Util.isDesktop) {
int dbVersion = DB.instance.get<dynamic>( final int dbVersion = DB.instance.get<dynamic>(
boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ?? boxName: DB.boxNameDBInfo,
key: "hive_data_version",
) as int? ??
0; 0;
if (dbVersion < Constants.currentDataVersion) { if (dbVersion < Constants.currentDataVersion) {
try { try {
@ -215,8 +218,11 @@ void main(List<String> args) async {
), ),
); );
} catch (e, s) { } catch (e, s) {
Logging.instance.log("Cannot migrate mobile database\n$e $s", Logging.instance.log(
level: LogLevel.Error, printFullLength: true); "Cannot migrate mobile database\n$e $s",
level: LogLevel.Error,
printFullLength: true,
);
} }
} }
} }
@ -262,7 +268,7 @@ void main(List<String> args) async {
/// MyApp initialises relevant services with a MultiProvider /// MyApp initialises relevant services with a MultiProvider
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -279,8 +285,8 @@ class MyApp extends StatelessWidget {
class MaterialAppWithTheme extends ConsumerStatefulWidget { class MaterialAppWithTheme extends ConsumerStatefulWidget {
const MaterialAppWithTheme({ const MaterialAppWithTheme({
Key? key, super.key,
}) : super(key: key); });
@override @override
ConsumerState<MaterialAppWithTheme> createState() => ConsumerState<MaterialAppWithTheme> createState() =>
@ -382,7 +388,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
switch (ref.read(prefsChangeNotifierProvider).backupFrequencyType) { switch (ref.read(prefsChangeNotifierProvider).backupFrequencyType) {
case BackupFrequencyType.everyTenMinutes: case BackupFrequencyType.everyTenMinutes:
ref.read(autoSWBServiceProvider).startPeriodicBackupTimer( ref.read(autoSWBServiceProvider).startPeriodicBackupTimer(
duration: const Duration(minutes: 10)); duration: const Duration(minutes: 10),
);
break; break;
case BackupFrequencyType.everyAppStart: case BackupFrequencyType.everyAppStart:
unawaited(ref.read(autoSWBServiceProvider).doBackup()); unawaited(ref.read(autoSWBServiceProvider).doBackup());
@ -448,7 +455,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
await loadingCompleter.future; await loadingCompleter.future;
await goToRestoreSWB( await goToRestoreSWB(
ref.read(openedFromSWBFileStringStateProvider.state).state!); ref.read(openedFromSWBFileStringStateProvider.state).state!,
);
ref.read(openedFromSWBFileStringStateProvider.state).state = null; ref.read(openedFromSWBFileStringStateProvider.state).state = null;
} }
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false; // ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
@ -511,7 +519,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
if (ref.read(openedFromSWBFileStringStateProvider.state).state != if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
null) { null) {
await goToRestoreSWB( await goToRestoreSWB(
ref.read(openedFromSWBFileStringStateProvider.state).state!); ref.read(openedFromSWBFileStringStateProvider.state).state!,
);
ref.read(openedFromSWBFileStringStateProvider.state).state = null; ref.read(openedFromSWBFileStringStateProvider.state).state = null;
} }
} }
@ -559,8 +568,9 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
await resetOpenPath(); await resetOpenPath();
Logging.instance.log( Logging.instance.log(
"This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}", "This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}",
level: LogLevel.Info); level: LogLevel.Info,
);
} }
/// should only be called on android currently /// should only be called on android currently
@ -575,27 +585,31 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
.then((value) { .then((value) {
if (value is! bool || value == false) { if (value is! bool || value == false) {
Navigator.of(navigatorKey.currentContext!).pushNamed( Navigator.of(navigatorKey.currentContext!).pushNamed(
RestoreFromEncryptedStringView.routeName, RestoreFromEncryptedStringView.routeName,
arguments: encrypted); arguments: encrypted,
);
} }
}); });
} else { } else {
unawaited(Navigator.push( unawaited(
navigatorKey.currentContext!, Navigator.push(
RouteGenerator.getRoute( navigatorKey.currentContext!,
shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute, RouteGenerator.getRoute(
builder: (_) => LockscreenView( shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute,
showBackButton: true, builder: (_) => LockscreenView(
routeOnSuccess: RestoreFromEncryptedStringView.routeName, showBackButton: true,
routeOnSuccessArguments: encrypted, routeOnSuccess: RestoreFromEncryptedStringView.routeName,
biometricsCancelButtonString: "CANCEL", routeOnSuccessArguments: encrypted,
biometricsLocalizedReason: biometricsCancelButtonString: "CANCEL",
"Authenticate to restore ${AppConfig.appName} backup", biometricsLocalizedReason:
biometricsAuthenticationTitle: "Restore ${AppConfig.prefix} backup", "Authenticate to restore ${AppConfig.appName} backup",
biometricsAuthenticationTitle:
"Restore ${AppConfig.prefix} backup",
),
settings: const RouteSettings(name: "/swbrestorelockscreen"),
), ),
settings: const RouteSettings(name: "/swbrestorelockscreen"),
), ),
)); );
} }
} }
@ -655,7 +669,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
foregroundColor: foregroundColor:
MaterialStateProperty.all(colorScheme.buttonTextSecondary), MaterialStateProperty.all(colorScheme.buttonTextSecondary),
backgroundColor: MaterialStateProperty.all<Color>( backgroundColor: MaterialStateProperty.all<Color>(
colorScheme.buttonBackSecondary), colorScheme.buttonBackSecondary,
),
shape: MaterialStateProperty.all<OutlinedBorder>( shape: MaterialStateProperty.all<OutlinedBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
// 1000 to be relatively sure it keeps its pill shape // 1000 to be relatively sure it keeps its pill shape

View file

@ -10,7 +10,6 @@
import '../add_wallet_list_entity.dart'; import '../add_wallet_list_entity.dart';
import '../../isar/models/ethereum/eth_contract.dart'; import '../../isar/models/ethereum/eth_contract.dart';
import '../../../wallets/crypto_currency/coins/ethereum.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart';
class EthTokenEntity extends AddWalletListEntity { class EthTokenEntity extends AddWalletListEntity {

View file

@ -72,7 +72,8 @@ class Balance {
), ),
pendingSpendable: decoded["pendingSpendable"] is String pendingSpendable: decoded["pendingSpendable"] is String
? Amount.fromSerializedJsonString( ? Amount.fromSerializedJsonString(
decoded["pendingSpendable"] as String) decoded["pendingSpendable"] as String,
)
: Amount( : Amount(
rawValue: BigInt.from(decoded["pendingSpendable"] as int), rawValue: BigInt.from(decoded["pendingSpendable"] as int),
fractionDigits: deprecatedValue, fractionDigits: deprecatedValue,

View file

@ -23,11 +23,12 @@ class Fiat {
/// Fiat name /// Fiat name
final Decimal maxAmount; final Decimal maxAmount;
Fiat( Fiat({
{required this.ticker, required this.ticker,
required this.name, required this.name,
required this.minAmount, required this.minAmount,
required this.maxAmount}); required this.maxAmount,
});
factory Fiat.fromJson(Map<String, dynamic> json) { factory Fiat.fromJson(Map<String, dynamic> json) {
try { try {

View file

@ -9,6 +9,7 @@
*/ */
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import '../response_objects/crypto.dart'; import '../response_objects/crypto.dart';
import '../response_objects/fiat.dart'; import '../response_objects/fiat.dart';
import '../response_objects/order.dart'; import '../response_objects/order.dart';
@ -20,7 +21,8 @@ class Simplex {
SimplexQuote quote = SimplexQuote( SimplexQuote quote = SimplexQuote(
crypto: Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}), crypto: Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}),
fiat: Fiat.fromJson( fiat: Fiat.fromJson(
{'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}), {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''},
),
youPayFiatPrice: Decimal.parse("100"), youPayFiatPrice: Decimal.parse("100"),
youReceiveCryptoAmount: Decimal.parse("1.0238917"), youReceiveCryptoAmount: Decimal.parse("1.0238917"),
id: "someID", id: "someID",
@ -28,20 +30,22 @@ class Simplex {
buyWithFiat: true, buyWithFiat: true,
); );
SimplexOrder order = SimplexOrder( SimplexOrder order = SimplexOrder(
quote: SimplexQuote( quote: SimplexQuote(
crypto: crypto:
Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}), Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}),
fiat: Fiat.fromJson( fiat: Fiat.fromJson(
{'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}), {'ticker': 'USD', 'name': 'United States Dollar', 'image': ''},
youPayFiatPrice: Decimal.parse("100"),
youReceiveCryptoAmount: Decimal.parse("1.0238917"),
id: "someID",
receivingAddress: '',
buyWithFiat: true,
), ),
orderId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', youPayFiatPrice: Decimal.parse("100"),
paymentId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', youReceiveCryptoAmount: Decimal.parse("1.0238917"),
userId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee'); id: "someID",
receivingAddress: '',
buyWithFiat: true,
),
orderId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
paymentId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
userId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
);
void updateSupportedCryptos(List<Crypto> newCryptos) { void updateSupportedCryptos(List<Crypto> newCryptos) {
supportedCryptos = newCryptos; supportedCryptos = newCryptos;

View file

@ -44,13 +44,13 @@ class Contact {
List<ContactAddressEntry>? addresses, List<ContactAddressEntry>? addresses,
bool? isFavorite, bool? isFavorite,
}) { }) {
List<ContactAddressEntry> _addresses = []; final List<ContactAddressEntry> _addresses = [];
if (addresses == null) { if (addresses == null) {
for (var e in this.addresses) { for (final e in this.addresses) {
_addresses.add(e.copyWith()); _addresses.add(e.copyWith());
} }
} else { } else {
for (var e in addresses) { for (final e in addresses) {
_addresses.add(e.copyWith()); _addresses.add(e.copyWith());
} }
} }

View file

@ -11,6 +11,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'epicbox_server_model.dart'; import 'epicbox_server_model.dart';
part 'type_adaptors/epicbox_config_model.g.dart'; part 'type_adaptors/epicbox_config_model.g.dart';
@ -57,7 +58,7 @@ class EpicBoxConfigModel {
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
Map<String, dynamic> map = {}; final Map<String, dynamic> map = {};
map['epicbox_domain'] = host; map['epicbox_domain'] = host;
map['epicbox_port'] = port; map['epicbox_port'] = port;
map['epicbox_protocol_insecure'] = protocolInsecure; map['epicbox_protocol_insecure'] = protocolInsecure;
@ -84,7 +85,7 @@ class EpicBoxConfigModel {
} }
static EpicBoxConfigModel fromString(String epicBoxConfigString) { static EpicBoxConfigModel fromString(String epicBoxConfigString) {
dynamic _epicBox = json.decode(epicBoxConfigString); final dynamic _epicBox = json.decode(epicBoxConfigString);
// handle old epicbox config formats // handle old epicbox config formats
final oldDomain = _epicBox["domain"] ?? "empty"; final oldDomain = _epicBox["domain"] ?? "empty";
@ -117,8 +118,11 @@ class EpicBoxConfigModel {
); );
} }
static EpicBoxConfigModel fromServer(EpicBoxServerModel server, static EpicBoxConfigModel fromServer(
{bool? protocolInsecure, int? addressIndex}) { EpicBoxServerModel server, {
bool? protocolInsecure,
int? addressIndex,
}) {
return EpicBoxConfigModel( return EpicBoxConfigModel(
host: server.host, host: server.host,
port: server.port ?? 443, port: server.port ?? 443,

View file

@ -64,7 +64,7 @@ class EpicBoxServerModel {
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
Map<String, dynamic> map = {}; final Map<String, dynamic> map = {};
map['id'] = id; map['id'] = id;
map['host'] = host; map['host'] = host;
map['port'] = port; map['port'] = port;

View file

@ -9,6 +9,7 @@
*/ */
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import '../../../utilities/logger.dart'; import '../../../utilities/logger.dart';
class EstimatedExchangeAmount { class EstimatedExchangeAmount {
@ -45,8 +46,10 @@ class EstimatedExchangeAmount {
factory EstimatedExchangeAmount.fromJson(Map<String, dynamic> json) { factory EstimatedExchangeAmount.fromJson(Map<String, dynamic> json) {
try { try {
return EstimatedExchangeAmount( return EstimatedExchangeAmount(
estimatedAmount: Decimal.parse(json["estimatedAmount"]?.toString() ?? estimatedAmount: Decimal.parse(
json["estimatedDeposit"].toString()), json["estimatedAmount"]?.toString() ??
json["estimatedDeposit"].toString(),
),
transactionSpeedForecast: transactionSpeedForecast:
json["transactionSpeedForecast"] as String? ?? "", json["transactionSpeedForecast"] as String? ?? "",
warningMessage: json["warningMessage"] as String?, warningMessage: json["warningMessage"] as String?,

View file

@ -10,13 +10,15 @@
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'exchange_transaction_status.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'exchange_transaction_status.dart';
part '../../type_adaptors/exchange_transaction.g.dart'; part '../../type_adaptors/exchange_transaction.g.dart';
@Deprecated( @Deprecated(
"Do not use. Migrated to Trade in db_version_migration to hive_data_version 2") "Do not use. Migrated to Trade in db_version_migration to hive_data_version 2",
)
// @HiveType(typeId: 13) // @HiveType(typeId: 13)
class ExchangeTransaction { class ExchangeTransaction {
/// You can use it to get transaction status at the Transaction status API endpoint /// You can use it to get transaction status at the Transaction status API endpoint
@ -114,7 +116,8 @@ class ExchangeTransaction {
statusString: json["statusString"] as String? ?? "", statusString: json["statusString"] as String? ?? "",
statusObject: json["statusObject"] is Map<String, dynamic> statusObject: json["statusObject"] is Map<String, dynamic>
? ExchangeTransactionStatus.fromJson( ? ExchangeTransactionStatus.fromJson(
json["statusObject"] as Map<String, dynamic>) json["statusObject"] as Map<String, dynamic>,
)
: null, : null,
); );
} catch (e) { } catch (e) {

View file

@ -9,6 +9,7 @@
*/ */
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import '../../../utilities/logger.dart'; import '../../../utilities/logger.dart';
part '../../type_adaptors/exchange_transaction_status.g.dart'; part '../../type_adaptors/exchange_transaction_status.g.dart';
@ -38,7 +39,8 @@ ChangeNowTransactionStatus changeNowTransactionStatusFromStringIgnoreCase(
} }
} }
throw ArgumentError( throw ArgumentError(
"String value does not match any known ChangeNowTransactionStatus"); "String value does not match any known ChangeNowTransactionStatus",
);
} }
@HiveType(typeId: 16) @HiveType(typeId: 16)
@ -189,7 +191,8 @@ class ExchangeTransactionStatus {
try { try {
return ExchangeTransactionStatus( return ExchangeTransactionStatus(
status: changeNowTransactionStatusFromStringIgnoreCase( status: changeNowTransactionStatusFromStringIgnoreCase(
json["status"] as String), json["status"] as String,
),
payinAddress: json["payinAddress"] as String? ?? "", payinAddress: json["payinAddress"] as String? ?? "",
payoutAddress: json["payoutAddress"] as String? ?? "", payoutAddress: json["payoutAddress"] as String? ?? "",
fromCurrency: json["fromCurrency"] as String? ?? "", fromCurrency: json["fromCurrency"] as String? ?? "",

View file

@ -9,10 +9,15 @@
*/ */
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'mb_object.dart'; import 'mb_object.dart';
class MBRate extends MBObject { class MBRate extends MBObject {
MBRate({required this.fromCurrency, required this.toCurrency, required this.rate,}); MBRate({
required this.fromCurrency,
required this.toCurrency,
required this.rate,
});
final String fromCurrency; final String fromCurrency;
final String toCurrency; final String toCurrency;

View file

@ -9,8 +9,9 @@
*/ */
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import '../change_now/exchange_transaction.dart';
import '../../../services/exchange/change_now/change_now_exchange.dart'; import '../../../services/exchange/change_now/change_now_exchange.dart';
import '../change_now/exchange_transaction.dart';
part 'trade.g.dart'; part 'trade.g.dart';
@ -213,7 +214,9 @@ class Trade {
} }
factory Trade.fromExchangeTransaction( factory Trade.fromExchangeTransaction(
ExchangeTransaction exTx, bool reversed) { ExchangeTransaction exTx,
bool reversed,
) {
return Trade( return Trade(
uuid: exTx.uuid, uuid: exTx.uuid,
tradeId: exTx.id, tradeId: exTx.id,

View file

@ -59,8 +59,10 @@ class SPCurrency {
warningsTo: json["warnings_to"] as List<dynamic>, warningsTo: json["warnings_to"] as List<dynamic>,
); );
} catch (e, s) { } catch (e, s) {
Logging.instance.log("SPCurrency.fromJson failed to parse: $e\n$s", Logging.instance.log(
level: LogLevel.Error); "SPCurrency.fromJson failed to parse: $e\n$s",
level: LogLevel.Error,
);
rethrow; rethrow;
} }
} }

View file

@ -23,10 +23,12 @@ class Currency {
final String exchangeName; final String exchangeName;
/// Currency ticker /// Currency ticker
@Index(composite: [ @Index(
CompositeIndex("exchangeName"), composite: [
CompositeIndex("name"), CompositeIndex("exchangeName"),
]) CompositeIndex("name"),
],
)
final String ticker; final String ticker;
/// Currency name /// Currency name

View file

@ -29,10 +29,12 @@ class Pair {
@Index() @Index()
final String exchangeName; final String exchangeName;
@Index(composite: [ @Index(
CompositeIndex("exchangeName"), composite: [
CompositeIndex("to"), CompositeIndex("exchangeName"),
]) CompositeIndex("to"),
],
)
final String from; final String from;
final String to; final String to;

View file

@ -12,11 +12,12 @@ import 'dart:convert';
import 'dart:math'; import 'dart:math';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../../../utilities/amount/amount.dart';
import 'address.dart'; import 'address.dart';
import 'input.dart'; import 'input.dart';
import 'output.dart'; import 'output.dart';
import '../../../../utilities/amount/amount.dart';
import 'package:tuple/tuple.dart';
part 'transaction.g.dart'; part 'transaction.g.dart';
@ -65,24 +66,24 @@ class Transaction {
}) { }) {
return Tuple2( return Tuple2(
Transaction( Transaction(
walletId: walletId ?? this.walletId, walletId: walletId ?? this.walletId,
txid: txid ?? this.txid, txid: txid ?? this.txid,
timestamp: timestamp ?? this.timestamp, timestamp: timestamp ?? this.timestamp,
type: type ?? this.type, type: type ?? this.type,
subType: subType ?? this.subType, subType: subType ?? this.subType,
amount: amount ?? this.amount, amount: amount ?? this.amount,
amountString: amountString ?? this.amountString, amountString: amountString ?? this.amountString,
fee: fee ?? this.fee, fee: fee ?? this.fee,
height: height ?? this.height, height: height ?? this.height,
isCancelled: isCancelled ?? this.isCancelled, isCancelled: isCancelled ?? this.isCancelled,
isLelantus: isLelantus ?? this.isLelantus, isLelantus: isLelantus ?? this.isLelantus,
slateId: slateId ?? this.slateId, slateId: slateId ?? this.slateId,
otherData: otherData ?? this.otherData, otherData: otherData ?? this.otherData,
nonce: nonce ?? this.nonce, nonce: nonce ?? this.nonce,
inputs: inputs ?? this.inputs, inputs: inputs ?? this.inputs,
outputs: outputs ?? this.outputs, outputs: outputs ?? this.outputs,
numberOfMessages: numberOfMessages ?? this.numberOfMessages) numberOfMessages: numberOfMessages ?? this.numberOfMessages,
..id = id ?? this.id, )..id = id ?? this.id,
address ?? this.address.value, address ?? this.address.value,
); );
} }

View file

@ -38,10 +38,14 @@ class UTXO {
@Index() @Index()
late final String walletId; late final String walletId;
@Index(unique: true, replace: true, composite: [ @Index(
CompositeIndex("walletId"), unique: true,
CompositeIndex("vout"), replace: true,
]) composite: [
CompositeIndex("walletId"),
CompositeIndex("vout"),
],
)
late final String txid; late final String txid;
late final int vout; late final int vout;

View file

@ -54,7 +54,7 @@ class OutputV2 {
bool isFullAmountNotSats = false, bool isFullAmountNotSats = false,
}) { }) {
try { try {
List<String> addresses = []; final List<String> addresses = [];
if (json["scriptPubKey"]?["addresses"] is List) { if (json["scriptPubKey"]?["addresses"] is List) {
for (final e in json["scriptPubKey"]["addresses"] as List) { for (final e in json["scriptPubKey"]["addresses"] as List) {
@ -68,7 +68,7 @@ class OutputV2 {
scriptPubKeyHex: json["scriptPubKey"]["hex"] as String, scriptPubKeyHex: json["scriptPubKey"]["hex"] as String,
scriptPubKeyAsm: json["scriptPubKey"]["asm"] as String?, scriptPubKeyAsm: json["scriptPubKey"]["asm"] as String?,
valueStringSats: parseOutputAmountString( valueStringSats: parseOutputAmountString(
json["value"] != null ? json["value"].toString(): "0", json["value"] != null ? json["value"].toString() : "0",
decimalPlaces: decimalPlaces, decimalPlaces: decimalPlaces,
isFullAmountNotSats: isFullAmountNotSats, isFullAmountNotSats: isFullAmountNotSats,
), ),

View file

@ -1,4 +1,5 @@
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../db/isar/main_db.dart'; import '../../db/isar/main_db.dart';
import '../../dto/ordinals/inscription_data.dart'; import '../../dto/ordinals/inscription_data.dart';
import 'models/isar_models.dart'; import 'models/isar_models.dart';
@ -11,10 +12,14 @@ class Ordinal {
final String walletId; final String walletId;
@Index(unique: true, replace: true, composite: [ @Index(
CompositeIndex("utxoTXID"), unique: true,
CompositeIndex("utxoVOUT"), replace: true,
]) composite: [
CompositeIndex("utxoTXID"),
CompositeIndex("utxoVOUT"),
],
)
final String inscriptionId; final String inscriptionId;
final int inscriptionNumber; final int inscriptionNumber;

View file

@ -40,7 +40,7 @@ class LelantusCoin {
@override @override
String toString() { String toString() {
String coin = final String coin =
"{index: $index, value: $value, publicCoin: $publicCoin, txId: $txId, anonymitySetId: $anonymitySetId, isUsed: $isUsed}"; "{index: $index, value: $value, publicCoin: $publicCoin, txId: $txId, anonymitySetId: $anonymitySetId, isUsed: $isUsed}";
return coin; return coin;
} }

View file

@ -86,7 +86,7 @@ class NodeModel {
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
Map<String, dynamic> map = {}; final Map<String, dynamic> map = {};
map['host'] = host; map['host'] = host;
map['port'] = port; map['port'] = port;
map['name'] = name; map['name'] = name;

View file

@ -34,29 +34,32 @@ class TransactionData {
TransactionData({this.txChunks = const []}); TransactionData({this.txChunks = const []});
factory TransactionData.fromJson(Map<String, dynamic> json) { factory TransactionData.fromJson(Map<String, dynamic> json) {
var dateTimeChunks = json['dateTimeChunks'] as List; final dateTimeChunks = json['dateTimeChunks'] as List;
List<TransactionChunk> chunksList = dateTimeChunks final List<TransactionChunk> chunksList = dateTimeChunks
.map((txChunk) => .map(
TransactionChunk.fromJson(txChunk as Map<String, dynamic>)) (txChunk) =>
TransactionChunk.fromJson(txChunk as Map<String, dynamic>),
)
.toList(); .toList();
return TransactionData(txChunks: chunksList); return TransactionData(txChunks: chunksList);
} }
factory TransactionData.fromMap(Map<String, Transaction> transactions) { factory TransactionData.fromMap(Map<String, Transaction> transactions) {
Map<String, List<Transaction>> chunks = {}; final Map<String, List<Transaction>> chunks = {};
transactions.forEach((key, value) { transactions.forEach((key, value) {
String date = extractDateFromTimestamp(value.timestamp); final String date = extractDateFromTimestamp(value.timestamp);
if (!chunks.containsKey(date)) { if (!chunks.containsKey(date)) {
chunks[date] = []; chunks[date] = [];
} }
chunks[date]!.add(value); chunks[date]!.add(value);
}); });
List<TransactionChunk> chunksList = []; final List<TransactionChunk> chunksList = [];
chunks.forEach((key, value) { chunks.forEach((key, value) {
value.sort((a, b) => b.timestamp.compareTo(a.timestamp)); value.sort((a, b) => b.timestamp.compareTo(a.timestamp));
chunksList.add( chunksList.add(
TransactionChunk(timestamp: value[0].timestamp, transactions: value)); TransactionChunk(timestamp: value[0].timestamp, transactions: value),
);
}); });
chunksList.sort((a, b) => b.timestamp.compareTo(a.timestamp)); chunksList.sort((a, b) => b.timestamp.compareTo(a.timestamp));
return TransactionData(txChunks: chunksList); return TransactionData(txChunks: chunksList);
@ -64,9 +67,9 @@ class TransactionData {
Transaction? findTransaction(String txid) { Transaction? findTransaction(String txid) {
for (var i = 0; i < txChunks.length; i++) { for (var i = 0; i < txChunks.length; i++) {
var txChunk = txChunks[i].transactions; final txChunk = txChunks[i].transactions;
for (var j = 0; j < txChunk.length; j++) { for (var j = 0; j < txChunk.length; j++) {
var tx = txChunk[j]; final tx = txChunk[j];
if (tx.txid == txid) { if (tx.txid == txid) {
return tx; return tx;
} }
@ -76,11 +79,11 @@ class TransactionData {
} }
Map<String, Transaction> getAllTransactions() { Map<String, Transaction> getAllTransactions() {
Map<String, Transaction> transactions = {}; final Map<String, Transaction> transactions = {};
for (var i = 0; i < txChunks.length; i++) { for (var i = 0; i < txChunks.length; i++) {
var txChunk = txChunks[i].transactions; final txChunk = txChunks[i].transactions;
for (var j = 0; j < txChunk.length; j++) { for (var j = 0; j < txChunk.length; j++) {
var tx = txChunk[j]; final tx = txChunk[j];
transactions[tx.txid] = tx; transactions[tx.txid] = tx;
} }
} }
@ -98,14 +101,15 @@ class TransactionChunk {
TransactionChunk({required this.timestamp, required this.transactions}); TransactionChunk({required this.timestamp, required this.transactions});
factory TransactionChunk.fromJson(Map<String, dynamic> json) { factory TransactionChunk.fromJson(Map<String, dynamic> json) {
var txArray = json['transactions'] as List; final txArray = json['transactions'] as List;
List<Transaction> txList = txArray final List<Transaction> txList = txArray
.map((tx) => Transaction.fromJson(tx as Map<String, dynamic>)) .map((tx) => Transaction.fromJson(tx as Map<String, dynamic>))
.toList(); .toList();
return TransactionChunk( return TransactionChunk(
timestamp: int.parse(json['timestamp'].toString()), timestamp: int.parse(json['timestamp'].toString()),
transactions: txList); transactions: txList,
);
} }
@override @override
@ -191,15 +195,16 @@ class Transaction {
}); });
factory Transaction.fromJson(Map<String, dynamic> json) { factory Transaction.fromJson(Map<String, dynamic> json) {
var inputArray = json['inputs'] as List; final inputArray = json['inputs'] as List;
var outputArray = json['outputs'] as List; final outputArray = json['outputs'] as List;
List<Input> inputList = inputArray final List<Input> inputList = inputArray
.map((input) => Input.fromJson(Map<String, dynamic>.from(input as Map))) .map((input) => Input.fromJson(Map<String, dynamic>.from(input as Map)))
.toList(); .toList();
List<Output> outputList = outputArray final List<Output> outputList = outputArray
.map((output) => .map(
Output.fromJson(Map<String, dynamic>.from(output as Map))) (output) => Output.fromJson(Map<String, dynamic>.from(output as Map)),
)
.toList(); .toList();
return Transaction( return Transaction(
@ -304,7 +309,7 @@ class Transaction {
@override @override
String toString() { String toString() {
String transaction = final String transaction =
"{txid: $txid, type: $txType, subType: $subType, value: $amount, fee: $fees, height: $height, confirm: $confirmedStatus, confirmations: $confirmations, address: $address, timestamp: $timestamp, worthNow: $worthNow, inputs: $inputs, slateid: $slateId, numberOfMessages: $numberOfMessages }"; "{txid: $txid, type: $txType, subType: $subType, value: $amount, fee: $fees, height: $height, confirm: $confirmedStatus, confirmations: $confirmations, address: $address, timestamp: $timestamp, worthNow: $worthNow, inputs: $inputs, slateid: $slateId, numberOfMessages: $numberOfMessages }";
return transaction; return transaction;
} }
@ -344,7 +349,7 @@ class Input {
}); });
factory Input.fromJson(Map<String, dynamic> json) { factory Input.fromJson(Map<String, dynamic> json) {
bool iscoinBase = json['coinbase'] != null; final bool iscoinBase = json['coinbase'] != null;
return Input( return Input(
txid: json['txid'] as String? ?? "", txid: json['txid'] as String? ?? "",
vout: json['vout'] as int? ?? -1, vout: json['vout'] as int? ?? -1,
@ -361,7 +366,7 @@ class Input {
@override @override
String toString() { String toString() {
String transaction = "{txid: $txid}"; final String transaction = "{txid: $txid}";
return transaction; return transaction;
} }
} }
@ -383,12 +388,13 @@ class Output {
// @HiveField(4) // @HiveField(4)
final int value; final int value;
Output( Output({
{this.scriptpubkey, this.scriptpubkey,
this.scriptpubkeyAsm, this.scriptpubkeyAsm,
this.scriptpubkeyType, this.scriptpubkeyType,
required this.scriptpubkeyAddress, required this.scriptpubkeyAddress,
required this.value}); required this.value,
});
factory Output.fromJson(Map<String, dynamic> json) { factory Output.fromJson(Map<String, dynamic> json) {
// TODO determine if any of this code is needed. // TODO determine if any of this code is needed.
@ -405,12 +411,13 @@ class Output {
); );
} catch (s, e) { } catch (s, e) {
return Output( return Output(
// Return output object with null values; allows wallet history to be built // Return output object with null values; allows wallet history to be built
scriptpubkey: "", scriptpubkey: "",
scriptpubkeyAsm: "", scriptpubkeyAsm: "",
scriptpubkeyType: "", scriptpubkeyType: "",
scriptpubkeyAddress: "", scriptpubkeyAddress: "",
value: _parse(0.toString())); value: _parse(0.toString()),
);
} }
} }
} }

View file

@ -35,8 +35,8 @@ class UtxoData {
}); });
factory UtxoData.fromJson(Map<String, dynamic> json) { factory UtxoData.fromJson(Map<String, dynamic> json) {
var outputList = json['outputArray'] as List; final outputList = json['outputArray'] as List;
List<UtxoObject> utxoList = outputList final List<UtxoObject> utxoList = outputList
.map((output) => UtxoObject.fromJson(output as Map<String, dynamic>)) .map((output) => UtxoObject.fromJson(output as Map<String, dynamic>))
.toList(); .toList();
final String totalUserCurr = json['total_user_currency'] as String? ?? ""; final String totalUserCurr = json['total_user_currency'] as String? ?? "";
@ -104,7 +104,7 @@ class UtxoObject {
@override @override
String toString() { String toString() {
String utxo = final String utxo =
"{txid: $txid, vout: $vout, value: $value, fiat: $fiatWorth, blocked: $blocked, status: $status, is_coinbase: $isCoinbase}"; "{txid: $txid, vout: $vout, value: $value, fiat: $fiatWorth, blocked: $blocked, status: $status, is_coinbase: $isCoinbase}";
return utxo; return utxo;

View file

@ -44,12 +44,16 @@ class PaynymAccount {
.map((e) => PaynymCode.fromMap(Map<String, dynamic>.from(e as Map))) .map((e) => PaynymCode.fromMap(Map<String, dynamic>.from(e as Map)))
.toList(), .toList(),
followers = (map["followers"] as List<dynamic>) followers = (map["followers"] as List<dynamic>)
.map((e) => .map(
PaynymAccountLite.fromMap(Map<String, dynamic>.from(e as Map))) (e) => PaynymAccountLite.fromMap(
Map<String, dynamic>.from(e as Map)),
)
.toList(), .toList(),
following = (map["following"] as List<dynamic>) following = (map["following"] as List<dynamic>)
.map((e) => .map(
PaynymAccountLite.fromMap(Map<String, dynamic>.from(e as Map))) (e) => PaynymAccountLite.fromMap(
Map<String, dynamic>.from(e as Map)),
)
.toList(); .toList();
PaynymAccount copyWith({ PaynymAccount copyWith({

View file

@ -21,13 +21,13 @@ class PaynymFollow {
token = map["token"] as String; token = map["token"] as String;
Map<String, dynamic> toMap() => { Map<String, dynamic> toMap() => {
"follower": follower, "follower": follower,
"following": following, "following": following,
"token": token, "token": token,
}; };
@override @override
String toString() { String toString() {
return toMap().toString(); return toMap().toString();
} }
} }

View file

@ -10,9 +10,10 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'wallet_restore_state.dart';
import '../utilities/enums/stack_restoring_status.dart'; import '../utilities/enums/stack_restoring_status.dart';
import '../wallets/wallet/wallet.dart'; import '../wallets/wallet/wallet.dart';
import 'wallet_restore_state.dart';
class StackRestoringUIState extends ChangeNotifier { class StackRestoringUIState extends ChangeNotifier {
bool _walletsWasSet = false; bool _walletsWasSet = false;
@ -94,7 +95,7 @@ class StackRestoringUIState extends ChangeNotifier {
} }
List<Wallet> get wallets { List<Wallet> get wallets {
List<Wallet> _wallets = []; final List<Wallet> _wallets = [];
for (final item in _walletStates.values) { for (final item in _walletStates.values) {
if (item.wallet != null) { if (item.wallet != null) {
_wallets.add(item.wallet!); _wallets.add(item.wallet!);
@ -125,7 +126,8 @@ class StackRestoringUIState extends ChangeNotifier {
} }
ChangeNotifierProvider<WalletRestoreState> getWalletRestoreStateProvider( ChangeNotifierProvider<WalletRestoreState> getWalletRestoreStateProvider(
String walletId) { String walletId,
) {
return _walletStateProviders[walletId]!; return _walletStateProviders[walletId]!;
} }

View file

@ -13,6 +13,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../app_config.dart'; import '../app_config.dart';
import '../models/isar/stack_theme.dart'; import '../models/isar/stack_theme.dart';
import '../models/notification_model.dart'; import '../models/notification_model.dart';
@ -28,9 +29,9 @@ import '../widgets/rounded_white_container.dart';
class NotificationCard extends ConsumerWidget { class NotificationCard extends ConsumerWidget {
const NotificationCard({ const NotificationCard({
Key? key, super.key,
required this.notification, required this.notification,
}) : super(key: key); });
final NotificationModel notification; final NotificationModel notification;
@ -71,10 +72,11 @@ class NotificationCard extends ConsumerWidget {
? SvgPicture.file( ? SvgPicture.file(
File( File(
coinIconPath( coinIconPath(
ref.watch( ref.watch(
themeAssetsProvider, themeAssetsProvider,
), ),
ref), ref,
),
), ),
width: isDesktop ? desktopIconSize : mobileIconSize, width: isDesktop ? desktopIconSize : mobileIconSize,
height: isDesktop ? desktopIconSize : mobileIconSize, height: isDesktop ? desktopIconSize : mobileIconSize,
@ -89,10 +91,11 @@ class NotificationCard extends ConsumerWidget {
child: SvgPicture.file( child: SvgPicture.file(
File( File(
coinIconPath( coinIconPath(
ref.watch( ref.watch(
themeAssetsProvider, themeAssetsProvider,
), ),
ref), ref,
),
), ),
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
@ -123,7 +126,7 @@ class NotificationCard extends ConsumerWidget {
.extension<StackColors>()! .extension<StackColors>()!
.accentColorGreen, .accentColorGreen,
), ),
) ),
], ],
), ),
child: Text( child: Text(

View file

@ -11,7 +11,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class TermsOfServiceView extends StatelessWidget { class TermsOfServiceView extends StatelessWidget {
const TermsOfServiceView({Key? key}) : super(key: key); const TermsOfServiceView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -13,6 +13,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../models/isar/models/ethereum/eth_contract.dart'; import '../../../models/isar/models/ethereum/eth_contract.dart';
import '../../../services/ethereum/ethereum_api.dart'; import '../../../services/ethereum/ethereum_api.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
@ -29,8 +30,8 @@ import '../../../widgets/stack_dialog.dart';
class AddCustomTokenView extends ConsumerStatefulWidget { class AddCustomTokenView extends ConsumerStatefulWidget {
const AddCustomTokenView({ const AddCustomTokenView({
Key? key, super.key,
}) : super(key: key); });
static const routeName = "/addCustomToken"; static const routeName = "/addCustomToken";
@ -138,7 +139,8 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
onPressed: () async { onPressed: () async {
final response = await showLoading( final response = await showLoading(
whileFuture: EthereumAPI.getTokenContractInfoByAddress( whileFuture: EthereumAPI.getTokenContractInfoByAddress(
contractController.text), contractController.text,
),
context: context, context: context,
message: "Looking up contract", message: "Looking up contract",
); );
@ -212,10 +214,12 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
controller: decimalsController, controller: decimalsController,
style: STextStyles.field(context), style: STextStyles.field(context),
inputFormatters: [ inputFormatters: [
TextInputFormatter.withFunction((oldValue, newValue) => TextInputFormatter.withFunction(
RegExp(r'^([0-9]*)$').hasMatch(newValue.text) (oldValue, newValue) =>
? newValue RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
: oldValue), ? newValue
: oldValue,
),
], ],
keyboardType: const TextInputType.numberWithOptions( keyboardType: const TextInputType.numberWithOptions(
signed: false, signed: false,
@ -253,10 +257,12 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
controller: decimalsController, controller: decimalsController,
style: STextStyles.field(context), style: STextStyles.field(context),
inputFormatters: [ inputFormatters: [
TextInputFormatter.withFunction((oldValue, newValue) => TextInputFormatter.withFunction(
RegExp(r'^([0-9]*)$').hasMatch(newValue.text) (oldValue, newValue) =>
? newValue RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
: oldValue), ? newValue
: oldValue,
),
], ],
keyboardType: const TextInputType.numberWithOptions( keyboardType: const TextInputType.numberWithOptions(
signed: false, signed: false,

View file

@ -14,14 +14,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../../../db/isar/main_db.dart'; import '../../../db/isar/main_db.dart';
import '../../../models/isar/models/ethereum/eth_contract.dart'; import '../../../models/isar/models/ethereum/eth_contract.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import 'add_custom_token_view.dart';
import 'sub_widgets/add_token_list.dart';
import 'sub_widgets/add_token_list_element.dart';
import 'sub_widgets/add_token_text.dart';
import '../../home_view/home_view.dart';
import '../../../pages_desktop_specific/desktop_home_view.dart'; import '../../../pages_desktop_specific/desktop_home_view.dart';
import '../../../providers/global/price_provider.dart'; import '../../../providers/global/price_provider.dart';
import '../../../providers/global/wallets_provider.dart'; import '../../../providers/global/wallets_provider.dart';
@ -46,14 +42,19 @@ import '../../../widgets/icon_widgets/x_icon.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_text_field.dart'; import '../../../widgets/stack_text_field.dart';
import '../../../widgets/textfield_icon_button.dart'; import '../../../widgets/textfield_icon_button.dart';
import '../../home_view/home_view.dart';
import 'add_custom_token_view.dart';
import 'sub_widgets/add_token_list.dart';
import 'sub_widgets/add_token_list_element.dart';
import 'sub_widgets/add_token_text.dart';
class EditWalletTokensView extends ConsumerStatefulWidget { class EditWalletTokensView extends ConsumerStatefulWidget {
const EditWalletTokensView({ const EditWalletTokensView({
Key? key, super.key,
required this.walletId, required this.walletId,
this.contractsToMarkSelected, this.contractsToMarkSelected,
this.isDesktopPopup = false, this.isDesktopPopup = false,
}) : super(key: key); });
final String walletId; final String walletId;
final List<String>? contractsToMarkSelected; final List<String>? contractsToMarkSelected;
@ -178,7 +179,8 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
if (contracts.isEmpty) { if (contracts.isEmpty) {
contracts.addAll(DefaultTokens.list); contracts.addAll(DefaultTokens.list);
MainDB.instance.putEthContracts(contracts).then( MainDB.instance.putEthContracts(contracts).then(
(_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice()); (_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice(),
);
} }
tokenEntities.addAll(contracts.map((e) => AddTokenListElementData(e))); tokenEntities.addAll(contracts.map((e) => AddTokenListElementData(e)));
@ -241,7 +243,8 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
"Add custom token", "Add custom token",
style: style:
STextStyles.desktopButtonSmallSecondaryEnabled( STextStyles.desktopButtonSmallSecondaryEnabled(
context), context,
),
), ),
), ),
), ),

View file

@ -18,9 +18,9 @@ import '../../../../utilities/util.dart';
class AddCustomTokenSelector extends StatelessWidget { class AddCustomTokenSelector extends StatelessWidget {
const AddCustomTokenSelector({ const AddCustomTokenSelector({
Key? key, super.key,
required this.addFunction, required this.addFunction,
}) : super(key: key); });
final VoidCallback addFunction; final VoidCallback addFunction;

View file

@ -15,11 +15,11 @@ import '../../../../widgets/conditional_parent.dart';
class AddTokenList extends StatelessWidget { class AddTokenList extends StatelessWidget {
const AddTokenList({ const AddTokenList({
Key? key, super.key,
required this.walletId, required this.walletId,
required this.items, required this.items,
required this.addFunction, required this.addFunction,
}) : super(key: key); });
final String walletId; final String walletId;
final List<AddTokenListElementData> items; final List<AddTokenListElementData> items;

View file

@ -13,10 +13,10 @@ import '../../../../utilities/text_styles.dart';
class AddTokenText extends StatelessWidget { class AddTokenText extends StatelessWidget {
const AddTokenText({ const AddTokenText({
Key? key, super.key,
required this.isDesktop, required this.isDesktop,
this.walletName, this.walletName,
}) : super(key: key); });
final String? walletName; final String? walletName;
final bool isDesktop; final bool isDesktop;

View file

@ -14,10 +14,10 @@ import 'coin_select_item.dart';
class AddWalletEntityList extends StatelessWidget { class AddWalletEntityList extends StatelessWidget {
const AddWalletEntityList({ const AddWalletEntityList({
Key? key, super.key,
required this.entities, required this.entities,
this.trailing, this.trailing,
}) : super(key: key); });
final List<AddWalletListEntity> entities; final List<AddWalletListEntity> entities;
final Widget? trailing; final Widget? trailing;

View file

@ -10,27 +10,27 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../../../models/add_wallet_list_entity/add_wallet_list_entity.dart'; import '../../../../models/add_wallet_list_entity/add_wallet_list_entity.dart';
import 'add_wallet_entity_list.dart';
import '../../../../themes/stack_colors.dart'; import '../../../../themes/stack_colors.dart';
import '../../../../utilities/assets.dart'; import '../../../../utilities/assets.dart';
import '../../../../utilities/text_styles.dart'; import '../../../../utilities/text_styles.dart';
import '../../../../utilities/util.dart'; import '../../../../utilities/util.dart';
import '../../../../widgets/animated_widgets/rotate_icon.dart'; import '../../../../widgets/animated_widgets/rotate_icon.dart';
import '../../../../widgets/expandable.dart'; import '../../../../widgets/expandable.dart';
import 'add_wallet_entity_list.dart';
class ExpandingSubListItem extends StatefulWidget { class ExpandingSubListItem extends StatefulWidget {
const ExpandingSubListItem({ const ExpandingSubListItem({
Key? key, super.key,
required this.title, required this.title,
required this.entities, required this.entities,
this.trailing, this.trailing,
required this.initialState, required this.initialState,
double? animationDurationMultiplier, double? animationDurationMultiplier,
this.curve = Curves.easeInOutCubicEmphasized, this.curve = Curves.easeInOutCubicEmphasized,
}) : animationDurationMultiplier = }) : animationDurationMultiplier =
animationDurationMultiplier ?? entities.length * 0.11, animationDurationMultiplier ?? entities.length * 0.11;
super(key: key);
final String title; final String title;
final List<AddWalletListEntity> entities; final List<AddWalletListEntity> entities;

View file

@ -19,9 +19,9 @@ import '../../../../utilities/text_styles.dart';
class AddWalletNextButton extends ConsumerWidget { class AddWalletNextButton extends ConsumerWidget {
const AddWalletNextButton({ const AddWalletNextButton({
Key? key, super.key,
required this.isDesktop, required this.isDesktop,
}) : super(key: key); });
final bool isDesktop; final bool isDesktop;

View file

@ -13,9 +13,9 @@ import '../../../../utilities/text_styles.dart';
class CreateRestoreWalletSubTitle extends StatelessWidget { class CreateRestoreWalletSubTitle extends StatelessWidget {
const CreateRestoreWalletSubTitle({ const CreateRestoreWalletSubTitle({
Key? key, super.key,
required this.isDesktop, required this.isDesktop,
}) : super(key: key); });
final bool isDesktop; final bool isDesktop;

View file

@ -87,7 +87,8 @@ class CreateWalletButtonGroup extends StatelessWidget {
: STextStyles.button(context).copyWith( : STextStyles.button(context).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
), ),
), ),
), ),

View file

@ -167,7 +167,7 @@ class _SelectNewFrostImportTypeViewState
FrostStepScaffold.routeName, FrostStepScaffold.routeName,
); );
}, },
) ),
], ],
), ),
), ),

View file

@ -176,7 +176,7 @@ class _FrostCreateStep1bState extends ConsumerState<FrostCreateStep1b> {
.routeName, .routeName,
); );
}, },
) ),
], ],
), ),
); );

View file

@ -70,7 +70,7 @@ class _FrostCreateStep4State extends ConsumerState<FrostCreateStep4> {
.routeName, .routeName,
); );
}, },
) ),
], ],
), ),
); );

View file

@ -222,7 +222,7 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
_buttonLock = false; _buttonLock = false;
} }
}, },
) ),
], ],
), ),
); );

View file

@ -341,7 +341,7 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
}); });
} }
}, },
) ),
], ],
), ),
), ),

View file

@ -40,11 +40,11 @@ import 'sub_widgets/mnemonic_table.dart';
class NewWalletRecoveryPhraseView extends ConsumerStatefulWidget { class NewWalletRecoveryPhraseView extends ConsumerStatefulWidget {
const NewWalletRecoveryPhraseView({ const NewWalletRecoveryPhraseView({
Key? key, super.key,
required this.wallet, required this.wallet,
required this.mnemonic, required this.mnemonic,
this.clipboardInterface = const ClipboardWrapper(), this.clipboardInterface = const ClipboardWrapper(),
}) : super(key: key); });
static const routeName = "/newWalletRecoveryPhrase"; static const routeName = "/newWalletRecoveryPhrase";
@ -91,12 +91,14 @@ class _NewWalletRecoveryPhraseViewState
Future<void> _copy() async { Future<void> _copy() async {
final words = _mnemonic; final words = _mnemonic;
await _clipboardInterface.setData(ClipboardData(text: words.join(" "))); await _clipboardInterface.setData(ClipboardData(text: words.join(" ")));
unawaited(showFloatingFlushBar( unawaited(
type: FlushBarType.info, showFloatingFlushBar(
message: "Copied to clipboard", type: FlushBarType.info,
iconAsset: Assets.svg.copy, message: "Copied to clipboard",
context: context, iconAsset: Assets.svg.copy,
)); context: context,
),
);
} }
@override @override
@ -238,7 +240,8 @@ class _NewWalletRecoveryPhraseViewState
.background .background
: Theme.of(context).extension<StackColors>()!.popupBG, : Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius), Constants.size.circularBorderRadius,
),
), ),
child: Padding( child: Padding(
padding: isDesktop padding: isDesktop
@ -252,7 +255,8 @@ class _NewWalletRecoveryPhraseViewState
: STextStyles.label(context).copyWith( : STextStyles.label(context).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
), ),
), ),
), ),
@ -300,8 +304,9 @@ class _NewWalletRecoveryPhraseViewState
Text( Text(
"Copy to clipboard", "Copy to clipboard",
style: STextStyles.desktopButtonSecondaryEnabled( style: STextStyles.desktopButtonSecondaryEnabled(
context), context,
) ),
),
], ],
), ),
), ),
@ -325,10 +330,12 @@ class _NewWalletRecoveryPhraseViewState
.read(verifyMnemonicCorrectWordStateProvider.state) .read(verifyMnemonicCorrectWordStateProvider.state)
.update((state) => _mnemonic[next]); .update((state) => _mnemonic[next]);
unawaited(Navigator.of(context).pushNamed( unawaited(
VerifyRecoveryPhraseView.routeName, Navigator.of(context).pushNamed(
arguments: Tuple2(_wallet, _mnemonic), VerifyRecoveryPhraseView.routeName,
)); arguments: Tuple2(_wallet, _mnemonic),
),
);
}, },
style: Theme.of(context) style: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!

View file

@ -13,11 +13,11 @@ import 'mnemonic_table_item.dart';
class MnemonicTable extends StatelessWidget { class MnemonicTable extends StatelessWidget {
const MnemonicTable({ const MnemonicTable({
Key? key, super.key,
required this.words, required this.words,
required this.isDesktop, required this.isDesktop,
this.itemBorderColor, this.itemBorderColor,
}) : super(key: key); });
final List<String> words; final List<String> words;
final bool isDesktop; final bool isDesktop;

View file

@ -15,12 +15,12 @@ import '../../../../widgets/rounded_white_container.dart';
class MnemonicTableItem extends StatelessWidget { class MnemonicTableItem extends StatelessWidget {
const MnemonicTableItem({ const MnemonicTableItem({
Key? key, super.key,
required this.number, required this.number,
required this.word, required this.word,
required this.isDesktop, required this.isDesktop,
this.borderColor, this.borderColor,
}) : super(key: key); });
final int number; final int number;
final String word; final String word;

View file

@ -14,7 +14,7 @@ import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
class RecoveryPhraseExplanationDialog extends StatelessWidget { class RecoveryPhraseExplanationDialog extends StatelessWidget {
const RecoveryPhraseExplanationDialog({Key? key}) : super(key: key); const RecoveryPhraseExplanationDialog({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -21,8 +21,7 @@ import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
class ConfirmRecoveryDialog extends StatelessWidget { class ConfirmRecoveryDialog extends StatelessWidget {
const ConfirmRecoveryDialog({Key? key, required this.onConfirm}) const ConfirmRecoveryDialog({super.key, required this.onConfirm});
: super(key: key);
final VoidCallback onConfirm; final VoidCallback onConfirm;
@ -85,10 +84,10 @@ class ConfirmRecoveryDialog extends StatelessWidget {
onConfirm.call(); onConfirm.call();
}, },
), ),
) ),
], ],
), ),
) ),
], ],
), ),
); );

View file

@ -20,9 +20,9 @@ import '../../../../../utilities/util.dart';
class MobileMnemonicLengthSelector extends ConsumerWidget { class MobileMnemonicLengthSelector extends ConsumerWidget {
const MobileMnemonicLengthSelector({ const MobileMnemonicLengthSelector({
Key? key, super.key,
required this.chooseMnemonicLength, required this.chooseMnemonicLength,
}) : super(key: key); });
final VoidCallback chooseMnemonicLength; final VoidCallback chooseMnemonicLength;
@ -66,7 +66,7 @@ class MobileMnemonicLengthSelector extends ConsumerWidget {
], ],
), ),
), ),
) ),
], ],
); );
} }

View file

@ -17,10 +17,10 @@ import '../../../../../utilities/util.dart';
class RestoreFromDatePicker extends StatefulWidget { class RestoreFromDatePicker extends StatefulWidget {
const RestoreFromDatePicker({ const RestoreFromDatePicker({
Key? key, super.key,
required this.onTap, required this.onTap,
required this.controller, required this.controller,
}) : super(key: key); });
final VoidCallback onTap; final VoidCallback onTap;
final TextEditingController controller; final TextEditingController controller;

View file

@ -14,10 +14,10 @@ import '../../../../../utilities/text_styles.dart';
class RestoreOptionsNextButton extends StatelessWidget { class RestoreOptionsNextButton extends StatelessWidget {
const RestoreOptionsNextButton({ const RestoreOptionsNextButton({
Key? key, super.key,
required this.isDesktop, required this.isDesktop,
this.onPressed, this.onPressed,
}) : super(key: key); });
final bool isDesktop; final bool isDesktop;
final VoidCallback? onPressed; final VoidCallback? onPressed;

View file

@ -13,10 +13,10 @@ import '../../../../../themes/stack_colors.dart';
class RestoreOptionsPlatformLayout extends StatelessWidget { class RestoreOptionsPlatformLayout extends StatelessWidget {
const RestoreOptionsPlatformLayout({ const RestoreOptionsPlatformLayout({
Key? key, super.key,
required this.isDesktop, required this.isDesktop,
required this.child, required this.child,
}) : super(key: key); });
final bool isDesktop; final bool isDesktop;
final Widget child; final Widget child;

View file

@ -48,11 +48,6 @@ import '../../../utilities/enums/form_input_status_enum.dart';
import '../../../utilities/logger.dart'; import '../../../utilities/logger.dart';
import '../../../utilities/text_styles.dart'; import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart'; import '../../../utilities/util.dart';
import '../../../wallets/crypto_currency/coins/epiccash.dart';
import '../../../wallets/crypto_currency/coins/ethereum.dart';
import '../../../wallets/crypto_currency/coins/firo.dart';
import '../../../wallets/crypto_currency/coins/monero.dart';
import '../../../wallets/crypto_currency/coins/wownero.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../wallets/isar/models/wallet_info.dart'; import '../../../wallets/isar/models/wallet_info.dart';
import '../../../wallets/wallet/impl/epiccash_wallet.dart'; import '../../../wallets/wallet/impl/epiccash_wallet.dart';

View file

@ -10,6 +10,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart'; import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
import '../../../../themes/stack_colors.dart'; import '../../../../themes/stack_colors.dart';
import '../../../../utilities/constants.dart'; import '../../../../utilities/constants.dart';
@ -17,9 +18,9 @@ import '../../../../utilities/text_styles.dart';
class MnemonicWordCountSelectSheet extends ConsumerWidget { class MnemonicWordCountSelectSheet extends ConsumerWidget {
const MnemonicWordCountSelectSheet({ const MnemonicWordCountSelectSheet({
Key? key, super.key,
required this.lengthOptions, required this.lengthOptions,
}) : super(key: key); });
final List<int> lengthOptions; final List<int> lengthOptions;
@ -113,13 +114,16 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
.radioButtonIconEnabled, .radioButtonIconEnabled,
value: lengthOptions[i], value: lengthOptions[i],
groupValue: ref groupValue: ref
.watch(mnemonicWordCountStateProvider .watch(
.state) mnemonicWordCountStateProvider.state,
)
.state, .state,
onChanged: (x) { onChanged: (x) {
ref ref
.read(mnemonicWordCountStateProvider .read(
.state) mnemonicWordCountStateProvider
.state,
)
.state = lengthOptions[i]; .state = lengthOptions[i];
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View file

@ -20,11 +20,11 @@ import '../../../../widgets/stack_dialog.dart';
class RestoreFailedDialog extends ConsumerStatefulWidget { class RestoreFailedDialog extends ConsumerStatefulWidget {
const RestoreFailedDialog({ const RestoreFailedDialog({
Key? key, super.key,
required this.errorMessage, required this.errorMessage,
required this.walletName, required this.walletName,
required this.walletId, required this.walletId,
}) : super(key: key); });
final String errorMessage; final String errorMessage;
final String walletName; final String walletName;

View file

@ -20,7 +20,7 @@ import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_dialog.dart';
class RestoreSucceededDialog extends StatelessWidget { class RestoreSucceededDialog extends StatelessWidget {
const RestoreSucceededDialog({Key? key}) : super(key: key); const RestoreSucceededDialog({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -20,9 +20,9 @@ import '../../../../widgets/stack_dialog.dart';
class RestoringDialog extends StatefulWidget { class RestoringDialog extends StatefulWidget {
const RestoringDialog({ const RestoringDialog({
Key? key, super.key,
required this.onCancel, required this.onCancel,
}) : super(key: key); });
final Future<void> Function() onCancel; final Future<void> Function() onCancel;

View file

@ -37,9 +37,9 @@ final newEthWalletTriggerTempUntilHiveCompletelyDeleted =
class SelectWalletForTokenView extends ConsumerStatefulWidget { class SelectWalletForTokenView extends ConsumerStatefulWidget {
const SelectWalletForTokenView({ const SelectWalletForTokenView({
Key? key, super.key,
required this.entity, required this.entity,
}) : super(key: key); });
static const String routeName = "/selectWalletForTokenView"; static const String routeName = "/selectWalletForTokenView";

View file

@ -14,10 +14,10 @@ import 'word_table_item.dart';
class WordTable extends ConsumerWidget { class WordTable extends ConsumerWidget {
const WordTable({ const WordTable({
Key? key, super.key,
required this.words, required this.words,
required this.isDesktop, required this.isDesktop,
}) : super(key: key); });
final List<String> words; final List<String> words;
final bool isDesktop; final bool isDesktop;

View file

@ -17,11 +17,11 @@ import '../../../../utilities/text_styles.dart';
class WordTableItem extends ConsumerWidget { class WordTableItem extends ConsumerWidget {
const WordTableItem({ const WordTableItem({
Key? key, super.key,
required this.number, required this.number,
required this.word, required this.word,
required this.isDesktop, required this.isDesktop,
}) : super(key: key); });
final int number; final int number;
final String word; final String word;

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import '../new_wallet_options/new_wallet_options_view.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart'; import '../../../utilities/assets.dart';
import '../../../utilities/constants.dart'; import '../../../utilities/constants.dart';
@ -15,6 +15,7 @@ import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
import '../../../widgets/stack_text_field.dart'; import '../../../widgets/stack_text_field.dart';
import '../new_wallet_options/new_wallet_options_view.dart';
class VerifyMnemonicPassphraseDialog extends ConsumerStatefulWidget { class VerifyMnemonicPassphraseDialog extends ConsumerStatefulWidget {
const VerifyMnemonicPassphraseDialog({super.key}); const VerifyMnemonicPassphraseDialog({super.key});
@ -154,7 +155,8 @@ class _VerifyMnemonicPassphraseDialogState
), ),
GestureDetector( GestureDetector(
key: const Key( key: const Key(
"mnemonicPassphraseFieldShowPasswordButtonKey"), "mnemonicPassphraseFieldShowPasswordButtonKey",
),
onTap: () async { onTap: () async {
setState(() { setState(() {
hidePassword = !hidePassword; hidePassword = !hidePassword;

View file

@ -20,7 +20,6 @@ import '../../providers/db/main_db_provider.dart';
import '../../providers/global/address_book_service_provider.dart'; import '../../providers/global/address_book_service_provider.dart';
import '../../providers/providers.dart'; import '../../providers/providers.dart';
import '../../providers/ui/address_book_providers/address_book_filter_provider.dart'; import '../../providers/ui/address_book_providers/address_book_filter_provider.dart';
import '../../app_config.dart';
import '../../themes/stack_colors.dart'; import '../../themes/stack_colors.dart';
import '../../utilities/assets.dart'; import '../../utilities/assets.dart';
import '../../utilities/constants.dart'; import '../../utilities/constants.dart';

View file

@ -12,8 +12,9 @@ import 'package:emojis/emoji.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:uuid/uuid.dart';
import '../../../models/isar/models/contact_entry.dart'; import '../../../models/isar/models/contact_entry.dart';
import 'new_contact_address_entry_form.dart';
import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/global/address_book_service_provider.dart';
import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart';
import '../../../providers/ui/address_book_providers/contact_name_is_not_empty_state_provider.dart'; import '../../../providers/ui/address_book_providers/contact_name_is_not_empty_state_provider.dart';
@ -37,14 +38,14 @@ import '../../../widgets/emoji_select_sheet.dart';
import '../../../widgets/icon_widgets/x_icon.dart'; import '../../../widgets/icon_widgets/x_icon.dart';
import '../../../widgets/stack_text_field.dart'; import '../../../widgets/stack_text_field.dart';
import '../../../widgets/textfield_icon_button.dart'; import '../../../widgets/textfield_icon_button.dart';
import 'package:uuid/uuid.dart'; import 'new_contact_address_entry_form.dart';
class AddAddressBookEntryView extends ConsumerStatefulWidget { class AddAddressBookEntryView extends ConsumerStatefulWidget {
const AddAddressBookEntryView({ const AddAddressBookEntryView({
Key? key, super.key,
this.barcodeScanner = const BarcodeScannerWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(),
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/addAddressBookEntry"; static const String routeName = "/addAddressBookEntry";
@ -129,64 +130,66 @@ class _AddAddressBookEntryViewState
builder: (child) { builder: (child) {
return Background( return Background(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor:
Theme.of(context).extension<StackColors>()!.background, Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
leading: AppBarBackButton( leading: AppBarBackButton(
onPressed: () async { onPressed: () async {
if (FocusScope.of(context).hasFocus) { if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 75)); const Duration(milliseconds: 75),
} );
if (mounted) { }
Navigator.of(context).pop(); if (mounted) {
} Navigator.of(context).pop();
}, }
), },
title: Text( ),
"New contact", title: Text(
style: STextStyles.navBarTitle(context), "New contact",
), style: STextStyles.navBarTitle(context),
actions: [ ),
Padding( actions: [
padding: const EdgeInsets.only( Padding(
top: 10, padding: const EdgeInsets.only(
bottom: 10, top: 10,
right: 10, bottom: 10,
), right: 10,
child: AspectRatio( ),
aspectRatio: 1, child: AspectRatio(
child: AppBarIconButton( aspectRatio: 1,
key: const Key("addAddressBookEntryFavoriteButtonKey"), child: AppBarIconButton(
size: 36, key: const Key("addAddressBookEntryFavoriteButtonKey"),
shadows: const [], size: 36,
color: Theme.of(context) shadows: const [],
.extension<StackColors>()! color: Theme.of(context)
.background, .extension<StackColors>()!
icon: SvgPicture.asset( .background,
Assets.svg.star, icon: SvgPicture.asset(
color: _isFavorite Assets.svg.star,
? Theme.of(context) color: _isFavorite
.extension<StackColors>()! ? Theme.of(context)
.favoriteStarActive .extension<StackColors>()!
: Theme.of(context) .favoriteStarActive
.extension<StackColors>()! : Theme.of(context)
.favoriteStarInactive, .extension<StackColors>()!
width: 20, .favoriteStarInactive,
height: 20, width: 20,
), height: 20,
onPressed: () {
setState(() {
_isFavorite = !_isFavorite;
});
},
), ),
onPressed: () {
setState(() {
_isFavorite = !_isFavorite;
});
},
), ),
), ),
], ),
), ],
body: child), ),
body: child,
),
); );
}, },
child: ConditionalParent( child: ConditionalParent(
@ -267,22 +270,23 @@ class _AddAddressBookEntryViewState
} }
showDialog<dynamic>( showDialog<dynamic>(
context: context, context: context,
builder: (context) { builder: (context) {
return const DesktopDialog( return const DesktopDialog(
maxHeight: 700, maxHeight: 700,
maxWidth: 600, maxWidth: 600,
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 32, left: 32,
right: 20, right: 20,
top: 32, top: 32,
bottom: 32, bottom: 32,
),
child: EmojiSelectSheet(),
), ),
); child: EmojiSelectSheet(),
}).then((value) { ),
);
},
).then((value) {
if (value is Emoji) { if (value is Emoji) {
setState(() { setState(() {
_selectedEmoji = value; _selectedEmoji = value;
@ -313,7 +317,8 @@ class _AddAddressBookEntryViewState
_selectedEmoji!.char, _selectedEmoji!.char,
style: STextStyles style: STextStyles
.pageTitleH1( .pageTitleH1(
context), context,
),
), ),
), ),
), ),
@ -323,19 +328,21 @@ class _AddAddressBookEntryViewState
height: 14, height: 14,
width: 14, width: 14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(
14), 14,
color: Theme.of(context) ),
.extension< color: Theme.of(context)
StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
child: Center( child: Center(
child: _selectedEmoji == null child: _selectedEmoji == null
? SvgPicture.asset( ? SvgPicture.asset(
Assets.svg.plus, Assets.svg.plus,
color: Theme.of( color: Theme.of(
context) context,
)
.extension< .extension<
StackColors>()! StackColors>()!
.textWhite, .textWhite,
@ -345,7 +352,8 @@ class _AddAddressBookEntryViewState
: SvgPicture.asset( : SvgPicture.asset(
Assets.svg.thickX, Assets.svg.thickX,
color: Theme.of( color: Theme.of(
context) context,
)
.extension< .extension<
StackColors>()! StackColors>()!
.textWhite, .textWhite,
@ -354,7 +362,7 @@ class _AddAddressBookEntryViewState
), ),
), ),
), ),
) ),
], ],
), ),
), ),
@ -384,13 +392,15 @@ class _AddAddressBookEntryViewState
STextStyles.fieldLabel(context), STextStyles.fieldLabel(context),
suffixIcon: ref suffixIcon: ref
.read( .read(
contactNameIsNotEmptyStateProvider contactNameIsNotEmptyStateProvider
.state) .state,
)
.state .state
? Padding( ? Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets.only(
right: 0), right: 0,
),
child: UnconstrainedBox( child: UnconstrainedBox(
child: Row( child: Row(
children: [ children: [
@ -412,8 +422,9 @@ class _AddAddressBookEntryViewState
onChanged: (newValue) { onChanged: (newValue) {
ref ref
.read( .read(
contactNameIsNotEmptyStateProvider contactNameIsNotEmptyStateProvider
.state) .state,
)
.state = newValue.isNotEmpty; .state = newValue.isNotEmpty;
}, },
), ),
@ -485,11 +496,12 @@ class _AddAddressBookEntryViewState
height: 14, height: 14,
width: 14, width: 14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.circular(14), BorderRadius.circular(14),
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
child: Center( child: Center(
child: _selectedEmoji == null child: _selectedEmoji == null
? SvgPicture.asset( ? SvgPicture.asset(
@ -512,7 +524,7 @@ class _AddAddressBookEntryViewState
), ),
), ),
), ),
) ),
], ],
), ),
), ),
@ -537,12 +549,14 @@ class _AddAddressBookEntryViewState
).copyWith( ).copyWith(
suffixIcon: ref suffixIcon: ref
.read( .read(
contactNameIsNotEmptyStateProvider contactNameIsNotEmptyStateProvider
.state) .state,
)
.state .state
? Padding( ? Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
right: 0), right: 0,
),
child: UnconstrainedBox( child: UnconstrainedBox(
child: Row( child: Row(
children: [ children: [
@ -564,8 +578,9 @@ class _AddAddressBookEntryViewState
onChanged: (newValue) { onChanged: (newValue) {
ref ref
.read( .read(
contactNameIsNotEmptyStateProvider contactNameIsNotEmptyStateProvider
.state) .state,
)
.state = newValue.isNotEmpty; .state = newValue.isNotEmpty;
}, },
), ),
@ -659,17 +674,22 @@ class _AddAddressBookEntryViewState
Expanded( Expanded(
child: Builder( child: Builder(
builder: (context) { builder: (context) {
bool nameExists = ref final bool nameExists = ref
.watch(contactNameIsNotEmptyStateProvider .watch(
.state) contactNameIsNotEmptyStateProvider
.state,
)
.state; .state;
bool validForms = ref.watch( final bool validForms = ref.watch(
validContactStateProvider(forms validContactStateProvider(
forms
.map((e) => e.id) .map((e) => e.id)
.toList(growable: false))); .toList(growable: false),
),
);
bool shouldEnableSave = final bool shouldEnableSave =
validForms && nameExists; validForms && nameExists;
return PrimaryButton( return PrimaryButton(
@ -684,31 +704,38 @@ class _AddAddressBookEntryViewState
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration( const Duration(
milliseconds: 75), milliseconds: 75,
),
); );
} }
List<ContactAddressEntry> entries = final List<ContactAddressEntry>
[]; entries = [];
for (int i = 0; for (int i = 0;
i < forms.length; i < forms.length;
i++) { i++) {
entries.add(ref entries.add(
.read( ref
.read(
addressEntryDataProvider( addressEntryDataProvider(
forms[i].id)) forms[i].id,
.buildAddressEntry()); ),
)
.buildAddressEntry(),
);
} }
ContactEntry contact = ContactEntry( final ContactEntry contact =
ContactEntry(
emojiChar: _selectedEmoji?.char, emojiChar: _selectedEmoji?.char,
name: nameController.text, name: nameController.text,
addresses: entries, addresses: entries,
isFavorite: _isFavorite, isFavorite: _isFavorite,
customId: const Uuid().v1(), customId: const Uuid().v1(),
); );
if (await ref if (await ref
.read( .read(
addressBookServiceProvider) addressBookServiceProvider,
)
.addContact(contact)) { .addContact(contact)) {
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();

View file

@ -11,8 +11,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../../models/isar/models/contact_entry.dart'; import '../../../models/isar/models/contact_entry.dart';
import 'new_contact_address_entry_form.dart';
import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/global/address_book_service_provider.dart';
import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart';
import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart'; import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart';
@ -27,14 +27,15 @@ import '../../../widgets/conditional_parent.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import 'new_contact_address_entry_form.dart';
class AddNewContactAddressView extends ConsumerStatefulWidget { class AddNewContactAddressView extends ConsumerStatefulWidget {
const AddNewContactAddressView({ const AddNewContactAddressView({
Key? key, super.key,
required this.contactId, required this.contactId,
this.barcodeScanner = const BarcodeScannerWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(),
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/addNewContactAddress"; static const String routeName = "/addNewContactAddress";
@ -66,8 +67,10 @@ class _AddNewContactAddressViewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final contact = ref.watch(addressBookServiceProvider final contact = ref.watch(
.select((value) => value.getContactById(contactId))); addressBookServiceProvider
.select((value) => value.getContactById(contactId)),
);
final isDesktop = Util.isDesktop; final isDesktop = Util.isDesktop;
@ -188,7 +191,8 @@ class _AddNewContactAddressViewState
if (!isDesktop && FocusScope.of(context).hasFocus) { if (!isDesktop && FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 75)); const Duration(milliseconds: 75),
);
} }
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -211,14 +215,14 @@ class _AddNewContactAddressViewState
const Duration(milliseconds: 75), const Duration(milliseconds: 75),
); );
} }
List<ContactAddressEntry> entries = final List<ContactAddressEntry> entries =
contact.addresses.toList(); contact.addresses.toList();
entries.add(ref entries.add(
.read(addressEntryDataProvider(0)) ref.read(addressEntryDataProvider(0)).buildAddressEntry(),
.buildAddressEntry()); );
ContactEntry editedContact = final ContactEntry editedContact =
contact.copyWith(addresses: entries); contact.copyWith(addresses: entries);
if (await ref if (await ref
@ -235,7 +239,7 @@ class _AddNewContactAddressViewState
), ),
), ),
], ],
) ),
], ],
), ),
); );

View file

@ -10,9 +10,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../app_config.dart';
import '../../../providers/global/prefs_provider.dart'; import '../../../providers/global/prefs_provider.dart';
import '../../../providers/ui/address_book_providers/address_book_filter_provider.dart'; import '../../../providers/ui/address_book_providers/address_book_filter_provider.dart';
import '../../../app_config.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/text_styles.dart'; import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart'; import '../../../utilities/util.dart';
@ -82,42 +83,44 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: LayoutBuilder(builder: (builderContext, constraints) { child: LayoutBuilder(
return SingleChildScrollView( builder: (builderContext, constraints) {
child: ConstrainedBox( return SingleChildScrollView(
constraints: BoxConstraints( child: ConstrainedBox(
minHeight: constraints.maxHeight, constraints: BoxConstraints(
), minHeight: constraints.maxHeight,
child: IntrinsicHeight( ),
child: Padding( child: IntrinsicHeight(
padding: const EdgeInsets.all(4), child: Padding(
child: Column( padding: const EdgeInsets.all(4),
crossAxisAlignment: CrossAxisAlignment.stretch, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.stretch,
RoundedWhiteContainer( children: [
child: Text( RoundedWhiteContainer(
"Only selected cryptocurrency addresses will be displayed.", child: Text(
style: STextStyles.itemSubtitle(context), "Only selected cryptocurrency addresses will be displayed.",
style: STextStyles.itemSubtitle(context),
),
), ),
), const SizedBox(
const SizedBox( height: 12,
height: 12, ),
), Text(
Text( "Select cryptocurrency",
"Select cryptocurrency", style: STextStyles.smallMed12(context),
style: STextStyles.smallMed12(context), ),
), const SizedBox(
const SizedBox( height: 12,
height: 12, ),
), child,
child, ],
], ),
), ),
), ),
), ),
), );
); },
}), ),
), ),
), ),
); );
@ -230,8 +233,10 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
width: 20, width: 20,
child: Checkbox( child: Checkbox(
value: ref value: ref
.watch(addressBookFilterProvider .watch(
.select((value) => value.coins)) addressBookFilterProvider
.select((value) => value.coins),
)
.contains(coin), .contains(coin),
onChanged: (value) { onChanged: (value) {
if (value is bool) { if (value is bool) {
@ -267,7 +272,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
style: STextStyles.itemSubtitle(context), style: STextStyles.itemSubtitle(context),
), ),
], ],
) ),
], ],
), ),
), ),

View file

@ -79,7 +79,7 @@ class CoinSelectSheet extends StatelessWidget {
Flexible( Flexible(
child: Consumer( child: Consumer(
builder: (_, ref, __) { builder: (_, ref, __) {
bool showTestNet = ref.watch( final bool showTestNet = ref.watch(
prefsChangeNotifierProvider prefsChangeNotifierProvider
.select((value) => value.showTestNetCoins), .select((value) => value.showTestNetCoins),
); );

View file

@ -15,11 +15,10 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../../models/isar/models/isar_models.dart'; import '../../../models/isar/models/isar_models.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import 'add_new_contact_address_view.dart';
import 'edit_contact_address_view.dart';
import 'edit_contact_name_emoji_view.dart';
import '../../../providers/db/main_db_provider.dart'; import '../../../providers/db/main_db_provider.dart';
import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/global/address_book_service_provider.dart';
import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart';
@ -36,7 +35,9 @@ import '../../../widgets/rounded_container.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
import '../../../widgets/transaction_card.dart'; import '../../../widgets/transaction_card.dart';
import 'package:tuple/tuple.dart'; import 'add_new_contact_address_view.dart';
import 'edit_contact_address_view.dart';
import 'edit_contact_name_emoji_view.dart';
class ContactDetailsView extends ConsumerStatefulWidget { class ContactDetailsView extends ConsumerStatefulWidget {
const ContactDetailsView({ const ContactDetailsView({
@ -73,8 +74,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
.transactions .transactions
.where() .where()
.filter() .filter()
.anyOf(contact.addresses.map((e) => e.address), .anyOf(
(q, String e) => q.address((q) => q.valueEqualTo(e))) contact.addresses.map((e) => e.address),
(q, String e) => q.address((q) => q.valueEqualTo(e)),
)
.sortByTimestampDesc() .sortByTimestampDesc()
.findAll(); .findAll();
@ -107,8 +110,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
final _contact = ref.watch(addressBookServiceProvider final _contact = ref.watch(
.select((value) => value.getContactById(_contactId))); addressBookServiceProvider
.select((value) => value.getContactById(_contactId)),
);
return Background( return Background(
child: Scaffold( child: Scaffold(
@ -153,7 +158,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
final bool isFavorite = _contact.isFavorite; final bool isFavorite = _contact.isFavorite;
ref.read(addressBookServiceProvider).editContact( ref.read(addressBookServiceProvider).editContact(
_contact.copyWith(isFavorite: !isFavorite)); _contact.copyWith(isFavorite: !isFavorite),
);
}, },
), ),
), ),
@ -289,18 +295,21 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
.getSecondaryEnabledButtonStyle(context)! .getSecondaryEnabledButtonStyle(context)!
.copyWith( .copyWith(
minimumSize: MaterialStateProperty.all<Size>( minimumSize: MaterialStateProperty.all<Size>(
const Size(46, 32)), const Size(46, 32),
),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row( child: Row(
children: [ children: [
SvgPicture.asset(Assets.svg.pencil, SvgPicture.asset(
width: 10, Assets.svg.pencil,
height: 10, width: 10,
color: Theme.of(context) height: 10,
.extension<StackColors>()! color: Theme.of(context)
.accentColorDark), .extension<StackColors>()!
.accentColorDark,
),
const SizedBox( const SizedBox(
width: 4, width: 4,
), ),
@ -463,9 +472,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
), ),
FutureBuilder( FutureBuilder(
future: _filteredTransactionsByContact(), future: _filteredTransactionsByContact(),
builder: (_, builder: (
AsyncSnapshot<List<Tuple2<String, Transaction>>> _,
snapshot) { AsyncSnapshot<List<Tuple2<String, Transaction>>> snapshot,
) {
if (snapshot.connectionState == ConnectionState.done && if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) { snapshot.hasData) {
_cachedTransactions = snapshot.data!; _cachedTransactions = snapshot.data!;
@ -478,7 +488,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
..._cachedTransactions.map( ..._cachedTransactions.map(
(e) => TransactionCard( (e) => TransactionCard(
key: Key( key: Key(
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey",
),
transaction: e.item2, transaction: e.item2,
walletId: e.item1, walletId: e.item1,
), ),
@ -508,7 +519,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
..._cachedTransactions.map( ..._cachedTransactions.map(
(e) => TransactionCard( (e) => TransactionCard(
key: Key( key: Key(
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"), "contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey",
),
transaction: e.item2, transaction: e.item2,
walletId: e.item1, walletId: e.item1,
), ),

View file

@ -51,8 +51,10 @@ class ContactPopUp extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final maxHeight = MediaQuery.of(context).size.height * 0.6; final maxHeight = MediaQuery.of(context).size.height * 0.6;
final contact = ref.watch(addressBookServiceProvider final contact = ref.watch(
.select((value) => value.getContactById(contactId))); addressBookServiceProvider
.select((value) => value.getContactById(contactId)),
);
final active = ref.read(currentWalletIdProvider); final active = ref.read(currentWalletIdProvider);
@ -157,7 +159,8 @@ class ContactPopUp extends ConsumerWidget {
style: Theme.of(context) style: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.getSecondaryEnabledButtonStyle( .getSecondaryEnabledButtonStyle(
context)! context,
)!
.copyWith( .copyWith(
minimumSize: minimumSize:
MaterialStateProperty.all< MaterialStateProperty.all<
@ -165,10 +168,14 @@ class ContactPopUp extends ConsumerWidget {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 18), horizontal: 18,
child: Text("Details", ),
style: STextStyles.buttonSmall( child: Text(
context)), "Details",
style: STextStyles.buttonSmall(
context,
),
),
), ),
), ),
], ],
@ -186,7 +193,8 @@ class ContactPopUp extends ConsumerWidget {
if (addresses.isEmpty) if (addresses.isEmpty)
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 20), horizontal: 20,
),
child: RoundedWhiteContainer( child: RoundedWhiteContainer(
child: Center( child: Center(
child: Text( child: Text(
@ -237,14 +245,16 @@ class ContactPopUp extends ConsumerWidget {
e.other!, e.other!,
style: style:
STextStyles.itemSubtitle12( STextStyles.itemSubtitle12(
context), context,
),
), ),
if (contact.customId != "default") if (contact.customId != "default")
Text( Text(
"${e.label} (${e.coin.ticker})", "${e.label} (${e.coin.ticker})",
style: style:
STextStyles.itemSubtitle12( STextStyles.itemSubtitle12(
context), context,
),
), ),
const SizedBox( const SizedBox(
height: 2, height: 2,
@ -252,8 +262,8 @@ class ContactPopUp extends ConsumerWidget {
Text( Text(
e.address, e.address,
style: STextStyles.itemSubtitle( style: STextStyles.itemSubtitle(
context) context,
.copyWith( ).copyWith(
fontSize: 8, fontSize: 8,
), ),
), ),
@ -286,12 +296,13 @@ class ContactPopUp extends ConsumerWidget {
.textFieldDefaultBG, .textFieldDefaultBG,
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.svg.copy, Assets.svg.copy,
width: 16, width: 16,
height: 16, height: 16,
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
), ),
), ),
], ],
@ -310,12 +321,15 @@ class ContactPopUp extends ConsumerWidget {
onTap: () { onTap: () {
ref ref
.read( .read(
exchangeFromAddressBookAddressStateProvider exchangeFromAddressBookAddressStateProvider
.state) .state,
)
.state = e.address; .state = e.address;
Navigator.of(context).popUntil( Navigator.of(context).popUntil(
ModalRoute.withName( ModalRoute.withName(
Step2View.routeName)); Step2View.routeName,
),
);
}, },
child: RoundedContainer( child: RoundedContainer(
color: Theme.of(context) color: Theme.of(context)
@ -324,13 +338,13 @@ class ContactPopUp extends ConsumerWidget {
padding: padding:
const EdgeInsets.all(6), const EdgeInsets.all(6),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.svg.chevronRight, Assets.svg.chevronRight,
width: 16, width: 16,
height: 16, height: 16,
color: Theme.of(context) color: Theme.of(context)
.extension< .extension<StackColors>()!
StackColors>()! .accentColorDark,
.accentColorDark), ),
), ),
), ),
], ],
@ -363,7 +377,8 @@ class ContactPopUp extends ConsumerWidget {
arguments: Tuple3( arguments: Tuple3(
active, active,
ref.read( ref.read(
pWalletCoin(active)), pWalletCoin(active),
),
SendViewAutoFillData( SendViewAutoFillData(
address: address, address: address,
contactLabel: contactLabel:
@ -381,18 +396,15 @@ class ContactPopUp extends ConsumerWidget {
Util.isDesktop ? 4 : 6, Util.isDesktop ? 4 : 6,
), ),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets Assets.svg.circleArrowUpRight,
.svg.circleArrowUpRight, width:
width: Util.isDesktop Util.isDesktop ? 12 : 16,
? 12 height:
: 16, Util.isDesktop ? 12 : 16,
height: Util.isDesktop color: Theme.of(context)
? 12 .extension<StackColors>()!
: 16, .accentColorDark,
color: Theme.of(context) ),
.extension<
StackColors>()!
.accentColorDark),
), ),
), ),
], ],

View file

@ -8,13 +8,11 @@
* *
*/ */
import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../../models/isar/models/contact_entry.dart'; import '../../../models/isar/models/contact_entry.dart';
import 'new_contact_address_entry_form.dart';
import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/global/address_book_service_provider.dart';
import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart'; import '../../../providers/ui/address_book_providers/address_entry_data_provider.dart';
import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart'; import '../../../providers/ui/address_book_providers/valid_contact_state_provider.dart';
@ -29,15 +27,16 @@ import '../../../widgets/conditional_parent.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import 'new_contact_address_entry_form.dart';
class EditContactAddressView extends ConsumerStatefulWidget { class EditContactAddressView extends ConsumerStatefulWidget {
const EditContactAddressView({ const EditContactAddressView({
Key? key, super.key,
required this.contactId, required this.contactId,
required this.addressEntry, required this.addressEntry,
this.barcodeScanner = const BarcodeScannerWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(),
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/editContactAddress"; static const String routeName = "/editContactAddress";
@ -67,7 +66,7 @@ class _EditContactAddressViewState
const Duration(milliseconds: 75), const Duration(milliseconds: 75),
); );
} }
List<ContactAddressEntry> entries = contact.addresses.toList(); final List<ContactAddressEntry> entries = contact.addresses.toList();
final entry = entries.firstWhere( final entry = entries.firstWhere(
(e) => (e) =>
@ -79,12 +78,12 @@ class _EditContactAddressViewState
final index = entries.indexOf(entry); final index = entries.indexOf(entry);
entries.remove(entry); entries.remove(entry);
ContactAddressEntry editedEntry = final ContactAddressEntry editedEntry =
ref.read(addressEntryDataProvider(0)).buildAddressEntry(); ref.read(addressEntryDataProvider(0)).buildAddressEntry();
entries.insert(index, editedEntry); entries.insert(index, editedEntry);
ContactEntry editedContact = contact.copyWith(addresses: entries); final ContactEntry editedContact = contact.copyWith(addresses: entries);
if (await ref.read(addressBookServiceProvider).editContact(editedContact)) { if (await ref.read(addressBookServiceProvider).editContact(editedContact)) {
if (mounted) { if (mounted) {
@ -108,8 +107,10 @@ class _EditContactAddressViewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final contact = ref.watch(addressBookServiceProvider final contact = ref.watch(
.select((value) => value.getContactById(contactId))); addressBookServiceProvider
.select((value) => value.getContactById(contactId)),
);
final bool isDesktop = Util.isDesktop; final bool isDesktop = Util.isDesktop;
@ -239,9 +240,10 @@ class _EditContactAddressViewState
//Deleting an entry directly from _addresses gives error //Deleting an entry directly from _addresses gives error
// "Cannot remove from a fixed-length list", so we remove the // "Cannot remove from a fixed-length list", so we remove the
// entry from a copy // entry from a copy
var tempAddresses = List<ContactAddressEntry>.from(_addresses); final tempAddresses =
List<ContactAddressEntry>.from(_addresses);
tempAddresses.remove(entry); tempAddresses.remove(entry);
ContactEntry editedContact = final ContactEntry editedContact =
contact.copyWith(addresses: tempAddresses); contact.copyWith(addresses: tempAddresses);
if (await ref if (await ref
.read(addressBookServiceProvider) .read(addressBookServiceProvider)
@ -272,7 +274,8 @@ class _EditContactAddressViewState
if (!isDesktop && FocusScope.of(context).hasFocus) { if (!isDesktop && FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 75)); const Duration(milliseconds: 75),
);
} }
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();

View file

@ -14,6 +14,7 @@ import 'package:emojis/emoji.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../../providers/global/address_book_service_provider.dart'; import '../../../providers/global/address_book_service_provider.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart'; import '../../../utilities/assets.dart';
@ -33,9 +34,9 @@ import '../../../widgets/textfield_icon_button.dart';
class EditContactNameEmojiView extends ConsumerStatefulWidget { class EditContactNameEmojiView extends ConsumerStatefulWidget {
const EditContactNameEmojiView({ const EditContactNameEmojiView({
Key? key, super.key,
required this.contactId, required this.contactId,
}) : super(key: key); });
static const String routeName = "/editContactNameEmoji"; static const String routeName = "/editContactNameEmoji";
@ -82,8 +83,10 @@ class _EditContactNameEmojiViewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final contact = ref.watch(addressBookServiceProvider final contact = ref.watch(
.select((value) => value.getContactById(contactId))); addressBookServiceProvider
.select((value) => value.getContactById(contactId)),
);
final isDesktop = Util.isDesktop; final isDesktop = Util.isDesktop;
final double emojiSize = isDesktop ? 56 : 48; final double emojiSize = isDesktop ? 56 : 48;
@ -152,23 +155,24 @@ class _EditContactNameEmojiViewState
} }
if (isDesktop) { if (isDesktop) {
showDialog<dynamic>( showDialog<dynamic>(
barrierColor: Colors.transparent, barrierColor: Colors.transparent,
context: context, context: context,
builder: (context) { builder: (context) {
return const DesktopDialog( return const DesktopDialog(
maxHeight: 700, maxHeight: 700,
maxWidth: 600, maxWidth: 600,
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 32, left: 32,
right: 20, right: 20,
top: 32, top: 32,
bottom: 32, bottom: 32,
),
child: EmojiSelectSheet(),
), ),
); child: EmojiSelectSheet(),
}).then((value) { ),
);
},
).then((value) {
if (value is Emoji) { if (value is Emoji) {
setState(() { setState(() {
_selectedEmoji = value; _selectedEmoji = value;
@ -229,10 +233,11 @@ class _EditContactNameEmojiViewState
height: 14, height: 14,
width: 14, width: 14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
child: Center( child: Center(
child: _selectedEmoji == null child: _selectedEmoji == null
? SvgPicture.asset( ? SvgPicture.asset(
@ -253,7 +258,7 @@ class _EditContactNameEmojiViewState
), ),
), ),
), ),
) ),
], ],
), ),
), ),
@ -362,7 +367,8 @@ class _EditContactNameEmojiViewState
if (!isDesktop && FocusScope.of(context).hasFocus) { if (!isDesktop && FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 75)); const Duration(milliseconds: 75),
);
} }
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -403,7 +409,7 @@ class _EditContactNameEmojiViewState
), ),
), ),
], ],
) ),
], ],
), ),
); );

View file

@ -439,7 +439,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
buyWithFiat: buyWithFiat, buyWithFiat: buyWithFiat,
); );
BuyResponse<SimplexQuote> quoteResponse = await _loadQuote(quote); final BuyResponse<SimplexQuote> quoteResponse = await _loadQuote(quote);
shouldPop = true; shouldPop = true;
if (mounted) { if (mounted) {
Navigator.of(context, rootNavigator: isDesktop).pop(); Navigator.of(context, rootNavigator: isDesktop).pop();
@ -767,8 +767,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
Locale locale = Localizations.localeOf(context); final Locale locale = Localizations.localeOf(context);
var format = NumberFormat.simpleCurrency(locale: locale.toString()); final format = NumberFormat.simpleCurrency(locale: locale.toString());
// See https://stackoverflow.com/a/67055685 // See https://stackoverflow.com/a/67055685
return ConditionalParent( return ConditionalParent(

View file

@ -11,6 +11,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../models/buy/response_objects/order.dart'; import '../../models/buy/response_objects/order.dart';
import '../../themes/stack_colors.dart'; import '../../themes/stack_colors.dart';
import '../../themes/theme_providers.dart'; import '../../themes/theme_providers.dart';
@ -25,9 +26,9 @@ import '../../widgets/rounded_white_container.dart';
class BuyOrderDetailsView extends ConsumerStatefulWidget { class BuyOrderDetailsView extends ConsumerStatefulWidget {
const BuyOrderDetailsView({ const BuyOrderDetailsView({
Key? key, super.key,
required this.order, required this.order,
}) : super(key: key); });
final SimplexOrder order; final SimplexOrder order;
@ -259,22 +260,25 @@ class _BuyOrderDetailsViewState extends ConsumerState<BuyOrderDetailsView> {
const SizedBox( const SizedBox(
height: 24, height: 24,
), ),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Row(
Text( mainAxisAlignment: MainAxisAlignment.center,
"This information is not saved,\nscreenshot it now for your records", children: [
style: STextStyles.label(context).copyWith( Text(
color: Theme.of(context).extension<StackColors>()!.textDark, "This information is not saved,\nscreenshot it now for your records",
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
textAlign: TextAlign.center,
), ),
textAlign: TextAlign.center, ],
), ),
]),
const Spacer(), const Spacer(),
PrimaryButton( PrimaryButton(
label: "Dismiss", label: "Dismiss",
onPressed: () { onPressed: () {
Navigator.of(context, rootNavigator: isDesktop).pop(); Navigator.of(context, rootNavigator: isDesktop).pop();
}, },
) ),
], ],
), ),
); );

View file

@ -29,9 +29,9 @@ import '../../widgets/rounded_white_container.dart';
class BuyQuotePreviewView extends ConsumerStatefulWidget { class BuyQuotePreviewView extends ConsumerStatefulWidget {
const BuyQuotePreviewView({ const BuyQuotePreviewView({
Key? key, super.key,
required this.quote, required this.quote,
}) : super(key: key); });
final SimplexQuote quote; final SimplexQuote quote;
@ -56,8 +56,8 @@ class _BuyQuotePreviewViewState extends ConsumerState<BuyQuotePreviewView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Locale locale = Localizations.localeOf(context); final Locale locale = Localizations.localeOf(context);
var format = NumberFormat.simpleCurrency(locale: locale.toString()); final format = NumberFormat.simpleCurrency(locale: locale.toString());
// See https://stackoverflow.com/a/67055685 // See https://stackoverflow.com/a/67055685
return ConditionalParent( return ConditionalParent(
@ -240,7 +240,7 @@ class _BuyQuotePreviewViewState extends ConsumerState<BuyQuotePreviewView> {
PrimaryButton( PrimaryButton(
label: "Buy", label: "Buy",
onPressed: _buyWarning, onPressed: _buyWarning,
) ),
], ],
), ),
); );

View file

@ -13,9 +13,9 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import '../../../models/buy/response_objects/order.dart'; import '../../../models/buy/response_objects/order.dart';
import '../../../models/buy/response_objects/quote.dart'; import '../../../models/buy/response_objects/quote.dart';
import '../buy_order_details.dart';
import '../../../services/buy/buy_response.dart'; import '../../../services/buy/buy_response.dart';
import '../../../services/buy/simplex/simplex_api.dart'; import '../../../services/buy/simplex/simplex_api.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
@ -29,13 +29,14 @@ import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
import '../buy_order_details.dart';
class BuyWarningPopup extends ConsumerStatefulWidget { class BuyWarningPopup extends ConsumerStatefulWidget {
const BuyWarningPopup({ const BuyWarningPopup({
Key? key, super.key,
required this.quote, required this.quote,
this.order, this.order,
}) : super(key: key); });
final SimplexQuote quote; final SimplexQuote quote;
final SimplexOrder? order; final SimplexOrder? order;
@override @override
@ -123,7 +124,8 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
} }
Future<void> onContinue() async { Future<void> onContinue() async {
BuyResponse<SimplexOrder> orderResponse = await newOrder(widget.quote); final BuyResponse<SimplexOrder> orderResponse =
await newOrder(widget.quote);
if (orderResponse.exception == null) { if (orderResponse.exception == null) {
await redirect(orderResponse.value as SimplexOrder) await redirect(orderResponse.value as SimplexOrder)
.then((_response) async { .then((_response) async {
@ -175,7 +177,7 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
), ),
), ),
], ],
) ),
], ],
), ),
), ),
@ -192,9 +194,10 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
child: Text( child: Text(
"Ok", "Ok",
style: STextStyles.button(context).copyWith( style: STextStyles.button(context).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.accentColorDark), .accentColorDark,
),
), ),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -274,7 +277,7 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
), ),
), ),
], ],
) ),
], ],
), ),
), ),

View file

@ -11,6 +11,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import '../../../models/buy/response_objects/fiat.dart'; import '../../../models/buy/response_objects/fiat.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart'; import '../../../utilities/assets.dart';
@ -28,9 +29,9 @@ import '../../../widgets/textfield_icon_button.dart';
class FiatSelectionView extends StatefulWidget { class FiatSelectionView extends StatefulWidget {
const FiatSelectionView({ const FiatSelectionView({
Key? key, super.key,
required this.fiats, required this.fiats,
}) : super(key: key); });
final List<Fiat> fiats; final List<Fiat> fiats;
@ -48,9 +49,11 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
void filter(String text) { void filter(String text) {
setState(() { setState(() {
_fiats = [ _fiats = [
...fiats.where((e) => ...fiats.where(
e.name.toLowerCase().contains(text.toLowerCase()) || (e) =>
e.ticker.toLowerCase().contains(text.toLowerCase())) e.name.toLowerCase().contains(text.toLowerCase()) ||
e.ticker.toLowerCase().contains(text.toLowerCase()),
),
]; ];
}); });
} }
@ -61,10 +64,12 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
fiats = [...widget.fiats]; fiats = [...widget.fiats];
fiats.sort( fiats.sort(
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase())); (a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()),
for (Fiats fiat in Fiats.values.reversed) { );
int index = fiats.indexWhere((element) => for (final Fiats fiat in Fiats.values.reversed) {
element.ticker.toLowerCase() == fiat.ticker.toLowerCase()); final int index = fiats.indexWhere(
(element) => element.ticker.toLowerCase() == fiat.ticker.toLowerCase(),
);
if (index > 0) { if (index > 0) {
final currency = fiats.removeAt(index); final currency = fiats.removeAt(index);
fiats.insert(0, currency); fiats.insert(0, currency);
@ -85,7 +90,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Locale locale = Localizations.localeOf(context); final Locale locale = Localizations.localeOf(context);
final format = NumberFormat.simpleCurrency(locale: locale.toString()); final format = NumberFormat.simpleCurrency(locale: locale.toString());
// See https://stackoverflow.com/a/67055685 // See https://stackoverflow.com/a/67055685
@ -104,7 +109,8 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
if (FocusScope.of(context).hasFocus) { if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
await Future<void>.delayed( await Future<void>.delayed(
const Duration(milliseconds: 50)); const Duration(milliseconds: 50),
);
} }
if (mounted) { if (mounted) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -235,17 +241,20 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
), ),
child: Text( child: Text(
format.simpleCurrencySymbol( format.simpleCurrencySymbol(
e.ticker.toUpperCase()), e.ticker.toUpperCase(),
),
style: STextStyles.subtitle(context) style: STextStyles.subtitle(context)
.apply( .apply(
fontSizeFactor: (1 / fontSizeFactor: (1 /
format format
.simpleCurrencySymbol( .simpleCurrencySymbol(
e.ticker.toUpperCase()) e.ticker.toUpperCase(),
)
.length * // Couldn't get pow() working here .length * // Couldn't get pow() working here
format format
.simpleCurrencySymbol( .simpleCurrencySymbol(
e.ticker.toUpperCase()) e.ticker.toUpperCase(),
)
.length), .length),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,

View file

@ -15,8 +15,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_native_splash/cli_commands.dart'; import 'package:flutter_native_splash/cli_commands.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'fusion_progress_view.dart';
import 'fusion_rounds_selection_sheet.dart';
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
import '../../providers/global/prefs_provider.dart'; import '../../providers/global/prefs_provider.dart';
import '../../providers/global/wallets_provider.dart'; import '../../providers/global/wallets_provider.dart';
@ -34,6 +33,8 @@ import '../../widgets/desktop/primary_button.dart';
import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_container.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_text_field.dart'; import '../../widgets/stack_text_field.dart';
import 'fusion_progress_view.dart';
import 'fusion_rounds_selection_sheet.dart';
class CashFusionView extends ConsumerStatefulWidget { class CashFusionView extends ConsumerStatefulWidget {
const CashFusionView({ const CashFusionView({
@ -73,7 +74,8 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
); );
} catch (e) { } catch (e) {
if (!e.toString().contains( if (!e.toString().contains(
"FusionProgressUIState was already set for ${widget.walletId}")) { "FusionProgressUIState was already set for ${widget.walletId}",
)) {
rethrow; rethrow;
} }
} }
@ -273,7 +275,7 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
controller: portController, controller: portController,
focusNode: portFocusNode, focusNode: portFocusNode,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.digitsOnly FilteringTextInputFormatter.digitsOnly,
], ],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
onChanged: (value) { onChanged: (value) {
@ -408,7 +410,7 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
controller: fusionRoundController, controller: fusionRoundController,
focusNode: fusionRoundFocusNode, focusNode: fusionRoundFocusNode,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.digitsOnly FilteringTextInputFormatter.digitsOnly,
], ],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
onChanged: (value) { onChanged: (value) {
@ -424,7 +426,8 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
fusionRoundFocusNode, fusionRoundFocusNode,
context, context,
).copyWith( ).copyWith(
labelText: "Enter number of fusions.."), labelText: "Enter number of fusions..",
),
), ),
), ),
const SizedBox( const SizedBox(

View file

@ -12,6 +12,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart'; import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
import '../../providers/global/prefs_provider.dart'; import '../../providers/global/prefs_provider.dart';
@ -244,7 +245,8 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
); );
} catch (e) { } catch (e) {
if (!e.toString().contains( if (!e.toString().contains(
"FusionProgressUIState was already set for ${widget.walletId}")) { "FusionProgressUIState was already set for ${widget.walletId}",
)) {
rethrow; rethrow;
} }
} }

View file

@ -22,9 +22,9 @@ enum FusionOption {
class FusionRoundCountSelectSheet extends HookWidget { class FusionRoundCountSelectSheet extends HookWidget {
const FusionRoundCountSelectSheet({ const FusionRoundCountSelectSheet({
Key? key, super.key,
required this.currentOption, required this.currentOption,
}) : super(key: key); });
final FusionOption currentOption; final FusionOption currentOption;

View file

@ -14,10 +14,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../db/isar/main_db.dart'; import '../../db/isar/main_db.dart';
import '../../models/isar/models/isar_models.dart'; import '../../models/isar/models/isar_models.dart';
import 'utxo_card.dart';
import 'utxo_details_view.dart';
import '../../providers/global/wallets_provider.dart'; import '../../providers/global/wallets_provider.dart';
import '../../themes/stack_colors.dart'; import '../../themes/stack_colors.dart';
import '../../utilities/amount/amount.dart'; import '../../utilities/amount/amount.dart';
@ -39,7 +39,8 @@ import '../../widgets/icon_widgets/x_icon.dart';
import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_container.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/toggle.dart'; import '../../widgets/toggle.dart';
import 'package:tuple/tuple.dart'; import 'utxo_card.dart';
import 'utxo_details_view.dart';
enum CoinControlViewType { enum CoinControlViewType {
manage, manage,
@ -148,7 +149,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
onWillPop: () async { onWillPop: () async {
unawaited(_refreshBalance()); unawaited(_refreshBalance());
Navigator.of(context).pop( Navigator.of(context).pop(
widget.type == CoinControlViewType.use ? _selectedAvailable : null); widget.type == CoinControlViewType.use ? _selectedAvailable : null,
);
return false; return false;
}, },
child: Background( child: Background(
@ -179,9 +181,10 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
onPressed: () { onPressed: () {
unawaited(_refreshBalance()); unawaited(_refreshBalance());
Navigator.of(context).pop( Navigator.of(context).pop(
widget.type == CoinControlViewType.use widget.type == CoinControlViewType.use
? _selectedAvailable ? _selectedAvailable
: null); : null,
);
}, },
), ),
title: _isSearching title: _isSearching
@ -336,7 +339,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
return UtxoCard( return UtxoCard(
key: Key( key: Key(
"${utxo.walletId}_${utxo.id}_$isSelected"), "${utxo.walletId}_${utxo.id}_$isSelected",
),
walletId: widget.walletId, walletId: widget.walletId,
utxo: utxo, utxo: utxo,
canSelect: widget.type == canSelect: widget.type ==
@ -398,7 +402,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
return UtxoCard( return UtxoCard(
key: Key( key: Key(
"${utxo.walletId}_${utxo.id}_$isSelected"), "${utxo.walletId}_${utxo.id}_$isSelected",
),
walletId: widget.walletId, walletId: widget.walletId,
utxo: utxo, utxo: utxo,
canSelect: widget.type == canSelect: widget.type ==
@ -486,7 +491,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
entry.key, entry.key,
style: style:
STextStyles.w600_14( STextStyles.w600_14(
context), context,
),
), ),
const SizedBox( const SizedBox(
height: 2, height: 2,
@ -496,8 +502,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
"output${entry.value.length > 1 ? "s" : ""}", "output${entry.value.length > 1 ? "s" : ""}",
style: style:
STextStyles.w500_12( STextStyles.w500_12(
context) context,
.copyWith( ).copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension< .extension<
StackColors>()! StackColors>()!
@ -538,7 +544,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
return UtxoCard( return UtxoCard(
key: Key( key: Key(
"${utxo.walletId}_${utxo.id}_$isSelected"), "${utxo.walletId}_${utxo.id}_$isSelected",
),
walletId: widget.walletId, walletId: widget.walletId,
utxo: utxo, utxo: utxo,
canSelect: widget.type == canSelect: widget.type ==
@ -615,22 +622,26 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
label: _showBlocked ? "Unfreeze" : "Freeze", label: _showBlocked ? "Unfreeze" : "Freeze",
onPressed: () async { onPressed: () async {
if (_showBlocked) { if (_showBlocked) {
await MainDB.instance.putUTXOs(_selectedBlocked await MainDB.instance.putUTXOs(
.map( _selectedBlocked
(e) => e.copyWith( .map(
isBlocked: false, (e) => e.copyWith(
), isBlocked: false,
) ),
.toList()); )
.toList(),
);
_selectedBlocked.clear(); _selectedBlocked.clear();
} else { } else {
await MainDB.instance.putUTXOs(_selectedAvailable await MainDB.instance.putUTXOs(
.map( _selectedAvailable
(e) => e.copyWith( .map(
isBlocked: true, (e) => e.copyWith(
), isBlocked: true,
) ),
.toList()); )
.toList(),
);
_selectedAvailable.clear(); _selectedAvailable.clear();
} }
setState(() {}); setState(() {});
@ -689,7 +700,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
.format(selectedSum), .format(selectedSum),
style: widget.requestedTotal == null style: widget.requestedTotal == null
? STextStyles.w600_14(context) ? STextStyles.w600_14(context)
: STextStyles.w600_14(context).copyWith( : STextStyles.w600_14(context)
.copyWith(
color: selectedSum >= color: selectedSum >=
widget widget
.requestedTotal! .requestedTotal!
@ -700,7 +712,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
: Theme.of(context) : Theme.of(context)
.extension< .extension<
StackColors>()! StackColors>()!
.accentColorRed), .accentColorRed,
),
); );
}, },
), ),

View file

@ -10,6 +10,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../db/isar/main_db.dart'; import '../../db/isar/main_db.dart';
import '../../models/isar/models/isar_models.dart'; import '../../models/isar/models/isar_models.dart';
import '../../providers/global/wallets_provider.dart'; import '../../providers/global/wallets_provider.dart';
@ -90,83 +91,84 @@ class _UtxoCardState extends ConsumerState<UtxoCard> {
? Theme.of(context).extension<StackColors>()!.popupBG ? Theme.of(context).extension<StackColors>()!.popupBG
: Colors.transparent, : Colors.transparent,
child: StreamBuilder<UTXO?>( child: StreamBuilder<UTXO?>(
stream: stream, stream: stream,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
utxo = snapshot.data!; utxo = snapshot.data!;
} }
return Row( return Row(
children: [ children: [
ConditionalParent( ConditionalParent(
condition: widget.canSelect, condition: widget.canSelect,
builder: (child) => GestureDetector( builder: (child) => GestureDetector(
onTap: () { onTap: () {
_selected = !_selected; _selected = !_selected;
widget.onSelectedChanged(_selected); widget.onSelectedChanged(_selected);
setState(() {}); setState(() {});
}, },
child: child, child: child,
),
child: UTXOStatusIcon(
blocked: utxo.isBlocked,
status: utxo.isConfirmed(
currentHeight,
ref
.watch(pWallets)
.getWallet(widget.walletId)
.cryptoCurrency
.minConfirms,
)
? UTXOStatusIconStatus.confirmed
: UTXOStatusIconStatus.unconfirmed,
background:
Theme.of(context).extension<StackColors>()!.popupBG,
selected: _selected,
width: 32,
height: 32,
),
), ),
const SizedBox( child: UTXOStatusIcon(
width: 10, blocked: utxo.isBlocked,
status: utxo.isConfirmed(
currentHeight,
ref
.watch(pWallets)
.getWallet(widget.walletId)
.cryptoCurrency
.minConfirms,
)
? UTXOStatusIconStatus.confirmed
: UTXOStatusIconStatus.unconfirmed,
background:
Theme.of(context).extension<StackColors>()!.popupBG,
selected: _selected,
width: 32,
height: 32,
), ),
Expanded( ),
child: Column( const SizedBox(
crossAxisAlignment: CrossAxisAlignment.start, width: 10,
mainAxisSize: MainAxisSize.min, ),
children: [ Expanded(
Text( child: Column(
ref.watch(pAmountFormatter(coin)).format( crossAxisAlignment: CrossAxisAlignment.start,
utxo.value.toAmountAsRaw( mainAxisSize: MainAxisSize.min,
fractionDigits: coin.fractionDigits, children: [
), Text(
), ref.watch(pAmountFormatter(coin)).format(
style: STextStyles.w600_14(context), utxo.value.toAmountAsRaw(
), fractionDigits: coin.fractionDigits,
const SizedBox(
height: 2,
),
Row(
children: [
Flexible(
child: Text(
utxo.name.isNotEmpty
? utxo.name
: utxo.address ?? utxo.txid,
style: STextStyles.w500_12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
), ),
), ),
], style: STextStyles.w600_14(context),
), ),
], const SizedBox(
), height: 2,
),
Row(
children: [
Flexible(
child: Text(
utxo.name.isNotEmpty
? utxo.name
: utxo.address ?? utxo.txid,
style: STextStyles.w500_12(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
),
],
),
],
), ),
], ),
); ],
}), );
},
),
), ),
); );
} }

View file

@ -550,7 +550,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
} }
class _Div extends StatelessWidget { class _Div extends StatelessWidget {
const _Div({Key? key}) : super(key: key); const _Div({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View file

@ -131,7 +131,7 @@ class _ChooseFromStackViewState extends ConsumerState<ChooseFromStackView> {
), ),
], ],
), ),
) ),
], ],
), ),
), ),

View file

@ -12,12 +12,11 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:uuid/uuid.dart';
import '../../models/exchange/response_objects/trade.dart'; import '../../models/exchange/response_objects/trade.dart';
import '../../models/isar/models/isar_models.dart'; import '../../models/isar/models/isar_models.dart';
import '../../models/trade_wallet_lookup.dart'; import '../../models/trade_wallet_lookup.dart';
import '../pinpad_views/lock_screen_view.dart';
import '../send_view/sub_widgets/sending_transaction_dialog.dart';
import '../wallet_view/wallet_view.dart';
import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart'; import '../../pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart';
import '../../providers/db/main_db_provider.dart'; import '../../providers/db/main_db_provider.dart';
import '../../providers/providers.dart'; import '../../providers/providers.dart';
@ -42,7 +41,9 @@ import '../../widgets/desktop/secondary_button.dart';
import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_container.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart'; import '../../widgets/stack_dialog.dart';
import 'package:uuid/uuid.dart'; import '../pinpad_views/lock_screen_view.dart';
import '../send_view/sub_widgets/sending_transaction_dialog.dart';
import '../wallet_view/wallet_view.dart';
class ConfirmChangeNowSendView extends ConsumerStatefulWidget { class ConfirmChangeNowSendView extends ConsumerStatefulWidget {
const ConfirmChangeNowSendView({ const ConfirmChangeNowSendView({
@ -342,7 +343,7 @@ class _ConfirmChangeNowSendViewState
Text( Text(
"Confirm ${ref.watch(pWalletCoin(walletId)).ticker} transaction", "Confirm ${ref.watch(pWalletCoin(walletId)).ticker} transaction",
style: STextStyles.desktopH3(context), style: STextStyles.desktopH3(context),
) ),
], ],
), ),
Padding( Padding(
@ -384,8 +385,11 @@ class _ConfirmChangeNowSendViewState
children: [ children: [
Text( Text(
ref ref
.watch(pAmountFormatter( .watch(
ref.watch(pWalletCoin(walletId)))) pAmountFormatter(
ref.watch(pWalletCoin(walletId)),
),
)
.format(widget.txData.fee!), .format(widget.txData.fee!),
style: style:
STextStyles.desktopTextExtraExtraSmall(context) STextStyles.desktopTextExtraExtraSmall(context)
@ -461,7 +465,7 @@ class _ConfirmChangeNowSendViewState
), ),
), ),
], ],
) ),
], ],
), ),
), ),
@ -574,41 +578,49 @@ class _ConfirmChangeNowSendViewState
builder: (child) => Row( builder: (child) => Row(
children: [ children: [
child, child,
Builder(builder: (context) { Builder(
final coin = ref.watch(pWalletCoin(walletId)); builder: (context) {
final price = ref.watch( final coin = ref.watch(pWalletCoin(walletId));
final price = ref.watch(
priceAnd24hChangeNotifierProvider priceAnd24hChangeNotifierProvider
.select((value) => value.getPrice(coin))); .select((value) => value.getPrice(coin)),
final amountWithoutChange = );
widget.txData.amountWithoutChange!; final amountWithoutChange =
final value = widget.txData.amountWithoutChange!;
(price.item1 * amountWithoutChange.decimal) final value =
.toAmount(fractionDigits: 2); (price.item1 * amountWithoutChange.decimal)
final currency = ref.watch(prefsChangeNotifierProvider .toAmount(fractionDigits: 2);
.select((value) => value.currency)); final currency = ref.watch(
final locale = ref.watch( prefsChangeNotifierProvider
localeServiceChangeNotifierProvider.select( .select((value) => value.currency),
(value) => value.locale, );
), final locale = ref.watch(
); localeServiceChangeNotifierProvider.select(
(value) => value.locale,
),
);
return Text( return Text(
" | ${value.fiatString(locale: locale)} $currency", " | ${value.fiatString(locale: locale)} $currency",
style: style: STextStyles.desktopTextExtraExtraSmall(
STextStyles.desktopTextExtraExtraSmall(context) context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.textSubtitle2, .textSubtitle2,
), ),
); );
}) },
),
], ],
), ),
child: Text( child: Text(
ref ref
.watch(pAmountFormatter( .watch(
ref.watch(pWalletCoin(walletId)))) pAmountFormatter(
ref.watch(pWalletCoin(walletId)),
),
)
.format((widget.txData.amountWithoutChange!)), .format((widget.txData.amountWithoutChange!)),
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
textAlign: TextAlign.right, textAlign: TextAlign.right,
@ -637,7 +649,8 @@ class _ConfirmChangeNowSendViewState
Text( Text(
ref ref
.watch( .watch(
pAmountFormatter(ref.read(pWalletCoin(walletId)))) pAmountFormatter(ref.read(pWalletCoin(walletId))),
)
.format( .format(
widget.txData.fee!, widget.txData.fee!,
), ),

View file

@ -23,10 +23,10 @@ import '../../widgets/textfield_icon_button.dart';
class EditTradeNoteView extends ConsumerStatefulWidget { class EditTradeNoteView extends ConsumerStatefulWidget {
const EditTradeNoteView({ const EditTradeNoteView({
Key? key, super.key,
required this.tradeId, required this.tradeId,
required this.note, required this.note,
}) : super(key: key); });
static const String routeName = "/editTradeNote"; static const String routeName = "/editTradeNote";
@ -151,7 +151,7 @@ class _EditNoteViewState extends ConsumerState<EditTradeNoteView> {
"Save", "Save",
style: STextStyles.button(context), style: STextStyles.button(context),
), ),
) ),
], ],
), ),
), ),

View file

@ -110,7 +110,7 @@ class _ExchangeCurrencySelectionViewState
return await _getCurrencies(); return await _getCurrencies();
} }
await ExchangeDataLoadingService.instance.initDB(); await ExchangeDataLoadingService.instance.initDB();
List<Currency> currencies = await ExchangeDataLoadingService final List<Currency> currencies = await ExchangeDataLoadingService
.instance.isar.currencies .instance.isar.currencies
.where() .where()
.filter() .filter()

View file

@ -16,6 +16,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import 'package:uuid/uuid.dart';
import '../../models/exchange/aggregate_currency.dart'; import '../../models/exchange/aggregate_currency.dart';
import '../../models/exchange/incomplete_exchange.dart'; import '../../models/exchange/incomplete_exchange.dart';
import '../../models/exchange/response_objects/estimate.dart'; import '../../models/exchange/response_objects/estimate.dart';
@ -23,11 +26,6 @@ import '../../models/exchange/response_objects/range.dart';
import '../../models/isar/exchange_cache/currency.dart'; import '../../models/isar/exchange_cache/currency.dart';
import '../../models/isar/exchange_cache/pair.dart'; import '../../models/isar/exchange_cache/pair.dart';
import '../../models/isar/models/ethereum/eth_contract.dart'; import '../../models/isar/models/ethereum/eth_contract.dart';
import 'exchange_coin_selection/exchange_currency_selection_view.dart';
import 'exchange_step_views/step_1_view.dart';
import 'exchange_step_views/step_2_view.dart';
import 'sub_widgets/exchange_provider_options.dart';
import 'sub_widgets/rate_type_toggle.dart';
import '../../pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart'; import '../../pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart';
import '../../providers/providers.dart'; import '../../providers/providers.dart';
import '../../services/exchange/change_now/change_now_exchange.dart'; import '../../services/exchange/change_now/change_now_exchange.dart';
@ -43,7 +41,6 @@ import '../../utilities/constants.dart';
import '../../utilities/enums/exchange_rate_type_enum.dart'; import '../../utilities/enums/exchange_rate_type_enum.dart';
import '../../utilities/text_styles.dart'; import '../../utilities/text_styles.dart';
import '../../utilities/util.dart'; import '../../utilities/util.dart';
import '../../wallets/crypto_currency/coins/bitcoin.dart';
import '../../wallets/crypto_currency/crypto_currency.dart'; import '../../wallets/crypto_currency/crypto_currency.dart';
import '../../widgets/conditional_parent.dart'; import '../../widgets/conditional_parent.dart';
import '../../widgets/custom_loading_overlay.dart'; import '../../widgets/custom_loading_overlay.dart';
@ -55,8 +52,11 @@ import '../../widgets/rounded_container.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart'; import '../../widgets/stack_dialog.dart';
import '../../widgets/textfields/exchange_textfield.dart'; import '../../widgets/textfields/exchange_textfield.dart';
import 'package:tuple/tuple.dart'; import 'exchange_coin_selection/exchange_currency_selection_view.dart';
import 'package:uuid/uuid.dart'; import 'exchange_step_views/step_1_view.dart';
import 'exchange_step_views/step_2_view.dart';
import 'sub_widgets/exchange_provider_options.dart';
import 'sub_widgets/rate_type_toggle.dart';
class ExchangeForm extends ConsumerStatefulWidget { class ExchangeForm extends ConsumerStatefulWidget {
const ExchangeForm({ const ExchangeForm({
@ -173,8 +173,9 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
.tryParse( .tryParse(
value, value,
locale: ref.read(localeServiceChangeNotifierProvider).locale, locale: ref.read(localeServiceChangeNotifierProvider).locale,
coin: Bitcoin(CryptoCurrencyNetwork coin: Bitcoin(
.main), // dummy value (not used due to override) CryptoCurrencyNetwork.main,
), // dummy value (not used due to override)
overrideWithDecimalPlacesFromString: true, overrideWithDecimalPlacesFromString: true,
) )
?.decimal; ?.decimal;
@ -184,15 +185,17 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
final rateType = ref.read(efRateTypeProvider); final rateType = ref.read(efRateTypeProvider);
final currencies = await ExchangeDataLoadingService.instance.isar.currencies final currencies = await ExchangeDataLoadingService.instance.isar.currencies
.filter() .filter()
.group((q) => rateType == ExchangeRateType.fixed .group(
? q (q) => rateType == ExchangeRateType.fixed
.rateTypeEqualTo(SupportedRateType.both) ? q
.or() .rateTypeEqualTo(SupportedRateType.both)
.rateTypeEqualTo(SupportedRateType.fixed) .or()
: q .rateTypeEqualTo(SupportedRateType.fixed)
.rateTypeEqualTo(SupportedRateType.both) : q
.or() .rateTypeEqualTo(SupportedRateType.both)
.rateTypeEqualTo(SupportedRateType.estimated)) .or()
.rateTypeEqualTo(SupportedRateType.estimated),
)
.and() .and()
.tickerEqualTo( .tickerEqualTo(
currency.ticker, currency.ticker,
@ -364,7 +367,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
], ],
), ),
); );
}) },
)
: await Navigator.of(context).push( : await Navigator.of(context).push(
MaterialPageRoute<dynamic>( MaterialPageRoute<dynamic>(
builder: (_) => ExchangeCurrencySelectionView( builder: (_) => ExchangeCurrencySelectionView(
@ -489,7 +493,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
), ),
), ),
], ],
) ),
], ],
), ),
); );
@ -949,7 +953,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
), ),
ExchangeTextField( ExchangeTextField(
key: Key( key: Key(
"exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeId}"), "exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeId}",
),
focusNode: _receiveFocusNode, focusNode: _receiveFocusNode,
controller: _receiveController, controller: _receiveController,
textStyle: STextStyles.smallMed14(context).copyWith( textStyle: STextStyles.smallMed14(context).copyWith(
@ -1011,7 +1016,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
enabled: ref.watch(efCanExchangeProvider), enabled: ref.watch(efCanExchangeProvider),
onPressed: onExchangePressed, onPressed: onExchangePressed,
label: "Swap", label: "Swap",
) ),
], ],
); );
} }

View file

@ -10,6 +10,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../providers/exchange/changenow_initial_load_status.dart'; import '../../providers/exchange/changenow_initial_load_status.dart';
import '../../themes/stack_colors.dart'; import '../../themes/stack_colors.dart';
import '../../utilities/text_styles.dart'; import '../../utilities/text_styles.dart';
@ -18,9 +19,9 @@ import '../../widgets/stack_dialog.dart';
class ExchangeLoadingOverlayView extends ConsumerStatefulWidget { class ExchangeLoadingOverlayView extends ConsumerStatefulWidget {
const ExchangeLoadingOverlayView({ const ExchangeLoadingOverlayView({
Key? key, super.key,
required this.unawaitedLoad, required this.unawaitedLoad,
}) : super(key: key); });
final VoidCallback unawaitedLoad; final VoidCallback unawaitedLoad;
@ -80,7 +81,9 @@ class _ExchangeLoadingOverlayViewState
.overlay .overlay
.withOpacity(0.7), .withOpacity(0.7),
child: const CustomLoadingOverlay( child: const CustomLoadingOverlay(
message: "Loading Exchange data", eventBus: null), message: "Loading Exchange data",
eventBus: null,
),
), ),
if ((_statusEst == ChangeNowLoadStatus.failed || if ((_statusEst == ChangeNowLoadStatus.failed ||
_statusFixed == ChangeNowLoadStatus.failed) && _statusFixed == ChangeNowLoadStatus.failed) &&

View file

@ -9,9 +9,8 @@
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../models/exchange/incomplete_exchange.dart'; import '../../../models/exchange/incomplete_exchange.dart';
import 'step_2_view.dart';
import '../sub_widgets/step_row.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/clipboard_interface.dart'; import '../../../utilities/clipboard_interface.dart';
import '../../../utilities/enums/exchange_rate_type_enum.dart'; import '../../../utilities/enums/exchange_rate_type_enum.dart';
@ -19,13 +18,15 @@ import '../../../utilities/text_styles.dart';
import '../../../widgets/background.dart'; import '../../../widgets/background.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../sub_widgets/step_row.dart';
import 'step_2_view.dart';
class Step1View extends StatefulWidget { class Step1View extends StatefulWidget {
const Step1View({ const Step1View({
Key? key, super.key,
required this.model, required this.model,
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/exchangeStep1"; static const String routeName = "/exchangeStep1";
@ -116,17 +117,19 @@ class _Step1ViewState extends State<Step1View> {
"You send", "You send",
style: STextStyles.itemSubtitle(context) style: STextStyles.itemSubtitle(context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.infoItemText), .infoItemText,
),
), ),
Text( Text(
"${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}", "${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12(context) style: STextStyles.itemSubtitle12(context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.infoItemText), .infoItemText,
),
), ),
], ],
), ),
@ -142,17 +145,19 @@ class _Step1ViewState extends State<Step1View> {
"You receive", "You receive",
style: STextStyles.itemSubtitle(context) style: STextStyles.itemSubtitle(context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.infoItemText), .infoItemText,
),
), ),
Text( Text(
"~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}", "~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12(context) style: STextStyles.itemSubtitle12(context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.infoItemText), .infoItemText,
),
), ),
], ],
), ),
@ -179,9 +184,10 @@ class _Step1ViewState extends State<Step1View> {
model.rateInfo, model.rateInfo,
style: STextStyles.itemSubtitle12(context) style: STextStyles.itemSubtitle12(context)
.copyWith( .copyWith(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.infoItemText), .infoItemText,
),
), ),
], ],
), ),
@ -193,8 +199,9 @@ class _Step1ViewState extends State<Step1View> {
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
Step2View.routeName, Step2View.routeName,
arguments: model); arguments: model,
);
}, },
style: Theme.of(context) style: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!

View file

@ -42,11 +42,11 @@ import 'step_3_view.dart';
class Step2View extends ConsumerStatefulWidget { class Step2View extends ConsumerStatefulWidget {
const Step2View({ const Step2View({
Key? key, super.key,
required this.model, required this.model,
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
this.barcodeScanner = const BarcodeScannerWrapper(), this.barcodeScanner = const BarcodeScannerWrapper(),
}) : super(key: key); });
static const String routeName = "/exchangeStep2"; static const String routeName = "/exchangeStep2";

View file

@ -12,10 +12,9 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../models/exchange/incomplete_exchange.dart'; import '../../../models/exchange/incomplete_exchange.dart';
import '../../../models/exchange/response_objects/trade.dart'; import '../../../models/exchange/response_objects/trade.dart';
import 'step_4_view.dart';
import '../sub_widgets/step_row.dart';
import '../../../providers/global/trades_service_provider.dart'; import '../../../providers/global/trades_service_provider.dart';
import '../../../providers/providers.dart'; import '../../../providers/providers.dart';
import '../../../services/exchange/exchange_response.dart'; import '../../../services/exchange/exchange_response.dart';
@ -31,13 +30,15 @@ import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../widgets/custom_loading_overlay.dart'; import '../../../widgets/custom_loading_overlay.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
import '../sub_widgets/step_row.dart';
import 'step_4_view.dart';
class Step3View extends ConsumerStatefulWidget { class Step3View extends ConsumerStatefulWidget {
const Step3View({ const Step3View({
Key? key, super.key,
required this.model, required this.model,
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/exchangeStep3"; static const String routeName = "/exchangeStep3";
@ -127,7 +128,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Text( Text(
"${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}", "${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
) ),
], ],
), ),
), ),
@ -145,7 +146,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Text( Text(
"${model.receiveAmount.toString()} ${model.receiveTicker.toUpperCase()}", "${model.receiveAmount.toString()} ${model.receiveTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
) ),
], ],
), ),
), ),
@ -163,7 +164,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Text( Text(
model.rateInfo, model.rateInfo,
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
) ),
], ],
), ),
), ),
@ -184,7 +185,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Text( Text(
model.recipientAddress!, model.recipientAddress!,
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
) ),
], ],
), ),
), ),
@ -207,7 +208,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Text( Text(
model.refundAddress!, model.refundAddress!,
style: STextStyles.itemSubtitle12(context), style: STextStyles.itemSubtitle12(context),
) ),
], ],
), ),
), ),
@ -321,22 +322,27 @@ class _Step3ViewState extends ConsumerState<Step3View> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
unawaited(NotificationApi.showNotification( unawaited(
changeNowId: model.trade!.tradeId, NotificationApi.showNotification(
title: status, changeNowId: model.trade!.tradeId,
body: "Trade ID ${model.trade!.tradeId}", title: status,
walletId: "", body:
iconAssetName: Assets.svg.arrowRotate, "Trade ID ${model.trade!.tradeId}",
date: model.trade!.timestamp, walletId: "",
shouldWatchForUpdates: true, iconAssetName: Assets.svg.arrowRotate,
coinName: "coinName", date: model.trade!.timestamp,
)); shouldWatchForUpdates: true,
coinName: "coinName",
),
);
if (mounted) { if (mounted) {
unawaited(Navigator.of(context).pushNamed( unawaited(
Step4View.routeName, Navigator.of(context).pushNamed(
arguments: model, Step4View.routeName,
)); arguments: model,
),
);
} }
}, },
style: Theme.of(context) style: Theme.of(context)

View file

@ -49,10 +49,10 @@ import '../sub_widgets/step_row.dart';
class Step4View extends ConsumerStatefulWidget { class Step4View extends ConsumerStatefulWidget {
const Step4View({ const Step4View({
Key? key, super.key,
required this.model, required this.model,
this.clipboard = const ClipboardWrapper(), this.clipboard = const ClipboardWrapper(),
}) : super(key: key); });
static const String routeName = "/exchangeStep4"; static const String routeName = "/exchangeStep4";

View file

@ -13,10 +13,10 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../db/isar/main_db.dart'; import '../../db/isar/main_db.dart';
import '../../models/isar/models/blockchain_data/transaction.dart'; import '../../models/isar/models/blockchain_data/transaction.dart';
import 'exchange_form.dart';
import 'trade_details_view.dart';
import '../../providers/global/trades_service_provider.dart'; import '../../providers/global/trades_service_provider.dart';
import '../../providers/providers.dart'; import '../../providers/providers.dart';
import '../../services/exchange/exchange_data_loading_service.dart'; import '../../services/exchange/exchange_data_loading_service.dart';
@ -26,10 +26,11 @@ import '../../utilities/text_styles.dart';
import '../../widgets/conditional_parent.dart'; import '../../widgets/conditional_parent.dart';
import '../../widgets/custom_loading_overlay.dart'; import '../../widgets/custom_loading_overlay.dart';
import '../../widgets/trade_card.dart'; import '../../widgets/trade_card.dart';
import 'package:tuple/tuple.dart'; import 'exchange_form.dart';
import 'trade_details_view.dart';
class ExchangeView extends ConsumerStatefulWidget { class ExchangeView extends ConsumerStatefulWidget {
const ExchangeView({Key? key}) : super(key: key); const ExchangeView({super.key});
@override @override
ConsumerState<ExchangeView> createState() => _ExchangeViewState(); ConsumerState<ExchangeView> createState() => _ExchangeViewState();
@ -102,7 +103,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
subMessage: "This could take a few minutes", subMessage: "This could take a few minutes",
eventBus: null, eventBus: null,
), ),
) ),
], ],
); );
}, },
@ -124,7 +125,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
child: ExchangeForm(), child: ExchangeForm(),
), ),
), ),
) ),
]; ];
}, },
body: Builder( body: Builder(
@ -169,63 +170,78 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
), ),
if (hasHistory) if (hasHistory)
SliverList( SliverList(
delegate: SliverChildBuilderDelegate((context, index) { delegate: SliverChildBuilderDelegate(
return Padding( (context, index) {
padding: const EdgeInsets.all(4), return Padding(
child: TradeCard( padding: const EdgeInsets.all(4),
key: Key("tradeCard_${trades[index].uuid}"), child: TradeCard(
trade: trades[index], key: Key("tradeCard_${trades[index].uuid}"),
onTap: () async { trade: trades[index],
final String tradeId = trades[index].tradeId; onTap: () async {
final String tradeId = trades[index].tradeId;
final lookup = ref final lookup = ref
.read(tradeSentFromStackLookupProvider) .read(tradeSentFromStackLookupProvider)
.all; .all;
//todo: check if print needed
// debugPrint("ALL: $lookup");
final String? txid = ref
.read(tradeSentFromStackLookupProvider)
.getTxidForTradeId(tradeId);
final List<String>? walletIds = ref
.read(tradeSentFromStackLookupProvider)
.getWalletIdsForTradeId(tradeId);
if (txid != null &&
walletIds != null &&
walletIds.isNotEmpty) {
final wallet = ref
.read(pWallets)
.getWallet(walletIds.first);
//todo: check if print needed //todo: check if print needed
// debugPrint("name: ${manager.walletName}"); // debugPrint("ALL: $lookup");
final tx = await MainDB.instance final String? txid = ref
.getTransactions(walletIds.first) .read(tradeSentFromStackLookupProvider)
.filter() .getTxidForTradeId(tradeId);
.txidEqualTo(txid) final List<String>? walletIds = ref
.findFirst(); .read(tradeSentFromStackLookupProvider)
.getWalletIdsForTradeId(tradeId);
if (mounted) { if (txid != null &&
unawaited(Navigator.of(context).pushNamed( walletIds != null &&
TradeDetailsView.routeName, walletIds.isNotEmpty) {
arguments: Tuple4(tradeId, tx, final wallet = ref
walletIds.first, wallet.info.name), .read(pWallets)
)); .getWallet(walletIds.first);
//todo: check if print needed
// debugPrint("name: ${manager.walletName}");
final tx = await MainDB.instance
.getTransactions(walletIds.first)
.filter()
.txidEqualTo(txid)
.findFirst();
if (mounted) {
unawaited(
Navigator.of(context).pushNamed(
TradeDetailsView.routeName,
arguments: Tuple4(
tradeId,
tx,
walletIds.first,
wallet.info.name,
),
),
);
}
} else {
unawaited(
Navigator.of(context).pushNamed(
TradeDetailsView.routeName,
arguments: Tuple4(
tradeId,
null,
walletIds?.first,
null,
),
),
);
} }
} else { },
unawaited(Navigator.of(context).pushNamed( ),
TradeDetailsView.routeName, );
arguments: Tuple4( },
tradeId, null, walletIds?.first, null), childCount: tradeCount,
)); ),
}
},
),
);
}, childCount: tradeCount),
), ),
if (!hasHistory) if (!hasHistory)
SliverToBoxAdapter( SliverToBoxAdapter(

Some files were not shown because too many files have changed in this diff Show more