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
2021-04-02 08:36:18 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d93c570aa15199eeda9433af1a6bc1cf3b06d45f
d93c570a
1 parent
77b84831
Remove deprecated avoid_as lint
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
12 additions
and
38 deletions
demo/lib/examples/report.dart
demo/pubspec.yaml
pdf/analysis_options.yaml
pdf/lib/src/pdf/data_types.dart
pdf/lib/src/pdf/exif.dart
pdf/lib/src/widgets/chart/chart.dart
pdf/lib/src/widgets/chart/grid_axis.dart
pdf/lib/src/widgets/chart/pie_chart.dart
pdf/lib/src/widgets/multi_page.dart
pdf/lib/src/widgets/widget.dart
printing/analysis_options.yaml
printing/lib/printing_web.dart
printing/lib/src/pdf_preview.dart
printing/lib/src/widget_wrapper.dart
demo/lib/examples/report.dart
View file @
d93c570
...
...
@@ -84,9 +84,7 @@ Future<Uint8List> generateReport(
grid:
pw
.
CartesianGrid
(
xAxis:
pw
.
FixedAxis
.
fromStrings
(
List
<
String
>.
generate
(
dataTable
.
length
,
// ignore: avoid_as
(
index
)
=>
dataTable
[
index
][
0
]
as
String
),
dataTable
.
length
,
(
index
)
=>
dataTable
[
index
][
0
]
as
String
),
marginStart:
30
,
marginEnd:
30
,
ticks:
true
,
...
...
@@ -107,7 +105,6 @@ Future<Uint8List> generateReport(
data:
List
<
pw
.
LineChartValue
>.
generate
(
dataTable
.
length
,
(
i
)
{
// ignore: avoid_as
final
v
=
dataTable
[
i
][
2
]
as
num
;
return
pw
.
LineChartValue
(
i
.
toDouble
(),
v
.
toDouble
());
},
...
...
@@ -122,7 +119,6 @@ Future<Uint8List> generateReport(
data:
List
<
pw
.
LineChartValue
>.
generate
(
dataTable
.
length
,
(
i
)
{
// ignore: avoid_as
final
v
=
dataTable
[
i
][
1
]
as
num
;
return
pw
.
LineChartValue
(
i
.
toDouble
(),
v
.
toDouble
());
},
...
...
@@ -149,7 +145,6 @@ Future<Uint8List> generateReport(
data:
List
<
pw
.
LineChartValue
>.
generate
(
dataTable
.
length
,
(
i
)
{
// ignore: avoid_as
final
v
=
dataTable
[
i
][
2
]
as
num
;
return
pw
.
LineChartValue
(
i
.
toDouble
(),
v
.
toDouble
());
},
...
...
demo/pubspec.yaml
View file @
d93c570
...
...
@@ -10,20 +10,17 @@ environment:
dependencies
:
flutter
:
sdk
:
flutter
http
:
intl
:
open_file
:
git
:
url
:
https://github.com/orevial/open_file
ref
:
null-safety-migration
path_provider
:
printing
:
url_launcher
:
http
:
^0.13.1
intl
:
^0.17.0
open_file
:
^3.1.0
path_provider
:
^2.0.1
printing
:
^5.0.4
url_launcher
:
^6.0.3
dev_dependencies
:
flutter_test
:
sdk
:
flutter
test
:
test
:
^1.16.5
dependency_overrides
:
pdf
:
...
...
pdf/analysis_options.yaml
View file @
d93c570
...
...
@@ -12,7 +12,6 @@ analyzer:
linter
:
rules
:
-
always_put_control_body_on_new_line
-
avoid_as
-
avoid_bool_literals_in_conditional_expressions
-
avoid_classes_with_only_static_members
-
avoid_field_initializers_in_const_classes
...
...
pdf/lib/src/pdf/data_types.dart
View file @
d93c570
...
...
@@ -597,7 +597,6 @@ class PdfColorType extends PdfDataType {
@override
void
output
(
PdfStream
s
)
{
if
(
color
is
PdfColorCmyk
)
{
// ignore: avoid_as
final
k
=
color
as
PdfColorCmyk
;
PdfArray
.
fromNum
(<
double
>[
k
.
cyan
,
...
...
pdf/lib/src/pdf/exif.dart
View file @
d93c570
...
...
@@ -354,12 +354,8 @@ orientation: $orientation''';
_readTags
(
buffer
,
tiffOffset
,
tiffOffset
+
firstIFDOffset
,
bigEnd
);
if
(
tags
.
containsKey
(
PdfExifTag
.
ExifIFDPointer
))
{
final
exifData
=
_readTags
(
buffer
,
tiffOffset
,
// ignore: avoid_as
tiffOffset
+
tags
[
PdfExifTag
.
ExifIFDPointer
]
as
int
,
bigEnd
);
final
exifData
=
_readTags
(
buffer
,
tiffOffset
,
tiffOffset
+
tags
[
PdfExifTag
.
ExifIFDPointer
]
as
int
,
bigEnd
);
tags
.
addAll
(
exifData
);
}
...
...
pdf/lib/src/widgets/chart/chart.dart
View file @
d93c570
...
...
@@ -59,7 +59,6 @@ class Chart extends Widget implements Inherited {
late
Widget
_child
;
// ignore: avoid_as
static
Chart
of
(
Context
context
)
=>
context
.
dependsOn
<
Chart
>()!;
PdfPoint
_computeSize
(
BoxConstraints
constraints
)
{
...
...
pdf/lib/src/widgets/chart/grid_axis.dart
View file @
d93c570
...
...
@@ -375,7 +375,6 @@ class FixedAxis<T extends num> extends GridAxis {
return
;
}
// ignore: avoid_as
final
grid
=
Chart
.
of
(
context
).
grid
as
CartesianGrid
;
switch
(
direction
)
{
...
...
pdf/lib/src/widgets/chart/pie_chart.dart
View file @
d93c570
...
...
@@ -178,7 +178,6 @@ class PieDataSet extends Dataset {
{
bool
parentUsesSize
=
false
})
{
final
_offset
=
_isFullCircle
?
0
:
offset
;
// ignore: avoid_as
final
grid
=
Chart
.
of
(
context
).
grid
as
PieGrid
;
final
len
=
grid
.
pieSize
+
_offset
;
var
x
=
-
len
;
...
...
@@ -277,7 +276,6 @@ class PieDataSet extends Dataset {
}
void
_shape
(
Context
context
)
{
// ignore: avoid_as
final
grid
=
Chart
.
of
(
context
).
grid
as
PieGrid
;
final
bisect
=
(
angleStart
+
angleEnd
)
/
2
;
...
...
@@ -365,7 +363,6 @@ class PieDataSet extends Dataset {
void
debugPaint
(
Context
context
)
{
super
.
debugPaint
(
context
);
// ignore: avoid_as
final
grid
=
Chart
.
of
(
context
).
grid
as
PieGrid
;
final
bisect
=
(
angleStart
+
angleEnd
)
/
2
;
...
...
pdf/lib/src/widgets/multi_page.dart
View file @
d93c570
...
...
@@ -317,7 +317,6 @@ class MultiPage extends Page {
'You probably need a SpanningWidget or use a single page layout'
);
}
// ignore: avoid_as
final
span
=
child
as
SpanningWidget
;
final
localConstraints
=
...
...
pdf/lib/src/widgets/widget.dart
View file @
d93c570
...
...
@@ -81,7 +81,6 @@ class Context {
}
T
?
dependsOn
<
T
>()
{
// ignore: avoid_as
return
_inherited
[
T
]
as
T
?;
}
...
...
printing/analysis_options.yaml
View file @
d93c570
...
...
@@ -12,7 +12,6 @@ analyzer:
linter
:
rules
:
-
always_put_control_body_on_new_line
-
avoid_as
-
avoid_bool_literals_in_conditional_expressions
-
avoid_classes_with_only_static_members
-
avoid_field_initializers_in_const_classes
...
...
printing/lib/printing_web.dart
View file @
d93c570
...
...
@@ -208,7 +208,7 @@ class PrintingPlugin extends PrintingPlatform {
final
html
.
CanvasElement
canvas
=
js
.
context
[
'document'
].
createElement
(
'canvas'
);
// ignore: avoid_as
final
context
=
canvas
.
getContext
(
'2d'
)
as
html
.
CanvasRenderingContext2D
?;
final
_pages
=
pages
??
Iterable
<
int
>.
generate
(
numPages
,
(
index
)
=>
index
);
...
...
@@ -233,7 +233,6 @@ class PrintingPlugin extends PrintingPlatform {
r
.
readAsArrayBuffer
(
blob
);
r
.
onLoadEnd
.
listen
(
(
ProgressEvent
e
)
{
// ignore: avoid_as
data
.
add
(
r
.
result
as
List
<
int
>);
completer
.
complete
();
},
...
...
printing/lib/src/pdf_preview.dart
View file @
d93c570
...
...
@@ -219,7 +219,7 @@ class _PdfPreviewState extends State<PdfPreview> {
void
initState
()
{
if
(
widget
.
initialPageFormat
==
null
)
{
final
locale
=
WidgetsBinding
.
instance
!.
window
.
locale
;
// ignore: unnecessary_cast
, avoid_as
// ignore: unnecessary_cast
final
cc
=
(
locale
as
Locale
?)?.
countryCode
??
'US'
;
if
(
cc
==
'US'
||
cc
==
'CA'
||
cc
==
'MX'
)
{
...
...
@@ -562,7 +562,6 @@ class _PdfPreviewState extends State<PdfPreview> {
Future
<
void
>
_share
()
async
{
// Calculate the widget center for iPad sharing popup position
final
referenceBox
=
// ignore: avoid_as
shareWidget
.
currentContext
!.
findRenderObject
()
as
RenderBox
;
final
topLeft
=
referenceBox
.
localToGlobal
(
referenceBox
.
paintBounds
.
topLeft
);
...
...
printing/lib/src/widget_wrapper.dart
View file @
d93c570
...
...
@@ -76,11 +76,9 @@ class WidgetWraper extends pw.ImageProvider {
assert
(
pixelRatio
>
0
);
final
wrappedWidget
=
// ignore: avoid_as
key
.
currentContext
!.
findRenderObject
()
as
RenderRepaintBoundary
;
final
image
=
await
wrappedWidget
.
toImage
(
pixelRatio:
pixelRatio
);
final
byteData
=
await
(
image
.
toByteData
(
format:
ui
.
ImageByteFormat
.
rawRgba
)
// ignore: avoid_as
as
FutureOr
<
ByteData
>);
final
imageData
=
byteData
.
buffer
.
asUint8List
();
return
WidgetWraper
.
_
(
...
...
Please
register
or
login
to post a comment