Skip to main content

Table

Struct Table 

Source
pub struct Table {
    pub key: Option<KeyRef>,
    pub children: Vec<TableRow>,
    pub column_widths: Option<HashMap<usize, TableColumnWidthRef>>,
    pub default_column_width: TableColumnWidthRef,
    pub text_direction: Option<TextDirection>,
    pub border: Option<TableBorder>,
    pub default_vertical_alignment: TableCellVerticalAlignment,
    pub text_baseline: Option<TextBaseline>,
    /* private fields */
}
Expand description

A widget that uses the table layout algorithm for its children.

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.

Rows size vertically based on their contents. To control the individual column widths, use the column_widths property to specify a TableColumnWidth for each column. If column_widths is None, or there is no entry for a given column in column_widths, the table uses the default_column_width instead.

By default, default_column_width is a FlexColumnWidth. This TableColumnWidth divides up the remaining space in the horizontal axis to determine the column width. If wrapping a Table in a horizontal ScrollView, choose a different TableColumnWidth, such as FixedColumnWidth.

For more details about the table layout algorithm, see RenderTable. To control the alignment of children, see TableCell.

Fields§

§key: Option<KeyRef>§children: Vec<TableRow>

The rows of the table.

Every row in a table must have the same number of children.

§column_widths: Option<HashMap<usize, TableColumnWidthRef>>

How the horizontal extents of the columns of this table should be determined.

If the map has no entry for a given column, the table uses the default_column_width instead. By default, that uses flex sizing to distribute free space equally among the columns.

The FixedColumnWidth class can be used to specify a specific width in pixels. That is the cheapest way to size a table’s columns.

The layout performance of the table depends critically on which column sizing algorithms are used here. In particular, IntrinsicColumnWidth is quite expensive because it needs to measure each cell in the column to determine the intrinsic size of the column.

The keys of this map (column indexes) are zero-based.

If this is set to None, then an empty map is assumed.

§default_column_width: TableColumnWidthRef

How to determine with widths of columns that don’t have an explicit sizing algorithm.

Specifically, the default_column_width is used for column i if column_widths[i] is absent. Defaults to FlexColumnWidth, which will divide the remaining horizontal space up evenly between columns of the same type TableColumnWidth.

A Table in a horizontal ScrollView must use a FixedColumnWidth, or an IntrinsicColumnWidth as the horizontal space is infinite.

§text_direction: Option<TextDirection>

The direction in which the columns are ordered.

Defaults to the ambient Directionality.

§border: Option<TableBorder>

The style to use when painting the boundary and interior divisions of the table.

§default_vertical_alignment: TableCellVerticalAlignment

How cells that do not explicitly specify a vertical alignment are aligned vertically.

Cells may specify a vertical alignment by wrapping their contents in a TableCell widget.

§text_baseline: Option<TextBaseline>

The text baseline to use when aligning rows using TableCellVerticalAlignment::Baseline.

This must be set if using baseline alignment. There is no default because there is no way for the framework to know the correct baseline a priori.

Implementations§

Source§

impl Table

Source

pub fn new() -> Table

Creates a table; Dart’s named arguments are the setters.

Source

pub fn key(self, key: KeyRef) -> Table

Dart Table(key:).

Source

pub fn children(self, children: impl IntoIterator<Item = TableRow>) -> Table

Dart Table(children:).

Source

pub fn column_widths( self, column_widths: HashMap<usize, TableColumnWidthRef>, ) -> Table

Dart Table(columnWidths:).

Source

pub fn default_column_width( self, default_column_width: TableColumnWidthRef, ) -> Table

Dart Table(defaultColumnWidth:).

Source

pub fn text_direction(self, text_direction: TextDirection) -> Table

Dart Table(textDirection:).

Source

pub fn border(self, border: TableBorder) -> Table

Dart Table(border:).

Source

pub fn default_vertical_alignment( self, default_vertical_alignment: TableCellVerticalAlignment, ) -> Table

Dart Table(defaultVerticalAlignment:).

Source

pub fn text_baseline(self, text_baseline: TextBaseline) -> Table

Dart Table(textBaseline:).

Source

pub fn into_widget(self) -> WidgetRef

The tree node: a Table is its own tree node, which [IntoWidget] converts.

Source

pub fn effective_row_decorations(&self) -> Option<Vec<Option<DecorationRef>>>

Dart’s _rowDecorations field, as its constructor fills it: each row’s decoration when any row has one, else None.

Trait Implementations§

Source§

impl Debug for Table

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Table

Source§

fn default() -> Table

Returns the “default value” for a type. Read more
Source§

impl RenderObjectWidget for Table

Source§

type RenderObject = RenderTable

The render object this widget creates; Dart’s covariant RenderObject parameter type.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject

Creates an instance of the RenderObject class that this widget represents, using the configuration described by this widget. Read more
Source§

fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<RenderTable>, )

