Commit ad9ee07199ffe75d3ca842ea2bd9ba26e4f59dad

Authored by wdn127929
1 parent 7fa21e86

导出的图片像素由设备像素决定

... ... @@ -24,6 +24,7 @@ import '../../utils/share_helper.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/loading.dart';
import '../../widgets/round_button.dart';
import 'dart:ui' as ui;
/**
* 优惠券分享海报
... ... @@ -74,12 +75,13 @@ class _CouponPosterPageState extends State<CouponPosterPage> {
/// 截图
Future<Uint8List> _capturePng(
GlobalKey globalKey, {
double pixelRatio = 6.0, //截屏的图片与原图的比例
double pixelRatio = 2.0, //截屏的图片与原图的比例
}) async {
try {
RenderRepaintBoundary boundary =
globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
var image = await boundary.toImage(pixelRatio: pixelRatio);
double dpr = ui.window.devicePixelRatio; // 获取当前设备的像素比
var image = await boundary.toImage(pixelRatio: dpr);
ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
Uint8List pngBytes = byteData?.buffer.asUint8List();
return pngBytes;
... ...
... ... @@ -2099,7 +2099,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
),
child: Text(
data.content,
overflow: TextOverflow.ellipsis,
// overflow: TextOverflow.ellipsis,
style: TextStyle(
height: 2,
color: MyColours.color_515151,
... ...
... ... @@ -34,7 +34,7 @@ class RowMultiText extends StatelessWidget {
Align(
alignment: Alignment.centerLeft,
child: Text(
title,
title ?? '',
style:
TextStyle(color: textColor, fontSize: ScreenUtil().setSp(30)),
),
... ... @@ -46,19 +46,30 @@ class RowMultiText extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (imageName != null && content.length > 0)
if (imageName != null &&
content.length > 0 &&
content != null)
Container(
margin: EdgeInsets.only(right: w(2)),
child: Image.asset(
Utils.getImgPath(imageName),
width: w(20),
)),
Text(content,
style: TextStyle(
color: textColorR,
fontSize: ScreenUtil().setSp(30)),
softWrap: true,
textAlign: this.textAlign),
imageName == null
? Expanded(
child: Text(content ?? '',
style: TextStyle(
color: textColorR,
fontSize: ScreenUtil().setSp(30)),
softWrap: true,
textAlign: this.textAlign))
: Text(content??'',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColorR,
fontSize: ScreenUtil().setSp(30)),
softWrap: true,
textAlign: this.textAlign),
],
)),
)
... ...