Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,10 +59,9 @@ class AppearanceSettingsView extends ConsumerWidget {
child: Consumer(
builder: (_, ref, __) {
return RawMaterialButton(
splashColor:
Theme.of(
context,
).extension<StackColors>()!.highlight,
splashColor: Theme.of(
context,
).extension<StackColors>()!.highlight,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
Expand DownExpand Up@@ -91,17 +90,78 @@ class AppearanceSettingsView extends ConsumerWidget {
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider.select(
(value) =>
value.showFavoriteWallets,
),
prefsChangeNotifierProvider
.select(
(value) => value
.showFavoriteWallets,
),
),
onValueChanged: (newValue) {
ref
.read(
prefsChangeNotifierProvider,
)
.showFavoriteWallets = newValue;
.read(
prefsChangeNotifierProvider,
)
.showFavoriteWallets =
newValue;
},
),
),
],
),
),
);
},
),
),
const SizedBox(height: 10),
RoundedWhiteContainer(
child: Consumer(
builder: (_, ref, __) {
return RawMaterialButton(
splashColor: Theme.of(
context,
).extension<StackColors>()!.highlight,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
onPressed: null,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Hide balances",
style: STextStyles.titleBold12(
context,
),
textAlign: TextAlign.left,
),
SizedBox(
height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider
.select(
(value) =>
value.hideBalances,
),
),
onValueChanged: (newValue) {
ref
.read(
prefsChangeNotifierProvider,
)
.hideBalances =
newValue;
},
),
),
Expand Down
49 changes: 31 additions & 18 deletions lib/pages/token_view/sub_widgets/token_summary.dart
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@ import '../../../wallets/isar/providers/eth/token_balance_provider.dart';
import '../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../widgets/coin_ticker_tag.dart';
import '../../../widgets/conditional_parent.dart';
import '../../../widgets/hideable_balance.dart';
import '../../../widgets/rounded_container.dart';
import '../../buy_view/buy_in_wallet_view.dart';
import '../../exchange_view/wallet_initiated_exchange_view.dart';
Expand DownExpand Up@@ -104,18 +105,24 @@ class TokenSummary extends ConsumerWidget {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
ref
.watch(
pAmountFormatter(
Ethereum(CryptoCurrencyNetwork.main),
),
)
.format(balance.total, tokenContract: token),
style: STextStyles.pageTitleH1(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
HideableBalance(
iconColor: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
iconSize: 24,
child: Text(
ref
.watch(
pAmountFormatter(
Ethereum(CryptoCurrencyNetwork.main),
),
)
.format(balance.total, tokenContract: token),
style: STextStyles.pageTitleH1(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
),
),
),
const SizedBox(width: 10),
Expand All@@ -128,12 +135,18 @@ class TokenSummary extends ConsumerWidget {
),
if (price != null) const SizedBox(height: 6),
if (price != null)
Text(
"${(balance.total.decimal * price).toAmount(fractionDigits: 2).fiatString(locale: ref.watch(localeServiceChangeNotifierProvider.select((value) => value.locale)))} ${ref.watch(prefsChangeNotifierProvider.select((value) => value.currency))}",
style: STextStyles.subtitle500(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
HideableBalance(
iconColor: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
iconSize: 16,
child: Text(
"${(balance.total.decimal * price).toAmount(fractionDigits: 2).fiatString(locale: ref.watch(localeServiceChangeNotifierProvider.select((value) => value.locale)))} ${ref.watch(prefsChangeNotifierProvider.select((value) => value.currency))}",
style: STextStyles.subtitle500(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.tokenSummaryTextPrimary,
),
),
),
const SizedBox(height: 20),
Expand Down
94 changes: 51 additions & 43 deletions lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@ import '../../../wallets/crypto_currency/coins/firo.dart';
import '../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../wallets/wallet/impl/banano_wallet.dart';
import '../../../widgets/conditional_parent.dart';
import '../../../widgets/hideable_balance.dart';
import 'wallet_balance_toggle_sheet.dart';
import 'wallet_refresh_button.dart';

Expand DownExpand Up@@ -101,10 +102,9 @@ class WalletSummaryInfo extends ConsumerWidget {
"${_showAvailable ? "Available" : "Full"} ${type.name.capitalize()} balance";
switch (type) {
case BalanceType.private:
final balance =
coin is Firo
? ref.watch(pWalletBalanceTertiary(walletId))
: ref.watch(pWalletBalanceSecondary(walletId));
final balance = coin is Firo
? ref.watch(pWalletBalanceTertiary(walletId))
: ref.watch(pWalletBalanceSecondary(walletId));
balanceToShow = _showAvailable ? balance.spendable : balance.total;
break;

Expand All@@ -122,23 +122,21 @@ class WalletSummaryInfo extends ConsumerWidget {
List<int>? imageBytes;

if (coin is Banano) {
imageBytes =
(ref.watch(pWallets).getWallet(walletId) as BananoWallet)
.getMonkeyImageBytes();
imageBytes = (ref.watch(pWallets).getWallet(walletId) as BananoWallet)
.getMonkeyImageBytes();
}

return ConditionalParent(
condition: imageBytes != null,
builder:
(child) => Stack(
children: [
Positioned.fill(
left: 150.0,
child: SvgPicture.memory(Uint8List.fromList(imageBytes!)),
),
child,
],
builder: (child) => Stack(
children: [
Positioned.fill(
left: 150.0,
child: SvgPicture.memory(Uint8List.fromList(imageBytes!)),
),
child,
],
),
child: Row(
children: [
Expanded(
Expand All@@ -151,12 +149,14 @@ class WalletSummaryInfo extends ConsumerWidget {
if (ref.read(walletBalanceToggleStateProvider) ==
WalletBalanceToggleState.available) {
ref
.read(walletBalanceToggleStateProvider.notifier)
.state = WalletBalanceToggleState.full;
.read(walletBalanceToggleStateProvider.notifier)
.state =
WalletBalanceToggleState.full;
} else {
ref
.read(walletBalanceToggleStateProvider.notifier)
.state = WalletBalanceToggleState.available;
.read(walletBalanceToggleStateProvider.notifier)
.state =
WalletBalanceToggleState.available;
}
} else {
showSheet(context);
Expand All@@ -167,20 +167,18 @@ class WalletSummaryInfo extends ConsumerWidget {
Text(
title,
style: STextStyles.subtitle500(context).copyWith(
color:
Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
color: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
),
),
if (!toggleBalance) ...[
const SizedBox(width: 4),
SvgPicture.asset(
Assets.svg.chevronDown,
color:
Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
color: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
width: 8,
height: 4,
),
Expand All@@ -206,25 +204,35 @@ class WalletSummaryInfo extends ConsumerWidget {
const Spacer(),
FittedBox(
fit: BoxFit.scaleDown,
child: SelectableText(
ref.watch(pAmountFormatter(coin)).format(balanceToShow),
style: STextStyles.pageTitleH1(context).copyWith(
fontSize: 24,
color:
Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
child: HideableBalance(
iconColor: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
iconSize: 24,
child: SelectableText(
ref.watch(pAmountFormatter(coin)).format(balanceToShow),
style: STextStyles.pageTitleH1(context).copyWith(
fontSize: 24,
color: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
),
),
),
),
if (price != null)
Text(
"${(price.value * balanceToShow.decimal).toAmount(fractionDigits: 2).fiatString(locale: locale)} $baseCurrency",
style: STextStyles.subtitle500(context).copyWith(
color:
Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
HideableBalance(
iconColor: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
iconSize: 16,
child: Text(
"${(price.value * balanceToShow.decimal).toAmount(fractionDigits: 2).fiatString(locale: locale)} $baseCurrency",
style: STextStyles.subtitle500(context).copyWith(
color: Theme.of(
context,
).extension<StackColors>()!.textFavoriteCard,
),
),
),
],
Expand Down
Loading
Loading