Skip to main content

PaginatedDataTable

Struct PaginatedDataTable 

Source
pub struct PaginatedDataTable {
Show 29 fields pub key: Option<KeyRef>, pub header: Option<WidgetRef>, pub actions: Option<Vec<WidgetRef>>, pub columns: Vec<DataColumn>, pub sort_column_index: Option<usize>, pub sort_ascending: bool, pub on_select_all: Option<ValueChanged<Option<bool>>>, pub data_row_min_height: Option<f64>, pub data_row_max_height: Option<f64>, pub heading_row_height: f64, pub horizontal_margin: f64, pub column_spacing: f64, pub show_checkbox_column: bool, pub show_first_last_buttons: bool, pub initial_first_row_index: Option<usize>, pub divider_thickness: Option<f64>, pub on_page_changed: Option<ValueChanged<usize>>, pub rows_per_page: usize, pub available_rows_per_page: Vec<usize>, pub on_rows_per_page_changed: Option<ValueChanged<Option<usize>>>, pub source: DataTableSourceRef, pub drag_start_behavior: DragStartBehavior, pub checkbox_horizontal_margin: Option<f64>, pub arrow_head_color: Option<Color>, pub controller: Option<ScrollControllerRef>, pub primary: Option<bool>, pub heading_row_color: Option<WidgetStatePropertyRef<Option<Color>>>, pub show_empty_rows: bool, pub sort_icon_builder: Option<DataTableSortIconBuilder>,
}
Expand description

A table that follows the Material 2 design guidelines, with pagination.

A paginated data table shows rows_per_page rows of data per page and provides controls for showing other pages.

Data is addressed by index (0 is the top row). The columns define the columns of the table, and the source provides the rows (see DataTableSource).

The PaginatedDataTable scrolls horizontally if it is too narrow for its columns.

See also:

Fields§

§key: Option<KeyRef>§header: Option<WidgetRef>

The table card’s optional header.

This is typically a Text widget, but can also be a Row of TextButtons. To show icon buttons at the top end side of the table with a header, set the actions property.

If items in the table are selectable, then, when the selection is not empty, the header is replaced by a count of the selected items. The actions are still visible when items are selected.

§actions: Option<Vec<WidgetRef>>

Icon buttons to show at the top end side of the table. The header must not be null to show the actions.

Typically, the exact actions included in this list will vary based on whether any rows are selected or not.

These should be size 24.0 with default padding (8.0).

§columns: Vec<DataColumn>

The configuration and labels for the columns in the table.

§sort_column_index: Option<usize>

The current primary sort key’s column.

See DataTable::sort_column_index.

§sort_ascending: bool

Whether the column mentioned in sort_column_index, if any, is sorted in ascending order.

See DataTable::sort_ascending for details.

§on_select_all: Option<ValueChanged<Option<bool>>>

Invoked when the user selects or unselects every row, using the checkbox in the heading row.

See DataTable::on_select_all.

§data_row_min_height: Option<f64>

The minimum height of each row (excluding the row that contains column headings).

This value is optional and defaults to K_MIN_INTERACTIVE_DIMENSION if not specified.

§data_row_max_height: Option<f64>

The maximum height of each row (excluding the row that contains column headings).

This value is optional and defaults to K_MIN_INTERACTIVE_DIMENSION if not specified.

§heading_row_height: f64

The height of the heading row.

This value is optional and defaults to 56.0 if not specified.

§horizontal_margin: f64

The horizontal margin between the edges of the table and the content in the first and last cells of each row.

When a checkbox is displayed, it is also the margin between the checkbox the content in the first data column.

This value defaults to 24.0 to adhere to the Material Design specifications.

§column_spacing: f64

The horizontal margin between the contents of each data column.

This value defaults to 56.0 to adhere to the Material Design specifications.

§show_checkbox_column: bool

Whether the widget should display checkboxes for selectable rows.

See DataTable::show_checkbox_column.

§show_first_last_buttons: bool

Whether to display buttons to go to the first and last pages.

Defaults to false.

§initial_first_row_index: Option<usize>

The index of the first row to display when the widget is first created.

§divider_thickness: Option<f64>

The thickness of the divider between rows.

This value is optional and defaults to 1.0 if not specified.

§on_page_changed: Option<ValueChanged<usize>>

Invoked when the user switches to another page.

The value is the index of the first row on the currently displayed page.

§rows_per_page: usize

The number of rows to show on each page.

See also:

§available_rows_per_page: Vec<usize>

The options to offer for the rowsPerPage.

The current rows_per_page must be a value in this list.

The values in this list should be sorted in ascending order.

§on_rows_per_page_changed: Option<ValueChanged<Option<usize>>>

