Commit ad9ee07199ffe75d3ca842ea2bd9ba26e4f59dad

Authored by wdn127929
1 parent 7fa21e86

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

@@ -24,6 +24,7 @@ import '../../utils/share_helper.dart'; @@ -24,6 +24,7 @@ import '../../utils/share_helper.dart';
24 import '../../widgets/h_empty_view.dart'; 24 import '../../widgets/h_empty_view.dart';
25 import '../../widgets/loading.dart'; 25 import '../../widgets/loading.dart';
26 import '../../widgets/round_button.dart'; 26 import '../../widgets/round_button.dart';
  27 +import 'dart:ui' as ui;
27 28
28 /** 29 /**
29 * 优惠券分享海报 30 * 优惠券分享海报
@@ -74,12 +75,13 @@ class _CouponPosterPageState extends State<CouponPosterPage> { @@ -74,12 +75,13 @@ class _CouponPosterPageState extends State<CouponPosterPage> {
74 /// 截图 75 /// 截图
75 Future<Uint8List> _capturePng( 76 Future<Uint8List> _capturePng(
76 GlobalKey globalKey, { 77 GlobalKey globalKey, {
77 - double pixelRatio = 6.0, //截屏的图片与原图的比例 78 + double pixelRatio = 2.0, //截屏的图片与原图的比例
78 }) async { 79 }) async {
79 try { 80 try {
80 RenderRepaintBoundary boundary = 81 RenderRepaintBoundary boundary =
81 globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary; 82 globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
82 - var image = await boundary.toImage(pixelRatio: pixelRatio); 83 + double dpr = ui.window.devicePixelRatio; // 获取当前设备的像素比
  84 + var image = await boundary.toImage(pixelRatio: dpr);
83 ByteData byteData = await image.toByteData(format: ImageByteFormat.png); 85 ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
84 Uint8List pngBytes = byteData?.buffer.asUint8List(); 86 Uint8List pngBytes = byteData?.buffer.asUint8List();
85 return pngBytes; 87 return pngBytes;
@@ -2099,7 +2099,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -2099,7 +2099,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
2099 ), 2099 ),
2100 child: Text( 2100 child: Text(
2101 data.content, 2101 data.content,
2102 - overflow: TextOverflow.ellipsis, 2102 + // overflow: TextOverflow.ellipsis,
2103 style: TextStyle( 2103 style: TextStyle(
2104 height: 2, 2104 height: 2,
2105 color: MyColours.color_515151, 2105 color: MyColours.color_515151,
@@ -34,7 +34,7 @@ class RowMultiText extends StatelessWidget { @@ -34,7 +34,7 @@ class RowMultiText extends StatelessWidget {
34 Align( 34 Align(
35 alignment: Alignment.centerLeft, 35 alignment: Alignment.centerLeft,
36 child: Text( 36 child: Text(
37 - title, 37 + title ?? '',
38 style: 38 style:
39 TextStyle(color: textColor, fontSize: ScreenUtil().setSp(30)), 39 TextStyle(color: textColor, fontSize: ScreenUtil().setSp(30)),
40 ), 40 ),
@@ -46,19 +46,30 @@ class RowMultiText extends StatelessWidget { @@ -46,19 +46,30 @@ class RowMultiText extends StatelessWidget {
46 child: Row( 46 child: Row(
47 mainAxisAlignment: MainAxisAlignment.end, 47 mainAxisAlignment: MainAxisAlignment.end,
48 children: [ 48 children: [
49 - if (imageName != null && content.length > 0) 49 + if (imageName != null &&
  50 + content.length > 0 &&
  51 + content != null)
50 Container( 52 Container(
51 margin: EdgeInsets.only(right: w(2)), 53 margin: EdgeInsets.only(right: w(2)),
52 child: Image.asset( 54 child: Image.asset(
53 Utils.getImgPath(imageName), 55 Utils.getImgPath(imageName),
54 width: w(20), 56 width: w(20),
55 )), 57 )),
56 - Text(content,  
57 - style: TextStyle(  
58 - color: textColorR,  
59 - fontSize: ScreenUtil().setSp(30)),  
60 - softWrap: true,  
61 - textAlign: this.textAlign), 58 + imageName == null
  59 + ? Expanded(
  60 + child: Text(content ?? '',
  61 + style: TextStyle(
  62 + color: textColorR,
  63 + fontSize: ScreenUtil().setSp(30)),
  64 + softWrap: true,
  65 + textAlign: this.textAlign))
  66 + : Text(content??'',
  67 + overflow: TextOverflow.ellipsis,
  68 + style: TextStyle(
  69 + color: textColorR,
  70 + fontSize: ScreenUtil().setSp(30)),
  71 + softWrap: true,
  72 + textAlign: this.textAlign),
62 ], 73 ],
63 )), 74 )),
64 ) 75 )