AdoptAWidget: Table (#69488) (#69588)

* Added Dartpad sample for Table widget

* Changed template to stateless_widget_scaffold

* Removed trailing character
This commit is contained in:
redsolver 2020-11-10 00:20:42 +01:00 committed by GitHub
parent a82c786d29
commit 3b7718c27d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.