Invoked when the user selects a different number of rows per page.

If this is null, then the value given by rows_per_page will be used and no affordance will be provided to change the value.

§source: DataTableSourceRef

The data source which provides data to show in each row.

This object should generally have a lifetime longer than the PaginatedDataTable widget itself; it should be reused each time the PaginatedDataTable constructor is called.

§drag_start_behavior: DragStartBehavior

{@macro flutter.widgets.scrollable.dragStartBehavior}

§checkbox_horizontal_margin: Option<f64>

Horizontal margin around the checkbox, if it is displayed.

§arrow_head_color: Option<Color>

Defines the color of the arrow heads in the footer.

§controller: Option<ScrollControllerRef>

Controls the scrolling of the horizontal table, which is only needed when the PaginatedDataTable is too narrow.

If null, a scroll controller is created internally by the scroll view.

§primary: Option<bool>

Whether this is the primary scroll view associated with the parent PrimaryScrollController.

When true, the scroll view will use the ambient primary scroll controller.

§heading_row_color: Option<WidgetStatePropertyRef<Option<Color>>>

The background color for the heading row.

See DataTable::heading_row_color.

§show_empty_rows: bool

Whether to display empty rows when the data source runs out of rows on the last page.

Defaults to true.

§sort_icon_builder: Option<DataTableSortIconBuilder>

Overrides the default sort indicator.

See DataTable::sort_icon_builder.

Implementations§

Source§

impl PaginatedDataTable

Source

pub const DEFAULT_ROWS_PER_PAGE: usize = 10

The default value for rows_per_page.

Defaults to 10, arbitrarily.

Source

pub fn new( columns: Vec<DataColumn>, source: DataTableSourceRef, ) -> PaginatedDataTable

Creates a widget describing a paginated DataTable on a Card; Dart’s optional named arguments are the setters.

The available_rows_per_page list must have at least one member and must all be greater than zero.

Source

pub fn key(self, key: KeyRef) -> PaginatedDataTable

Dart PaginatedDataTable(key:).

Source

pub fn header<K>(self, header: impl IntoWidget<K>) -> PaginatedDataTable

Dart PaginatedDataTable(header:).

Source

pub fn actions(self, actions: Vec<WidgetRef>) -> PaginatedDataTable

Dart PaginatedDataTable(actions:).

Source

pub fn sort_column_index(self, sort_column_index: usize) -> PaginatedDataTable

Dart PaginatedDataTable(sortColumnIndex:).

Source

pub fn sort_ascending(self, sort_ascending: bool) -> PaginatedDataTable

Dart PaginatedDataTable(sortAscending:).

Source

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

Dart PaginatedDataTable(onSelectAll:).

Source

pub fn data_row_height(self, data_row_height: f64) -> PaginatedDataTable

👎Deprecated:

Migrate to use data_row_min_height and data_row_max_height instead. This feature was deprecated after v3.7.0-5.0.pre.

Dart’s deprecated PaginatedDataTable(dataRowHeight:): it sets data_row_min_height and data_row_max_height to one value.

Dart asserts that the argument is not given with either of them; a fluent chain has no one call to compare, so a later setter replaces what an earlier one wrote.

Source

pub fn data_row_min_height(self, data_row_min_height: f64) -> PaginatedDataTable

Dart PaginatedDataTable(dataRowMinHeight:).

Source

pub fn data_row_max_height(self, data_row_max_height: f64) -> PaginatedDataTable

Dart PaginatedDataTable(dataRowMaxHeight:).

Source

pub fn data_row_height_value(&self) -> Option<f64>

👎Deprecated:

Migrate to use data_row_min_height and data_row_max_height instead. This feature was deprecated after v3.7.0-5.0.pre.

Dart’s deprecated dataRowHeight getter: the row height, if the minimum and the maximum are the same.

Source

pub fn heading_row_height(self, heading_row_height: f64) -> PaginatedDataTable

Dart PaginatedDataTable(headingRowHeight:).

Source

pub fn horizontal_margin(self, horizontal_margin: f64) -> PaginatedDataTable

Dart PaginatedDataTable(horizontalMargin:).

Source

pub fn column_spacing(self, column_spacing: f64) -> PaginatedDataTable

Dart PaginatedDataTable(columnSpacing:).

Source

pub fn show_checkbox_column( self, show_checkbox_column: bool, ) -> PaginatedDataTable

Dart PaginatedDataTable(showCheckboxColumn:).

Source

pub fn show_first_last_buttons( self, show_first_last_buttons: bool, ) -> PaginatedDataTable

Dart PaginatedDataTable(showFirstLastButtons:).

Source

pub fn initial_first_row_index( self, initial_first_row_index: Option<usize>, ) -> PaginatedDataTable

