mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
fix: load secondary (ex. chan kiss) gif properly if exists
This commit is contained in:
parent
87bafa77c5
commit
e92501c38d
2 changed files with 56 additions and 18 deletions
|
@ -1,15 +1,18 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
|
import 'package:stackwallet/themes/coin_image_provider.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
|
|
||||||
class SendingTransactionDialog extends StatefulWidget {
|
class SendingTransactionDialog extends ConsumerStatefulWidget {
|
||||||
const SendingTransactionDialog({
|
const SendingTransactionDialog({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.coin,
|
required this.coin,
|
||||||
|
@ -20,10 +23,11 @@ class SendingTransactionDialog extends StatefulWidget {
|
||||||
final ProgressAndSuccessController controller;
|
final ProgressAndSuccessController controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SendingTransactionDialog> createState() => _RestoringDialogState();
|
ConsumerState<SendingTransactionDialog> createState() =>
|
||||||
|
_RestoringDialogState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RestoringDialogState extends State<SendingTransactionDialog> {
|
class _RestoringDialogState extends ConsumerState<SendingTransactionDialog> {
|
||||||
late ProgressAndSuccessController? _progressAndSuccessController;
|
late ProgressAndSuccessController? _progressAndSuccessController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -42,10 +46,11 @@ class _RestoringDialogState extends State<SendingTransactionDialog> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isChans = Theme.of(context).extension<StackColors>()!.themeType ==
|
final assetPath = ref.watch(
|
||||||
ThemeType.chan ||
|
coinImageSecondaryProvider(
|
||||||
Theme.of(context).extension<StackColors>()!.themeType ==
|
widget.coin,
|
||||||
ThemeType.darkChans;
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if (Util.isDesktop) {
|
if (Util.isDesktop) {
|
||||||
return DesktopDialog(
|
return DesktopDialog(
|
||||||
|
@ -61,11 +66,9 @@ class _RestoringDialogState extends State<SendingTransactionDialog> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
),
|
),
|
||||||
isChans
|
assetPath.endsWith(".gif")
|
||||||
? Image(
|
? Image.file(
|
||||||
image: AssetImage(
|
File(assetPath),
|
||||||
Assets.gif.kiss(widget.coin),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: ProgressAndSuccess(
|
: ProgressAndSuccess(
|
||||||
controller: _progressAndSuccessController!,
|
controller: _progressAndSuccessController!,
|
||||||
|
@ -79,16 +82,14 @@ class _RestoringDialogState extends State<SendingTransactionDialog> {
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
child: isChans
|
child: assetPath.endsWith(".gif")
|
||||||
? StackDialogBase(
|
? StackDialogBase(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Image(
|
Image.file(
|
||||||
image: AssetImage(
|
File(assetPath),
|
||||||
Assets.gif.kiss(widget.coin),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"Sending transaction",
|
"Sending transaction",
|
||||||
|
|
|
@ -38,3 +38,40 @@ final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
return assets.ethereumImage;
|
return assets.ethereumImage;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
|
||||||
|
final assets = ref.watch(themeProvider).assets;
|
||||||
|
switch (coin) {
|
||||||
|
case Coin.bitcoin:
|
||||||
|
return assets.bitcoinImageSecondary;
|
||||||
|
case Coin.litecoin:
|
||||||
|
case Coin.litecoinTestNet:
|
||||||
|
return assets.litecoinImageSecondary;
|
||||||
|
case Coin.bitcoincash:
|
||||||
|
return assets.bitcoincashImageSecondary;
|
||||||
|
case Coin.dogecoin:
|
||||||
|
return assets.dogecoinImageSecondary;
|
||||||
|
case Coin.epicCash:
|
||||||
|
return assets.epicCashImageSecondary;
|
||||||
|
case Coin.firo:
|
||||||
|
return assets.firoImageSecondary;
|
||||||
|
case Coin.monero:
|
||||||
|
return assets.moneroImageSecondary;
|
||||||
|
case Coin.wownero:
|
||||||
|
return assets.wowneroImageSecondary;
|
||||||
|
case Coin.namecoin:
|
||||||
|
return assets.namecoinImageSecondary;
|
||||||
|
case Coin.particl:
|
||||||
|
return assets.particlImageSecondary;
|
||||||
|
case Coin.bitcoinTestNet:
|
||||||
|
return assets.bitcoinImageSecondary;
|
||||||
|
case Coin.bitcoincashTestnet:
|
||||||
|
return assets.bitcoincashImageSecondary;
|
||||||
|
case Coin.firoTestNet:
|
||||||
|
return assets.firoImageSecondary;
|
||||||
|
case Coin.dogecoinTestNet:
|
||||||
|
return assets.dogecoinImageSecondary;
|
||||||
|
case Coin.ethereum:
|
||||||
|
return assets.ethereumImageSecondary;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue