diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart index 4ac5363f91..46ce39567a 100644 --- a/packages/flutter/lib/src/widgets/table.dart +++ b/packages/flutter/lib/src/widgets/table.dart @@ -81,6 +81,70 @@ class _TableElementRow { /// /// {@youtube 560 315 https://www.youtube.com/watch?v=_lbE0wsVZSw} /// +/// {@tool dartpad --template=stateless_widget_scaffold} +/// +/// This sample shows a `Table` with borders, multiple types of column widths and different vertical cell alignments. +/// +/// ```dart +/// Widget build(BuildContext context) { +/// return Table( +/// border: TableBorder.all(), +/// columnWidths: { +/// 0: IntrinsicColumnWidth(), +/// 1: FlexColumnWidth(), +/// 2: FixedColumnWidth(64), +/// }, +/// defaultVerticalAlignment: TableCellVerticalAlignment.middle, +/// children: [ +/// TableRow( +/// children: [ +/// Container( +/// height: 32, +/// color: Colors.green, +/// ), +/// TableCell( +/// verticalAlignment: TableCellVerticalAlignment.top, +/// child: Container( +/// height: 32, +/// width: 32, +/// color: Colors.red, +/// ), +/// ), +/// Container( +/// height: 64, +/// color: Colors.blue, +/// ), +/// ], +/// ), +/// TableRow( +/// decoration: BoxDecoration( +/// color: Colors.grey, +/// ), +/// children: [ +/// Container( +/// height: 64, +/// width: 128, +/// color: Colors.purple, +/// ), +/// Container( +/// height: 32, +/// color: Colors.yellow, +/// ), +/// Center( +/// child: Container( +/// height: 32, +/// width: 32, +/// color: Colors.orange, +/// ), +/// ), +/// ], +/// ), +/// ], +/// ); +/// } +/// ``` +/// {@end-tool} +/// /// If you only have one row, the [Row] widget is more appropriate. If you only /// have one column, the [SliverList] or [Column] widgets will be more /// appropriate.