mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
replace dialog with flushbar message
This commit is contained in:
parent
16a2b23dde
commit
ce74f9508b
1 changed files with 23 additions and 27 deletions
|
@ -15,9 +15,10 @@ import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:zxing2/qrcode.dart';
|
import 'package:zxing2/qrcode.dart';
|
||||||
|
|
||||||
|
import '../../notifications/show_flush_bar.dart';
|
||||||
|
import '../../utilities/assets.dart';
|
||||||
import '../../utilities/logger.dart';
|
import '../../utilities/logger.dart';
|
||||||
import '../../utilities/text_styles.dart';
|
import '../../utilities/text_styles.dart';
|
||||||
import '../stack_dialog.dart';
|
|
||||||
import 'desktop_dialog.dart';
|
import 'desktop_dialog.dart';
|
||||||
import 'desktop_dialog_close_button.dart';
|
import 'desktop_dialog_close_button.dart';
|
||||||
|
|
||||||
|
@ -322,24 +323,22 @@ class _QrCodeScannerDialogState extends State<QrCodeScannerDialog> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result == null || result.files.single.path == null) {
|
if (result == null || result.files.single.path == null) {
|
||||||
await showDialog<void>(
|
await showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "No file selected",
|
||||||
|
iconAsset: Assets.svg.file,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const StackOkDialog(
|
|
||||||
title: "Error scanning QR code",
|
|
||||||
message: "No file selected.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final filePath = result?.files.single.path!;
|
final filePath = result?.files.single.path!;
|
||||||
if (filePath == null) {
|
if (filePath == null) {
|
||||||
await showDialog<void>(
|
await showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "Error selecting file.",
|
||||||
|
iconAsset: Assets.svg.file,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const StackOkDialog(
|
|
||||||
title: "Error scanning QR code",
|
|
||||||
message: "Error selecting file.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -347,12 +346,11 @@ class _QrCodeScannerDialogState extends State<QrCodeScannerDialog> {
|
||||||
final img.Image? image =
|
final img.Image? image =
|
||||||
img.decodeImage(File(filePath!).readAsBytesSync());
|
img.decodeImage(File(filePath!).readAsBytesSync());
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
await showDialog<void>(
|
await showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "Failed to decode image.",
|
||||||
|
iconAsset: Assets.svg.file,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const StackOkDialog(
|
|
||||||
title: "Error scanning QR code",
|
|
||||||
message: "Failed to decode image.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -362,24 +360,22 @@ class _QrCodeScannerDialogState extends State<QrCodeScannerDialog> {
|
||||||
widget.onQrCodeDetected(scanResult);
|
widget.onQrCodeDetected(scanResult);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} else {
|
} else {
|
||||||
await showDialog<void>(
|
await showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "No QR code found in the image.",
|
||||||
|
iconAsset: Assets.svg.file,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const StackOkDialog(
|
|
||||||
title: "Error scanning QR code",
|
|
||||||
message: "No QR code found in the image.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log("Failed to decode image: $e\n$s",
|
Logging.instance.log("Failed to decode image: $e\n$s",
|
||||||
level: LogLevel.Error);
|
level: LogLevel.Error);
|
||||||
await showDialog<void>(
|
await showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message:
|
||||||
|
"Error processing the image. Please try again.",
|
||||||
|
iconAsset: Assets.svg.file,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const StackOkDialog(
|
|
||||||
title: "Error scanning QR code",
|
|
||||||
message:
|
|
||||||
"Error processing the image. Please try again.",
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue