Issues/58053 - Set default textBaseline to alphabetic in the Table widget (#60586)

This commit is contained in:
Ram Navan 2020-07-06 12:19:02 -07:00 committed by GitHub
parent de205ec13c
commit 60deae8546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -63,3 +63,4 @@ Brian Wang <xinlei966@gmail.com>
法的空间 <zmtzawqlp@live.com>
CaiJingLong <cjl_spy@163.com>
Alex Li <google@alexv525.com>
Ram Navan <hiramprasad@gmail.com>

View File

@ -109,7 +109,7 @@ class Table extends RenderObjectWidget {
this.textDirection,
this.border,
this.defaultVerticalAlignment = TableCellVerticalAlignment.top,
this.textBaseline,
this.textBaseline = TextBaseline.alphabetic,
}) : assert(children != null),
assert(defaultColumnWidth != null),
assert(defaultVerticalAlignment != null),
@ -201,6 +201,8 @@ class Table extends RenderObjectWidget {
final TableCellVerticalAlignment defaultVerticalAlignment;
/// The text baseline to use when aligning rows using [TableCellVerticalAlignment.baseline].
///
/// Defaults to [TextBaseline.alphabetic].
final TextBaseline textBaseline;
final List<Decoration> _rowDecorations;

View File

@ -932,5 +932,29 @@ void main() {
},
);
testWidgets(
'Table widget - Default textBaseline is set to TableBaseline.alphabetic',
(WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.baseline,
children: const <TableRow>[
TableRow(
children: <Widget>[
Text('Some Text'),
],
),
],
),
),
);
final RenderTable table = tester.renderObject(find.byType(Table));
expect(table.textBaseline, TextBaseline.alphabetic);
},
);
// TODO(ianh): Test handling of TableCell object
}