mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
commit
1920034e1f
4 changed files with 36 additions and 23 deletions
|
@ -66,6 +66,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _monkeyPath = "";
|
||||||
|
|
||||||
Future<void> _saveMonKeyToFile({
|
Future<void> _saveMonKeyToFile({
|
||||||
required Uint8List bytes,
|
required Uint8List bytes,
|
||||||
bool isPNG = false,
|
bool isPNG = false,
|
||||||
|
@ -96,6 +98,7 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await imgFile.writeAsBytes(bytes);
|
await imgFile.writeAsBytes(bytes);
|
||||||
|
_monkeyPath = filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -369,7 +372,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
if (!didError && mounted) {
|
if (!didError && mounted) {
|
||||||
await showFloatingFlushBar(
|
await showFloatingFlushBar(
|
||||||
type: FlushBarType.success,
|
type: FlushBarType.success,
|
||||||
message: "SVG MonKey image saved",
|
message:
|
||||||
|
"SVG MonKey image saved to $_monkeyPath",
|
||||||
context: context,
|
context: context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -421,7 +425,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
||||||
if (!didError && mounted) {
|
if (!didError && mounted) {
|
||||||
await showFloatingFlushBar(
|
await showFloatingFlushBar(
|
||||||
type: FlushBarType.success,
|
type: FlushBarType.success,
|
||||||
message: "PNG MonKey image saved",
|
message:
|
||||||
|
"PNG MonKey image saved to $_monkeyPath",
|
||||||
context: context,
|
context: context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
||||||
|
|
||||||
static const _spacing = 12.0;
|
static const _spacing = 12.0;
|
||||||
|
|
||||||
Future<void> _savePngToFile() async {
|
Future<String> _savePngToFile() async {
|
||||||
final response = await get(Uri.parse(ordinal.content));
|
final response = await get(Uri.parse(ordinal.content));
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
|
@ -257,6 +257,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
await imgFile.writeAsBytes(bytes);
|
await imgFile.writeAsBytes(bytes);
|
||||||
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -309,11 +310,8 @@ class _OrdinalImageGroup extends StatelessWidget {
|
||||||
iconSpacing: 4,
|
iconSpacing: 4,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
bool didError = false;
|
bool didError = false;
|
||||||
await showLoading(
|
final filePath = await showLoading<String>(
|
||||||
whileFuture: Future.wait([
|
whileFuture: _savePngToFile(),
|
||||||
_savePngToFile(),
|
|
||||||
Future<void>.delayed(const Duration(seconds: 2)),
|
|
||||||
]),
|
|
||||||
context: context,
|
context: context,
|
||||||
isDesktop: true,
|
isDesktop: true,
|
||||||
message: "Saving ordinal image",
|
message: "Saving ordinal image",
|
||||||
|
@ -334,7 +332,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
||||||
if (!didError && context.mounted) {
|
if (!didError && context.mounted) {
|
||||||
await showFloatingFlushBar(
|
await showFloatingFlushBar(
|
||||||
type: FlushBarType.success,
|
type: FlushBarType.success,
|
||||||
message: "Image saved",
|
message: "Image saved to $filePath",
|
||||||
context: context,
|
context: context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:event_bus/event_bus.dart';
|
import 'package:event_bus/event_bus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -28,6 +29,7 @@ import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub
|
||||||
import 'package:stackwallet/providers/global/auto_swb_service_provider.dart';
|
import 'package:stackwallet/providers/global/auto_swb_service_provider.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart';
|
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart';
|
||||||
|
import 'package:stackwallet/services/coins/banano/banano_wallet.dart';
|
||||||
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
||||||
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
||||||
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
|
@ -153,6 +155,10 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
final managerProvider = ref.watch(walletsChangeNotifierProvider
|
final managerProvider = ref.watch(walletsChangeNotifierProvider
|
||||||
.select((value) => value.getManagerProvider(widget.walletId)));
|
.select((value) => value.getManagerProvider(widget.walletId)));
|
||||||
|
|
||||||
|
final monke = coin == Coin.banano
|
||||||
|
? (manager.wallet as BananoWallet).getMonkeyImageBytes()
|
||||||
|
: null;
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
condition: _rescanningOnOpen,
|
condition: _rescanningOnOpen,
|
||||||
builder: (child) {
|
builder: (child) {
|
||||||
|
@ -334,13 +340,20 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.file(
|
if (monke != null)
|
||||||
File(
|
SvgPicture.memory(
|
||||||
ref.watch(coinIconProvider(coin)),
|
Uint8List.fromList(monke!),
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
),
|
||||||
|
if (monke == null)
|
||||||
|
SvgPicture.file(
|
||||||
|
File(
|
||||||
|
ref.watch(coinIconProvider(coin)),
|
||||||
|
),
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
),
|
),
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
|
|
|
@ -49,7 +49,7 @@ class _DesktopOrdinalDetailsViewState
|
||||||
|
|
||||||
late final UTXO? utxo;
|
late final UTXO? utxo;
|
||||||
|
|
||||||
Future<void> _savePngToFile() async {
|
Future<String> _savePngToFile() async {
|
||||||
final response = await get(Uri.parse(widget.ordinal.content));
|
final response = await get(Uri.parse(widget.ordinal.content));
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
|
@ -77,6 +77,7 @@ class _DesktopOrdinalDetailsViewState
|
||||||
}
|
}
|
||||||
|
|
||||||
await imgFile.writeAsBytes(bytes);
|
await imgFile.writeAsBytes(bytes);
|
||||||
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -224,12 +225,8 @@ class _DesktopOrdinalDetailsViewState
|
||||||
iconSpacing: 8,
|
iconSpacing: 8,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
bool didError = false;
|
bool didError = false;
|
||||||
await showLoading(
|
final path = await showLoading<String>(
|
||||||
whileFuture: Future.wait([
|
whileFuture: _savePngToFile(),
|
||||||
_savePngToFile(),
|
|
||||||
Future<void>.delayed(
|
|
||||||
const Duration(seconds: 2)),
|
|
||||||
]),
|
|
||||||
context: context,
|
context: context,
|
||||||
isDesktop: true,
|
isDesktop: true,
|
||||||
message: "Saving ordinal image",
|
message: "Saving ordinal image",
|
||||||
|
@ -251,7 +248,7 @@ class _DesktopOrdinalDetailsViewState
|
||||||
if (!didError && mounted) {
|
if (!didError && mounted) {
|
||||||
await showFloatingFlushBar(
|
await showFloatingFlushBar(
|
||||||
type: FlushBarType.success,
|
type: FlushBarType.success,
|
||||||
message: "Image saved",
|
message: "Image saved to $path",
|
||||||
context: context,
|
context: context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue