mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
Merge remote-tracking branch 'origin_SW/staging' into nano_rep_change
This commit is contained in:
commit
9369ae15ec
6 changed files with 56 additions and 20 deletions
|
@ -2341,8 +2341,6 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
|
||||
// Added some future proof params in case we want to add anything else
|
||||
// This should provide some buffer in stead of creating assetsV4 etc
|
||||
@Name("otherStringParam1")
|
||||
late final String? dummy1;
|
||||
@Name("otherStringParam2")
|
||||
late final String? dummy2;
|
||||
@Name("otherStringParam3")
|
||||
|
@ -2388,6 +2386,19 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
Map<Coin, String>? _coinCardImages;
|
||||
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();
|
||||
|
||||
factory ThemeAssetsV3.fromJson({
|
||||
|
@ -2443,13 +2454,18 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
Map<String, dynamic>.from(json["coins"]["cards"] as Map),
|
||||
)
|
||||
: null
|
||||
..coinCardFavoritesImagesString = json["coins"]["favoriteCards"] is Map
|
||||
? createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map),
|
||||
)
|
||||
: null
|
||||
..loadingGifRelative = json["loading_gif"] is String
|
||||
? "$themeId/assets/${json["loading_gif"] as String}"
|
||||
: null
|
||||
..backgroundRelative = json["background"] is String
|
||||
? "$themeId/assets/${json["background"] as String}"
|
||||
: null
|
||||
..dummy1 = null
|
||||
..dummy2 = null
|
||||
..dummy3 = null;
|
||||
}
|
||||
|
@ -2528,6 +2544,7 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
'coinImages: $coinImages, '
|
||||
'coinSecondaryImages: $coinSecondaryImages, '
|
||||
'coinCardImages: $coinCardImages'
|
||||
'coinCardFavoritesImages: $coinCardFavoritesImages'
|
||||
')';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29626,7 +29626,7 @@ int _themeAssetsV3EstimateSize(
|
|||
}
|
||||
}
|
||||
{
|
||||
final value = object.dummy1;
|
||||
final value = object.coinCardFavoritesImagesString;
|
||||
if (value != null) {
|
||||
bytesCount += 3 + value.length * 3;
|
||||
}
|
||||
|
@ -29677,7 +29677,7 @@ void _themeAssetsV3Serialize(
|
|||
writer.writeString(offsets[7], object.coinSecondaryImagesString);
|
||||
writer.writeString(offsets[8], object.exchangeRelative);
|
||||
writer.writeString(offsets[9], object.loadingGifRelative);
|
||||
writer.writeString(offsets[10], object.dummy1);
|
||||
writer.writeString(offsets[10], object.coinCardFavoritesImagesString);
|
||||
writer.writeString(offsets[11], object.dummy2);
|
||||
writer.writeString(offsets[12], object.dummy3);
|
||||
writer.writeString(offsets[13], object.personaEasyRelative);
|
||||
|
@ -29714,7 +29714,7 @@ ThemeAssetsV3 _themeAssetsV3Deserialize(
|
|||
object.coinSecondaryImagesString = reader.readString(offsets[7]);
|
||||
object.exchangeRelative = reader.readString(offsets[8]);
|
||||
object.loadingGifRelative = reader.readStringOrNull(offsets[9]);
|
||||
object.dummy1 = reader.readStringOrNull(offsets[10]);
|
||||
object.coinCardFavoritesImagesString = reader.readStringOrNull(offsets[10]);
|
||||
object.dummy2 = reader.readStringOrNull(offsets[11]);
|
||||
object.dummy3 = reader.readStringOrNull(offsets[12]);
|
||||
object.personaEasyRelative = reader.readString(offsets[13]);
|
||||
|
@ -31224,7 +31224,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1IsNull() {
|
||||
coinCardFavoritesImagesStringIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const FilterCondition.isNull(
|
||||
property: r'otherStringParam1',
|
||||
|
@ -31233,7 +31233,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1IsNotNull() {
|
||||
coinCardFavoritesImagesStringIsNotNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const FilterCondition.isNotNull(
|
||||
property: r'otherStringParam1',
|
||||
|
@ -31242,7 +31242,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1EqualTo(
|
||||
coinCardFavoritesImagesStringEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
|
@ -31256,7 +31256,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1GreaterThan(
|
||||
coinCardFavoritesImagesStringGreaterThan(
|
||||
String? value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
|
@ -31272,7 +31272,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1LessThan(
|
||||
coinCardFavoritesImagesStringLessThan(
|
||||
String? value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
|
@ -31288,7 +31288,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1Between(
|
||||
coinCardFavoritesImagesStringBetween(
|
||||
String? lower,
|
||||
String? upper, {
|
||||
bool includeLower = true,
|
||||
|
@ -31308,7 +31308,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1StartsWith(
|
||||
coinCardFavoritesImagesStringStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
|
@ -31322,7 +31322,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1EndsWith(
|
||||
coinCardFavoritesImagesStringEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
|
@ -31336,7 +31336,8 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1Contains(String value, {bool caseSensitive = true}) {
|
||||
coinCardFavoritesImagesStringContains(String value,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.contains(
|
||||
property: r'otherStringParam1',
|
||||
|
@ -31347,7 +31348,8 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1Matches(String pattern, {bool caseSensitive = true}) {
|
||||
coinCardFavoritesImagesStringMatches(String pattern,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.matches(
|
||||
property: r'otherStringParam1',
|
||||
|
@ -31358,7 +31360,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1IsEmpty() {
|
||||
coinCardFavoritesImagesStringIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'otherStringParam1',
|
||||
|
@ -31368,7 +31370,7 @@ extension ThemeAssetsV3QueryFilter
|
|||
}
|
||||
|
||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||
dummy1IsNotEmpty() {
|
||||
coinCardFavoritesImagesStringIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
property: r'otherStringParam1',
|
||||
|
|
|
@ -52,6 +52,7 @@ class WalletSummary extends StatelessWidget {
|
|||
walletId: walletId,
|
||||
width: constraints.maxWidth,
|
||||
height: constraints.maxHeight,
|
||||
isFavorite: false,
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Padding(
|
||||
|
|
|
@ -149,6 +149,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
walletId: widget.walletId,
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
isFavorite: true,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
|
|
|
@ -22,3 +22,14 @@ final coinCardProvider = Provider.family<String?, Coin>((ref, coin) {
|
|||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
final coinCardFavoritesProvider = Provider.family<String?, Coin>((ref, coin) {
|
||||
final assets = ref.watch(themeAssetsProvider);
|
||||
|
||||
if (assets is ThemeAssetsV3) {
|
||||
return assets.coinCardFavoritesImages?[coin.mainNetVersion] ??
|
||||
assets.coinCardImages?[coin.mainNetVersion];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,11 +25,13 @@ class CoinCard extends ConsumerWidget {
|
|||
required this.walletId,
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.isFavorite,
|
||||
});
|
||||
|
||||
final String walletId;
|
||||
final double width;
|
||||
final double height;
|
||||
final bool isFavorite;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
@ -38,7 +40,7 @@ class CoinCard extends ConsumerWidget {
|
|||
.select((value) => value.getManager(walletId).coin),
|
||||
);
|
||||
|
||||
final bool hasCardImageBg = ref.watch(coinCardProvider(coin)) != null;
|
||||
final bool hasCardImageBg = (isFavorite) ? ref.watch(coinCardFavoritesProvider(coin)) != null : ref.watch(coinCardProvider(coin)) != null;
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
|
@ -54,7 +56,9 @@ class CoinCard extends ConsumerWidget {
|
|||
fit: BoxFit.cover,
|
||||
image: FileImage(
|
||||
File(
|
||||
ref.watch(coinCardProvider(coin))!,
|
||||
(isFavorite)
|
||||
? ref.watch(coinCardFavoritesProvider(coin))!
|
||||
: ref.watch(coinCardProvider(coin))!,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue