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: TableColumnWidthRefHow 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: TableCellVerticalAlignmentHow 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
impl Table
Sourcepub fn children(self, children: impl IntoIterator<Item = TableRow>) -> Table
pub fn children(self, children: impl IntoIterator<Item = TableRow>) -> Table
Dart Table(children:).
Sourcepub fn column_widths(
self,
column_widths: HashMap<usize, TableColumnWidthRef>,
) -> Table
pub fn column_widths( self, column_widths: HashMap<usize, TableColumnWidthRef>, ) -> Table
Dart Table(columnWidths:).
Sourcepub fn default_column_width(
self,
default_column_width: TableColumnWidthRef,
) -> Table
pub fn default_column_width( self, default_column_width: TableColumnWidthRef, ) -> Table
Dart Table(defaultColumnWidth:).
Sourcepub fn text_direction(self, text_direction: TextDirection) -> Table
pub fn text_direction(self, text_direction: TextDirection) -> Table
Dart Table(textDirection:).
Sourcepub fn border(self, border: TableBorder) -> Table
pub fn border(self, border: TableBorder) -> Table
Dart Table(border:).
Sourcepub fn default_vertical_alignment(
self,
default_vertical_alignment: TableCellVerticalAlignment,
) -> Table
pub fn default_vertical_alignment( self, default_vertical_alignment: TableCellVerticalAlignment, ) -> Table
Dart Table(defaultVerticalAlignment:).
Sourcepub fn text_baseline(self, text_baseline: TextBaseline) -> Table
pub fn text_baseline(self, text_baseline: TextBaseline) -> Table
Dart Table(textBaseline:).
Sourcepub fn into_widget(self) -> WidgetRef
pub fn into_widget(self) -> WidgetRef
The tree node: a Table is its own tree node, which [IntoWidget] converts.
Sourcepub fn effective_row_decorations(&self) -> Option<Vec<Option<DecorationRef>>>
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 RenderObjectWidget for Table
impl RenderObjectWidget for Table
Source§type RenderObject = RenderTable
type RenderObject = RenderTable
covariant RenderObject parameter type.Source§fn create_render_object(
&self,
app: &mut App,
context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn update_render_object(
&self,
app: &mut App,
context: BuildContext,
render_object: RenderHandle<RenderTable>,
)
fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<RenderTable>, )
create_render_object. Read moreSource§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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
fn to_string_short(&self) -> String
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn debug_visit_onstage_children(
&self,
app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
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>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
RenderObject will be of the same type as returned by this object’s
create_render_object.Source§impl Widget for Table
impl Widget for Table
Source§fn key(&self) -> Option<&KeyRef>
fn key(&self) -> Option<&KeyRef>
Source§fn creation_location(&self) -> Option<&'static Location<'static>>
fn creation_location(&self) -> Option<&'static Location<'static>>
Source§fn record_creation_location(&mut self, location: CreationLocation)
fn record_creation_location(&mut self, location: CreationLocation)
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
fn create_element(&self, app: &mut App, this: WidgetRef) -> AnyElement
this is this widget’s shared
reference, which the element keeps.Source§fn widget_type(&self) -> TypeId
fn widget_type(&self) -> TypeId
runtimeType.Source§fn kind(&self) -> WidgetKind
fn kind(&self) -> WidgetKind
Element.updateChild’s superclass
check.Source§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
toStringShort: the type, then the key when there is one, as
Text-[<'title'>].Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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](Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
runtimeType prints in a message: the
type’s own name without its module path. Read moreSource§fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>
fn as_inherited_theme(&self) -> Option<&dyn InheritedTheme>
Source§fn as_render_object(&self) -> Option<&dyn AnyRenderObjectWidget>
fn as_render_object(&self) -> Option<&dyn AnyRenderObjectWidget>
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>
fn as_single_child_render_object( &self, ) -> Option<&dyn AnySingleChildRenderObjectWidget>
SingleChildRenderObjectWidget, when it is one.Source§fn as_multi_child_render_object(
&self,
) -> Option<&dyn AnyMultiChildRenderObjectWidget>
fn as_multi_child_render_object( &self, ) -> Option<&dyn AnyMultiChildRenderObjectWidget>
MultiChildRenderObjectWidget, when it is one.Source§fn as_parent_data(&self) -> Option<&dyn AnyParentDataWidget>
fn as_parent_data(&self) -> Option<&dyn AnyParentDataWidget>
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>
fn as_stateful(&self) -> Option<&dyn AnyStatefulWidget>
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>
fn as_inherited(&self) -> Option<&dyn AnyInheritedWidget>
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>
fn as_stateless(&self) -> Option<&dyn StatelessWidget>
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>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
widget is PreferredSizeWidget: this widget as a PreferredSizeWidget, when
it is one. Read moreAuto 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 Tablewhere
*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
impl UnsafeUnpin for Tablewhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<TableRow>: UnsafeUnpin,
PhantomData<(usize, Rc<dyn TableColumnWidth>)>: UnsafeUnpin,
*const RcInner<dyn TableColumnWidth> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn TableColumnWidth>>: UnsafeUnpin,
&'static Location<'static>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<TreeNodeKind> for Wwhere
W: Widget,
impl<W> IntoWidget<TreeNodeKind> for Wwhere
W: Widget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.