Showing
2 changed files
with
12 additions
and
3 deletions
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | - Add onPageFormatChanged event | 6 | - Add onPageFormatChanged event |
| 7 | - Fix raster quality on Android | 7 | - Fix raster quality on Android |
| 8 | - Use a CDN for emoji and cupertino fonts | 8 | - Use a CDN for emoji and cupertino fonts |
| 9 | +- Improved Android rendering | ||
| 9 | 10 | ||
| 10 | ## 5.7.1 | 11 | ## 5.7.1 |
| 11 | 12 |
| @@ -46,7 +46,7 @@ mixin PdfPreviewRaster on State<PdfPreviewCustom> { | @@ -46,7 +46,7 @@ mixin PdfPreviewRaster on State<PdfPreviewCustom> { | ||
| 46 | Object? error; | 46 | Object? error; |
| 47 | 47 | ||
| 48 | /// Dots per inch | 48 | /// Dots per inch |
| 49 | - double dpi = 10; | 49 | + double dpi = PdfPageFormat.inch; |
| 50 | 50 | ||
| 51 | var _rastering = false; | 51 | var _rastering = false; |
| 52 | 52 | ||
| @@ -63,8 +63,16 @@ mixin PdfPreviewRaster on State<PdfPreviewCustom> { | @@ -63,8 +63,16 @@ mixin PdfPreviewRaster on State<PdfPreviewCustom> { | ||
| 63 | _previewUpdate?.cancel(); | 63 | _previewUpdate?.cancel(); |
| 64 | _previewUpdate = Timer(_updateTime, () { | 64 | _previewUpdate = Timer(_updateTime, () { |
| 65 | final mq = MediaQuery.of(context); | 65 | final mq = MediaQuery.of(context); |
| 66 | - final maxDPR = !kIsWeb && Platform.isAndroid ? 2.0 : 1.0; | ||
| 67 | - final dpr = max(maxDPR, mq.devicePixelRatio); | 66 | + final double dpr; |
| 67 | + if (!kIsWeb && Platform.isAndroid) { | ||
| 68 | + if (mq.size.shortestSide * mq.devicePixelRatio < 800) { | ||
| 69 | + dpr = 2 * mq.devicePixelRatio; | ||
| 70 | + } else { | ||
| 71 | + dpr = mq.devicePixelRatio; | ||
| 72 | + } | ||
| 73 | + } else { | ||
| 74 | + dpr = mq.devicePixelRatio; | ||
| 75 | + } | ||
| 68 | dpi = (min(mq.size.width - 16, widget.maxPageWidth ?? double.infinity)) * | 76 | dpi = (min(mq.size.width - 16, widget.maxPageWidth ?? double.infinity)) * |
| 69 | dpr / | 77 | dpr / |
| 70 | pageFormat.width * | 78 | pageFormat.width * |
-
Please register or login to post a comment