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:
DataTable, which is not paginated.- https://material.io/go/design-data-tables#data-tables-tables-within-cards
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.
sort_ascending: boolWhether 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.
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: f64The height of the heading row.
This value is optional and defaults to 56.0 if not specified.
horizontal_margin: f64The 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: f64The 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: boolWhether the widget should display checkboxes for selectable rows.
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§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: DataTableSourceRefThe 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.
show_empty_rows: boolWhether 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.
Implementations§
Source§impl PaginatedDataTable
impl PaginatedDataTable
Sourcepub const DEFAULT_ROWS_PER_PAGE: usize = 10
pub const DEFAULT_ROWS_PER_PAGE: usize = 10
The default value for rows_per_page.
Defaults to 10, arbitrarily.
Sourcepub fn new(
columns: Vec<DataColumn>,
source: DataTableSourceRef,
) -> PaginatedDataTable
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.
Sourcepub fn key(self, key: KeyRef) -> PaginatedDataTable
pub fn key(self, key: KeyRef) -> PaginatedDataTable
Dart PaginatedDataTable(key:).
Sourcepub fn header<K>(self, header: impl IntoWidget<K>) -> PaginatedDataTable
pub fn header<K>(self, header: impl IntoWidget<K>) -> PaginatedDataTable
Dart PaginatedDataTable(header:).
Sourcepub fn actions(self, actions: Vec<WidgetRef>) -> PaginatedDataTable
pub fn actions(self, actions: Vec<WidgetRef>) -> PaginatedDataTable
Dart PaginatedDataTable(actions:).
Sourcepub fn sort_column_index(self, sort_column_index: usize) -> PaginatedDataTable
pub fn sort_column_index(self, sort_column_index: usize) -> PaginatedDataTable
Dart PaginatedDataTable(sortColumnIndex:).
Sourcepub fn sort_ascending(self, sort_ascending: bool) -> PaginatedDataTable
pub fn sort_ascending(self, sort_ascending: bool) -> PaginatedDataTable
Dart PaginatedDataTable(sortAscending:).
Sourcepub fn on_select_all(
self,
on_select_all: impl Fn(&mut App, Option<bool>) + 'static,
) -> PaginatedDataTable
pub fn on_select_all( self, on_select_all: impl Fn(&mut App, Option<bool>) + 'static, ) -> PaginatedDataTable
Dart PaginatedDataTable(onSelectAll:).
Sourcepub 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.
pub fn data_row_height(self, data_row_height: f64) -> PaginatedDataTable
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.
Sourcepub fn data_row_min_height(self, data_row_min_height: f64) -> PaginatedDataTable
pub fn data_row_min_height(self, data_row_min_height: f64) -> PaginatedDataTable
Dart PaginatedDataTable(dataRowMinHeight:).
Sourcepub fn data_row_max_height(self, data_row_max_height: f64) -> PaginatedDataTable
pub fn data_row_max_height(self, data_row_max_height: f64) -> PaginatedDataTable
Dart PaginatedDataTable(dataRowMaxHeight:).
Sourcepub 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.
pub fn data_row_height_value(&self) -> Option<f64>
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.
Sourcepub fn heading_row_height(self, heading_row_height: f64) -> PaginatedDataTable
pub fn heading_row_height(self, heading_row_height: f64) -> PaginatedDataTable
Dart PaginatedDataTable(headingRowHeight:).
Sourcepub fn horizontal_margin(self, horizontal_margin: f64) -> PaginatedDataTable
pub fn horizontal_margin(self, horizontal_margin: f64) -> PaginatedDataTable
Dart PaginatedDataTable(horizontalMargin:).
Sourcepub fn column_spacing(self, column_spacing: f64) -> PaginatedDataTable
pub fn column_spacing(self, column_spacing: f64) -> PaginatedDataTable
Dart PaginatedDataTable(columnSpacing:).
Sourcepub fn show_checkbox_column(
self,
show_checkbox_column: bool,
) -> PaginatedDataTable
pub fn show_checkbox_column( self, show_checkbox_column: bool, ) -> PaginatedDataTable
Dart PaginatedDataTable(showCheckboxColumn:).
Dart PaginatedDataTable(showFirstLastButtons:).
Sourcepub fn initial_first_row_index(
self,
initial_first_row_index: Option<usize>,
) -> PaginatedDataTable
pub fn initial_first_row_index( self, initial_first_row_index: Option<usize>, ) -> PaginatedDataTable
Dart PaginatedDataTable(initialFirstRowIndex:); None is Dart’s null.
Sourcepub fn divider_thickness(self, divider_thickness: f64) -> PaginatedDataTable
pub fn divider_thickness(self, divider_thickness: f64) -> PaginatedDataTable
Dart PaginatedDataTable(dividerThickness:).
Sourcepub fn on_page_changed(
self,
on_page_changed: impl Fn(&mut App, usize) + 'static,
) -> PaginatedDataTable
pub fn on_page_changed( self, on_page_changed: impl Fn(&mut App, usize) + 'static, ) -> PaginatedDataTable
Dart PaginatedDataTable(onPageChanged:).
Sourcepub fn rows_per_page(self, rows_per_page: usize) -> PaginatedDataTable
pub fn rows_per_page(self, rows_per_page: usize) -> PaginatedDataTable
Dart PaginatedDataTable(rowsPerPage:).
Sourcepub fn available_rows_per_page(
self,
available_rows_per_page: Vec<usize>,
) -> PaginatedDataTable
pub fn available_rows_per_page( self, available_rows_per_page: Vec<usize>, ) -> PaginatedDataTable
Dart PaginatedDataTable(availableRowsPerPage:).
Sourcepub fn on_rows_per_page_changed(
self,
on_rows_per_page_changed: impl Fn(&mut App, Option<usize>) + 'static,
) -> PaginatedDataTable
pub fn on_rows_per_page_changed( self, on_rows_per_page_changed: impl Fn(&mut App, Option<usize>) + 'static, ) -> PaginatedDataTable
Dart PaginatedDataTable(onRowsPerPageChanged:).
Sourcepub fn drag_start_behavior(
self,
drag_start_behavior: DragStartBehavior,
) -> PaginatedDataTable
pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> PaginatedDataTable
Dart PaginatedDataTable(dragStartBehavior:).
Sourcepub fn checkbox_horizontal_margin(
self,
checkbox_horizontal_margin: f64,
) -> PaginatedDataTable
pub fn checkbox_horizontal_margin( self, checkbox_horizontal_margin: f64, ) -> PaginatedDataTable
Dart PaginatedDataTable(checkboxHorizontalMargin:).
Sourcepub fn arrow_head_color(self, arrow_head_color: Color) -> PaginatedDataTable
pub fn arrow_head_color(self, arrow_head_color: Color) -> PaginatedDataTable
Dart PaginatedDataTable(arrowHeadColor:).
Sourcepub fn controller(self, controller: ScrollControllerRef) -> PaginatedDataTable
pub fn controller(self, controller: ScrollControllerRef) -> PaginatedDataTable
Dart PaginatedDataTable(controller:).
Sourcepub fn primary(self, primary: bool) -> PaginatedDataTable
pub fn primary(self, primary: bool) -> PaginatedDataTable
Dart PaginatedDataTable(primary:).
Sourcepub fn heading_row_color(
self,
heading_row_color: WidgetStatePropertyRef<Option<Color>>,
) -> PaginatedDataTable
pub fn heading_row_color( self, heading_row_color: WidgetStatePropertyRef<Option<Color>>, ) -> PaginatedDataTable
Dart PaginatedDataTable(headingRowColor:).
Sourcepub fn show_empty_rows(self, show_empty_rows: bool) -> PaginatedDataTable
pub fn show_empty_rows(self, show_empty_rows: bool) -> PaginatedDataTable
Dart PaginatedDataTable(showEmptyRows:).
Sourcepub fn sort_icon_builder(
self,
sort_icon_builder: impl Fn(&mut App, BuildContext, bool, bool) -> WidgetRef + 'static,
) -> PaginatedDataTable
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
impl Clone for PaginatedDataTable
Source§impl Debug for PaginatedDataTable
impl Debug for PaginatedDataTable
Source§impl StatefulWidget for PaginatedDataTable
impl StatefulWidget for PaginatedDataTable
Source§type State = PaginatedDataTableState
type State = PaginatedDataTableState
Source§fn create_state(&self) -> PaginatedDataTableState
fn create_state(&self) -> PaginatedDataTableState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 PaginatedDataTablewhere
*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 PaginatedDataTablewhere
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 PaginatedDataTablewhere
*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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.