fix:修复门铃码保存后是黑色图片问题
This commit is contained in:
parent
b9fb2bd479
commit
460ca1e2e2
@ -456,16 +456,24 @@ class ShowCupertinoAlertView {
|
|||||||
onClick: () async {
|
onClick: () async {
|
||||||
// 截图并保存到相册
|
// 截图并保存到相册
|
||||||
try {
|
try {
|
||||||
final RenderRepaintBoundary boundary =
|
final QrPainter painter = QrPainter(
|
||||||
_repaintBoundaryKey.currentContext!
|
data: qrCodeUrl,
|
||||||
.findRenderObject()!
|
version: QrVersions.auto,
|
||||||
as RenderRepaintBoundary;
|
gapless: false,
|
||||||
final image = await boundary.toImage();
|
errorCorrectionLevel: QrErrorCorrectLevel.L,
|
||||||
final ByteData? byteData = await image
|
eyeStyle: const QrEyeStyle(
|
||||||
.toByteData(format: ImageByteFormat.png);
|
eyeShape: QrEyeShape.square,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
dataModuleStyle: const QrDataModuleStyle(
|
||||||
|
dataModuleShape: QrDataModuleShape.square,
|
||||||
|
color: Colors.white,
|
||||||
|
));
|
||||||
|
final ByteData? byteData =
|
||||||
|
await painter.toImageData(600.0,
|
||||||
|
format: ImageByteFormat.png);
|
||||||
final Uint8List pngBytes =
|
final Uint8List pngBytes =
|
||||||
byteData!.buffer.asUint8List();
|
byteData!.buffer.asUint8List();
|
||||||
|
|
||||||
final result =
|
final result =
|
||||||
await ImageGallerySaver.saveImage(
|
await ImageGallerySaver.saveImage(
|
||||||
Uint8List.fromList(pngBytes),
|
Uint8List.fromList(pngBytes),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user