Repository navigation
feat: add Table control - #33
Merged
Merged
Conversation
Render Ruby table/table_row as a design-neutral Flutter Table: flex/fixed/fraction/intrinsic column widths, optional TableBorder, row bgcolor, cell padding and vertical alignment. Short rows are padded so Flutter's equal-cell assertion never fires, and hidden cells keep their column.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Tableand itsTableRowchild type (Work Package F, item F5). It is a plain grid for layouts such as receipts, spec sheets and key/value lists, whereDataTableis too heavy.Ruby counterpart: AdamMusa/ruflet#47
Rendering
lib/src/controls/table.dartis one design-neutral file that imports onlywidgets.dart. Material and Cupertino render the same thing: Flutter'sTableinsideLayoutControl.rows, or block children incontrolswhenrowsis empty. Hidden rows are skipped. A child that is not aTableRowrenders anErrorControlwhose message points totable_row.TableRowis a child type only (R3), so it has nocreateWidgetcase.Wire keys
rows/controlschildren(TableRows)column_widthscolumnWidths:{ "0" => {type, value} }default_column_widthdefaultColumnWidth{type: "flex", value: 1}border_colorTableBordersides; no border when nilborder_widthborder_radiusTableBorder.borderRadiusinner_bordershorizontalInside/verticalInsidedefault_vertical_alignmenttop/middle/bottom/baseline/fill/intrinsicHeight(snake_case OK;baselinesetstextBaseline: alphabetic)topcell_paddingPaddingaround every cellcontrolsbgcolorTableRow.decoration: BoxDecoration(color:)Column width types are
flex(value = flex factor, default 1),fixed(pixels),fraction(0..1 of the table width) andintrinsic(optional flex). A bare number means a fixed width. Ruby hash keys arrive as strings and are parsed withint.tryParse, so integer keys also work.Events: only the common
on_animation_endandon_size_change.Tests
test/widgets/ruby_table_test.dart, 32 tests on iOS and Android. The table is 400 px wide unless noted.default_column_widthfixed at 120 applies to unlisted columns.[2, 2]and hidden rows are skipped.bgcolorbecomes aBoxDecoration.border_color; width, radius andinner_borders: falseare checked.cell_paddinginsets each cell: the content is 84 px inside a 100 px column, at offset (8, 8).controlsworks as a fallback.ErrorControl.Table, two rows where the second has one cell, which proves the short-row padding on all 5 platforms.verify_pr.shwith Flutter 3.41.2: +732: All tests passed! (baseline 695).flutter analyze lib testreports No issues found!. The wire-key audit shows 0 new findings: Table and TableRow have every key read.