David PHAM-VAN

Fix Table.fromTextArray alignments with multi-lines text

# Changelog
## 1.11.1
- Fix Table.fromTextArray alignments with multi-lines text
## 1.11.0
- Fix mixing Arabic with English [Anas Altair]
... ...
... ... @@ -286,9 +286,13 @@ class Table extends Widget implements SpanningWidget {
if (rowNum < headerCount) {
for (final dynamic cell in row) {
final Alignment align =
headerAlignments[tableRow.length] ?? headerAlignment;
final TextAlign textAlign = _textAlign(align);
tableRow.add(
Container(
alignment: headerAlignments[tableRow.length] ?? headerAlignment,
alignment: align,
padding: headerPadding,
constraints: BoxConstraints(minHeight: headerHeight),
child: Text(
... ... @@ -296,15 +300,19 @@ class Table extends Widget implements SpanningWidget {
? cell.toString()
: headerFormat(tableRow.length, cell),
style: headerStyle,
textAlign: textAlign,
),
),
);
}
} else {
for (final dynamic cell in row) {
final Alignment align =
cellAlignments[tableRow.length] ?? cellAlignment;
final TextAlign textAlign = _textAlign(align);
tableRow.add(
Container(
alignment: cellAlignments[tableRow.length] ?? cellAlignment,
alignment: align,
padding: cellPadding,
constraints: BoxConstraints(minHeight: cellHeight),
child: Text(
... ... @@ -312,6 +320,7 @@ class Table extends Widget implements SpanningWidget {
? cell.toString()
: cellFormat(tableRow.length, cell),
style: isOdd ? oddCellStyle : cellStyle,
textAlign: textAlign,
),
),
);
... ... @@ -585,4 +594,14 @@ class Table extends Widget implements SpanningWidget {
border.paint(context, box, _widths, _heights);
}
}
static TextAlign _textAlign(Alignment align) {
if (align.x == 0) {
return TextAlign.center;
} else if (align.x < 0) {
return TextAlign.left;
} else {
return TextAlign.right;
}
}
}
... ...
... ... @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
repository: https://github.com/DavBfr/dart_pdf
issue_tracker: https://github.com/DavBfr/dart_pdf/issues
version: 1.11.0
version: 1.11.1
environment:
sdk: ">=2.3.0 <3.0.0"
... ...