Skip to main content

DataColumn

Struct DataColumn 

Source
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: WidgetRef

The 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: bool

Whether 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

Source

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.

Source

pub fn column_width(self, column_width: TableColumnWidthRef) -> DataColumn

Dart DataColumn(columnWidth:).

Source

pub fn tooltip(self, tooltip: impl Into<String>) -> DataColumn

Dart DataColumn(tooltip:).

Source

pub fn numeric(self, numeric: bool) -> DataColumn

Dart DataColumn(numeric:).

Source

pub fn on_sort( self, on_sort: impl Fn(&mut App, i32, bool) + 'static, ) -> DataColumn

Dart DataColumn(onSort:).

Source

pub fn mouse_cursor( self, mouse_cursor: WidgetStatePropertyRef<Option<MouseCursorRef>>, ) -> DataColumn

Dart DataColumn(mouseCursor:).

Source

pub fn heading_row_alignment( self, heading_row_alignment: MainAxisAlignment, ) -> DataColumn

Dart DataColumn(headingRowAlignment:).

Trait Implementations§

Source§

impl Clone for DataColumn

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DataColumn

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for DataColumn

§

impl !Send for DataColumn

§

impl !Sync for DataColumn

§

impl !UnwindSafe for DataColumn

§

impl Forget for DataColumn

§

impl Freeze for DataColumn
where *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const RcInner<dyn TableColumnWidth> is !null: Freeze, PhantomData<RcInner<dyn TableColumnWidth>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App, i32, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, i32, bool)>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: Freeze,

§

impl Move for DataColumn

§

impl Unpin for DataColumn
where Rc<dyn Widget>: Unpin, Rc<dyn TableColumnWidth>: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn(&mut App, i32, bool)>: Unpin, Rc<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>: Unpin,

§

impl UnsafeUnpin for DataColumn
where *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn TableColumnWidth> is !null: UnsafeUnpin, PhantomData<RcInner<dyn TableColumnWidth>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, i32, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, i32, bool)>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: UnsafeUnpin,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>