mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
WIP: added cardFavoriteImages + check if card should be favorites or wallet
This commit is contained in:
parent
308f982593
commit
480f637670
5 changed files with 40 additions and 5 deletions
|
@ -2310,8 +2310,6 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
|
|
||||||
// Added some future proof params in case we want to add anything else
|
// Added some future proof params in case we want to add anything else
|
||||||
// This should provide some buffer in stead of creating assetsV4 etc
|
// This should provide some buffer in stead of creating assetsV4 etc
|
||||||
@Name("otherStringParam1")
|
|
||||||
late final String? dummy1;
|
|
||||||
@Name("otherStringParam2")
|
@Name("otherStringParam2")
|
||||||
late final String? dummy2;
|
late final String? dummy2;
|
||||||
@Name("otherStringParam3")
|
@Name("otherStringParam3")
|
||||||
|
@ -2357,6 +2355,20 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
Map<Coin, String>? _coinCardImages;
|
Map<Coin, String>? _coinCardImages;
|
||||||
late final String? coinCardImagesString;
|
late final String? coinCardImagesString;
|
||||||
|
|
||||||
|
|
||||||
|
@ignore
|
||||||
|
Map<Coin, String>? get coinCardFavoritesImages =>
|
||||||
|
_coinCardFavoritesImages ??= coinCardFavoritesImagesString == null
|
||||||
|
? null
|
||||||
|
: parseCoinAssetsString(
|
||||||
|
coinCardFavoritesImagesString!,
|
||||||
|
placeHolder: coinPlaceholder,
|
||||||
|
);
|
||||||
|
@ignore
|
||||||
|
Map<Coin, String>? _coinCardFavoritesImages;
|
||||||
|
@Name("otherStringParam1")
|
||||||
|
late final String? coinCardFavoritesImagesString;
|
||||||
|
|
||||||
ThemeAssetsV3();
|
ThemeAssetsV3();
|
||||||
|
|
||||||
factory ThemeAssetsV3.fromJson({
|
factory ThemeAssetsV3.fromJson({
|
||||||
|
@ -2421,13 +2433,18 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
Map<String, dynamic>.from(json["coins"]["cards"] as Map),
|
Map<String, dynamic>.from(json["coins"]["cards"] as Map),
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
|
..coinCardFavoritesImagesString = json["coins"]["favoriteCards"] is Map
|
||||||
|
? createCoinAssetsString(
|
||||||
|
"$applicationThemesDirectoryPath/$themeId/assets",
|
||||||
|
Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map),
|
||||||
|
)
|
||||||
|
: null
|
||||||
..loadingGif = json["loading_gif"] is String
|
..loadingGif = json["loading_gif"] is String
|
||||||
? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}"
|
? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}"
|
||||||
: null
|
: null
|
||||||
..background = json["background"] is String
|
..background = json["background"] is String
|
||||||
? "$applicationThemesDirectoryPath/$themeId/assets/${json["background"] as String}"
|
? "$applicationThemesDirectoryPath/$themeId/assets/${json["background"] as String}"
|
||||||
: null
|
: null
|
||||||
..dummy1 = null
|
|
||||||
..dummy2 = null
|
..dummy2 = null
|
||||||
..dummy3 = null;
|
..dummy3 = null;
|
||||||
}
|
}
|
||||||
|
@ -2483,7 +2500,8 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
'coinIcons: $coinIcons, '
|
'coinIcons: $coinIcons, '
|
||||||
'coinImages: $coinImages, '
|
'coinImages: $coinImages, '
|
||||||
'coinSecondaryImages: $coinSecondaryImages, '
|
'coinSecondaryImages: $coinSecondaryImages, '
|
||||||
'coinCardImages: $coinCardImages'
|
'coinCardWalletImages: $coinCardImages'
|
||||||
|
'coinCardFavoritesImages: $coinCardFavoritesImages'
|
||||||
')';
|
')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ class WalletSummary extends StatelessWidget {
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
width: constraints.maxWidth,
|
width: constraints.maxWidth,
|
||||||
height: constraints.maxHeight,
|
height: constraints.maxHeight,
|
||||||
|
isFavorite: false,
|
||||||
),
|
),
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
|
@ -149,6 +149,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
height: widget.height,
|
height: widget.height,
|
||||||
|
isFavorite: false,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
|
|
@ -22,3 +22,13 @@ final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final coinCardFavoritesProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||||
|
final assets = ref.watch(themeAssetsProvider);
|
||||||
|
|
||||||
|
if (assets is ThemeAssetsV3) {
|
||||||
|
return assets.coinCardFavoritesImages?[coin.mainNetVersion];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -25,11 +25,13 @@ class CoinCard extends ConsumerWidget {
|
||||||
required this.walletId,
|
required this.walletId,
|
||||||
required this.width,
|
required this.width,
|
||||||
required this.height,
|
required this.height,
|
||||||
|
required this.isFavorite,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String walletId;
|
final String walletId;
|
||||||
final double width;
|
final double width;
|
||||||
final double height;
|
final double height;
|
||||||
|
final bool isFavorite;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
@ -39,6 +41,7 @@ class CoinCard extends ConsumerWidget {
|
||||||
);
|
);
|
||||||
|
|
||||||
final bool hasCardImageBg = ref.watch(coinCardProvider(coin)) != null;
|
final bool hasCardImageBg = ref.watch(coinCardProvider(coin)) != null;
|
||||||
|
final isFavorite = false;
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
|
@ -54,7 +57,9 @@ class CoinCard extends ConsumerWidget {
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
image: FileImage(
|
image: FileImage(
|
||||||
File(
|
File(
|
||||||
ref.watch(coinCardProvider(coin))!,
|
(isFavorite)
|
||||||
|
? ref.watch(coinCardFavoritesProvider(coin))!
|
||||||
|
: ref.watch(coinCardProvider(coin))!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue