Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add TableCellVerticalAlignment property in markdown stylesheet
  • Loading branch information
joshpetit committed May 2, 2023
commit 9c67e58f18782e416bd64eb49b40dca34410f501
2 changes: 1 addition & 1 deletion packages/flutter_markdown/lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class MarkdownBuilder implements md.NodeVisitor {
} else if (tag == 'table') {
child = Table(
defaultColumnWidth: styleSheet.tableColumnWidth!,
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
defaultVerticalAlignment: styleSheet.tableVerticalAlignment,
border: styleSheet.tableBorder,
children: _tables.removeLast().rows,
);
Expand Down
11 changes: 11 additions & 0 deletions packages/flutter_markdown/lib/src/style_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class MarkdownStyleSheet {
this.tableColumnWidth,
this.tableCellsPadding,
this.tableCellsDecoration,
this.tableVerticalAlignment = TableCellVerticalAlignment.middle,
this.blockquotePadding,
this.blockquoteDecoration,
this.codeblockPadding,
Expand Down Expand Up @@ -362,6 +363,7 @@ class MarkdownStyleSheet {
TableColumnWidth? tableColumnWidth,
EdgeInsets? tableCellsPadding,
Decoration? tableCellsDecoration,
TableCellVerticalAlignment? tableVerticalAlignment,
EdgeInsets? blockquotePadding,
Decoration? blockquoteDecoration,
EdgeInsets? codeblockPadding,
Expand Down Expand Up @@ -414,6 +416,8 @@ class MarkdownStyleSheet {
tableColumnWidth: tableColumnWidth ?? this.tableColumnWidth,
tableCellsPadding: tableCellsPadding ?? this.tableCellsPadding,
tableCellsDecoration: tableCellsDecoration ?? this.tableCellsDecoration,
tableVerticalAlignment:
tableVerticalAlignment ?? this.tableVerticalAlignment,
blockquotePadding: blockquotePadding ?? this.blockquotePadding,
blockquoteDecoration: blockquoteDecoration ?? this.blockquoteDecoration,
codeblockPadding: codeblockPadding ?? this.codeblockPadding,
Expand Down Expand Up @@ -475,6 +479,7 @@ class MarkdownStyleSheet {
tableColumnWidth: other.tableColumnWidth,
tableCellsPadding: other.tableCellsPadding,
tableCellsDecoration: other.tableCellsDecoration,
tableVerticalAlignment: other.tableVerticalAlignment,
blockquotePadding: other.blockquotePadding,
blockquoteDecoration: other.blockquoteDecoration,
codeblockPadding: other.codeblockPadding,
Expand Down Expand Up @@ -594,6 +599,9 @@ class MarkdownStyleSheet {
/// The decoration to use for `th` and `td` elements.
final Decoration? tableCellsDecoration;

/// The [TableCellVerticalAlignment] to use for `th` and `td` elements.
final TableCellVerticalAlignment tableVerticalAlignment;

/// The padding to use for `blockquote` elements.
final EdgeInsets? blockquotePadding;

Expand Down Expand Up @@ -692,6 +700,8 @@ class MarkdownStyleSheet {
other.tableColumnWidth == tableColumnWidth &&
other.tableCellsPadding == tableCellsPadding &&
other.tableCellsDecoration == tableCellsDecoration &&
other.tableVerticalAlignment == tableVerticalAlignment &&
other.tableVerticalAlignment == tableVerticalAlignment &&
other.blockquotePadding == blockquotePadding &&
other.blockquoteDecoration == blockquoteDecoration &&
other.codeblockPadding == codeblockPadding &&
Expand Down Expand Up @@ -748,6 +758,7 @@ class MarkdownStyleSheet {
tableColumnWidth,
tableCellsPadding,
tableCellsDecoration,
tableVerticalAlignment,
blockquotePadding,
blockquoteDecoration,
codeblockPadding,
Expand Down