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: boolWhether 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
impl DataRow
Sourcepub fn new(cells: Vec<DataCell>) -> DataRow
pub fn new(cells: Vec<DataCell>) -> DataRow
Creates the configuration for a row of a DataTable; Dart’s optional named arguments
are the setters.
Sourcepub fn by_index(index: Option<i32>, cells: Vec<DataCell>) -> DataRow
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.
Sourcepub fn on_select_changed(
self,
on_select_changed: impl Fn(&mut App, Option<bool>) + 'static,
) -> DataRow
pub fn on_select_changed( self, on_select_changed: impl Fn(&mut App, Option<bool>) + 'static, ) -> DataRow
Dart DataRow(onSelectChanged:).
Sourcepub fn on_long_press(self, on_long_press: GestureLongPressCallback) -> DataRow
pub fn on_long_press(self, on_long_press: GestureLongPressCallback) -> DataRow
Dart DataRow(onLongPress:).
Sourcepub fn on_hover(self, on_hover: impl Fn(&mut App, bool) + 'static) -> DataRow
pub fn on_hover(self, on_hover: impl Fn(&mut App, bool) + 'static) -> DataRow
Dart DataRow(onHover:).
Sourcepub fn color(self, color: WidgetStatePropertyRef<Option<Color>>) -> DataRow
pub fn color(self, color: WidgetStatePropertyRef<Option<Color>>) -> DataRow
Dart DataRow(color:).
Sourcepub fn mouse_cursor(
self,
mouse_cursor: WidgetStatePropertyRef<Option<MouseCursorRef>>,
) -> DataRow
pub fn mouse_cursor( self, mouse_cursor: WidgetStatePropertyRef<Option<MouseCursorRef>>, ) -> DataRow
Dart DataRow(mouseCursor:).