pub struct DataColumn {
pub label: WidgetRef,
pub column_width: Option<TableColumnWidthRef>,
pub tooltip: Option<String>,
pub numeric: bool,
pub on_sort: Option<DataColumnSortCallback>,
pub mouse_cursor: Option<WidgetStatePropertyRef<Option<MouseCursorRef>>>,
pub heading_row_alignment: Option<MainAxisAlignment>,
}Expand description
Column configuration for a DataTable.
One column configuration must be provided for each column to display in the table. The list
of DataColumn objects is passed as the columns argument to the DataTable::new
constructor.
Fields§
§label: WidgetRefThe column heading.
Typically, this will be a Text widget. It could also be an Icon (typically using size
18), or a Row with an icon and some text.
The [label] is placed within a Row along with an arrow icon (if [on_sort] is
non-null). By default, [label] is only as wide as needed to fit its contents.
column_width: Option<TableColumnWidthRef>How the horizontal extents of this column of the table should be determined.
The FixedColumnWidth class can be used to specify a specific width in pixels. This 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.
If this is None, the column width is determined by the table, as described by
DataTable.
tooltip: Option<String>The column heading’s tooltip.
This is a longer description of the column heading, for cases where the heading might have been abbreviated to keep the column width to a reasonable size.
numeric: boolWhether this column represents numeric data or not.
The contents of cells of columns containing numeric data are right-aligned.
on_sort: Option<DataColumnSortCallback>Called when the user asks to sort the table using this column.
If non-null, the user can sort the table using this column. The callback is passed the column index and whether the new sort is ascending.
mouse_cursor: Option<WidgetStatePropertyRef<Option<MouseCursorRef>>>The cursor for a mouse pointer when it enters or is hovering over the heading row.
WidgetStateProperty::resolve is used for the following WidgetStates:
If this is None, then the value of [DataTableThemeData::heading_cell_cursor] is used.
If that’s None too, then SystemMouseCursors::click is used.
heading_row_alignment: Option<MainAxisAlignment>Defines the horizontal layout of the label and sort indicator in the
heading row.
If [DataTable::heading_row_alignment] is set, it takes precedence over this value.
Implementations§
Source§impl DataColumn
impl DataColumn
Sourcepub fn new<K>(label: impl IntoWidget<K>) -> DataColumn
pub fn new<K>(label: impl IntoWidget<K>) -> DataColumn
Creates the configuration for a column of a DataTable; Dart’s optional named
arguments are the setters.
Sourcepub fn column_width(self, column_width: TableColumnWidthRef) -> DataColumn
pub fn column_width(self, column_width: TableColumnWidthRef) -> DataColumn
Dart DataColumn(columnWidth:).
Sourcepub fn tooltip(self, tooltip: impl Into<String>) -> DataColumn
pub fn tooltip(self, tooltip: impl Into<String>) -> DataColumn
Dart DataColumn(tooltip:).
Sourcepub fn numeric(self, numeric: bool) -> DataColumn
pub fn numeric(self, numeric: bool) -> DataColumn
Dart DataColumn(numeric:).
Sourcepub fn on_sort(
self,
on_sort: impl Fn(&mut App, i32, bool) + 'static,
) -> DataColumn
pub fn on_sort( self, on_sort: impl Fn(&mut App, i32, bool) + 'static, ) -> DataColumn
Dart DataColumn(onSort:).
Sourcepub fn mouse_cursor(
self,
mouse_cursor: WidgetStatePropertyRef<Option<MouseCursorRef>>,
) -> DataColumn
pub fn mouse_cursor( self, mouse_cursor: WidgetStatePropertyRef<Option<MouseCursorRef>>, ) -> DataColumn
Dart DataColumn(mouseCursor:).
Sourcepub fn heading_row_alignment(
self,
heading_row_alignment: MainAxisAlignment,
) -> DataColumn
pub fn heading_row_alignment( self, heading_row_alignment: MainAxisAlignment, ) -> DataColumn
Dart DataColumn(headingRowAlignment:).