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-05-08 08:54:41 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7f82b605197e227a2001d0a8cd7fe0847fa21f8d
7f82b605
1 parent
a84e6c5b
Add LinearProgressIndicator
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
3 deletions
pdf/CHANGELOG.md
pdf/lib/src/widgets/basic.dart
pdf/lib/src/widgets/progress.dart
pdf/CHANGELOG.md
View file @
7f82b60
...
...
@@ -4,6 +4,7 @@
-
Fix Text.softWrap behavior
-
Add TableOfContent Widget
-
Add LinearProgressIndicator
## 3.3.0
...
...
pdf/lib/src/widgets/basic.dart
View file @
7f82b60
...
...
@@ -62,7 +62,7 @@ class LimitedBox extends SingleChildWidget {
assert
(
child
!.
box
!=
null
);
size
=
constraints
.
constrain
(
child
!.
box
!.
size
);
}
else
{
size
=
_limitConstraints
(
constraints
).
constrain
(
PdfPoint
.
zero
)
;
size
=
_limitConstraints
(
constraints
).
smallest
;
}
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
size
);
}
...
...
@@ -425,8 +425,8 @@ class ConstrainedBox extends SingleChildWidget {
assert
(
child
!.
box
!=
null
);
box
=
child
!.
box
;
}
else
{
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
this
.
constraints
.
enforce
(
constraints
).
constrain
(
PdfPoint
.
zero
));
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
this
.
constraints
.
enforce
(
constraints
).
smallest
);
}
}
...
...
pdf/lib/src/widgets/progress.dart
View file @
7f82b60
...
...
@@ -28,10 +28,14 @@ class CircularProgressIndicator extends Widget {
this
.
strokeWidth
=
4.0
,
this
.
backgroundColor
});
/// The value of this progress indicator.
/// A value of 0.0 means no progress and 1.0 means that progress is complete.
final
double
value
;
/// The progress indicator's color
final
PdfColor
?
color
;
/// The progress indicator's background color.
final
PdfColor
?
backgroundColor
;
final
double
strokeWidth
;
...
...
@@ -97,3 +101,64 @@ class CircularProgressIndicator extends Widget {
}
}
}
/// A material design linear progress indicator, also known as a progress bar.
class
LinearProgressIndicator
extends
Widget
{
/// Creates a linear progress indicator.
LinearProgressIndicator
({
required
this
.
value
,
this
.
backgroundColor
,
this
.
valueColor
,
this
.
minHeight
,
});
/// The progress indicator's background color.
final
PdfColor
?
backgroundColor
;
/// The minimum height of the line used to draw the indicator.
final
double
?
minHeight
;
/// The value of this progress indicator.
/// A value of 0.0 means no progress and 1.0 means that progress is complete.
final
double
value
;
/// The progress indicator's color
final
PdfColor
?
valueColor
;
@override
void
layout
(
Context
context
,
BoxConstraints
constraints
,
{
bool
parentUsesSize
=
false
})
{
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
BoxConstraints
(
minWidth:
double
.
infinity
,
minHeight:
minHeight
??
4.0
,
).
enforce
(
constraints
).
smallest
,
);
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
final
vc
=
value
.
clamp
(
0.0
,
1.0
);
final
_valueColor
=
valueColor
??
PdfColors
.
blue
;
final
_backgroundColor
=
backgroundColor
??
_valueColor
.
shade
(
0.1
);
if
(
vc
<
1.0
)
{
final
epsilon
=
vc
==
0
?
0
:
0.01
;
context
.
canvas
..
drawRect
(
box
!.
left
+
box
!.
width
*
vc
-
epsilon
,
box
!.
bottom
,
box
!.
width
*
(
1
-
vc
)
+
epsilon
,
box
!.
height
)
..
setFillColor
(
_backgroundColor
)
..
fillPath
();
}
if
(
vc
>
0.0
)
{
context
.
canvas
..
drawRect
(
box
!.
left
,
box
!.
bottom
,
box
!.
width
*
vc
,
box
!.
height
)
..
setFillColor
(
_valueColor
)
..
fillPath
();
}
}
}
...
...
Please
register
or
login
to post a comment