mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
commit
54186520f2
10 changed files with 107 additions and 50 deletions
|
@ -338,6 +338,7 @@ class _ExchangeCurrencySelectionViewState
|
|||
coin.ticker.toLowerCase() == e.ticker.toLowerCase())
|
||||
.isNotEmpty)
|
||||
.toList(growable: false);
|
||||
items.sort((a, b) => a.name.compareTo(b.name));
|
||||
|
||||
return RoundedWhiteContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
|
@ -427,6 +428,7 @@ class _ExchangeCurrencySelectionViewState
|
|||
Flexible(
|
||||
child: Builder(builder: (context) {
|
||||
final filtered = filter(_searchString);
|
||||
filtered.sort((a, b) => a.name.compareTo(b.name));
|
||||
return RoundedWhiteContainer(
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: ListView.builder(
|
||||
|
|
|
@ -3,8 +3,11 @@ import 'dart:math';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||
|
||||
class LoadingView extends StatelessWidget {
|
||||
const LoadingView({Key? key}) : super(key: key);
|
||||
|
@ -12,18 +15,31 @@ class LoadingView extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
final width = min(size.width, size.height) * 0.5;
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||
body: Container(
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: min(size.width, size.height) * 0.5,
|
||||
child: Lottie.asset(
|
||||
Assets.lottie.test2,
|
||||
animate: true,
|
||||
repeat: true,
|
||||
child: ConditionalParent(
|
||||
condition:
|
||||
Theme.of(context).extension<StackColors>()!.themeType ==
|
||||
ThemeType.oledBlack,
|
||||
builder: (child) => RoundedContainer(
|
||||
color: const Color(0xFFDEDEDE),
|
||||
radiusMultiplier: 100,
|
||||
width: width * 1.35,
|
||||
height: width * 1.35,
|
||||
child: child,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: Lottie.asset(
|
||||
Assets.lottie.test2,
|
||||
animate: true,
|
||||
repeat: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
// child: Image(
|
||||
|
|
|
@ -125,14 +125,16 @@ class BitcoinWallet extends CoinServiceAPI
|
|||
getMnemonicString: () => mnemonicString,
|
||||
getMnemonicPassphrase: () => mnemonicPassphrase,
|
||||
getChainHeight: () => chainHeight,
|
||||
getCurrentChangeAddress: () => currentChangeAddressP2PKH,
|
||||
// getCurrentChangeAddress: () => currentChangeAddressP2PKH,
|
||||
getCurrentChangeAddress: () => currentChangeAddress,
|
||||
estimateTxFee: estimateTxFee,
|
||||
prepareSend: prepareSend,
|
||||
getTxCount: getTxCount,
|
||||
fetchBuildTxData: fetchBuildTxData,
|
||||
refresh: refresh,
|
||||
checkChangeAddressForTransactions:
|
||||
_checkP2PKHChangeAddressForTransactions,
|
||||
checkChangeAddressForTransactions: _checkChangeAddressForTransactions,
|
||||
// checkChangeAddressForTransactions:
|
||||
// _checkP2PKHChangeAddressForTransactions,
|
||||
addDerivation: addDerivation,
|
||||
dustLimitP2PKH: DUST_LIMIT_P2PKH,
|
||||
minConfirms: MINIMUM_CONFIRMATIONS,
|
||||
|
@ -1016,6 +1018,7 @@ class BitcoinWallet extends CoinServiceAPI
|
|||
if (currentHeight != storedHeight) {
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.2, walletId));
|
||||
await _checkChangeAddressForTransactions();
|
||||
await _checkP2PKHChangeAddressForTransactions();
|
||||
|
||||
GlobalEventBus.instance.fire(RefreshPercentChangedEvent(0.3, walletId));
|
||||
await _checkCurrentReceivingAddressesForTransactions();
|
||||
|
|
|
@ -22,8 +22,14 @@ class MajesticBankExchange extends Exchange {
|
|||
static const exchangeName = "Majestic Bank";
|
||||
|
||||
static const kMajesticBankCurrencyNames = {
|
||||
"BCH": "Bitcoin Cash",
|
||||
"BTC": "Bitcoin",
|
||||
"DOGE": "Dogecoin",
|
||||
"EPIC": "Epic Cash",
|
||||
"FIRO": "Firo",
|
||||
"LTC": "Litecoin",
|
||||
"NMC": "Namecoin",
|
||||
"PART": "Particl",
|
||||
"WOW": "Wownero",
|
||||
"XMR": "Monero",
|
||||
};
|
||||
|
|
|
@ -283,7 +283,7 @@ class OledBlackColors extends StackColorTheme {
|
|||
@override
|
||||
Color get infoItemText => const Color(0xFFDEDEDE);
|
||||
@override
|
||||
Color get infoItemIcons => const Color(0xFF5C94F4);
|
||||
Color get infoItemIcons => const Color(0xFFF26822); //const Color(0xFF5C94F4);
|
||||
|
||||
// popup
|
||||
@override
|
||||
|
@ -321,7 +321,8 @@ class OledBlackColors extends StackColorTheme {
|
|||
@override
|
||||
Color get myStackContactIconBG => const Color(0xFF747778);
|
||||
@override
|
||||
Color get textConfirmTotalAmount => const Color(0xFF144D35);
|
||||
Color get textConfirmTotalAmount =>
|
||||
textFieldSuccessLabel; //const Color(0xFF144D35);
|
||||
@override
|
||||
Color get textSelectedWordTableItem => const Color(0xFF143D8E);
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@ import 'package:decimal/decimal.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/animated_text.dart';
|
||||
|
||||
class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
||||
const WalletInfoRowBalanceFuture({Key? key, required this.walletId})
|
||||
|
@ -27,44 +28,23 @@ class WalletInfoRowBalanceFuture extends ConsumerWidget {
|
|||
),
|
||||
);
|
||||
|
||||
// TODO redo this widget now that its not actually a future
|
||||
return FutureBuilder(
|
||||
future: Future(() => manager.balance.getTotal()),
|
||||
builder: (builderContext, AsyncSnapshot<Decimal> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
return Text(
|
||||
"${Format.localizedStringAsFixed(
|
||||
value: snapshot.data!,
|
||||
locale: locale,
|
||||
decimalPlaces: 8,
|
||||
)} ${manager.coin.ticker}",
|
||||
style: Util.isDesktop
|
||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textSubtitle1,
|
||||
)
|
||||
: STextStyles.itemSubtitle(context),
|
||||
);
|
||||
} else {
|
||||
return AnimatedText(
|
||||
stringsToLoopThrough: const [
|
||||
"Loading balance",
|
||||
"Loading balance.",
|
||||
"Loading balance..",
|
||||
"Loading balance..."
|
||||
],
|
||||
style: Util.isDesktop
|
||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textSubtitle1,
|
||||
)
|
||||
: STextStyles.itemSubtitle(context),
|
||||
);
|
||||
}
|
||||
},
|
||||
Decimal balance = manager.balance.getTotal();
|
||||
|
||||
if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) {
|
||||
balance += (manager.wallet as FiroWallet).balancePrivate.getTotal();
|
||||
}
|
||||
|
||||
return Text(
|
||||
"${Format.localizedStringAsFixed(
|
||||
value: balance,
|
||||
locale: locale,
|
||||
decimalPlaces: Constants.decimalPlacesForCoin(manager.coin),
|
||||
)} ${manager.coin.ticker}",
|
||||
style: Util.isDesktop
|
||||
? STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textSubtitle1,
|
||||
)
|
||||
: STextStyles.itemSubtitle(context),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stackwallet/models/balance.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/my_stack_view/coin_wallets_table.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||
|
@ -34,6 +35,15 @@ void main() {
|
|||
|
||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
||||
when(wallet.balance).thenAnswer(
|
||||
(_) => Balance(
|
||||
coin: Coin.bitcoin,
|
||||
total: 0,
|
||||
spendable: 0,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: 0,
|
||||
),
|
||||
);
|
||||
|
||||
final manager = Manager(wallet);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart' as mockito;
|
||||
import 'package:stackwallet/models/balance.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||
|
@ -29,6 +30,15 @@ void main() {
|
|||
mockito
|
||||
.when(wallet.walletName)
|
||||
.thenAnswer((realInvocation) => "wallet name");
|
||||
mockito.when(wallet.balance).thenAnswer(
|
||||
(_) => Balance(
|
||||
coin: Coin.bitcoin,
|
||||
total: 0,
|
||||
spendable: 0,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: 0,
|
||||
),
|
||||
);
|
||||
|
||||
final wallets = MockWallets();
|
||||
final locale = MockLocaleService();
|
||||
|
@ -89,6 +99,15 @@ void main() {
|
|||
mockito
|
||||
.when(wallet.walletName)
|
||||
.thenAnswer((realInvocation) => "wallet name");
|
||||
mockito.when(wallet.balance).thenAnswer(
|
||||
(_) => Balance(
|
||||
coin: Coin.bitcoin,
|
||||
total: 0,
|
||||
spendable: 0,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: 0,
|
||||
),
|
||||
);
|
||||
|
||||
final wallets = MockWallets();
|
||||
final manager = Manager(wallet);
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stackwallet/models/balance.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||
|
@ -35,6 +36,15 @@ void main() {
|
|||
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||
when(wallet.balance).thenAnswer(
|
||||
(_) => Balance(
|
||||
coin: Coin.bitcoin,
|
||||
total: 0,
|
||||
spendable: 0,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: 0,
|
||||
),
|
||||
);
|
||||
|
||||
final manager = Manager(wallet);
|
||||
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stackwallet/models/balance.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||
|
@ -35,6 +36,15 @@ void main() {
|
|||
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||
when(wallet.balance).thenAnswer(
|
||||
(_) => Balance(
|
||||
coin: Coin.bitcoin,
|
||||
total: 0,
|
||||
spendable: 0,
|
||||
blockedTotal: 0,
|
||||
pendingSpendable: 0,
|
||||
),
|
||||
);
|
||||
|
||||
final manager = Manager(wallet);
|
||||
when(wallets.getManagerProvider("some-wallet-id")).thenAnswer(
|
||||
|
|
Loading…
Reference in a new issue