Dart PaginatedDataTable(initialFirstRowIndex:); None is Dart’s null.

Source

pub fn divider_thickness(self, divider_thickness: f64) -> PaginatedDataTable

Dart PaginatedDataTable(dividerThickness:).

Source

pub fn on_page_changed( self, on_page_changed: impl Fn(&mut App, usize) + 'static, ) -> PaginatedDataTable

Dart PaginatedDataTable(onPageChanged:).

Source

pub fn rows_per_page(self, rows_per_page: usize) -> PaginatedDataTable

Dart PaginatedDataTable(rowsPerPage:).

Source

pub fn available_rows_per_page( self, available_rows_per_page: Vec<usize>, ) -> PaginatedDataTable

Dart PaginatedDataTable(availableRowsPerPage:).

Source

pub fn on_rows_per_page_changed( self, on_rows_per_page_changed: impl Fn(&mut App, Option<usize>) + 'static, ) -> PaginatedDataTable

Dart PaginatedDataTable(onRowsPerPageChanged:).

Source

pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> PaginatedDataTable

Dart PaginatedDataTable(dragStartBehavior:).

Source

pub fn checkbox_horizontal_margin( self, checkbox_horizontal_margin: f64, ) -> PaginatedDataTable

Dart PaginatedDataTable(checkboxHorizontalMargin:).

Source

pub fn arrow_head_color(self, arrow_head_color: Color) -> PaginatedDataTable

Dart PaginatedDataTable(arrowHeadColor:).

Source

pub fn controller(self, controller: ScrollControllerRef) -> PaginatedDataTable

Dart PaginatedDataTable(controller:).

Source

pub fn primary(self, primary: bool) -> PaginatedDataTable

Dart PaginatedDataTable(primary:).

Source

pub fn heading_row_color( self, heading_row_color: WidgetStatePropertyRef<Option<Color>>, ) -> PaginatedDataTable

Dart PaginatedDataTable(headingRowColor:).

Source

pub fn show_empty_rows(self, show_empty_rows: bool) -> PaginatedDataTable

Dart PaginatedDataTable(showEmptyRows:).

Source

pub fn sort_icon_builder( self, sort_icon_builder: impl Fn(&mut App, BuildContext, bool, bool) -> WidgetRef + 'static, ) -> PaginatedDataTable

Dart PaginatedDataTable(sortIconBuilder:).

Trait Implementations§

Source§

impl Clone for PaginatedDataTable

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 PaginatedDataTable

Source§

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

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for PaginatedDataTable

Source§

type State = PaginatedDataTableState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn debug_check_constructor(&self)

Source§

fn create_state(&self) -> PaginatedDataTableState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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 as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for PaginatedDataTable

§

impl !Send for PaginatedDataTable

§

impl !Sync for PaginatedDataTable

§

impl !UnwindSafe for PaginatedDataTable

§

impl Forget for PaginatedDataTable

§

impl Freeze for PaginatedDataTable
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const u8 is !null: Freeze, PhantomData<Rc<dyn Widget>>: Freeze, PhantomData<DataColumn>: 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, usize)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, usize)>>: Freeze, PhantomData<usize>: Freeze, *const RcInner<dyn Fn(&mut App, Option<usize>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Option<usize>)>>: Freeze, NonZero<u32>: Freeze, &'static DataTableSourceVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, &'static ScrollControllerVTable: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, bool, bool) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, bool, bool) -> Rc<dyn Widget>>>: Freeze,

§

impl Move for PaginatedDataTable

§

impl Unpin for PaginatedDataTable
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, *const u8 is !null: Unpin, Rc<dyn TableColumnWidth>: Unpin, Rc<dyn Fn(&mut App, i32, bool)>: Unpin, Rc<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>: Unpin, Rc<dyn Fn(&mut App, Option<bool>)>: Unpin, Rc<dyn Fn(&mut App, usize)>: Unpin, Rc<dyn Fn(&mut App, Option<usize>)>: Unpin, NonZero<u32>: Unpin, &'static DataTableSourceVTable: Unpin, Rc<Keep>: Unpin, &'static ScrollControllerVTable: Unpin, Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin, Rc<dyn Fn(&mut App, AnyElement, bool, bool) -> Rc<dyn Widget>>: Unpin,

§

impl UnsafeUnpin for PaginatedDataTable
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Rc<dyn Widget>>: UnsafeUnpin, PhantomData<DataColumn>: 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, usize)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, usize)>>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Option<usize>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Option<usize>)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static DataTableSourceVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, &'static ScrollControllerVTable: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, bool, bool) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, bool, bool) -> Rc<dyn Widget>>>: 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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
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>