mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +00:00
code style clean up and gen mocks
This commit is contained in:
parent
8b523739d9
commit
9006de0f0a
605 changed files with 9126 additions and 6975 deletions
|
@ -11,6 +11,8 @@
|
|||
import 'package:decimal/decimal.dart';
|
||||
import 'package:flutter_native_splash/cli_commands.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../exceptions/main_db/main_db_exception.dart';
|
||||
import '../../models/isar/models/block_explorer.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/wallet_info.dart';
|
||||
import '../../wallets/isar/models/wallet_info_meta.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
part '../queries/queries.dart';
|
||||
|
||||
|
@ -149,8 +150,9 @@ class MainDB {
|
|||
}
|
||||
|
||||
// tx block explorers
|
||||
TransactionBlockExplorer? getTransactionBlockExplorer(
|
||||
{required CryptoCurrency cryptoCurrency}) {
|
||||
TransactionBlockExplorer? getTransactionBlockExplorer({
|
||||
required CryptoCurrency cryptoCurrency,
|
||||
}) {
|
||||
return isar.transactionBlockExplorers
|
||||
.where()
|
||||
.tickerEqualTo(cryptoCurrency.ticker)
|
||||
|
|
|
@ -207,7 +207,8 @@ Future<void> migrateWalletsToIsar({
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import '../../utilities/amount/amount.dart';
|
||||
import '../../wallets/crypto_currency/coins/ethereum.dart';
|
||||
import '../../wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
class EthTokenTxExtraDTO {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import '../../utilities/amount/amount.dart';
|
||||
import '../../wallets/crypto_currency/coins/ethereum.dart';
|
||||
import '../../wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
class EthTxDTO {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import 'litescribe_response.dart';
|
||||
import 'inscription_data.dart';
|
||||
import 'litescribe_response.dart';
|
||||
|
||||
class AddressInscriptionResponse extends LitescribeResponse<AddressInscriptionResponse> {
|
||||
class AddressInscriptionResponse
|
||||
extends LitescribeResponse<AddressInscriptionResponse> {
|
||||
final int status;
|
||||
final String message;
|
||||
final AddressInscriptionResult result;
|
||||
|
@ -16,7 +17,8 @@ class AddressInscriptionResponse extends LitescribeResponse<AddressInscriptionRe
|
|||
return AddressInscriptionResponse(
|
||||
status: json['status'] as int,
|
||||
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) {
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:string_validator/string_validator.dart';
|
||||
|
||||
import '../db/hive/db.dart';
|
||||
import 'electrumx_client.dart';
|
||||
import '../utilities/logger.dart';
|
||||
import '../wallets/crypto_currency/crypto_currency.dart';
|
||||
import 'package:string_validator/string_validator.dart';
|
||||
import 'electrumx_client.dart';
|
||||
|
||||
class CachedElectrumXClient {
|
||||
final ElectrumXClient electrumXClient;
|
||||
|
@ -331,8 +332,9 @@ class CachedElectrumXClient {
|
|||
}
|
||||
|
||||
/// Clear all cached transactions for the specified coin
|
||||
Future<void> clearSharedTransactionCache(
|
||||
{required CryptoCurrency cryptoCurrency}) async {
|
||||
Future<void> clearSharedTransactionCache({
|
||||
required CryptoCurrency cryptoCurrency,
|
||||
}) async {
|
||||
await DB.instance.clearSharedTransactionCache(currency: cryptoCurrency);
|
||||
await DB.instance.closeAnonymitySetCacheBox(currency: cryptoCurrency);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ import '../services/event_bus/global_event_bus.dart';
|
|||
import '../services/tor_service.dart';
|
||||
import '../utilities/logger.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 'package:stream_channel/stream_channel.dart';
|
||||
|
||||
|
|
|
@ -180,7 +180,8 @@ void main(List<String> args) async {
|
|||
|
||||
Hive.registerAdapter(UnspentCoinsInfoAdapter());
|
||||
await Hive.initFlutter(
|
||||
(await StackFileSystem.applicationHiveDirectory()).path);
|
||||
(await StackFileSystem.applicationHiveDirectory()).path,
|
||||
);
|
||||
|
||||
await Hive.openBox<dynamic>(DB.boxNameDBInfo);
|
||||
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)
|
||||
if (!Util.isDesktop) {
|
||||
int dbVersion = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ??
|
||||
final int dbVersion = DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNameDBInfo,
|
||||
key: "hive_data_version",
|
||||
) as int? ??
|
||||
0;
|
||||
if (dbVersion < Constants.currentDataVersion) {
|
||||
try {
|
||||
|
@ -215,8 +218,11 @@ void main(List<String> args) async {
|
|||
),
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Cannot migrate mobile database\n$e $s",
|
||||
level: LogLevel.Error, printFullLength: true);
|
||||
Logging.instance.log(
|
||||
"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
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -279,8 +285,8 @@ class MyApp extends StatelessWidget {
|
|||
|
||||
class MaterialAppWithTheme extends ConsumerStatefulWidget {
|
||||
const MaterialAppWithTheme({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
ConsumerState<MaterialAppWithTheme> createState() =>
|
||||
|
@ -382,7 +388,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
switch (ref.read(prefsChangeNotifierProvider).backupFrequencyType) {
|
||||
case BackupFrequencyType.everyTenMinutes:
|
||||
ref.read(autoSWBServiceProvider).startPeriodicBackupTimer(
|
||||
duration: const Duration(minutes: 10));
|
||||
duration: const Duration(minutes: 10),
|
||||
);
|
||||
break;
|
||||
case BackupFrequencyType.everyAppStart:
|
||||
unawaited(ref.read(autoSWBServiceProvider).doBackup());
|
||||
|
@ -448,7 +455,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
await loadingCompleter.future;
|
||||
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!,
|
||||
);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
}
|
||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
|
||||
|
@ -511,7 +519,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
|
||||
null) {
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!,
|
||||
);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
}
|
||||
}
|
||||
|
@ -559,8 +568,9 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
await resetOpenPath();
|
||||
|
||||
Logging.instance.log(
|
||||
"This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}",
|
||||
level: LogLevel.Info);
|
||||
"This is the .swb content from intent: ${ref.read(openedFromSWBFileStringStateProvider.state).state}",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
}
|
||||
|
||||
/// should only be called on android currently
|
||||
|
@ -575,27 +585,31 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
.then((value) {
|
||||
if (value is! bool || value == false) {
|
||||
Navigator.of(navigatorKey.currentContext!).pushNamed(
|
||||
RestoreFromEncryptedStringView.routeName,
|
||||
arguments: encrypted);
|
||||
RestoreFromEncryptedStringView.routeName,
|
||||
arguments: encrypted,
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
unawaited(Navigator.push(
|
||||
navigatorKey.currentContext!,
|
||||
RouteGenerator.getRoute(
|
||||
shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute,
|
||||
builder: (_) => LockscreenView(
|
||||
showBackButton: true,
|
||||
routeOnSuccess: RestoreFromEncryptedStringView.routeName,
|
||||
routeOnSuccessArguments: encrypted,
|
||||
biometricsCancelButtonString: "CANCEL",
|
||||
biometricsLocalizedReason:
|
||||
"Authenticate to restore ${AppConfig.appName} backup",
|
||||
biometricsAuthenticationTitle: "Restore ${AppConfig.prefix} backup",
|
||||
unawaited(
|
||||
Navigator.push(
|
||||
navigatorKey.currentContext!,
|
||||
RouteGenerator.getRoute(
|
||||
shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute,
|
||||
builder: (_) => LockscreenView(
|
||||
showBackButton: true,
|
||||
routeOnSuccess: RestoreFromEncryptedStringView.routeName,
|
||||
routeOnSuccessArguments: encrypted,
|
||||
biometricsCancelButtonString: "CANCEL",
|
||||
biometricsLocalizedReason:
|
||||
"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:
|
||||
MaterialStateProperty.all(colorScheme.buttonTextSecondary),
|
||||
backgroundColor: MaterialStateProperty.all<Color>(
|
||||
colorScheme.buttonBackSecondary),
|
||||
colorScheme.buttonBackSecondary,
|
||||
),
|
||||
shape: MaterialStateProperty.all<OutlinedBorder>(
|
||||
RoundedRectangleBorder(
|
||||
// 1000 to be relatively sure it keeps its pill shape
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
import '../add_wallet_list_entity.dart';
|
||||
import '../../isar/models/ethereum/eth_contract.dart';
|
||||
import '../../../wallets/crypto_currency/coins/ethereum.dart';
|
||||
import '../../../wallets/crypto_currency/crypto_currency.dart';
|
||||
|
||||
class EthTokenEntity extends AddWalletListEntity {
|
||||
|
|
|
@ -72,7 +72,8 @@ class Balance {
|
|||
),
|
||||
pendingSpendable: decoded["pendingSpendable"] is String
|
||||
? Amount.fromSerializedJsonString(
|
||||
decoded["pendingSpendable"] as String)
|
||||
decoded["pendingSpendable"] as String,
|
||||
)
|
||||
: Amount(
|
||||
rawValue: BigInt.from(decoded["pendingSpendable"] as int),
|
||||
fractionDigits: deprecatedValue,
|
||||
|
|
|
@ -23,11 +23,12 @@ class Fiat {
|
|||
/// Fiat name
|
||||
final Decimal maxAmount;
|
||||
|
||||
Fiat(
|
||||
{required this.ticker,
|
||||
required this.name,
|
||||
required this.minAmount,
|
||||
required this.maxAmount});
|
||||
Fiat({
|
||||
required this.ticker,
|
||||
required this.name,
|
||||
required this.minAmount,
|
||||
required this.maxAmount,
|
||||
});
|
||||
|
||||
factory Fiat.fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
|
||||
import '../response_objects/crypto.dart';
|
||||
import '../response_objects/fiat.dart';
|
||||
import '../response_objects/order.dart';
|
||||
|
@ -20,7 +21,8 @@ class Simplex {
|
|||
SimplexQuote quote = SimplexQuote(
|
||||
crypto: Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}),
|
||||
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",
|
||||
|
@ -28,20 +30,22 @@ class Simplex {
|
|||
buyWithFiat: true,
|
||||
);
|
||||
SimplexOrder order = SimplexOrder(
|
||||
quote: SimplexQuote(
|
||||
crypto:
|
||||
Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}),
|
||||
fiat: Fiat.fromJson(
|
||||
{'ticker': 'USD', 'name': 'United States Dollar', 'image': ''}),
|
||||
youPayFiatPrice: Decimal.parse("100"),
|
||||
youReceiveCryptoAmount: Decimal.parse("1.0238917"),
|
||||
id: "someID",
|
||||
receivingAddress: '',
|
||||
buyWithFiat: true,
|
||||
quote: SimplexQuote(
|
||||
crypto:
|
||||
Crypto.fromJson({'ticker': 'BTC', 'name': 'Bitcoin', 'image': ''}),
|
||||
fiat: Fiat.fromJson(
|
||||
{'ticker': 'USD', 'name': 'United States Dollar', 'image': ''},
|
||||
),
|
||||
orderId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
|
||||
paymentId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
|
||||
userId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee');
|
||||
youPayFiatPrice: Decimal.parse("100"),
|
||||
youReceiveCryptoAmount: Decimal.parse("1.0238917"),
|
||||
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) {
|
||||
supportedCryptos = newCryptos;
|
||||
|
|
|
@ -44,13 +44,13 @@ class Contact {
|
|||
List<ContactAddressEntry>? addresses,
|
||||
bool? isFavorite,
|
||||
}) {
|
||||
List<ContactAddressEntry> _addresses = [];
|
||||
final List<ContactAddressEntry> _addresses = [];
|
||||
if (addresses == null) {
|
||||
for (var e in this.addresses) {
|
||||
for (final e in this.addresses) {
|
||||
_addresses.add(e.copyWith());
|
||||
}
|
||||
} else {
|
||||
for (var e in addresses) {
|
||||
for (final e in addresses) {
|
||||
_addresses.add(e.copyWith());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
import 'epicbox_server_model.dart';
|
||||
|
||||
part 'type_adaptors/epicbox_config_model.g.dart';
|
||||
|
@ -57,7 +58,7 @@ class EpicBoxConfigModel {
|
|||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
Map<String, dynamic> map = {};
|
||||
final Map<String, dynamic> map = {};
|
||||
map['epicbox_domain'] = host;
|
||||
map['epicbox_port'] = port;
|
||||
map['epicbox_protocol_insecure'] = protocolInsecure;
|
||||
|
@ -84,7 +85,7 @@ class EpicBoxConfigModel {
|
|||
}
|
||||
|
||||
static EpicBoxConfigModel fromString(String epicBoxConfigString) {
|
||||
dynamic _epicBox = json.decode(epicBoxConfigString);
|
||||
final dynamic _epicBox = json.decode(epicBoxConfigString);
|
||||
|
||||
// handle old epicbox config formats
|
||||
final oldDomain = _epicBox["domain"] ?? "empty";
|
||||
|
@ -117,8 +118,11 @@ class EpicBoxConfigModel {
|
|||
);
|
||||
}
|
||||
|
||||
static EpicBoxConfigModel fromServer(EpicBoxServerModel server,
|
||||
{bool? protocolInsecure, int? addressIndex}) {
|
||||
static EpicBoxConfigModel fromServer(
|
||||
EpicBoxServerModel server, {
|
||||
bool? protocolInsecure,
|
||||
int? addressIndex,
|
||||
}) {
|
||||
return EpicBoxConfigModel(
|
||||
host: server.host,
|
||||
port: server.port ?? 443,
|
||||
|
|
|
@ -64,7 +64,7 @@ class EpicBoxServerModel {
|
|||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
Map<String, dynamic> map = {};
|
||||
final Map<String, dynamic> map = {};
|
||||
map['id'] = id;
|
||||
map['host'] = host;
|
||||
map['port'] = port;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
|
||||
import '../../../utilities/logger.dart';
|
||||
|
||||
class EstimatedExchangeAmount {
|
||||
|
@ -45,8 +46,10 @@ class EstimatedExchangeAmount {
|
|||
factory EstimatedExchangeAmount.fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
return EstimatedExchangeAmount(
|
||||
estimatedAmount: Decimal.parse(json["estimatedAmount"]?.toString() ??
|
||||
json["estimatedDeposit"].toString()),
|
||||
estimatedAmount: Decimal.parse(
|
||||
json["estimatedAmount"]?.toString() ??
|
||||
json["estimatedDeposit"].toString(),
|
||||
),
|
||||
transactionSpeedForecast:
|
||||
json["transactionSpeedForecast"] as String? ?? "",
|
||||
warningMessage: json["warningMessage"] as String?,
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'exchange_transaction_status.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import 'exchange_transaction_status.dart';
|
||||
|
||||
part '../../type_adaptors/exchange_transaction.g.dart';
|
||||
|
||||
@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)
|
||||
class ExchangeTransaction {
|
||||
/// 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? ?? "",
|
||||
statusObject: json["statusObject"] is Map<String, dynamic>
|
||||
? ExchangeTransactionStatus.fromJson(
|
||||
json["statusObject"] as Map<String, dynamic>)
|
||||
json["statusObject"] as Map<String, dynamic>,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
} catch (e) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
import '../../../utilities/logger.dart';
|
||||
|
||||
part '../../type_adaptors/exchange_transaction_status.g.dart';
|
||||
|
@ -38,7 +39,8 @@ ChangeNowTransactionStatus changeNowTransactionStatusFromStringIgnoreCase(
|
|||
}
|
||||
}
|
||||
throw ArgumentError(
|
||||
"String value does not match any known ChangeNowTransactionStatus");
|
||||
"String value does not match any known ChangeNowTransactionStatus",
|
||||
);
|
||||
}
|
||||
|
||||
@HiveType(typeId: 16)
|
||||
|
@ -189,7 +191,8 @@ class ExchangeTransactionStatus {
|
|||
try {
|
||||
return ExchangeTransactionStatus(
|
||||
status: changeNowTransactionStatusFromStringIgnoreCase(
|
||||
json["status"] as String),
|
||||
json["status"] as String,
|
||||
),
|
||||
payinAddress: json["payinAddress"] as String? ?? "",
|
||||
payoutAddress: json["payoutAddress"] as String? ?? "",
|
||||
fromCurrency: json["fromCurrency"] as String? ?? "",
|
||||
|
|
|
@ -9,10 +9,15 @@
|
|||
*/
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
|
||||
import 'mb_object.dart';
|
||||
|
||||
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 toCurrency;
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
*/
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import '../change_now/exchange_transaction.dart';
|
||||
|
||||
import '../../../services/exchange/change_now/change_now_exchange.dart';
|
||||
import '../change_now/exchange_transaction.dart';
|
||||
|
||||
part 'trade.g.dart';
|
||||
|
||||
|
@ -213,7 +214,9 @@ class Trade {
|
|||
}
|
||||
|
||||
factory Trade.fromExchangeTransaction(
|
||||
ExchangeTransaction exTx, bool reversed) {
|
||||
ExchangeTransaction exTx,
|
||||
bool reversed,
|
||||
) {
|
||||
return Trade(
|
||||
uuid: exTx.uuid,
|
||||
tradeId: exTx.id,
|
||||
|
|
|
@ -59,8 +59,10 @@ class SPCurrency {
|
|||
warningsTo: json["warnings_to"] as List<dynamic>,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("SPCurrency.fromJson failed to parse: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
Logging.instance.log(
|
||||
"SPCurrency.fromJson failed to parse: $e\n$s",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,12 @@ class Currency {
|
|||
final String exchangeName;
|
||||
|
||||
/// Currency ticker
|
||||
@Index(composite: [
|
||||
CompositeIndex("exchangeName"),
|
||||
CompositeIndex("name"),
|
||||
])
|
||||
@Index(
|
||||
composite: [
|
||||
CompositeIndex("exchangeName"),
|
||||
CompositeIndex("name"),
|
||||
],
|
||||
)
|
||||
final String ticker;
|
||||
|
||||
/// Currency name
|
||||
|
|
|
@ -29,10 +29,12 @@ class Pair {
|
|||
@Index()
|
||||
final String exchangeName;
|
||||
|
||||
@Index(composite: [
|
||||
CompositeIndex("exchangeName"),
|
||||
CompositeIndex("to"),
|
||||
])
|
||||
@Index(
|
||||
composite: [
|
||||
CompositeIndex("exchangeName"),
|
||||
CompositeIndex("to"),
|
||||
],
|
||||
)
|
||||
final String from;
|
||||
|
||||
final String to;
|
||||
|
|
|
@ -12,11 +12,12 @@ import 'dart:convert';
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../../../utilities/amount/amount.dart';
|
||||
import 'address.dart';
|
||||
import 'input.dart';
|
||||
import 'output.dart';
|
||||
import '../../../../utilities/amount/amount.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
part 'transaction.g.dart';
|
||||
|
||||
|
@ -65,24 +66,24 @@ class Transaction {
|
|||
}) {
|
||||
return Tuple2(
|
||||
Transaction(
|
||||
walletId: walletId ?? this.walletId,
|
||||
txid: txid ?? this.txid,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
type: type ?? this.type,
|
||||
subType: subType ?? this.subType,
|
||||
amount: amount ?? this.amount,
|
||||
amountString: amountString ?? this.amountString,
|
||||
fee: fee ?? this.fee,
|
||||
height: height ?? this.height,
|
||||
isCancelled: isCancelled ?? this.isCancelled,
|
||||
isLelantus: isLelantus ?? this.isLelantus,
|
||||
slateId: slateId ?? this.slateId,
|
||||
otherData: otherData ?? this.otherData,
|
||||
nonce: nonce ?? this.nonce,
|
||||
inputs: inputs ?? this.inputs,
|
||||
outputs: outputs ?? this.outputs,
|
||||
numberOfMessages: numberOfMessages ?? this.numberOfMessages)
|
||||
..id = id ?? this.id,
|
||||
walletId: walletId ?? this.walletId,
|
||||
txid: txid ?? this.txid,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
type: type ?? this.type,
|
||||
subType: subType ?? this.subType,
|
||||
amount: amount ?? this.amount,
|
||||
amountString: amountString ?? this.amountString,
|
||||
fee: fee ?? this.fee,
|
||||
height: height ?? this.height,
|
||||
isCancelled: isCancelled ?? this.isCancelled,
|
||||
isLelantus: isLelantus ?? this.isLelantus,
|
||||
slateId: slateId ?? this.slateId,
|
||||
otherData: otherData ?? this.otherData,
|
||||
nonce: nonce ?? this.nonce,
|
||||
inputs: inputs ?? this.inputs,
|
||||
outputs: outputs ?? this.outputs,
|
||||
numberOfMessages: numberOfMessages ?? this.numberOfMessages,
|
||||
)..id = id ?? this.id,
|
||||
address ?? this.address.value,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,10 +38,14 @@ class UTXO {
|
|||
@Index()
|
||||
late final String walletId;
|
||||
|
||||
@Index(unique: true, replace: true, composite: [
|
||||
CompositeIndex("walletId"),
|
||||
CompositeIndex("vout"),
|
||||
])
|
||||
@Index(
|
||||
unique: true,
|
||||
replace: true,
|
||||
composite: [
|
||||
CompositeIndex("walletId"),
|
||||
CompositeIndex("vout"),
|
||||
],
|
||||
)
|
||||
late final String txid;
|
||||
|
||||
late final int vout;
|
||||
|
|
|
@ -54,7 +54,7 @@ class OutputV2 {
|
|||
bool isFullAmountNotSats = false,
|
||||
}) {
|
||||
try {
|
||||
List<String> addresses = [];
|
||||
final List<String> addresses = [];
|
||||
|
||||
if (json["scriptPubKey"]?["addresses"] is List) {
|
||||
for (final e in json["scriptPubKey"]["addresses"] as List) {
|
||||
|
@ -68,7 +68,7 @@ class OutputV2 {
|
|||
scriptPubKeyHex: json["scriptPubKey"]["hex"] as String,
|
||||
scriptPubKeyAsm: json["scriptPubKey"]["asm"] as String?,
|
||||
valueStringSats: parseOutputAmountString(
|
||||
json["value"] != null ? json["value"].toString(): "0",
|
||||
json["value"] != null ? json["value"].toString() : "0",
|
||||
decimalPlaces: decimalPlaces,
|
||||
isFullAmountNotSats: isFullAmountNotSats,
|
||||
),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:isar/isar.dart';
|
||||
|
||||
import '../../db/isar/main_db.dart';
|
||||
import '../../dto/ordinals/inscription_data.dart';
|
||||
import 'models/isar_models.dart';
|
||||
|
@ -11,10 +12,14 @@ class Ordinal {
|
|||
|
||||
final String walletId;
|
||||
|
||||
@Index(unique: true, replace: true, composite: [
|
||||
CompositeIndex("utxoTXID"),
|
||||
CompositeIndex("utxoVOUT"),
|
||||
])
|
||||
@Index(
|
||||
unique: true,
|
||||
replace: true,
|
||||
composite: [
|
||||
CompositeIndex("utxoTXID"),
|
||||
CompositeIndex("utxoVOUT"),
|
||||
],
|
||||
)
|
||||
final String inscriptionId;
|
||||
|
||||
final int inscriptionNumber;
|
||||
|
|
|
@ -40,7 +40,7 @@ class LelantusCoin {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
String coin =
|
||||
final String coin =
|
||||
"{index: $index, value: $value, publicCoin: $publicCoin, txId: $txId, anonymitySetId: $anonymitySetId, isUsed: $isUsed}";
|
||||
return coin;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class NodeModel {
|
|||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
Map<String, dynamic> map = {};
|
||||
final Map<String, dynamic> map = {};
|
||||
map['host'] = host;
|
||||
map['port'] = port;
|
||||
map['name'] = name;
|
||||
|
|
|
@ -34,29 +34,32 @@ class TransactionData {
|
|||
TransactionData({this.txChunks = const []});
|
||||
|
||||
factory TransactionData.fromJson(Map<String, dynamic> json) {
|
||||
var dateTimeChunks = json['dateTimeChunks'] as List;
|
||||
List<TransactionChunk> chunksList = dateTimeChunks
|
||||
.map((txChunk) =>
|
||||
TransactionChunk.fromJson(txChunk as Map<String, dynamic>))
|
||||
final dateTimeChunks = json['dateTimeChunks'] as List;
|
||||
final List<TransactionChunk> chunksList = dateTimeChunks
|
||||
.map(
|
||||
(txChunk) =>
|
||||
TransactionChunk.fromJson(txChunk as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return TransactionData(txChunks: chunksList);
|
||||
}
|
||||
|
||||
factory TransactionData.fromMap(Map<String, Transaction> transactions) {
|
||||
Map<String, List<Transaction>> chunks = {};
|
||||
final Map<String, List<Transaction>> chunks = {};
|
||||
transactions.forEach((key, value) {
|
||||
String date = extractDateFromTimestamp(value.timestamp);
|
||||
final String date = extractDateFromTimestamp(value.timestamp);
|
||||
if (!chunks.containsKey(date)) {
|
||||
chunks[date] = [];
|
||||
}
|
||||
chunks[date]!.add(value);
|
||||
});
|
||||
List<TransactionChunk> chunksList = [];
|
||||
final List<TransactionChunk> chunksList = [];
|
||||
chunks.forEach((key, value) {
|
||||
value.sort((a, b) => b.timestamp.compareTo(a.timestamp));
|
||||
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));
|
||||
return TransactionData(txChunks: chunksList);
|
||||
|
@ -64,9 +67,9 @@ class TransactionData {
|
|||
|
||||
Transaction? findTransaction(String txid) {
|
||||
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++) {
|
||||
var tx = txChunk[j];
|
||||
final tx = txChunk[j];
|
||||
if (tx.txid == txid) {
|
||||
return tx;
|
||||
}
|
||||
|
@ -76,11 +79,11 @@ class TransactionData {
|
|||
}
|
||||
|
||||
Map<String, Transaction> getAllTransactions() {
|
||||
Map<String, Transaction> transactions = {};
|
||||
final Map<String, Transaction> transactions = {};
|
||||
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++) {
|
||||
var tx = txChunk[j];
|
||||
final tx = txChunk[j];
|
||||
transactions[tx.txid] = tx;
|
||||
}
|
||||
}
|
||||
|
@ -98,14 +101,15 @@ class TransactionChunk {
|
|||
TransactionChunk({required this.timestamp, required this.transactions});
|
||||
|
||||
factory TransactionChunk.fromJson(Map<String, dynamic> json) {
|
||||
var txArray = json['transactions'] as List;
|
||||
List<Transaction> txList = txArray
|
||||
final txArray = json['transactions'] as List;
|
||||
final List<Transaction> txList = txArray
|
||||
.map((tx) => Transaction.fromJson(tx as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
return TransactionChunk(
|
||||
timestamp: int.parse(json['timestamp'].toString()),
|
||||
transactions: txList);
|
||||
timestamp: int.parse(json['timestamp'].toString()),
|
||||
transactions: txList,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -191,15 +195,16 @@ class Transaction {
|
|||
});
|
||||
|
||||
factory Transaction.fromJson(Map<String, dynamic> json) {
|
||||
var inputArray = json['inputs'] as List;
|
||||
var outputArray = json['outputs'] as List;
|
||||
final inputArray = json['inputs'] 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)))
|
||||
.toList();
|
||||
List<Output> outputList = outputArray
|
||||
.map((output) =>
|
||||
Output.fromJson(Map<String, dynamic>.from(output as Map)))
|
||||
final List<Output> outputList = outputArray
|
||||
.map(
|
||||
(output) => Output.fromJson(Map<String, dynamic>.from(output as Map)),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return Transaction(
|
||||
|
@ -304,7 +309,7 @@ class Transaction {
|
|||
|
||||
@override
|
||||
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 }";
|
||||
return transaction;
|
||||
}
|
||||
|
@ -344,7 +349,7 @@ class Input {
|
|||
});
|
||||
|
||||
factory Input.fromJson(Map<String, dynamic> json) {
|
||||
bool iscoinBase = json['coinbase'] != null;
|
||||
final bool iscoinBase = json['coinbase'] != null;
|
||||
return Input(
|
||||
txid: json['txid'] as String? ?? "",
|
||||
vout: json['vout'] as int? ?? -1,
|
||||
|
@ -361,7 +366,7 @@ class Input {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
String transaction = "{txid: $txid}";
|
||||
final String transaction = "{txid: $txid}";
|
||||
return transaction;
|
||||
}
|
||||
}
|
||||
|
@ -383,12 +388,13 @@ class Output {
|
|||
// @HiveField(4)
|
||||
final int value;
|
||||
|
||||
Output(
|
||||
{this.scriptpubkey,
|
||||
this.scriptpubkeyAsm,
|
||||
this.scriptpubkeyType,
|
||||
required this.scriptpubkeyAddress,
|
||||
required this.value});
|
||||
Output({
|
||||
this.scriptpubkey,
|
||||
this.scriptpubkeyAsm,
|
||||
this.scriptpubkeyType,
|
||||
required this.scriptpubkeyAddress,
|
||||
required this.value,
|
||||
});
|
||||
|
||||
factory Output.fromJson(Map<String, dynamic> json) {
|
||||
// TODO determine if any of this code is needed.
|
||||
|
@ -405,12 +411,13 @@ class Output {
|
|||
);
|
||||
} catch (s, e) {
|
||||
return Output(
|
||||
// Return output object with null values; allows wallet history to be built
|
||||
scriptpubkey: "",
|
||||
scriptpubkeyAsm: "",
|
||||
scriptpubkeyType: "",
|
||||
scriptpubkeyAddress: "",
|
||||
value: _parse(0.toString()));
|
||||
// Return output object with null values; allows wallet history to be built
|
||||
scriptpubkey: "",
|
||||
scriptpubkeyAsm: "",
|
||||
scriptpubkeyType: "",
|
||||
scriptpubkeyAddress: "",
|
||||
value: _parse(0.toString()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ class UtxoData {
|
|||
});
|
||||
|
||||
factory UtxoData.fromJson(Map<String, dynamic> json) {
|
||||
var outputList = json['outputArray'] as List;
|
||||
List<UtxoObject> utxoList = outputList
|
||||
final outputList = json['outputArray'] as List;
|
||||
final List<UtxoObject> utxoList = outputList
|
||||
.map((output) => UtxoObject.fromJson(output as Map<String, dynamic>))
|
||||
.toList();
|
||||
final String totalUserCurr = json['total_user_currency'] as String? ?? "";
|
||||
|
@ -104,7 +104,7 @@ class UtxoObject {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
String utxo =
|
||||
final String utxo =
|
||||
"{txid: $txid, vout: $vout, value: $value, fiat: $fiatWorth, blocked: $blocked, status: $status, is_coinbase: $isCoinbase}";
|
||||
|
||||
return utxo;
|
||||
|
|
|
@ -44,12 +44,16 @@ class PaynymAccount {
|
|||
.map((e) => PaynymCode.fromMap(Map<String, dynamic>.from(e as Map)))
|
||||
.toList(),
|
||||
followers = (map["followers"] as List<dynamic>)
|
||||
.map((e) =>
|
||||
PaynymAccountLite.fromMap(Map<String, dynamic>.from(e as Map)))
|
||||
.map(
|
||||
(e) => PaynymAccountLite.fromMap(
|
||||
Map<String, dynamic>.from(e as Map)),
|
||||
)
|
||||
.toList(),
|
||||
following = (map["following"] as List<dynamic>)
|
||||
.map((e) =>
|
||||
PaynymAccountLite.fromMap(Map<String, dynamic>.from(e as Map)))
|
||||
.map(
|
||||
(e) => PaynymAccountLite.fromMap(
|
||||
Map<String, dynamic>.from(e as Map)),
|
||||
)
|
||||
.toList();
|
||||
|
||||
PaynymAccount copyWith({
|
||||
|
|
|
@ -21,13 +21,13 @@ class PaynymFollow {
|
|||
token = map["token"] as String;
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"follower": follower,
|
||||
"following": following,
|
||||
"token": token,
|
||||
};
|
||||
"follower": follower,
|
||||
"following": following,
|
||||
"token": token,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'wallet_restore_state.dart';
|
||||
|
||||
import '../utilities/enums/stack_restoring_status.dart';
|
||||
import '../wallets/wallet/wallet.dart';
|
||||
import 'wallet_restore_state.dart';
|
||||
|
||||
class StackRestoringUIState extends ChangeNotifier {
|
||||
bool _walletsWasSet = false;
|
||||
|
@ -94,7 +95,7 @@ class StackRestoringUIState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
List<Wallet> get wallets {
|
||||
List<Wallet> _wallets = [];
|
||||
final List<Wallet> _wallets = [];
|
||||
for (final item in _walletStates.values) {
|
||||
if (item.wallet != null) {
|
||||
_wallets.add(item.wallet!);
|
||||
|
@ -125,7 +126,8 @@ class StackRestoringUIState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
ChangeNotifierProvider<WalletRestoreState> getWalletRestoreStateProvider(
|
||||
String walletId) {
|
||||
String walletId,
|
||||
) {
|
||||
return _walletStateProviders[walletId]!;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../app_config.dart';
|
||||
import '../models/isar/stack_theme.dart';
|
||||
import '../models/notification_model.dart';
|
||||
|
@ -28,9 +29,9 @@ import '../widgets/rounded_white_container.dart';
|
|||
|
||||
class NotificationCard extends ConsumerWidget {
|
||||
const NotificationCard({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.notification,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final NotificationModel notification;
|
||||
|
||||
|
@ -71,10 +72,11 @@ class NotificationCard extends ConsumerWidget {
|
|||
? SvgPicture.file(
|
||||
File(
|
||||
coinIconPath(
|
||||
ref.watch(
|
||||
themeAssetsProvider,
|
||||
),
|
||||
ref),
|
||||
ref.watch(
|
||||
themeAssetsProvider,
|
||||
),
|
||||
ref,
|
||||
),
|
||||
),
|
||||
width: isDesktop ? desktopIconSize : mobileIconSize,
|
||||
height: isDesktop ? desktopIconSize : mobileIconSize,
|
||||
|
@ -89,10 +91,11 @@ class NotificationCard extends ConsumerWidget {
|
|||
child: SvgPicture.file(
|
||||
File(
|
||||
coinIconPath(
|
||||
ref.watch(
|
||||
themeAssetsProvider,
|
||||
),
|
||||
ref),
|
||||
ref.watch(
|
||||
themeAssetsProvider,
|
||||
),
|
||||
ref,
|
||||
),
|
||||
),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
@ -123,7 +126,7 @@ class NotificationCard extends ConsumerWidget {
|
|||
.extension<StackColors>()!
|
||||
.accentColorGreen,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class TermsOfServiceView extends StatelessWidget {
|
||||
const TermsOfServiceView({Key? key}) : super(key: key);
|
||||
const TermsOfServiceView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../models/isar/models/ethereum/eth_contract.dart';
|
||||
import '../../../services/ethereum/ethereum_api.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
|
@ -29,8 +30,8 @@ import '../../../widgets/stack_dialog.dart';
|
|||
|
||||
class AddCustomTokenView extends ConsumerStatefulWidget {
|
||||
const AddCustomTokenView({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
static const routeName = "/addCustomToken";
|
||||
|
||||
|
@ -138,7 +139,8 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
|
|||
onPressed: () async {
|
||||
final response = await showLoading(
|
||||
whileFuture: EthereumAPI.getTokenContractInfoByAddress(
|
||||
contractController.text),
|
||||
contractController.text,
|
||||
),
|
||||
context: context,
|
||||
message: "Looking up contract",
|
||||
);
|
||||
|
@ -212,10 +214,12 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
|
|||
controller: decimalsController,
|
||||
style: STextStyles.field(context),
|
||||
inputFormatters: [
|
||||
TextInputFormatter.withFunction((oldValue, newValue) =>
|
||||
RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
|
||||
? newValue
|
||||
: oldValue),
|
||||
TextInputFormatter.withFunction(
|
||||
(oldValue, newValue) =>
|
||||
RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
|
||||
? newValue
|
||||
: oldValue,
|
||||
),
|
||||
],
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
signed: false,
|
||||
|
@ -253,10 +257,12 @@ class _AddCustomTokenViewState extends ConsumerState<AddCustomTokenView> {
|
|||
controller: decimalsController,
|
||||
style: STextStyles.field(context),
|
||||
inputFormatters: [
|
||||
TextInputFormatter.withFunction((oldValue, newValue) =>
|
||||
RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
|
||||
? newValue
|
||||
: oldValue),
|
||||
TextInputFormatter.withFunction(
|
||||
(oldValue, newValue) =>
|
||||
RegExp(r'^([0-9]*)$').hasMatch(newValue.text)
|
||||
? newValue
|
||||
: oldValue,
|
||||
),
|
||||
],
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
signed: false,
|
||||
|
|
|
@ -14,14 +14,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
import '../../../db/isar/main_db.dart';
|
||||
import '../../../models/isar/models/ethereum/eth_contract.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 '../../../providers/global/price_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/stack_text_field.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 {
|
||||
const EditWalletTokensView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
this.contractsToMarkSelected,
|
||||
this.isDesktopPopup = false,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String walletId;
|
||||
final List<String>? contractsToMarkSelected;
|
||||
|
@ -178,7 +179,8 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
if (contracts.isEmpty) {
|
||||
contracts.addAll(DefaultTokens.list);
|
||||
MainDB.instance.putEthContracts(contracts).then(
|
||||
(_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice());
|
||||
(_) => ref.read(priceAnd24hChangeNotifierProvider).updatePrice(),
|
||||
);
|
||||
}
|
||||
|
||||
tokenEntities.addAll(contracts.map((e) => AddTokenListElementData(e)));
|
||||
|
@ -241,7 +243,8 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
"Add custom token",
|
||||
style:
|
||||
STextStyles.desktopButtonSmallSecondaryEnabled(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -18,9 +18,9 @@ import '../../../../utilities/util.dart';
|
|||
|
||||
class AddCustomTokenSelector extends StatelessWidget {
|
||||
const AddCustomTokenSelector({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.addFunction,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final VoidCallback addFunction;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ import '../../../../widgets/conditional_parent.dart';
|
|||
|
||||
class AddTokenList extends StatelessWidget {
|
||||
const AddTokenList({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
required this.items,
|
||||
required this.addFunction,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String walletId;
|
||||
final List<AddTokenListElementData> items;
|
||||
|
|
|
@ -13,10 +13,10 @@ import '../../../../utilities/text_styles.dart';
|
|||
|
||||
class AddTokenText extends StatelessWidget {
|
||||
const AddTokenText({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.isDesktop,
|
||||
this.walletName,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String? walletName;
|
||||
final bool isDesktop;
|
||||
|
|
|
@ -14,10 +14,10 @@ import 'coin_select_item.dart';
|
|||
|
||||
class AddWalletEntityList extends StatelessWidget {
|
||||
const AddWalletEntityList({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.entities,
|
||||
this.trailing,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<AddWalletListEntity> entities;
|
||||
final Widget? trailing;
|
||||
|
|
|
@ -10,27 +10,27 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../../../models/add_wallet_list_entity/add_wallet_list_entity.dart';
|
||||
import 'add_wallet_entity_list.dart';
|
||||
import '../../../../themes/stack_colors.dart';
|
||||
import '../../../../utilities/assets.dart';
|
||||
import '../../../../utilities/text_styles.dart';
|
||||
import '../../../../utilities/util.dart';
|
||||
import '../../../../widgets/animated_widgets/rotate_icon.dart';
|
||||
import '../../../../widgets/expandable.dart';
|
||||
import 'add_wallet_entity_list.dart';
|
||||
|
||||
class ExpandingSubListItem extends StatefulWidget {
|
||||
const ExpandingSubListItem({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.entities,
|
||||
this.trailing,
|
||||
required this.initialState,
|
||||
double? animationDurationMultiplier,
|
||||
this.curve = Curves.easeInOutCubicEmphasized,
|
||||
}) : animationDurationMultiplier =
|
||||
animationDurationMultiplier ?? entities.length * 0.11,
|
||||
super(key: key);
|
||||
}) : animationDurationMultiplier =
|
||||
animationDurationMultiplier ?? entities.length * 0.11;
|
||||
|
||||
final String title;
|
||||
final List<AddWalletListEntity> entities;
|
||||
|
|
|
@ -19,9 +19,9 @@ import '../../../../utilities/text_styles.dart';
|
|||
|
||||
class AddWalletNextButton extends ConsumerWidget {
|
||||
const AddWalletNextButton({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.isDesktop,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool isDesktop;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import '../../../../utilities/text_styles.dart';
|
|||
|
||||
class CreateRestoreWalletSubTitle extends StatelessWidget {
|
||||
const CreateRestoreWalletSubTitle({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.isDesktop,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool isDesktop;
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ class CreateWalletButtonGroup extends StatelessWidget {
|
|||
: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -167,7 +167,7 @@ class _SelectNewFrostImportTypeViewState
|
|||
FrostStepScaffold.routeName,
|
||||
);
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -176,7 +176,7 @@ class _FrostCreateStep1bState extends ConsumerState<FrostCreateStep1b> {
|
|||
.routeName,
|
||||
);
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -70,7 +70,7 @@ class _FrostCreateStep4State extends ConsumerState<FrostCreateStep4> {
|
|||
.routeName,
|
||||
);
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -222,7 +222,7 @@ class _FrostReshareStep1cState extends ConsumerState<FrostReshareStep1c> {
|
|||
_buttonLock = false;
|
||||
}
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -341,7 +341,7 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
|
|||
});
|
||||
}
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -40,11 +40,11 @@ import 'sub_widgets/mnemonic_table.dart';
|
|||
|
||||
class NewWalletRecoveryPhraseView extends ConsumerStatefulWidget {
|
||||
const NewWalletRecoveryPhraseView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.wallet,
|
||||
required this.mnemonic,
|
||||
this.clipboardInterface = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const routeName = "/newWalletRecoveryPhrase";
|
||||
|
||||
|
@ -91,12 +91,14 @@ class _NewWalletRecoveryPhraseViewState
|
|||
Future<void> _copy() async {
|
||||
final words = _mnemonic;
|
||||
await _clipboardInterface.setData(ClipboardData(text: words.join(" ")));
|
||||
unawaited(showFloatingFlushBar(
|
||||
type: FlushBarType.info,
|
||||
message: "Copied to clipboard",
|
||||
iconAsset: Assets.svg.copy,
|
||||
context: context,
|
||||
));
|
||||
unawaited(
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.info,
|
||||
message: "Copied to clipboard",
|
||||
iconAsset: Assets.svg.copy,
|
||||
context: context,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -238,7 +240,8 @@ class _NewWalletRecoveryPhraseViewState
|
|||
.background
|
||||
: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius),
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: isDesktop
|
||||
|
@ -252,7 +255,8 @@ class _NewWalletRecoveryPhraseViewState
|
|||
: STextStyles.label(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -300,8 +304,9 @@ class _NewWalletRecoveryPhraseViewState
|
|||
Text(
|
||||
"Copy to clipboard",
|
||||
style: STextStyles.desktopButtonSecondaryEnabled(
|
||||
context),
|
||||
)
|
||||
context,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -325,10 +330,12 @@ class _NewWalletRecoveryPhraseViewState
|
|||
.read(verifyMnemonicCorrectWordStateProvider.state)
|
||||
.update((state) => _mnemonic[next]);
|
||||
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
VerifyRecoveryPhraseView.routeName,
|
||||
arguments: Tuple2(_wallet, _mnemonic),
|
||||
));
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
VerifyRecoveryPhraseView.routeName,
|
||||
arguments: Tuple2(_wallet, _mnemonic),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
|
|
@ -13,11 +13,11 @@ import 'mnemonic_table_item.dart';
|
|||
|
||||
class MnemonicTable extends StatelessWidget {
|
||||
const MnemonicTable({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.words,
|
||||
required this.isDesktop,
|
||||
this.itemBorderColor,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<String> words;
|
||||
final bool isDesktop;
|
||||
|
|
|
@ -15,12 +15,12 @@ import '../../../../widgets/rounded_white_container.dart';
|
|||
|
||||
class MnemonicTableItem extends StatelessWidget {
|
||||
const MnemonicTableItem({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.number,
|
||||
required this.word,
|
||||
required this.isDesktop,
|
||||
this.borderColor,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final int number;
|
||||
final String word;
|
||||
|
|
|
@ -14,7 +14,7 @@ import '../../../widgets/desktop/secondary_button.dart';
|
|||
import '../../../widgets/stack_dialog.dart';
|
||||
|
||||
class RecoveryPhraseExplanationDialog extends StatelessWidget {
|
||||
const RecoveryPhraseExplanationDialog({Key? key}) : super(key: key);
|
||||
const RecoveryPhraseExplanationDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -21,8 +21,7 @@ import '../../../widgets/desktop/secondary_button.dart';
|
|||
import '../../../widgets/stack_dialog.dart';
|
||||
|
||||
class ConfirmRecoveryDialog extends StatelessWidget {
|
||||
const ConfirmRecoveryDialog({Key? key, required this.onConfirm})
|
||||
: super(key: key);
|
||||
const ConfirmRecoveryDialog({super.key, required this.onConfirm});
|
||||
|
||||
final VoidCallback onConfirm;
|
||||
|
||||
|
@ -85,10 +84,10 @@ class ConfirmRecoveryDialog extends StatelessWidget {
|
|||
onConfirm.call();
|
||||
},
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -20,9 +20,9 @@ import '../../../../../utilities/util.dart';
|
|||
|
||||
class MobileMnemonicLengthSelector extends ConsumerWidget {
|
||||
const MobileMnemonicLengthSelector({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.chooseMnemonicLength,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final VoidCallback chooseMnemonicLength;
|
||||
|
||||
|
@ -66,7 +66,7 @@ class MobileMnemonicLengthSelector extends ConsumerWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ import '../../../../../utilities/util.dart';
|
|||
|
||||
class RestoreFromDatePicker extends StatefulWidget {
|
||||
const RestoreFromDatePicker({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.onTap,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final VoidCallback onTap;
|
||||
final TextEditingController controller;
|
||||
|
|
|
@ -14,10 +14,10 @@ import '../../../../../utilities/text_styles.dart';
|
|||
|
||||
class RestoreOptionsNextButton extends StatelessWidget {
|
||||
const RestoreOptionsNextButton({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.isDesktop,
|
||||
this.onPressed,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool isDesktop;
|
||||
final VoidCallback? onPressed;
|
||||
|
|
|
@ -13,10 +13,10 @@ import '../../../../../themes/stack_colors.dart';
|
|||
|
||||
class RestoreOptionsPlatformLayout extends StatelessWidget {
|
||||
const RestoreOptionsPlatformLayout({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.isDesktop,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final bool isDesktop;
|
||||
final Widget child;
|
||||
|
|
|
@ -48,11 +48,6 @@ import '../../../utilities/enums/form_input_status_enum.dart';
|
|||
import '../../../utilities/logger.dart';
|
||||
import '../../../utilities/text_styles.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/isar/models/wallet_info.dart';
|
||||
import '../../../wallets/wallet/impl/epiccash_wallet.dart';
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../../providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
|
||||
import '../../../../themes/stack_colors.dart';
|
||||
import '../../../../utilities/constants.dart';
|
||||
|
@ -17,9 +18,9 @@ import '../../../../utilities/text_styles.dart';
|
|||
|
||||
class MnemonicWordCountSelectSheet extends ConsumerWidget {
|
||||
const MnemonicWordCountSelectSheet({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.lengthOptions,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<int> lengthOptions;
|
||||
|
||||
|
@ -113,13 +114,16 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
|
|||
.radioButtonIconEnabled,
|
||||
value: lengthOptions[i],
|
||||
groupValue: ref
|
||||
.watch(mnemonicWordCountStateProvider
|
||||
.state)
|
||||
.watch(
|
||||
mnemonicWordCountStateProvider.state,
|
||||
)
|
||||
.state,
|
||||
onChanged: (x) {
|
||||
ref
|
||||
.read(mnemonicWordCountStateProvider
|
||||
.state)
|
||||
.read(
|
||||
mnemonicWordCountStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = lengthOptions[i];
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
|
|
@ -20,11 +20,11 @@ import '../../../../widgets/stack_dialog.dart';
|
|||
|
||||
class RestoreFailedDialog extends ConsumerStatefulWidget {
|
||||
const RestoreFailedDialog({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.errorMessage,
|
||||
required this.walletName,
|
||||
required this.walletId,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String errorMessage;
|
||||
final String walletName;
|
||||
|
|
|
@ -20,7 +20,7 @@ import '../../../../widgets/desktop/primary_button.dart';
|
|||
import '../../../../widgets/stack_dialog.dart';
|
||||
|
||||
class RestoreSucceededDialog extends StatelessWidget {
|
||||
const RestoreSucceededDialog({Key? key}) : super(key: key);
|
||||
const RestoreSucceededDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -20,9 +20,9 @@ import '../../../../widgets/stack_dialog.dart';
|
|||
|
||||
class RestoringDialog extends StatefulWidget {
|
||||
const RestoringDialog({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.onCancel,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Future<void> Function() onCancel;
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ final newEthWalletTriggerTempUntilHiveCompletelyDeleted =
|
|||
|
||||
class SelectWalletForTokenView extends ConsumerStatefulWidget {
|
||||
const SelectWalletForTokenView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.entity,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/selectWalletForTokenView";
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ import 'word_table_item.dart';
|
|||
|
||||
class WordTable extends ConsumerWidget {
|
||||
const WordTable({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.words,
|
||||
required this.isDesktop,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<String> words;
|
||||
final bool isDesktop;
|
||||
|
|
|
@ -17,11 +17,11 @@ import '../../../../utilities/text_styles.dart';
|
|||
|
||||
class WordTableItem extends ConsumerWidget {
|
||||
const WordTableItem({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.number,
|
||||
required this.word,
|
||||
required this.isDesktop,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final int number;
|
||||
final String word;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../notifications/show_flush_bar.dart';
|
||||
import '../new_wallet_options/new_wallet_options_view.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/assets.dart';
|
||||
import '../../../utilities/constants.dart';
|
||||
|
@ -15,6 +15,7 @@ import '../../../widgets/desktop/primary_button.dart';
|
|||
import '../../../widgets/desktop/secondary_button.dart';
|
||||
import '../../../widgets/stack_dialog.dart';
|
||||
import '../../../widgets/stack_text_field.dart';
|
||||
import '../new_wallet_options/new_wallet_options_view.dart';
|
||||
|
||||
class VerifyMnemonicPassphraseDialog extends ConsumerStatefulWidget {
|
||||
const VerifyMnemonicPassphraseDialog({super.key});
|
||||
|
@ -154,7 +155,8 @@ class _VerifyMnemonicPassphraseDialogState
|
|||
),
|
||||
GestureDetector(
|
||||
key: const Key(
|
||||
"mnemonicPassphraseFieldShowPasswordButtonKey"),
|
||||
"mnemonicPassphraseFieldShowPasswordButtonKey",
|
||||
),
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
hidePassword = !hidePassword;
|
||||
|
|
|
@ -20,7 +20,6 @@ import '../../providers/db/main_db_provider.dart';
|
|||
import '../../providers/global/address_book_service_provider.dart';
|
||||
import '../../providers/providers.dart';
|
||||
import '../../providers/ui/address_book_providers/address_book_filter_provider.dart';
|
||||
import '../../app_config.dart';
|
||||
import '../../themes/stack_colors.dart';
|
||||
import '../../utilities/assets.dart';
|
||||
import '../../utilities/constants.dart';
|
||||
|
|
|
@ -12,8 +12,9 @@ import 'package:emojis/emoji.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:uuid/uuid.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/ui/address_book_providers/address_entry_data_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/stack_text_field.dart';
|
||||
import '../../../widgets/textfield_icon_button.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'new_contact_address_entry_form.dart';
|
||||
|
||||
class AddAddressBookEntryView extends ConsumerStatefulWidget {
|
||||
const AddAddressBookEntryView({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.barcodeScanner = const BarcodeScannerWrapper(),
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/addAddressBookEntry";
|
||||
|
||||
|
@ -129,64 +130,66 @@ class _AddAddressBookEntryViewState
|
|||
builder: (child) {
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"New contact",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: AppBarIconButton(
|
||||
key: const Key("addAddressBookEntryFavoriteButtonKey"),
|
||||
size: 36,
|
||||
shadows: const [],
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.star,
|
||||
color: _isFavorite
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarActive
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarInactive,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isFavorite = !_isFavorite;
|
||||
});
|
||||
},
|
||||
backgroundColor:
|
||||
Theme.of(context).extension<StackColors>()!.background,
|
||||
appBar: AppBar(
|
||||
leading: AppBarBackButton(
|
||||
onPressed: () async {
|
||||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
"New contact",
|
||||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: AppBarIconButton(
|
||||
key: const Key("addAddressBookEntryFavoriteButtonKey"),
|
||||
size: 36,
|
||||
shadows: const [],
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.star,
|
||||
color: _isFavorite
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarActive
|
||||
: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.favoriteStarInactive,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isFavorite = !_isFavorite;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: child),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ConditionalParent(
|
||||
|
@ -267,22 +270,23 @@ class _AddAddressBookEntryViewState
|
|||
}
|
||||
|
||||
showDialog<dynamic>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const DesktopDialog(
|
||||
maxHeight: 700,
|
||||
maxWidth: 600,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 20,
|
||||
top: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: EmojiSelectSheet(),
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const DesktopDialog(
|
||||
maxHeight: 700,
|
||||
maxWidth: 600,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 20,
|
||||
top: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
);
|
||||
}).then((value) {
|
||||
child: EmojiSelectSheet(),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) {
|
||||
if (value is Emoji) {
|
||||
setState(() {
|
||||
_selectedEmoji = value;
|
||||
|
@ -313,7 +317,8 @@ class _AddAddressBookEntryViewState
|
|||
_selectedEmoji!.char,
|
||||
style: STextStyles
|
||||
.pageTitleH1(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -323,19 +328,21 @@ class _AddAddressBookEntryViewState
|
|||
height: 14,
|
||||
width: 14,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
14),
|
||||
color: Theme.of(context)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.accentColorDark),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
14,
|
||||
),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
child: Center(
|
||||
child: _selectedEmoji == null
|
||||
? SvgPicture.asset(
|
||||
Assets.svg.plus,
|
||||
color: Theme.of(
|
||||
context)
|
||||
context,
|
||||
)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.textWhite,
|
||||
|
@ -345,7 +352,8 @@ class _AddAddressBookEntryViewState
|
|||
: SvgPicture.asset(
|
||||
Assets.svg.thickX,
|
||||
color: Theme.of(
|
||||
context)
|
||||
context,
|
||||
)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.textWhite,
|
||||
|
@ -354,7 +362,7 @@ class _AddAddressBookEntryViewState
|
|||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -384,13 +392,15 @@ class _AddAddressBookEntryViewState
|
|||
STextStyles.fieldLabel(context),
|
||||
suffixIcon: ref
|
||||
.read(
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state)
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state,
|
||||
)
|
||||
.state
|
||||
? Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(
|
||||
right: 0),
|
||||
right: 0,
|
||||
),
|
||||
child: UnconstrainedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -412,8 +422,9 @@ class _AddAddressBookEntryViewState
|
|||
onChanged: (newValue) {
|
||||
ref
|
||||
.read(
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state)
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = newValue.isNotEmpty;
|
||||
},
|
||||
),
|
||||
|
@ -485,11 +496,12 @@ class _AddAddressBookEntryViewState
|
|||
height: 14,
|
||||
width: 14,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(14),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
borderRadius:
|
||||
BorderRadius.circular(14),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
child: Center(
|
||||
child: _selectedEmoji == null
|
||||
? SvgPicture.asset(
|
||||
|
@ -512,7 +524,7 @@ class _AddAddressBookEntryViewState
|
|||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -537,12 +549,14 @@ class _AddAddressBookEntryViewState
|
|||
).copyWith(
|
||||
suffixIcon: ref
|
||||
.read(
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state)
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state,
|
||||
)
|
||||
.state
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 0),
|
||||
right: 0,
|
||||
),
|
||||
child: UnconstrainedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
|
@ -564,8 +578,9 @@ class _AddAddressBookEntryViewState
|
|||
onChanged: (newValue) {
|
||||
ref
|
||||
.read(
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state)
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = newValue.isNotEmpty;
|
||||
},
|
||||
),
|
||||
|
@ -659,17 +674,22 @@ class _AddAddressBookEntryViewState
|
|||
Expanded(
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
bool nameExists = ref
|
||||
.watch(contactNameIsNotEmptyStateProvider
|
||||
.state)
|
||||
final bool nameExists = ref
|
||||
.watch(
|
||||
contactNameIsNotEmptyStateProvider
|
||||
.state,
|
||||
)
|
||||
.state;
|
||||
|
||||
bool validForms = ref.watch(
|
||||
validContactStateProvider(forms
|
||||
final bool validForms = ref.watch(
|
||||
validContactStateProvider(
|
||||
forms
|
||||
.map((e) => e.id)
|
||||
.toList(growable: false)));
|
||||
.toList(growable: false),
|
||||
),
|
||||
);
|
||||
|
||||
bool shouldEnableSave =
|
||||
final bool shouldEnableSave =
|
||||
validForms && nameExists;
|
||||
|
||||
return PrimaryButton(
|
||||
|
@ -684,31 +704,38 @@ class _AddAddressBookEntryViewState
|
|||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(
|
||||
milliseconds: 75),
|
||||
milliseconds: 75,
|
||||
),
|
||||
);
|
||||
}
|
||||
List<ContactAddressEntry> entries =
|
||||
[];
|
||||
final List<ContactAddressEntry>
|
||||
entries = [];
|
||||
for (int i = 0;
|
||||
i < forms.length;
|
||||
i++) {
|
||||
entries.add(ref
|
||||
.read(
|
||||
entries.add(
|
||||
ref
|
||||
.read(
|
||||
addressEntryDataProvider(
|
||||
forms[i].id))
|
||||
.buildAddressEntry());
|
||||
forms[i].id,
|
||||
),
|
||||
)
|
||||
.buildAddressEntry(),
|
||||
);
|
||||
}
|
||||
ContactEntry contact = ContactEntry(
|
||||
final ContactEntry contact =
|
||||
ContactEntry(
|
||||
emojiChar: _selectedEmoji?.char,
|
||||
name: nameController.text,
|
||||
addresses: entries,
|
||||
isFavorite: _isFavorite,
|
||||
customId: const Uuid().v1(),
|
||||
customId: const Uuid().v1(),
|
||||
);
|
||||
|
||||
if (await ref
|
||||
.read(
|
||||
addressBookServiceProvider)
|
||||
addressBookServiceProvider,
|
||||
)
|
||||
.addContact(contact)) {
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.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/ui/address_book_providers/address_entry_data_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/desktop/primary_button.dart';
|
||||
import '../../../widgets/desktop/secondary_button.dart';
|
||||
import 'new_contact_address_entry_form.dart';
|
||||
|
||||
class AddNewContactAddressView extends ConsumerStatefulWidget {
|
||||
const AddNewContactAddressView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.contactId,
|
||||
this.barcodeScanner = const BarcodeScannerWrapper(),
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/addNewContactAddress";
|
||||
|
||||
|
@ -66,8 +67,10 @@ class _AddNewContactAddressViewState
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final contact = ref.watch(addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)));
|
||||
final contact = ref.watch(
|
||||
addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)),
|
||||
);
|
||||
|
||||
final isDesktop = Util.isDesktop;
|
||||
|
||||
|
@ -188,7 +191,8 @@ class _AddNewContactAddressViewState
|
|||
if (!isDesktop && FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -211,14 +215,14 @@ class _AddNewContactAddressViewState
|
|||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
List<ContactAddressEntry> entries =
|
||||
final List<ContactAddressEntry> entries =
|
||||
contact.addresses.toList();
|
||||
|
||||
entries.add(ref
|
||||
.read(addressEntryDataProvider(0))
|
||||
.buildAddressEntry());
|
||||
entries.add(
|
||||
ref.read(addressEntryDataProvider(0)).buildAddressEntry(),
|
||||
);
|
||||
|
||||
ContactEntry editedContact =
|
||||
final ContactEntry editedContact =
|
||||
contact.copyWith(addresses: entries);
|
||||
|
||||
if (await ref
|
||||
|
@ -235,7 +239,7 @@ class _AddNewContactAddressViewState
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../app_config.dart';
|
||||
import '../../../providers/global/prefs_provider.dart';
|
||||
import '../../../providers/ui/address_book_providers/address_book_filter_provider.dart';
|
||||
import '../../../app_config.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/text_styles.dart';
|
||||
import '../../../utilities/util.dart';
|
||||
|
@ -82,42 +83,44 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: LayoutBuilder(builder: (builderContext, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"Only selected cryptocurrency addresses will be displayed.",
|
||||
style: STextStyles.itemSubtitle(context),
|
||||
child: LayoutBuilder(
|
||||
builder: (builderContext, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"Only selected cryptocurrency addresses will be displayed.",
|
||||
style: STextStyles.itemSubtitle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
"Select cryptocurrency",
|
||||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
child,
|
||||
],
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
"Select cryptocurrency",
|
||||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
child,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -230,8 +233,10 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
width: 20,
|
||||
child: Checkbox(
|
||||
value: ref
|
||||
.watch(addressBookFilterProvider
|
||||
.select((value) => value.coins))
|
||||
.watch(
|
||||
addressBookFilterProvider
|
||||
.select((value) => value.coins),
|
||||
)
|
||||
.contains(coin),
|
||||
onChanged: (value) {
|
||||
if (value is bool) {
|
||||
|
@ -267,7 +272,7 @@ class _AddressBookFilterViewState extends ConsumerState<AddressBookFilterView> {
|
|||
style: STextStyles.itemSubtitle(context),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -79,7 +79,7 @@ class CoinSelectSheet extends StatelessWidget {
|
|||
Flexible(
|
||||
child: Consumer(
|
||||
builder: (_, ref, __) {
|
||||
bool showTestNet = ref.watch(
|
||||
final bool showTestNet = ref.watch(
|
||||
prefsChangeNotifierProvider
|
||||
.select((value) => value.showTestNetCoins),
|
||||
);
|
||||
|
|
|
@ -15,11 +15,10 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../../models/isar/models/isar_models.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/global/address_book_service_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/stack_dialog.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 {
|
||||
const ContactDetailsView({
|
||||
|
@ -73,8 +74,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
.transactions
|
||||
.where()
|
||||
.filter()
|
||||
.anyOf(contact.addresses.map((e) => e.address),
|
||||
(q, String e) => q.address((q) => q.valueEqualTo(e)))
|
||||
.anyOf(
|
||||
contact.addresses.map((e) => e.address),
|
||||
(q, String e) => q.address((q) => q.valueEqualTo(e)),
|
||||
)
|
||||
.sortByTimestampDesc()
|
||||
.findAll();
|
||||
|
||||
|
@ -107,8 +110,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final _contact = ref.watch(addressBookServiceProvider
|
||||
.select((value) => value.getContactById(_contactId)));
|
||||
final _contact = ref.watch(
|
||||
addressBookServiceProvider
|
||||
.select((value) => value.getContactById(_contactId)),
|
||||
);
|
||||
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
|
@ -153,7 +158,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
final bool isFavorite = _contact.isFavorite;
|
||||
|
||||
ref.read(addressBookServiceProvider).editContact(
|
||||
_contact.copyWith(isFavorite: !isFavorite));
|
||||
_contact.copyWith(isFavorite: !isFavorite),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -289,18 +295,21 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
.getSecondaryEnabledButtonStyle(context)!
|
||||
.copyWith(
|
||||
minimumSize: MaterialStateProperty.all<Size>(
|
||||
const Size(46, 32)),
|
||||
const Size(46, 32),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(Assets.svg.pencil,
|
||||
width: 10,
|
||||
height: 10,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.pencil,
|
||||
width: 10,
|
||||
height: 10,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
|
@ -463,9 +472,10 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
),
|
||||
FutureBuilder(
|
||||
future: _filteredTransactionsByContact(),
|
||||
builder: (_,
|
||||
AsyncSnapshot<List<Tuple2<String, Transaction>>>
|
||||
snapshot) {
|
||||
builder: (
|
||||
_,
|
||||
AsyncSnapshot<List<Tuple2<String, Transaction>>> snapshot,
|
||||
) {
|
||||
if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
_cachedTransactions = snapshot.data!;
|
||||
|
@ -478,7 +488,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
..._cachedTransactions.map(
|
||||
(e) => TransactionCard(
|
||||
key: Key(
|
||||
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"),
|
||||
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey",
|
||||
),
|
||||
transaction: e.item2,
|
||||
walletId: e.item1,
|
||||
),
|
||||
|
@ -508,7 +519,8 @@ class _ContactDetailsViewState extends ConsumerState<ContactDetailsView> {
|
|||
..._cachedTransactions.map(
|
||||
(e) => TransactionCard(
|
||||
key: Key(
|
||||
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey"),
|
||||
"contactDetailsTransaction_${e.item1}_${e.item2.txid}_cardKey",
|
||||
),
|
||||
transaction: e.item2,
|
||||
walletId: e.item1,
|
||||
),
|
||||
|
|
|
@ -51,8 +51,10 @@ class ContactPopUp extends ConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final maxHeight = MediaQuery.of(context).size.height * 0.6;
|
||||
final contact = ref.watch(addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)));
|
||||
final contact = ref.watch(
|
||||
addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)),
|
||||
);
|
||||
|
||||
final active = ref.read(currentWalletIdProvider);
|
||||
|
||||
|
@ -157,7 +159,8 @@ class ContactPopUp extends ConsumerWidget {
|
|||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonStyle(
|
||||
context)!
|
||||
context,
|
||||
)!
|
||||
.copyWith(
|
||||
minimumSize:
|
||||
MaterialStateProperty.all<
|
||||
|
@ -165,10 +168,14 @@ class ContactPopUp extends ConsumerWidget {
|
|||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 18),
|
||||
child: Text("Details",
|
||||
style: STextStyles.buttonSmall(
|
||||
context)),
|
||||
horizontal: 18,
|
||||
),
|
||||
child: Text(
|
||||
"Details",
|
||||
style: STextStyles.buttonSmall(
|
||||
context,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -186,7 +193,8 @@ class ContactPopUp extends ConsumerWidget {
|
|||
if (addresses.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20),
|
||||
horizontal: 20,
|
||||
),
|
||||
child: RoundedWhiteContainer(
|
||||
child: Center(
|
||||
child: Text(
|
||||
|
@ -237,14 +245,16 @@ class ContactPopUp extends ConsumerWidget {
|
|||
e.other!,
|
||||
style:
|
||||
STextStyles.itemSubtitle12(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
if (contact.customId != "default")
|
||||
Text(
|
||||
"${e.label} (${e.coin.ticker})",
|
||||
style:
|
||||
STextStyles.itemSubtitle12(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
|
@ -252,8 +262,8 @@ class ContactPopUp extends ConsumerWidget {
|
|||
Text(
|
||||
e.address,
|
||||
style: STextStyles.itemSubtitle(
|
||||
context)
|
||||
.copyWith(
|
||||
context,
|
||||
).copyWith(
|
||||
fontSize: 8,
|
||||
),
|
||||
),
|
||||
|
@ -286,12 +296,13 @@ class ContactPopUp extends ConsumerWidget {
|
|||
.textFieldDefaultBG,
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.copy,
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
Assets.svg.copy,
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -310,12 +321,15 @@ class ContactPopUp extends ConsumerWidget {
|
|||
onTap: () {
|
||||
ref
|
||||
.read(
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state)
|
||||
exchangeFromAddressBookAddressStateProvider
|
||||
.state,
|
||||
)
|
||||
.state = e.address;
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(
|
||||
Step2View.routeName));
|
||||
ModalRoute.withName(
|
||||
Step2View.routeName,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: RoundedContainer(
|
||||
color: Theme.of(context)
|
||||
|
@ -324,13 +338,13 @@ class ContactPopUp extends ConsumerWidget {
|
|||
padding:
|
||||
const EdgeInsets.all(6),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.chevronRight,
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.accentColorDark),
|
||||
Assets.svg.chevronRight,
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -363,7 +377,8 @@ class ContactPopUp extends ConsumerWidget {
|
|||
arguments: Tuple3(
|
||||
active,
|
||||
ref.read(
|
||||
pWalletCoin(active)),
|
||||
pWalletCoin(active),
|
||||
),
|
||||
SendViewAutoFillData(
|
||||
address: address,
|
||||
contactLabel:
|
||||
|
@ -381,18 +396,15 @@ class ContactPopUp extends ConsumerWidget {
|
|||
Util.isDesktop ? 4 : 6,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
Assets
|
||||
.svg.circleArrowUpRight,
|
||||
width: Util.isDesktop
|
||||
? 12
|
||||
: 16,
|
||||
height: Util.isDesktop
|
||||
? 12
|
||||
: 16,
|
||||
color: Theme.of(context)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.accentColorDark),
|
||||
Assets.svg.circleArrowUpRight,
|
||||
width:
|
||||
Util.isDesktop ? 12 : 16,
|
||||
height:
|
||||
Util.isDesktop ? 12 : 16,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.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/ui/address_book_providers/address_entry_data_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/desktop/primary_button.dart';
|
||||
import '../../../widgets/desktop/secondary_button.dart';
|
||||
import 'new_contact_address_entry_form.dart';
|
||||
|
||||
class EditContactAddressView extends ConsumerStatefulWidget {
|
||||
const EditContactAddressView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.contactId,
|
||||
required this.addressEntry,
|
||||
this.barcodeScanner = const BarcodeScannerWrapper(),
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/editContactAddress";
|
||||
|
||||
|
@ -67,7 +66,7 @@ class _EditContactAddressViewState
|
|||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
List<ContactAddressEntry> entries = contact.addresses.toList();
|
||||
final List<ContactAddressEntry> entries = contact.addresses.toList();
|
||||
|
||||
final entry = entries.firstWhere(
|
||||
(e) =>
|
||||
|
@ -79,12 +78,12 @@ class _EditContactAddressViewState
|
|||
final index = entries.indexOf(entry);
|
||||
entries.remove(entry);
|
||||
|
||||
ContactAddressEntry editedEntry =
|
||||
final ContactAddressEntry editedEntry =
|
||||
ref.read(addressEntryDataProvider(0)).buildAddressEntry();
|
||||
|
||||
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 (mounted) {
|
||||
|
@ -108,8 +107,10 @@ class _EditContactAddressViewState
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final contact = ref.watch(addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)));
|
||||
final contact = ref.watch(
|
||||
addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)),
|
||||
);
|
||||
|
||||
final bool isDesktop = Util.isDesktop;
|
||||
|
||||
|
@ -239,9 +240,10 @@ class _EditContactAddressViewState
|
|||
//Deleting an entry directly from _addresses gives error
|
||||
// "Cannot remove from a fixed-length list", so we remove the
|
||||
// entry from a copy
|
||||
var tempAddresses = List<ContactAddressEntry>.from(_addresses);
|
||||
final tempAddresses =
|
||||
List<ContactAddressEntry>.from(_addresses);
|
||||
tempAddresses.remove(entry);
|
||||
ContactEntry editedContact =
|
||||
final ContactEntry editedContact =
|
||||
contact.copyWith(addresses: tempAddresses);
|
||||
if (await ref
|
||||
.read(addressBookServiceProvider)
|
||||
|
@ -272,7 +274,8 @@ class _EditContactAddressViewState
|
|||
if (!isDesktop && FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
|
|
@ -14,6 +14,7 @@ import 'package:emojis/emoji.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../../providers/global/address_book_service_provider.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/assets.dart';
|
||||
|
@ -33,9 +34,9 @@ import '../../../widgets/textfield_icon_button.dart';
|
|||
|
||||
class EditContactNameEmojiView extends ConsumerStatefulWidget {
|
||||
const EditContactNameEmojiView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.contactId,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/editContactNameEmoji";
|
||||
|
||||
|
@ -82,8 +83,10 @@ class _EditContactNameEmojiViewState
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final contact = ref.watch(addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)));
|
||||
final contact = ref.watch(
|
||||
addressBookServiceProvider
|
||||
.select((value) => value.getContactById(contactId)),
|
||||
);
|
||||
|
||||
final isDesktop = Util.isDesktop;
|
||||
final double emojiSize = isDesktop ? 56 : 48;
|
||||
|
@ -152,23 +155,24 @@ class _EditContactNameEmojiViewState
|
|||
}
|
||||
if (isDesktop) {
|
||||
showDialog<dynamic>(
|
||||
barrierColor: Colors.transparent,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const DesktopDialog(
|
||||
maxHeight: 700,
|
||||
maxWidth: 600,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 20,
|
||||
top: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: EmojiSelectSheet(),
|
||||
barrierColor: Colors.transparent,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const DesktopDialog(
|
||||
maxHeight: 700,
|
||||
maxWidth: 600,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 20,
|
||||
top: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
);
|
||||
}).then((value) {
|
||||
child: EmojiSelectSheet(),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) {
|
||||
if (value is Emoji) {
|
||||
setState(() {
|
||||
_selectedEmoji = value;
|
||||
|
@ -229,10 +233,11 @@ class _EditContactNameEmojiViewState
|
|||
height: 14,
|
||||
width: 14,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
child: Center(
|
||||
child: _selectedEmoji == null
|
||||
? SvgPicture.asset(
|
||||
|
@ -253,7 +258,7 @@ class _EditContactNameEmojiViewState
|
|||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -362,7 +367,8 @@ class _EditContactNameEmojiViewState
|
|||
if (!isDesktop && FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -403,7 +409,7 @@ class _EditContactNameEmojiViewState
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -439,7 +439,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
|||
buyWithFiat: buyWithFiat,
|
||||
);
|
||||
|
||||
BuyResponse<SimplexQuote> quoteResponse = await _loadQuote(quote);
|
||||
final BuyResponse<SimplexQuote> quoteResponse = await _loadQuote(quote);
|
||||
shouldPop = true;
|
||||
if (mounted) {
|
||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||
|
@ -767,8 +767,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
Locale locale = Localizations.localeOf(context);
|
||||
var format = NumberFormat.simpleCurrency(locale: locale.toString());
|
||||
final Locale locale = Localizations.localeOf(context);
|
||||
final format = NumberFormat.simpleCurrency(locale: locale.toString());
|
||||
// See https://stackoverflow.com/a/67055685
|
||||
|
||||
return ConditionalParent(
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../models/buy/response_objects/order.dart';
|
||||
import '../../themes/stack_colors.dart';
|
||||
import '../../themes/theme_providers.dart';
|
||||
|
@ -25,9 +26,9 @@ import '../../widgets/rounded_white_container.dart';
|
|||
|
||||
class BuyOrderDetailsView extends ConsumerStatefulWidget {
|
||||
const BuyOrderDetailsView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.order,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final SimplexOrder order;
|
||||
|
||||
|
@ -259,22 +260,25 @@ class _BuyOrderDetailsViewState extends ConsumerState<BuyOrderDetailsView> {
|
|||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Text(
|
||||
"This information is not saved,\nscreenshot it now for your records",
|
||||
style: STextStyles.label(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"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(),
|
||||
PrimaryButton(
|
||||
label: "Dismiss",
|
||||
onPressed: () {
|
||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -29,9 +29,9 @@ import '../../widgets/rounded_white_container.dart';
|
|||
|
||||
class BuyQuotePreviewView extends ConsumerStatefulWidget {
|
||||
const BuyQuotePreviewView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.quote,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final SimplexQuote quote;
|
||||
|
||||
|
@ -56,8 +56,8 @@ class _BuyQuotePreviewViewState extends ConsumerState<BuyQuotePreviewView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Locale locale = Localizations.localeOf(context);
|
||||
var format = NumberFormat.simpleCurrency(locale: locale.toString());
|
||||
final Locale locale = Localizations.localeOf(context);
|
||||
final format = NumberFormat.simpleCurrency(locale: locale.toString());
|
||||
// See https://stackoverflow.com/a/67055685
|
||||
|
||||
return ConditionalParent(
|
||||
|
@ -240,7 +240,7 @@ class _BuyQuotePreviewViewState extends ConsumerState<BuyQuotePreviewView> {
|
|||
PrimaryButton(
|
||||
label: "Buy",
|
||||
onPressed: _buyWarning,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -13,9 +13,9 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
import '../../../models/buy/response_objects/order.dart';
|
||||
import '../../../models/buy/response_objects/quote.dart';
|
||||
import '../buy_order_details.dart';
|
||||
import '../../../services/buy/buy_response.dart';
|
||||
import '../../../services/buy/simplex/simplex_api.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
|
@ -29,13 +29,14 @@ import '../../../widgets/desktop/primary_button.dart';
|
|||
import '../../../widgets/desktop/secondary_button.dart';
|
||||
import '../../../widgets/rounded_white_container.dart';
|
||||
import '../../../widgets/stack_dialog.dart';
|
||||
import '../buy_order_details.dart';
|
||||
|
||||
class BuyWarningPopup extends ConsumerStatefulWidget {
|
||||
const BuyWarningPopup({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.quote,
|
||||
this.order,
|
||||
}) : super(key: key);
|
||||
});
|
||||
final SimplexQuote quote;
|
||||
final SimplexOrder? order;
|
||||
@override
|
||||
|
@ -123,7 +124,8 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
|
|||
}
|
||||
|
||||
Future<void> onContinue() async {
|
||||
BuyResponse<SimplexOrder> orderResponse = await newOrder(widget.quote);
|
||||
final BuyResponse<SimplexOrder> orderResponse =
|
||||
await newOrder(widget.quote);
|
||||
if (orderResponse.exception == null) {
|
||||
await redirect(orderResponse.value as SimplexOrder)
|
||||
.then((_response) async {
|
||||
|
@ -175,7 +177,7 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -192,9 +194,10 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
|
|||
child: Text(
|
||||
"Ok",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -274,7 +277,7 @@ class _BuyWarningPopupState extends ConsumerState<BuyWarningPopup> {
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../models/buy/response_objects/fiat.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/assets.dart';
|
||||
|
@ -28,9 +29,9 @@ import '../../../widgets/textfield_icon_button.dart';
|
|||
|
||||
class FiatSelectionView extends StatefulWidget {
|
||||
const FiatSelectionView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.fiats,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final List<Fiat> fiats;
|
||||
|
||||
|
@ -48,9 +49,11 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
|
|||
void filter(String text) {
|
||||
setState(() {
|
||||
_fiats = [
|
||||
...fiats.where((e) =>
|
||||
e.name.toLowerCase().contains(text.toLowerCase()) ||
|
||||
e.ticker.toLowerCase().contains(text.toLowerCase()))
|
||||
...fiats.where(
|
||||
(e) =>
|
||||
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.sort(
|
||||
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()));
|
||||
for (Fiats fiat in Fiats.values.reversed) {
|
||||
int index = fiats.indexWhere((element) =>
|
||||
element.ticker.toLowerCase() == fiat.ticker.toLowerCase());
|
||||
(a, b) => a.ticker.toLowerCase().compareTo(b.ticker.toLowerCase()),
|
||||
);
|
||||
for (final Fiats fiat in Fiats.values.reversed) {
|
||||
final int index = fiats.indexWhere(
|
||||
(element) => element.ticker.toLowerCase() == fiat.ticker.toLowerCase(),
|
||||
);
|
||||
if (index > 0) {
|
||||
final currency = fiats.removeAt(index);
|
||||
fiats.insert(0, currency);
|
||||
|
@ -85,7 +90,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Locale locale = Localizations.localeOf(context);
|
||||
final Locale locale = Localizations.localeOf(context);
|
||||
final format = NumberFormat.simpleCurrency(locale: locale.toString());
|
||||
// See https://stackoverflow.com/a/67055685
|
||||
|
||||
|
@ -104,7 +109,8 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
|
|||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 50));
|
||||
const Duration(milliseconds: 50),
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
@ -235,17 +241,20 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
|
|||
),
|
||||
child: Text(
|
||||
format.simpleCurrencySymbol(
|
||||
e.ticker.toUpperCase()),
|
||||
e.ticker.toUpperCase(),
|
||||
),
|
||||
style: STextStyles.subtitle(context)
|
||||
.apply(
|
||||
fontSizeFactor: (1 /
|
||||
format
|
||||
.simpleCurrencySymbol(
|
||||
e.ticker.toUpperCase())
|
||||
e.ticker.toUpperCase(),
|
||||
)
|
||||
.length * // Couldn't get pow() working here
|
||||
format
|
||||
.simpleCurrencySymbol(
|
||||
e.ticker.toUpperCase())
|
||||
e.ticker.toUpperCase(),
|
||||
)
|
||||
.length),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
|
|
|
@ -15,8 +15,7 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_native_splash/cli_commands.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.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/global/prefs_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_white_container.dart';
|
||||
import '../../widgets/stack_text_field.dart';
|
||||
import 'fusion_progress_view.dart';
|
||||
import 'fusion_rounds_selection_sheet.dart';
|
||||
|
||||
class CashFusionView extends ConsumerStatefulWidget {
|
||||
const CashFusionView({
|
||||
|
@ -73,7 +74,8 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
|
|||
);
|
||||
} catch (e) {
|
||||
if (!e.toString().contains(
|
||||
"FusionProgressUIState was already set for ${widget.walletId}")) {
|
||||
"FusionProgressUIState was already set for ${widget.walletId}",
|
||||
)) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +275,7 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
|
|||
controller: portController,
|
||||
focusNode: portFocusNode,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (value) {
|
||||
|
@ -408,7 +410,7 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
|
|||
controller: fusionRoundController,
|
||||
focusNode: fusionRoundFocusNode,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (value) {
|
||||
|
@ -424,7 +426,8 @@ class _CashFusionViewState extends ConsumerState<CashFusionView> {
|
|||
fusionRoundFocusNode,
|
||||
context,
|
||||
).copyWith(
|
||||
labelText: "Enter number of fusions.."),
|
||||
labelText: "Enter number of fusions..",
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
|
|
@ -12,6 +12,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
|
||||
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
||||
import '../../providers/global/prefs_provider.dart';
|
||||
|
@ -244,7 +245,8 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
|||
);
|
||||
} catch (e) {
|
||||
if (!e.toString().contains(
|
||||
"FusionProgressUIState was already set for ${widget.walletId}")) {
|
||||
"FusionProgressUIState was already set for ${widget.walletId}",
|
||||
)) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ enum FusionOption {
|
|||
|
||||
class FusionRoundCountSelectSheet extends HookWidget {
|
||||
const FusionRoundCountSelectSheet({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.currentOption,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final FusionOption currentOption;
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../db/isar/main_db.dart';
|
||||
import '../../models/isar/models/isar_models.dart';
|
||||
import 'utxo_card.dart';
|
||||
import 'utxo_details_view.dart';
|
||||
import '../../providers/global/wallets_provider.dart';
|
||||
import '../../themes/stack_colors.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_white_container.dart';
|
||||
import '../../widgets/toggle.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'utxo_card.dart';
|
||||
import 'utxo_details_view.dart';
|
||||
|
||||
enum CoinControlViewType {
|
||||
manage,
|
||||
|
@ -148,7 +149,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
onWillPop: () async {
|
||||
unawaited(_refreshBalance());
|
||||
Navigator.of(context).pop(
|
||||
widget.type == CoinControlViewType.use ? _selectedAvailable : null);
|
||||
widget.type == CoinControlViewType.use ? _selectedAvailable : null,
|
||||
);
|
||||
return false;
|
||||
},
|
||||
child: Background(
|
||||
|
@ -179,9 +181,10 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
onPressed: () {
|
||||
unawaited(_refreshBalance());
|
||||
Navigator.of(context).pop(
|
||||
widget.type == CoinControlViewType.use
|
||||
? _selectedAvailable
|
||||
: null);
|
||||
widget.type == CoinControlViewType.use
|
||||
? _selectedAvailable
|
||||
: null,
|
||||
);
|
||||
},
|
||||
),
|
||||
title: _isSearching
|
||||
|
@ -336,7 +339,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
|
||||
return UtxoCard(
|
||||
key: Key(
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected"),
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected",
|
||||
),
|
||||
walletId: widget.walletId,
|
||||
utxo: utxo,
|
||||
canSelect: widget.type ==
|
||||
|
@ -398,7 +402,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
|
||||
return UtxoCard(
|
||||
key: Key(
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected"),
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected",
|
||||
),
|
||||
walletId: widget.walletId,
|
||||
utxo: utxo,
|
||||
canSelect: widget.type ==
|
||||
|
@ -486,7 +491,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
entry.key,
|
||||
style:
|
||||
STextStyles.w600_14(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
|
@ -496,8 +502,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
"output${entry.value.length > 1 ? "s" : ""}",
|
||||
style:
|
||||
STextStyles.w500_12(
|
||||
context)
|
||||
.copyWith(
|
||||
context,
|
||||
).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
|
@ -538,7 +544,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
|
||||
return UtxoCard(
|
||||
key: Key(
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected"),
|
||||
"${utxo.walletId}_${utxo.id}_$isSelected",
|
||||
),
|
||||
walletId: widget.walletId,
|
||||
utxo: utxo,
|
||||
canSelect: widget.type ==
|
||||
|
@ -615,22 +622,26 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
label: _showBlocked ? "Unfreeze" : "Freeze",
|
||||
onPressed: () async {
|
||||
if (_showBlocked) {
|
||||
await MainDB.instance.putUTXOs(_selectedBlocked
|
||||
.map(
|
||||
(e) => e.copyWith(
|
||||
isBlocked: false,
|
||||
),
|
||||
)
|
||||
.toList());
|
||||
await MainDB.instance.putUTXOs(
|
||||
_selectedBlocked
|
||||
.map(
|
||||
(e) => e.copyWith(
|
||||
isBlocked: false,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
_selectedBlocked.clear();
|
||||
} else {
|
||||
await MainDB.instance.putUTXOs(_selectedAvailable
|
||||
.map(
|
||||
(e) => e.copyWith(
|
||||
isBlocked: true,
|
||||
),
|
||||
)
|
||||
.toList());
|
||||
await MainDB.instance.putUTXOs(
|
||||
_selectedAvailable
|
||||
.map(
|
||||
(e) => e.copyWith(
|
||||
isBlocked: true,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
_selectedAvailable.clear();
|
||||
}
|
||||
setState(() {});
|
||||
|
@ -689,7 +700,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
.format(selectedSum),
|
||||
style: widget.requestedTotal == null
|
||||
? STextStyles.w600_14(context)
|
||||
: STextStyles.w600_14(context).copyWith(
|
||||
: STextStyles.w600_14(context)
|
||||
.copyWith(
|
||||
color: selectedSum >=
|
||||
widget
|
||||
.requestedTotal!
|
||||
|
@ -700,7 +712,8 @@ class _CoinControlViewState extends ConsumerState<CoinControlView> {
|
|||
: Theme.of(context)
|
||||
.extension<
|
||||
StackColors>()!
|
||||
.accentColorRed),
|
||||
.accentColorRed,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../db/isar/main_db.dart';
|
||||
import '../../models/isar/models/isar_models.dart';
|
||||
import '../../providers/global/wallets_provider.dart';
|
||||
|
@ -90,83 +91,84 @@ class _UtxoCardState extends ConsumerState<UtxoCard> {
|
|||
? Theme.of(context).extension<StackColors>()!.popupBG
|
||||
: Colors.transparent,
|
||||
child: StreamBuilder<UTXO?>(
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
utxo = snapshot.data!;
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
ConditionalParent(
|
||||
condition: widget.canSelect,
|
||||
builder: (child) => GestureDetector(
|
||||
onTap: () {
|
||||
_selected = !_selected;
|
||||
widget.onSelectedChanged(_selected);
|
||||
setState(() {});
|
||||
},
|
||||
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,
|
||||
),
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
utxo = snapshot.data!;
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
ConditionalParent(
|
||||
condition: widget.canSelect,
|
||||
builder: (child) => GestureDetector(
|
||||
onTap: () {
|
||||
_selected = !_selected;
|
||||
widget.onSelectedChanged(_selected);
|
||||
setState(() {});
|
||||
},
|
||||
child: child,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
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,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
ref.watch(pAmountFormatter(coin)).format(
|
||||
utxo.value.toAmountAsRaw(
|
||||
fractionDigits: coin.fractionDigits,
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
ref.watch(pAmountFormatter(coin)).format(
|
||||
utxo.value.toAmountAsRaw(
|
||||
fractionDigits: coin.fractionDigits,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
|||
}
|
||||
|
||||
class _Div extends StatelessWidget {
|
||||
const _Div({Key? key}) : super(key: key);
|
||||
const _Div({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
@ -131,7 +131,7 @@ class _ChooseFromStackViewState extends ConsumerState<ChooseFromStackView> {
|
|||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -12,12 +12,11 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../../models/exchange/response_objects/trade.dart';
|
||||
import '../../models/isar/models/isar_models.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 '../../providers/db/main_db_provider.dart';
|
||||
import '../../providers/providers.dart';
|
||||
|
@ -42,7 +41,9 @@ import '../../widgets/desktop/secondary_button.dart';
|
|||
import '../../widgets/rounded_container.dart';
|
||||
import '../../widgets/rounded_white_container.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 {
|
||||
const ConfirmChangeNowSendView({
|
||||
|
@ -342,7 +343,7 @@ class _ConfirmChangeNowSendViewState
|
|||
Text(
|
||||
"Confirm ${ref.watch(pWalletCoin(walletId)).ticker} transaction",
|
||||
style: STextStyles.desktopH3(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
|
@ -384,8 +385,11 @@ class _ConfirmChangeNowSendViewState
|
|||
children: [
|
||||
Text(
|
||||
ref
|
||||
.watch(pAmountFormatter(
|
||||
ref.watch(pWalletCoin(walletId))))
|
||||
.watch(
|
||||
pAmountFormatter(
|
||||
ref.watch(pWalletCoin(walletId)),
|
||||
),
|
||||
)
|
||||
.format(widget.txData.fee!),
|
||||
style:
|
||||
STextStyles.desktopTextExtraExtraSmall(context)
|
||||
|
@ -461,7 +465,7 @@ class _ConfirmChangeNowSendViewState
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -574,41 +578,49 @@ class _ConfirmChangeNowSendViewState
|
|||
builder: (child) => Row(
|
||||
children: [
|
||||
child,
|
||||
Builder(builder: (context) {
|
||||
final coin = ref.watch(pWalletCoin(walletId));
|
||||
final price = ref.watch(
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final coin = ref.watch(pWalletCoin(walletId));
|
||||
final price = ref.watch(
|
||||
priceAnd24hChangeNotifierProvider
|
||||
.select((value) => value.getPrice(coin)));
|
||||
final amountWithoutChange =
|
||||
widget.txData.amountWithoutChange!;
|
||||
final value =
|
||||
(price.item1 * amountWithoutChange.decimal)
|
||||
.toAmount(fractionDigits: 2);
|
||||
final currency = ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.currency));
|
||||
final locale = ref.watch(
|
||||
localeServiceChangeNotifierProvider.select(
|
||||
(value) => value.locale,
|
||||
),
|
||||
);
|
||||
.select((value) => value.getPrice(coin)),
|
||||
);
|
||||
final amountWithoutChange =
|
||||
widget.txData.amountWithoutChange!;
|
||||
final value =
|
||||
(price.item1 * amountWithoutChange.decimal)
|
||||
.toAmount(fractionDigits: 2);
|
||||
final currency = ref.watch(
|
||||
prefsChangeNotifierProvider
|
||||
.select((value) => value.currency),
|
||||
);
|
||||
final locale = ref.watch(
|
||||
localeServiceChangeNotifierProvider.select(
|
||||
(value) => value.locale,
|
||||
),
|
||||
);
|
||||
|
||||
return Text(
|
||||
" | ${value.fiatString(locale: locale)} $currency",
|
||||
style:
|
||||
STextStyles.desktopTextExtraExtraSmall(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textSubtitle2,
|
||||
),
|
||||
);
|
||||
})
|
||||
return Text(
|
||||
" | ${value.fiatString(locale: locale)} $currency",
|
||||
style: STextStyles.desktopTextExtraExtraSmall(
|
||||
context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textSubtitle2,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
ref
|
||||
.watch(pAmountFormatter(
|
||||
ref.watch(pWalletCoin(walletId))))
|
||||
.watch(
|
||||
pAmountFormatter(
|
||||
ref.watch(pWalletCoin(walletId)),
|
||||
),
|
||||
)
|
||||
.format((widget.txData.amountWithoutChange!)),
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
textAlign: TextAlign.right,
|
||||
|
@ -637,7 +649,8 @@ class _ConfirmChangeNowSendViewState
|
|||
Text(
|
||||
ref
|
||||
.watch(
|
||||
pAmountFormatter(ref.read(pWalletCoin(walletId))))
|
||||
pAmountFormatter(ref.read(pWalletCoin(walletId))),
|
||||
)
|
||||
.format(
|
||||
widget.txData.fee!,
|
||||
),
|
||||
|
|
|
@ -23,10 +23,10 @@ import '../../widgets/textfield_icon_button.dart';
|
|||
|
||||
class EditTradeNoteView extends ConsumerStatefulWidget {
|
||||
const EditTradeNoteView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.tradeId,
|
||||
required this.note,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/editTradeNote";
|
||||
|
||||
|
@ -151,7 +151,7 @@ class _EditNoteViewState extends ConsumerState<EditTradeNoteView> {
|
|||
"Save",
|
||||
style: STextStyles.button(context),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -110,7 +110,7 @@ class _ExchangeCurrencySelectionViewState
|
|||
return await _getCurrencies();
|
||||
}
|
||||
await ExchangeDataLoadingService.instance.initDB();
|
||||
List<Currency> currencies = await ExchangeDataLoadingService
|
||||
final List<Currency> currencies = await ExchangeDataLoadingService
|
||||
.instance.isar.currencies
|
||||
.where()
|
||||
.filter()
|
||||
|
|
|
@ -16,6 +16,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:flutter_svg/svg.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/incomplete_exchange.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/pair.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 '../../providers/providers.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/text_styles.dart';
|
||||
import '../../utilities/util.dart';
|
||||
import '../../wallets/crypto_currency/coins/bitcoin.dart';
|
||||
import '../../wallets/crypto_currency/crypto_currency.dart';
|
||||
import '../../widgets/conditional_parent.dart';
|
||||
import '../../widgets/custom_loading_overlay.dart';
|
||||
|
@ -55,8 +52,11 @@ import '../../widgets/rounded_container.dart';
|
|||
import '../../widgets/rounded_white_container.dart';
|
||||
import '../../widgets/stack_dialog.dart';
|
||||
import '../../widgets/textfields/exchange_textfield.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'package:uuid/uuid.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';
|
||||
|
||||
class ExchangeForm extends ConsumerStatefulWidget {
|
||||
const ExchangeForm({
|
||||
|
@ -173,8 +173,9 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
.tryParse(
|
||||
value,
|
||||
locale: ref.read(localeServiceChangeNotifierProvider).locale,
|
||||
coin: Bitcoin(CryptoCurrencyNetwork
|
||||
.main), // dummy value (not used due to override)
|
||||
coin: Bitcoin(
|
||||
CryptoCurrencyNetwork.main,
|
||||
), // dummy value (not used due to override)
|
||||
overrideWithDecimalPlacesFromString: true,
|
||||
)
|
||||
?.decimal;
|
||||
|
@ -184,15 +185,17 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
final rateType = ref.read(efRateTypeProvider);
|
||||
final currencies = await ExchangeDataLoadingService.instance.isar.currencies
|
||||
.filter()
|
||||
.group((q) => rateType == ExchangeRateType.fixed
|
||||
? q
|
||||
.rateTypeEqualTo(SupportedRateType.both)
|
||||
.or()
|
||||
.rateTypeEqualTo(SupportedRateType.fixed)
|
||||
: q
|
||||
.rateTypeEqualTo(SupportedRateType.both)
|
||||
.or()
|
||||
.rateTypeEqualTo(SupportedRateType.estimated))
|
||||
.group(
|
||||
(q) => rateType == ExchangeRateType.fixed
|
||||
? q
|
||||
.rateTypeEqualTo(SupportedRateType.both)
|
||||
.or()
|
||||
.rateTypeEqualTo(SupportedRateType.fixed)
|
||||
: q
|
||||
.rateTypeEqualTo(SupportedRateType.both)
|
||||
.or()
|
||||
.rateTypeEqualTo(SupportedRateType.estimated),
|
||||
)
|
||||
.and()
|
||||
.tickerEqualTo(
|
||||
currency.ticker,
|
||||
|
@ -364,7 +367,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
],
|
||||
),
|
||||
);
|
||||
})
|
||||
},
|
||||
)
|
||||
: await Navigator.of(context).push(
|
||||
MaterialPageRoute<dynamic>(
|
||||
builder: (_) => ExchangeCurrencySelectionView(
|
||||
|
@ -489,7 +493,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -949,7 +953,8 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
),
|
||||
ExchangeTextField(
|
||||
key: Key(
|
||||
"exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeId}"),
|
||||
"exchangeTextFieldKeyFor1_${Theme.of(context).extension<StackColors>()!.themeId}",
|
||||
),
|
||||
focusNode: _receiveFocusNode,
|
||||
controller: _receiveController,
|
||||
textStyle: STextStyles.smallMed14(context).copyWith(
|
||||
|
@ -1011,7 +1016,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
enabled: ref.watch(efCanExchangeProvider),
|
||||
onPressed: onExchangePressed,
|
||||
label: "Swap",
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../providers/exchange/changenow_initial_load_status.dart';
|
||||
import '../../themes/stack_colors.dart';
|
||||
import '../../utilities/text_styles.dart';
|
||||
|
@ -18,9 +19,9 @@ import '../../widgets/stack_dialog.dart';
|
|||
|
||||
class ExchangeLoadingOverlayView extends ConsumerStatefulWidget {
|
||||
const ExchangeLoadingOverlayView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.unawaitedLoad,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final VoidCallback unawaitedLoad;
|
||||
|
||||
|
@ -80,7 +81,9 @@ class _ExchangeLoadingOverlayViewState
|
|||
.overlay
|
||||
.withOpacity(0.7),
|
||||
child: const CustomLoadingOverlay(
|
||||
message: "Loading Exchange data", eventBus: null),
|
||||
message: "Loading Exchange data",
|
||||
eventBus: null,
|
||||
),
|
||||
),
|
||||
if ((_statusEst == ChangeNowLoadStatus.failed ||
|
||||
_statusFixed == ChangeNowLoadStatus.failed) &&
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../models/exchange/incomplete_exchange.dart';
|
||||
import 'step_2_view.dart';
|
||||
import '../sub_widgets/step_row.dart';
|
||||
import '../../../themes/stack_colors.dart';
|
||||
import '../../../utilities/clipboard_interface.dart';
|
||||
import '../../../utilities/enums/exchange_rate_type_enum.dart';
|
||||
|
@ -19,13 +18,15 @@ import '../../../utilities/text_styles.dart';
|
|||
import '../../../widgets/background.dart';
|
||||
import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import '../../../widgets/rounded_white_container.dart';
|
||||
import '../sub_widgets/step_row.dart';
|
||||
import 'step_2_view.dart';
|
||||
|
||||
class Step1View extends StatefulWidget {
|
||||
const Step1View({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.model,
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/exchangeStep1";
|
||||
|
||||
|
@ -116,17 +117,19 @@ class _Step1ViewState extends State<Step1View> {
|
|||
"You send",
|
||||
style: STextStyles.itemSubtitle(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}",
|
||||
style: STextStyles.itemSubtitle12(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -142,17 +145,19 @@ class _Step1ViewState extends State<Step1View> {
|
|||
"You receive",
|
||||
style: STextStyles.itemSubtitle(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}",
|
||||
style: STextStyles.itemSubtitle12(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -179,9 +184,10 @@ class _Step1ViewState extends State<Step1View> {
|
|||
model.rateInfo,
|
||||
style: STextStyles.itemSubtitle12(context)
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.infoItemText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -193,8 +199,9 @@ class _Step1ViewState extends State<Step1View> {
|
|||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Step2View.routeName,
|
||||
arguments: model);
|
||||
Step2View.routeName,
|
||||
arguments: model,
|
||||
);
|
||||
},
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
|
|
@ -42,11 +42,11 @@ import 'step_3_view.dart';
|
|||
|
||||
class Step2View extends ConsumerStatefulWidget {
|
||||
const Step2View({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.model,
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
this.barcodeScanner = const BarcodeScannerWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/exchangeStep2";
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../models/exchange/incomplete_exchange.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/providers.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/rounded_white_container.dart';
|
||||
import '../../../widgets/stack_dialog.dart';
|
||||
import '../sub_widgets/step_row.dart';
|
||||
import 'step_4_view.dart';
|
||||
|
||||
class Step3View extends ConsumerStatefulWidget {
|
||||
const Step3View({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.model,
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/exchangeStep3";
|
||||
|
||||
|
@ -127,7 +128,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Text(
|
||||
"${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -145,7 +146,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Text(
|
||||
"${model.receiveAmount.toString()} ${model.receiveTicker.toUpperCase()}",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -163,7 +164,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Text(
|
||||
model.rateInfo,
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -184,7 +185,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Text(
|
||||
model.recipientAddress!,
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -207,7 +208,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Text(
|
||||
model.refundAddress!,
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -321,22 +322,27 @@ class _Step3ViewState extends ConsumerState<Step3View> {
|
|||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
unawaited(NotificationApi.showNotification(
|
||||
changeNowId: model.trade!.tradeId,
|
||||
title: status,
|
||||
body: "Trade ID ${model.trade!.tradeId}",
|
||||
walletId: "",
|
||||
iconAssetName: Assets.svg.arrowRotate,
|
||||
date: model.trade!.timestamp,
|
||||
shouldWatchForUpdates: true,
|
||||
coinName: "coinName",
|
||||
));
|
||||
unawaited(
|
||||
NotificationApi.showNotification(
|
||||
changeNowId: model.trade!.tradeId,
|
||||
title: status,
|
||||
body:
|
||||
"Trade ID ${model.trade!.tradeId}",
|
||||
walletId: "",
|
||||
iconAssetName: Assets.svg.arrowRotate,
|
||||
date: model.trade!.timestamp,
|
||||
shouldWatchForUpdates: true,
|
||||
coinName: "coinName",
|
||||
),
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
Step4View.routeName,
|
||||
arguments: model,
|
||||
));
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
Step4View.routeName,
|
||||
arguments: model,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
style: Theme.of(context)
|
||||
|
|
|
@ -49,10 +49,10 @@ import '../sub_widgets/step_row.dart';
|
|||
|
||||
class Step4View extends ConsumerStatefulWidget {
|
||||
const Step4View({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.model,
|
||||
this.clipboard = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/exchangeStep4";
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../../db/isar/main_db.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/providers.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/custom_loading_overlay.dart';
|
||||
import '../../widgets/trade_card.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'exchange_form.dart';
|
||||
import 'trade_details_view.dart';
|
||||
|
||||
class ExchangeView extends ConsumerStatefulWidget {
|
||||
const ExchangeView({Key? key}) : super(key: key);
|
||||
const ExchangeView({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ExchangeView> createState() => _ExchangeViewState();
|
||||
|
@ -102,7 +103,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
|
|||
subMessage: "This could take a few minutes",
|
||||
eventBus: null,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
@ -124,7 +125,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
|
|||
child: ExchangeForm(),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
];
|
||||
},
|
||||
body: Builder(
|
||||
|
@ -169,63 +170,78 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
|
|||
),
|
||||
if (hasHistory)
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: TradeCard(
|
||||
key: Key("tradeCard_${trades[index].uuid}"),
|
||||
trade: trades[index],
|
||||
onTap: () async {
|
||||
final String tradeId = trades[index].tradeId;
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: TradeCard(
|
||||
key: Key("tradeCard_${trades[index].uuid}"),
|
||||
trade: trades[index],
|
||||
onTap: () async {
|
||||
final String tradeId = trades[index].tradeId;
|
||||
|
||||
final lookup = ref
|
||||
.read(tradeSentFromStackLookupProvider)
|
||||
.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);
|
||||
final lookup = ref
|
||||
.read(tradeSentFromStackLookupProvider)
|
||||
.all;
|
||||
|
||||
//todo: check if print needed
|
||||
// debugPrint("name: ${manager.walletName}");
|
||||
// debugPrint("ALL: $lookup");
|
||||
|
||||
final tx = await MainDB.instance
|
||||
.getTransactions(walletIds.first)
|
||||
.filter()
|
||||
.txidEqualTo(txid)
|
||||
.findFirst();
|
||||
final String? txid = ref
|
||||
.read(tradeSentFromStackLookupProvider)
|
||||
.getTxidForTradeId(tradeId);
|
||||
final List<String>? walletIds = ref
|
||||
.read(tradeSentFromStackLookupProvider)
|
||||
.getWalletIdsForTradeId(tradeId);
|
||||
|
||||
if (mounted) {
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
TradeDetailsView.routeName,
|
||||
arguments: Tuple4(tradeId, tx,
|
||||
walletIds.first, wallet.info.name),
|
||||
));
|
||||
if (txid != null &&
|
||||
walletIds != null &&
|
||||
walletIds.isNotEmpty) {
|
||||
final wallet = ref
|
||||
.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)
|
||||
SliverToBoxAdapter(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue