mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-26 21:39:21 +00:00
127 lines
3.4 KiB
Dart
127 lines
3.4 KiB
Dart
/*
|
|
* This file is part of Stack Wallet.
|
|
*
|
|
* Copyright (c) 2023 Cypher Stack
|
|
* All Rights Reserved.
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
*
|
|
*/
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import '../themes/coin_card_provider.dart';
|
|
import '../themes/theme_providers.dart';
|
|
import '../utilities/assets.dart';
|
|
import '../utilities/constants.dart';
|
|
import '../wallets/isar/providers/wallet_info_provider.dart';
|
|
|
|
class CoinCard extends ConsumerWidget {
|
|
const CoinCard({
|
|
super.key,
|
|
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) {
|
|
final coin = ref.watch(pWalletCoin(walletId));
|
|
|
|
final bool hasCardImageBg = (isFavorite)
|
|
? ref.watch(coinCardFavoritesProvider(coin)) != null
|
|
: ref.watch(coinCardProvider(coin)) != null;
|
|
|
|
return Stack(
|
|
children: [
|
|
if (hasCardImageBg)
|
|
Container(
|
|
width: width,
|
|
height: height,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(
|
|
Constants.size.circularBorderRadius,
|
|
),
|
|
image: DecorationImage(
|
|
fit: BoxFit.cover,
|
|
image: FileImage(
|
|
File(
|
|
(isFavorite)
|
|
? ref.watch(coinCardFavoritesProvider(coin))!
|
|
: ref.watch(coinCardProvider(coin))!,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
if (!hasCardImageBg)
|
|
Container(
|
|
width: width,
|
|
height: height,
|
|
decoration: BoxDecoration(
|
|
color: ref.watch(pCoinColor(coin)),
|
|
borderRadius: BorderRadius.circular(
|
|
Constants.size.circularBorderRadius,
|
|
),
|
|
),
|
|
),
|
|
if (!hasCardImageBg)
|
|
Column(
|
|
children: [
|
|
const Spacer(),
|
|
SizedBox(
|
|
height: width * 0.3,
|
|
child: Row(
|
|
children: [
|
|
const Spacer(
|
|
flex: 9,
|
|
),
|
|
SvgPicture.asset(
|
|
Assets.svg.ellipse2,
|
|
height: width * 0.3,
|
|
),
|
|
// ),
|
|
const Spacer(
|
|
flex: 2,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
if (!hasCardImageBg)
|
|
Row(
|
|
children: [
|
|
const Spacer(
|
|
flex: 5,
|
|
),
|
|
SizedBox(
|
|
width: width * 0.45,
|
|
child: Column(
|
|
children: [
|
|
SvgPicture.asset(
|
|
Assets.svg.ellipse1,
|
|
width: width * 0.45,
|
|
),
|
|
const Spacer(),
|
|
],
|
|
),
|
|
),
|
|
const Spacer(
|
|
flex: 1,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|