Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2023-03-25 13:24:07 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
029c8f53d623a1f991ece3c548cb7d83a83aff49
029c8f53
1 parent
3288c617
Fix more Flutter 3.9 deprecations
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
printing/lib/src/preview/controller.dart
printing/lib/src/raster.dart
printing/lib/src/widget_wrapper.dart
printing/lib/src/preview/controller.dart
View file @
029c8f5
...
...
@@ -67,8 +67,7 @@ class PdfPreviewData extends ChangeNotifier {
PdfPageFormat
get
actualPageFormat
=>
_onComputeActualPageFormat
();
String
get
localPageFormat
{
final
wbi
=
WidgetsBinding
.
instance
;
final
locale
=
wbi
.
window
.
locale
;
final
locale
=
WidgetsBinding
.
instance
.
platformDispatcher
.
locale
;
final
cc
=
locale
.
countryCode
??
'US'
;
if
(
cc
==
'US'
||
cc
==
'CA'
||
cc
==
'MX'
)
{
...
...
printing/lib/src/raster.dart
View file @
029c8f5
...
...
@@ -70,6 +70,12 @@ class PdfRasterImage extends ImageProvider<PdfRaster> {
return
OneFrameImageStreamCompleter
(
_loadAsync
());
}
// Flutter 3.9
// @override
// ImageStreamCompleter loadImage(PdfRaster key, ImageDecoderCallback decode) {
// return OneFrameImageStreamCompleter(_loadAsync());
// }
@override
Future
<
PdfRaster
>
obtainKey
(
ImageConfiguration
configuration
)
async
{
return
raster
;
...
...
printing/lib/src/widget_wrapper.dart
View file @
029c8f5
...
...
@@ -15,9 +15,9 @@
*/
import
'dart:async'
;
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -126,6 +126,7 @@ class WidgetWrapper extends pw.ImageProvider {
/// );
/// ```
static
Future
<
WidgetWrapper
>
fromWidget
({
required
BuildContext
context
,
required
Widget
widget
,
required
BoxConstraints
constraints
,
double
pixelRatio
=
1.0
,
...
...
@@ -163,6 +164,9 @@ class WidgetWrapper extends pw.ImageProvider {
}
final
repaintBoundary
=
RenderRepaintBoundary
();
// Flutter 3.9
// final view = View.of(context);
final
view
=
WidgetsBinding
.
instance
.
window
;
final
renderView
=
RenderView
(
child:
RenderPositionedBox
(
...
...
@@ -170,8 +174,8 @@ class WidgetWrapper extends pw.ImageProvider {
configuration:
ViewConfiguration
(
size:
Size
(
computedConstraints
.
maxWidth
,
computedConstraints
.
maxHeight
),
devicePixelRatio:
ui
.
window
.
devicePixelRatio
),
window:
ui
.
window
,
devicePixelRatio:
view
.
devicePixelRatio
),
window:
view
,
);
final
pipelineOwner
=
PipelineOwner
()..
rootNode
=
renderView
;
...
...
@@ -258,6 +262,7 @@ class WidgetWraper extends WidgetWrapper {
/// Wrap a Flutter Widget to an ImageProvider.
@Deprecated
(
'Use WidgetWrapper.fromWidget instead'
)
static
Future
<
WidgetWrapper
>
fromWidget
({
required
BuildContext
context
,
required
Widget
widget
,
required
BoxConstraints
constraints
,
double
pixelRatio
=
1.0
,
...
...
@@ -265,6 +270,7 @@ class WidgetWraper extends WidgetWrapper {
double
?
dpi
,
})
{
return
WidgetWrapper
.
fromWidget
(
context:
context
,
widget:
widget
,
constraints:
constraints
,
pixelRatio:
pixelRatio
,
...
...
Please
register
or
login
to post a comment