mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
fix coin card color
This commit is contained in:
parent
738cb55a40
commit
37cb83a2d4
7 changed files with 252 additions and 238 deletions
|
@ -13,11 +13,11 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/themes/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/box_shadow.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/gradient.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/string.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/stack_file_system.dart';
|
||||
|
||||
part 'stack_theme.g.dart';
|
||||
|
@ -1857,13 +1857,16 @@ class StackTheme {
|
|||
|
||||
final Map<Coin, Color> result = {};
|
||||
|
||||
for (final coin in Coin.values) {
|
||||
for (final coin in Coin.values.map((e) => e.mainNetVersion)) {
|
||||
if (map[coin.name] is String) {
|
||||
result[coin] = Color(
|
||||
(map[coin.name] as String).toBigIntFromHex.toInt(),
|
||||
);
|
||||
} else {
|
||||
result[coin] = kCoinThemeColorDefaults.forCoin(coin);
|
||||
Logging.instance.log(
|
||||
"Color not found in theme for $coin",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'package:stackwallet/widgets/coin_card.dart';
|
|||
|
||||
class WalletSummary extends StatelessWidget {
|
||||
const WalletSummary({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
required this.initialSyncStatus,
|
||||
this.aspectRatio = 2.0,
|
||||
|
@ -23,7 +23,7 @@ class WalletSummary extends StatelessWidget {
|
|||
this.minWidth = 200.0,
|
||||
this.maxHeight = 250.0,
|
||||
this.maxWidth = 400.0,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String walletId;
|
||||
final WalletSyncStatus initialSyncStatus;
|
||||
|
|
|
@ -63,18 +63,21 @@ class WalletSummaryInfo extends ConsumerWidget {
|
|||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final externalCalls = ref.watch(
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls));
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls),
|
||||
);
|
||||
final coin = ref.watch(pWalletCoin(walletId));
|
||||
final balance = ref.watch(pWalletBalance(walletId));
|
||||
|
||||
final locale = ref.watch(
|
||||
localeServiceChangeNotifierProvider.select((value) => value.locale));
|
||||
localeServiceChangeNotifierProvider.select((value) => value.locale),
|
||||
);
|
||||
|
||||
final baseCurrency = ref
|
||||
.watch(prefsChangeNotifierProvider.select((value) => value.currency));
|
||||
|
||||
final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider
|
||||
.select((value) => value.getPrice(coin)));
|
||||
final priceTuple = ref.watch(
|
||||
priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin)),
|
||||
);
|
||||
|
||||
final _showAvailable =
|
||||
ref.watch(walletBalanceToggleStateProvider.state).state ==
|
||||
|
@ -206,7 +209,7 @@ class WalletSummaryInfo extends ConsumerWidget {
|
|||
initialSyncStatus: initialSyncStatus,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -99,11 +99,11 @@ import 'package:tuple/tuple.dart';
|
|||
/// [eventBus] should only be set during testing
|
||||
class WalletView extends ConsumerStatefulWidget {
|
||||
const WalletView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
this.eventBus,
|
||||
this.clipboardInterface = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/wallet";
|
||||
static const double navBarHeight = 65.0;
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/themes/theme_service.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
||||
final applicationThemesDirectoryPathProvider = StateProvider((ref) => "");
|
||||
|
||||
|
@ -38,3 +40,11 @@ final themeAssetsProvider = StateProvider<IThemeAssets>(
|
|||
),
|
||||
),
|
||||
);
|
||||
|
||||
final pCoinColor = StateProvider.family<Color, Coin>(
|
||||
(ref, coin) =>
|
||||
ref.watch(
|
||||
themeProvider.select((value) => value.coinColors[coin.mainNetVersion]),
|
||||
) ??
|
||||
Colors.deepOrangeAccent,
|
||||
);
|
||||
|
|
|
@ -29,7 +29,7 @@ final pThemeService = Provider<ThemeService>((ref) {
|
|||
});
|
||||
|
||||
class ThemeService {
|
||||
static const _currentDefaultThemeVersion = 9;
|
||||
static const _currentDefaultThemeVersion = 10;
|
||||
ThemeService._();
|
||||
static ThemeService? _instance;
|
||||
static ThemeService get instance => _instance ??= ThemeService._();
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/themes/coin_card_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
|
@ -68,9 +68,7 @@ class CoinCard extends ConsumerWidget {
|
|||
width: width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.colorForCoin(coin),
|
||||
color: ref.watch(pCoinColor(coin)),
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue