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
Brian Kayfitz
2024-11-28 05:53:06 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-11-28 06:53:06 -0400
Commit
32c1e5ef6247257a8fc01618b68954fba12b5bbf
32c1e5ef
1 parent
030912db
Add helper functions to replace text styles and cell content
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
pdf/lib/src/widgets/table_helper.dart
pdf/lib/src/widgets/table_helper.dart
View file @
32c1e5e
...
...
@@ -24,6 +24,10 @@ import 'text_style.dart';
import
'theme.dart'
;
import
'widget.dart'
;
typedef
OnCell
=
Widget
?
Function
(
int
index
,
dynamic
data
,
int
rowNum
);
typedef
OnCellTextStyle
=
TextStyle
?
Function
(
int
index
,
dynamic
data
,
int
rowNum
);
mixin
TableHelper
{
static
TextAlign
_textAlign
(
Alignment
align
)
{
if
(
align
.
x
==
0
)
{
...
...
@@ -71,6 +75,8 @@ mixin TableHelper {
BoxDecoration
?
oddRowDecoration
,
TextDirection
?
headerDirection
,
TextDirection
?
tableDirection
,
OnCell
?
cellBuilder
,
OnCellTextStyle
?
textStyleBuilder
,
})
{
assert
(
headerCount
>=
0
);
...
...
@@ -161,14 +167,17 @@ mixin TableHelper {
:
cellDecoration
(
tableRow
.
length
,
cell
,
rowNum
),
child:
cell
is
Widget
?
cell
:
Text
(
cellFormat
==
null
?
cell
.
toString
()
:
cellFormat
(
tableRow
.
length
,
cell
),
style:
isOdd
?
oddCellStyle
:
cellStyle
,
textAlign:
_textAlign
(
align
.
resolve
(
textDirection
)),
textDirection:
tableDirection
,
),
:
cellBuilder
?.
call
(
tableRow
.
length
,
cell
,
rowNum
)
??
Text
(
cellFormat
==
null
?
cell
.
toString
()
:
cellFormat
(
tableRow
.
length
,
cell
),
style:
textStyleBuilder
?.
call
(
tableRow
.
length
,
cell
,
rowNum
)
??
(
isOdd
?
oddCellStyle
:
cellStyle
),
textAlign:
_textAlign
(
align
.
resolve
(
textDirection
)),
textDirection:
tableDirection
,
),
),
);
}
...
...
Please
register
or
login
to post a comment