Copies the configuration described by this widget to the given render object, which will be of the same type as returned by this object’s create_render_object. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn to_string_short(&self) -> String

Dart’s toStringShort, for a widget that names itself apart from its type, as SizedBox.expand does; see Widget::to_string_short.
Source§

fn debug_check_constructor(&self)

Source§

fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )

Dart’s debugVisitOnstageChildren of the element this widget makes, for a widget whose Dart element subclass overrides it only to hide children (_OffstageElement, _IndexedStackElement): calls visitor for each of children, in order, that is onstage. Waft’s generic single- and multi-child elements stand in for those subclasses and ask their widget here; an element of a widget’s own overrides Element::debug_visit_onstage_children instead.
Source§

fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )

A render object previously associated with this widget has been removed from the tree. The given RenderObject will be of the same type as returned by this object’s create_render_object.
Source§

impl Widget for Table

Source§

fn key(&self) -> Option<&KeyRef>

Controls how one widget replaces another widget in the tree. Read more
Source§

fn creation_location(&self) -> Option<&'static Location<'static>>

Where the widget was made, in a debug build: Dart’s creation location, which the widget inspector shows and its summary tree keeps the app’s own widgets by.
Source§

fn record_creation_location(&mut self, location: CreationLocation)

Keeps where the widget was made, for creation_location to answer: what into_widget calls on a widget that is its own tree node, which has no wrapper to keep it in. Such a widget keeps it in a field (created: Option<CreationLocation>); the default keeps nothing.
Source§

fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement

Inflates this configuration to a concrete instance. this is this widget’s shared reference, which the element keeps.
Source§

fn as_any(&self) -> &dyn Any

The concrete widget, for Dart’s widget as Foo.
Source§

fn widget_type(&self) -> TypeId

The concrete widget’s type, Dart’s runtimeType.
Source§

fn kind(&self) -> WidgetKind

The kind of element this widget inflates to, for Element.updateChild’s superclass check.
Source§

fn to_string_short(&self) -> String

Dart’s toStringShort: the type, then the key when there is one, as Text-[<'title'>].
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which [to_diagnostics_node](::to_diagnostics_node) does before calling this.
Source§

fn type_name(&self) -> &'static str

The concrete widget’s type name, as Dart’s runtimeType prints in a message: the type’s own name without its module path. Read more
Source§

fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>

Dart’s widget is InheritedTheme: this widget as an InheritedTheme, when it is one. Read more
Source§

fn as_render_object(&self) -> Option<&dyn AnyRenderObjectWidget>

This widget as a RenderObjectWidget, when it is one of the three kinds the framework makes elements for (leaf, single-child, multi-child): what those elements create and update their render object through, so they are not copied per widget type.
Source§

fn as_single_child_render_object( &self, ) -> Option<&dyn AnySingleChildRenderObjectWidget>

This widget as a SingleChildRenderObjectWidget, when it is one.
Source§

fn as_multi_child_render_object( &self, ) -> Option<&dyn AnyMultiChildRenderObjectWidget>

This widget as a MultiChildRenderObjectWidget, when it is one.
Source§

fn as_parent_data(&self) -> Option<&dyn AnyParentDataWidget>

This widget as a ParentDataWidget, when it is one: what the one ParentDataElement reads, so that element is not copied per widget type.
Source§

fn as_stateful(&self) -> Option<&dyn AnyStatefulWidget>

This widget as a StatefulWidget, when it is one: what the one StatefulElement creates its state through, so that element is not copied per widget type.
Source§

fn as_inherited(&self) -> Option<&dyn AnyInheritedWidget>

This widget as an InheritedWidget, when it is one: what the one InheritedElement reads, so that element is not copied per widget type.
Source§

fn as_stateless(&self) -> Option<&dyn StatelessWidget>

This widget as a StatelessWidget, when it is one: what the one StatelessElement builds from, so that element is not copied per widget type.
Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Dart’s widget is PreferredSizeWidget: this widget as a PreferredSizeWidget, when it is one. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Table

§

impl !Send for Table

§

impl !Sync for Table

§

impl !UnwindSafe for Table

§

impl Forget for Table

§

impl Freeze for Table
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<TableRow>: Freeze, PhantomData<(usize, Rc<dyn TableColumnWidth>)>: Freeze, *const RcInner<dyn TableColumnWidth> is !null: Freeze, PhantomData<RcInner<dyn TableColumnWidth>>: Freeze, &'static Location<'static>: Freeze,

§

impl Move for Table

§

impl Unpin for Table
where Rc<dyn Key>: Unpin, *const u8 is !null: Unpin, Rc<dyn LocalKey>: Unpin, Rc<dyn Decoration>: Unpin, Rc<dyn Widget>: Unpin, Rc<dyn TableColumnWidth>: Unpin, &'static Location<'static>: Unpin,

§

impl UnsafeUnpin for Table

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<TreeNodeKind> for W
where W: Widget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>