Skip to main content

DataRow

Struct DataRow 

Source
pub struct DataRow {
    pub key: Option<Rc<dyn LocalKey>>,
    pub on_select_changed: Option<ValueChanged<Option<bool>>>,
    pub on_long_press: Option<GestureLongPressCallback>,
    pub on_hover: Option<ValueChanged<bool>>,
    pub selected: bool,
    pub cells: Vec<DataCell>,
    pub color: Option<WidgetStatePropertyRef<Option<Color>>>,
    pub mouse_cursor: Option<WidgetStatePropertyRef<Option<MouseCursorRef>>>,
}
Expand description

Row configuration and cell data for a DataTable.

One row configuration must be provided for each row to display in the table. The list of DataRow objects is passed as the rows argument to the DataTable::new constructor.

The data for this row of the table is provided in the cells property of the DataRow object.

Fields§

§key: Option<Rc<dyn LocalKey>>

A LocalKey that identifies the row.

Rows must have a key if the table can be reordered.

§on_select_changed: Option<ValueChanged<Option<bool>>>

Called when the user selects or unselects a selectable row.

If this is not null, then the row is selectable. The current selection state of the row is given by selected.

If any row is selectable, then the table’s heading row will have a checkbox that can be checked to select all selectable rows (and which is checked if all the rows are selected), and each subsequent row will have a checkbox to toggle just that row.

A row whose on_select_changed callback is null is ignored for the purposes of determining the state of the “all” checkbox, and its checkbox is disabled.

If a DataCell in the row has its DataCell::on_tap callback defined, that callback behavior overrides the gesture behavior of the row for that particular cell.

§on_long_press: Option<GestureLongPressCallback>

Called if the row is long-pressed.

If a DataCell in the row has its DataCell::on_tap, DataCell::on_double_tap, DataCell::on_long_press, DataCell::on_tap_cancel or DataCell::on_tap_down callback defined, that callback behavior overrides the gesture behavior of the row for that particular cell.

§on_hover: Option<ValueChanged<bool>>

Called when a pointer enters or exits the row.

The boolean value passed to the callback is true if a pointer has entered the row and false if it has exited.

§selected: bool

Whether the row is selected.

If on_select_changed is non-null for any row in the table, then a checkbox is shown at the start of each row. If the row is selected (true), the checkbox will be checked and the row will be highlighted.

Otherwise, the checkbox, if present, will not be checked.

§cells: Vec<DataCell>

The data for this row.

There must be exactly as many cells as there are columns in the table.

§color: Option<WidgetStatePropertyRef<Option<Color>>>

The color for the row.

By default, the color is transparent unless selected. Selected rows has a grey translucent color.

The effective color can depend on the WidgetState state, if the row is selected, pressed, hovered, focused, disabled or enabled. The color is painted as an overlay to the row. To make sure that the row’s InkWell is visible (when pressed, hovered and focused), it is recommended to use a translucent color.

§mouse_cursor: Option<WidgetStatePropertyRef<Option<MouseCursorRef>>>

The cursor for a mouse pointer when it enters or is hovering over the data row.

WidgetStateProperty::resolve is used for the following WidgetStates:

If this is None, then the value of [DataTableThemeData::data_row_cursor] is used. If that’s None too, then SystemMouseCursors::click is used.

Implementations§

Source§

impl DataRow

Source

pub fn new(cells: Vec<DataCell>) -> DataRow

Creates the configuration for a row of a DataTable; Dart’s optional named arguments are the setters.

Source

pub fn by_index(index: Option<i32>, cells: Vec<DataCell>) -> DataRow

Dart’s DataRow.byIndex: creates the configuration for a row of a DataTable, deriving the key from a row index.

The row is keyed with a ValueKey<Option<i32>> of index.

Source

pub fn key(self, key: impl LocalKey + 'static) -> DataRow

Dart DataRow(key:).

Source

pub fn selected(self, selected: bool) -> DataRow

Dart DataRow(selected:).

Source

pub fn on_select_changed( self, on_select_changed: impl Fn(&mut App, Option<bool>) + 'static, ) -> DataRow

Dart DataRow(onSelectChanged:).

Source

pub fn on_long_press(self, on_long_press: GestureLongPressCallback) -> DataRow

Dart DataRow(onLongPress:).

Source

pub fn on_hover(self, on_hover: impl Fn(&mut App, bool) + 'static) -> DataRow

Dart DataRow(onHover:).

Source

pub fn color(self, color: WidgetStatePropertyRef<Option<Color>>) -> DataRow

Dart DataRow(color:).

Source

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

Dart DataRow(mouseCursor:).

Trait Implementations§

Source§

impl Clone for DataRow

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 DataRow

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for DataRow

§

impl !Send for DataRow

§

impl !Sync for DataRow

§

impl !UnwindSafe for DataRow

§

impl Forget for DataRow

§

impl Freeze for DataRow
where *const RcInner<dyn LocalKey> is !null: Freeze, PhantomData<RcInner<dyn LocalKey>>: Freeze, *const RcInner<dyn Fn(&mut App, Option<bool>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Option<bool>)>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const u8 is !null: Freeze, PhantomData<DataCell>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: Freeze,

§

impl Move for DataRow

§

impl Unpin for DataRow
where Rc<dyn LocalKey>: Unpin, Rc<dyn Fn(&mut App, Option<bool>)>: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<dyn Fn(&mut App, bool)>: Unpin, *const u8 is !null: Unpin, Rc<dyn Widget>: Unpin, Rc<dyn Fn(&mut App, TapDownDetails)>: Unpin, Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin, Rc<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>: Unpin,

§

impl UnsafeUnpin for DataRow
where *const RcInner<dyn LocalKey> is !null: UnsafeUnpin, PhantomData<RcInner<dyn LocalKey>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Option<bool>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Option<bool>)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<DataCell>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: 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>