mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
show file path on image save
This commit is contained in:
parent
c1b7c9239b
commit
a6a7b53837
3 changed files with 17 additions and 17 deletions
|
@ -66,6 +66,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
}
|
||||
}
|
||||
|
||||
String _monkeyPath = "";
|
||||
|
||||
Future<void> _saveMonKeyToFile({
|
||||
required Uint8List bytes,
|
||||
bool isPNG = false,
|
||||
|
@ -96,6 +98,7 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
}
|
||||
|
||||
await imgFile.writeAsBytes(bytes);
|
||||
_monkeyPath = filePath;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -369,7 +372,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
if (!didError && mounted) {
|
||||
await showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "SVG MonKey image saved",
|
||||
message:
|
||||
"SVG MonKey image saved to $_monkeyPath",
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
@ -421,7 +425,8 @@ class _MonkeyViewState extends ConsumerState<MonkeyView> {
|
|||
if (!didError && mounted) {
|
||||
await showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "PNG MonKey image saved",
|
||||
message:
|
||||
"PNG MonKey image saved to $_monkeyPath",
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
|||
|
||||
static const _spacing = 12.0;
|
||||
|
||||
Future<void> _savePngToFile() async {
|
||||
Future<String> _savePngToFile() async {
|
||||
final response = await get(Uri.parse(ordinal.content));
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
|
@ -257,6 +257,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
|||
}
|
||||
|
||||
await imgFile.writeAsBytes(bytes);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -309,11 +310,8 @@ class _OrdinalImageGroup extends StatelessWidget {
|
|||
iconSpacing: 4,
|
||||
onPressed: () async {
|
||||
bool didError = false;
|
||||
await showLoading(
|
||||
whileFuture: Future.wait([
|
||||
_savePngToFile(),
|
||||
Future<void>.delayed(const Duration(seconds: 2)),
|
||||
]),
|
||||
final filePath = await showLoading<String>(
|
||||
whileFuture: _savePngToFile(),
|
||||
context: context,
|
||||
isDesktop: true,
|
||||
message: "Saving ordinal image",
|
||||
|
@ -334,7 +332,7 @@ class _OrdinalImageGroup extends StatelessWidget {
|
|||
if (!didError && context.mounted) {
|
||||
await showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "Image saved",
|
||||
message: "Image saved to $filePath",
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class _DesktopOrdinalDetailsViewState
|
|||
|
||||
late final UTXO? utxo;
|
||||
|
||||
Future<void> _savePngToFile() async {
|
||||
Future<String> _savePngToFile() async {
|
||||
final response = await get(Uri.parse(widget.ordinal.content));
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
|
@ -77,6 +77,7 @@ class _DesktopOrdinalDetailsViewState
|
|||
}
|
||||
|
||||
await imgFile.writeAsBytes(bytes);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -224,12 +225,8 @@ class _DesktopOrdinalDetailsViewState
|
|||
iconSpacing: 8,
|
||||
onPressed: () async {
|
||||
bool didError = false;
|
||||
await showLoading(
|
||||
whileFuture: Future.wait([
|
||||
_savePngToFile(),
|
||||
Future<void>.delayed(
|
||||
const Duration(seconds: 2)),
|
||||
]),
|
||||
final path = await showLoading<String>(
|
||||
whileFuture: _savePngToFile(),
|
||||
context: context,
|
||||
isDesktop: true,
|
||||
message: "Saving ordinal image",
|
||||
|
@ -251,7 +248,7 @@ class _DesktopOrdinalDetailsViewState
|
|||
if (!didError && mounted) {
|
||||
await showFloatingFlushBar(
|
||||
type: FlushBarType.success,
|
||||
message: "Image saved",
|
||||
message: "Image saved to $path",
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue