mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-20 22:28:48 +00:00
Merge pull request #619 from cypherstack/chan-cards
updated chan card images
This commit is contained in:
commit
82d2f33ade
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
|
// 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")
|
||||||
|
@ -2388,6 +2386,19 @@ 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({
|
||||||
|
@ -2443,13 +2454,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(
|
||||||
|
"$themeId/assets",
|
||||||
|
Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map),
|
||||||
|
)
|
||||||
|
: null
|
||||||
..loadingGifRelative = json["loading_gif"] is String
|
..loadingGifRelative = json["loading_gif"] is String
|
||||||
? "$themeId/assets/${json["loading_gif"] as String}"
|
? "$themeId/assets/${json["loading_gif"] as String}"
|
||||||
: null
|
: null
|
||||||
..backgroundRelative = json["background"] is String
|
..backgroundRelative = json["background"] is String
|
||||||
? "$themeId/assets/${json["background"] as String}"
|
? "$themeId/assets/${json["background"] as String}"
|
||||||
: null
|
: null
|
||||||
..dummy1 = null
|
|
||||||
..dummy2 = null
|
..dummy2 = null
|
||||||
..dummy3 = null;
|
..dummy3 = null;
|
||||||
}
|
}
|
||||||
|
@ -2528,6 +2544,7 @@ class ThemeAssetsV3 implements IThemeAssets {
|
||||||
'coinImages: $coinImages, '
|
'coinImages: $coinImages, '
|
||||||
'coinSecondaryImages: $coinSecondaryImages, '
|
'coinSecondaryImages: $coinSecondaryImages, '
|
||||||
'coinCardImages: $coinCardImages'
|
'coinCardImages: $coinCardImages'
|
||||||
|
'coinCardFavoritesImages: $coinCardFavoritesImages'
|
||||||
')';
|
')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29626,7 +29626,7 @@ int _themeAssetsV3EstimateSize(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
final value = object.dummy1;
|
final value = object.coinCardFavoritesImagesString;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
bytesCount += 3 + value.length * 3;
|
bytesCount += 3 + value.length * 3;
|
||||||
}
|
}
|
||||||
|
@ -29677,7 +29677,7 @@ void _themeAssetsV3Serialize(
|
||||||
writer.writeString(offsets[7], object.coinSecondaryImagesString);
|
writer.writeString(offsets[7], object.coinSecondaryImagesString);
|
||||||
writer.writeString(offsets[8], object.exchangeRelative);
|
writer.writeString(offsets[8], object.exchangeRelative);
|
||||||
writer.writeString(offsets[9], object.loadingGifRelative);
|
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[11], object.dummy2);
|
||||||
writer.writeString(offsets[12], object.dummy3);
|
writer.writeString(offsets[12], object.dummy3);
|
||||||
writer.writeString(offsets[13], object.personaEasyRelative);
|
writer.writeString(offsets[13], object.personaEasyRelative);
|
||||||
|
@ -29714,7 +29714,7 @@ ThemeAssetsV3 _themeAssetsV3Deserialize(
|
||||||
object.coinSecondaryImagesString = reader.readString(offsets[7]);
|
object.coinSecondaryImagesString = reader.readString(offsets[7]);
|
||||||
object.exchangeRelative = reader.readString(offsets[8]);
|
object.exchangeRelative = reader.readString(offsets[8]);
|
||||||
object.loadingGifRelative = reader.readStringOrNull(offsets[9]);
|
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.dummy2 = reader.readStringOrNull(offsets[11]);
|
||||||
object.dummy3 = reader.readStringOrNull(offsets[12]);
|
object.dummy3 = reader.readStringOrNull(offsets[12]);
|
||||||
object.personaEasyRelative = reader.readString(offsets[13]);
|
object.personaEasyRelative = reader.readString(offsets[13]);
|
||||||
|
@ -31224,7 +31224,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1IsNull() {
|
coinCardFavoritesImagesStringIsNull() {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(const FilterCondition.isNull(
|
return query.addFilterCondition(const FilterCondition.isNull(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
@ -31233,7 +31233,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1IsNotNull() {
|
coinCardFavoritesImagesStringIsNotNull() {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(const FilterCondition.isNotNull(
|
return query.addFilterCondition(const FilterCondition.isNotNull(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
@ -31242,7 +31242,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1EqualTo(
|
coinCardFavoritesImagesStringEqualTo(
|
||||||
String? value, {
|
String? value, {
|
||||||
bool caseSensitive = true,
|
bool caseSensitive = true,
|
||||||
}) {
|
}) {
|
||||||
|
@ -31256,7 +31256,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1GreaterThan(
|
coinCardFavoritesImagesStringGreaterThan(
|
||||||
String? value, {
|
String? value, {
|
||||||
bool include = false,
|
bool include = false,
|
||||||
bool caseSensitive = true,
|
bool caseSensitive = true,
|
||||||
|
@ -31272,7 +31272,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1LessThan(
|
coinCardFavoritesImagesStringLessThan(
|
||||||
String? value, {
|
String? value, {
|
||||||
bool include = false,
|
bool include = false,
|
||||||
bool caseSensitive = true,
|
bool caseSensitive = true,
|
||||||
|
@ -31288,7 +31288,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1Between(
|
coinCardFavoritesImagesStringBetween(
|
||||||
String? lower,
|
String? lower,
|
||||||
String? upper, {
|
String? upper, {
|
||||||
bool includeLower = true,
|
bool includeLower = true,
|
||||||
|
@ -31308,7 +31308,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1StartsWith(
|
coinCardFavoritesImagesStringStartsWith(
|
||||||
String value, {
|
String value, {
|
||||||
bool caseSensitive = true,
|
bool caseSensitive = true,
|
||||||
}) {
|
}) {
|
||||||
|
@ -31322,7 +31322,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1EndsWith(
|
coinCardFavoritesImagesStringEndsWith(
|
||||||
String value, {
|
String value, {
|
||||||
bool caseSensitive = true,
|
bool caseSensitive = true,
|
||||||
}) {
|
}) {
|
||||||
|
@ -31336,7 +31336,8 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1Contains(String value, {bool caseSensitive = true}) {
|
coinCardFavoritesImagesStringContains(String value,
|
||||||
|
{bool caseSensitive = true}) {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(FilterCondition.contains(
|
return query.addFilterCondition(FilterCondition.contains(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
@ -31347,7 +31348,8 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1Matches(String pattern, {bool caseSensitive = true}) {
|
coinCardFavoritesImagesStringMatches(String pattern,
|
||||||
|
{bool caseSensitive = true}) {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(FilterCondition.matches(
|
return query.addFilterCondition(FilterCondition.matches(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
@ -31358,7 +31360,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1IsEmpty() {
|
coinCardFavoritesImagesStringIsEmpty() {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(FilterCondition.equalTo(
|
return query.addFilterCondition(FilterCondition.equalTo(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
@ -31368,7 +31370,7 @@ extension ThemeAssetsV3QueryFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
QueryBuilder<ThemeAssetsV3, ThemeAssetsV3, QAfterFilterCondition>
|
||||||
dummy1IsNotEmpty() {
|
coinCardFavoritesImagesStringIsNotEmpty() {
|
||||||
return QueryBuilder.apply(this, (query) {
|
return QueryBuilder.apply(this, (query) {
|
||||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||||
property: r'otherStringParam1',
|
property: r'otherStringParam1',
|
||||||
|
|
|
@ -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: true,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
|
|
@ -22,3 +22,14 @@ 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] ??
|
||||||
|
assets.coinCardImages?[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) {
|
||||||
|
@ -38,7 +40,7 @@ class CoinCard extends ConsumerWidget {
|
||||||
.select((value) => value.getManager(walletId).coin),
|
.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(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
|
@ -54,7 +56,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