Browse Source

1.调整分享的图片大小

tags/0.013+9
“yanghuaxuan” 3 years ago
parent
commit
1fdb79b410
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      lib/widgets/share/share_alert_select.dart

+ 1
- 1
lib/widgets/share/share_alert_select.dart View File

@@ -112,7 +112,7 @@ class _ShareAlertSelectState extends State<ShareAlertSelect> {
RenderRepaintBoundary boundary = buildContext.findRenderObject(); RenderRepaintBoundary boundary = buildContext.findRenderObject();


///pixelRatio是放大倍数 ///pixelRatio是放大倍数
ui.Image image = await boundary.toImage(pixelRatio: 5);
ui.Image image = await boundary.toImage(pixelRatio: 3);
// 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba // 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List(); Uint8List pngBytes = byteData.buffer.asUint8List();


Loading…
Cancel
Save