mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-30 14:15:52 +00:00
use EthTokenIcon class
This commit is contained in:
parent
6e5cffa4d4
commit
a9306e5267
3 changed files with 14 additions and 18 deletions
|
@ -15,6 +15,7 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/background.dart';
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/icon_widgets/eth_token_icon.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
final tokenServiceStateProvider = StateProvider<EthTokenWallet?>((ref) => null);
|
final tokenServiceStateProvider = StateProvider<EthTokenWallet?>((ref) => null);
|
||||||
|
@ -76,13 +77,13 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(
|
EthTokenIcon(
|
||||||
Assets.svg.iconForToken(
|
contractAddress: ref.watch(
|
||||||
contractAddress: ref.watch(
|
tokenServiceProvider.select(
|
||||||
tokenServiceProvider.select(
|
(value) => value!.tokenContract.address,
|
||||||
(value) => value!.tokenContract.address))),
|
),
|
||||||
width: 24,
|
),
|
||||||
height: 24,
|
size: 24,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
|
|
|
@ -344,13 +344,6 @@ class _SVG {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String iconForToken({required String contractAddress}) {
|
|
||||||
switch (contractAddress) {
|
|
||||||
default:
|
|
||||||
return ethereum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// big icons
|
// big icons
|
||||||
String bitcoinImage(BuildContext context) => "${_path(context)}/bitcoin.svg";
|
String bitcoinImage(BuildContext context) => "${_path(context)}/bitcoin.svg";
|
||||||
String bitcoincashImage(BuildContext context) =>
|
String bitcoincashImage(BuildContext context) =>
|
||||||
|
|
|
@ -10,9 +10,11 @@ class EthTokenIcon extends StatefulWidget {
|
||||||
const EthTokenIcon({
|
const EthTokenIcon({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.contractAddress,
|
required this.contractAddress,
|
||||||
|
this.size = 22,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final String contractAddress;
|
final String contractAddress;
|
||||||
|
final double size;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EthTokenIcon> createState() => _EthTokenIconState();
|
State<EthTokenIcon> createState() => _EthTokenIconState();
|
||||||
|
@ -37,14 +39,14 @@ class _EthTokenIconState extends State<EthTokenIcon> {
|
||||||
if (imageUrl == null || imageUrl!.isEmpty) {
|
if (imageUrl == null || imageUrl!.isEmpty) {
|
||||||
return SvgPicture.asset(
|
return SvgPicture.asset(
|
||||||
Assets.svg.iconFor(coin: Coin.ethereum),
|
Assets.svg.iconFor(coin: Coin.ethereum),
|
||||||
width: 22,
|
width: widget.size,
|
||||||
height: 22,
|
height: widget.size,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return SvgPicture.network(
|
return SvgPicture.network(
|
||||||
imageUrl!,
|
imageUrl!,
|
||||||
width: 22,
|
width: widget.size,
|
||||||
height: 22,
|
height: widget.size,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue