ThemedTable<T> class

Inheritance

Constructors

ThemedTable({Key? key, required List<ThemedColumn<T>> columns, required List<T> items, Future<void> onShow(BuildContext, T)?, Future<void> onEdit(BuildContext, T)?, Future<void> onDelete(BuildContext, T)?, Future<bool> onMultiDelete(BuildContext ctx, List<T> items)?, List<ThemedActionButton> additionalActions(BuildContext, T)?, String searchText = '', required String module, Widget? title, VoidCallback? onAdd, List<Widget> additionalButtons = const [], required String idBuilder(BuildContext, T), bool multiSelectionEnabled = true, List<ThemedTableAction<T>> multiSelectionActions = const [], int minSelectionsBeforeDialog = 2, double mobileBreakpoint = kExtraSmallGrid, bool isLoading = false, bool isCooldown = false, VoidCallback? onCooldown, VoidCallback? onRefresh, void onSelectedItemsChanged(BuildContext, List<T>)?, bool enableMultiSelectDialog = true, bool canEdit(BuildContext, T) = kThemedTableCanTrue, bool canDelete(BuildContext, T) = kThemedTableCanTrue, String idLabel = 'ID', String? customTitleText, double rowHeight = 40.0, CellTap? onIdTap, bool idEnabled = true, int? rowsPerPage, List<int> availableRowsPerPage = const [10, 25, 50, 100], String paginatorStartText = 'First page', String paginatorPreviousText = 'Previous page', String paginatorShowingText = 'Showing {count} of {total}', String paginatorNextText = 'Next page', String paginatorEndText = 'Last page', String paginatorAutoText = 'Fit screen', String paginatorRowsPerPageText = 'Rows per page', String showButtonLabelText = 'Show item', String editButtonLabelText = 'Edit item', String deleteButtonLabelText = 'Delete item', String actionsLabelText = 'Actions', String searchLabelText = 'Search item', String multiSelectionTitleText = 'Multiselection mode', String multiSelectionContentText = 'What do you want to do with the selected items?', String multiSelectionCancelLabelText = 'Cancel', String multiSelectionDeleteLabelText = 'Delete', String tableTitleText = 'My items ({count})', String addButtonLabelText = 'Add new item', String refreshButtonLabelText = 'Reload list'})
A standard table with a list of items, designed to be used in the scaffold. Helps to display a list of items in desktop and mobile mode without a lot of code. (I hope so) Please read the documentation of each property to understand how to use it.
const

Properties

actionsLabelText String
actionsLabelText replaces the text of the actions label. This property only will work when LayrzAppLocalizations is null.
final
addButtonLabelText String
addButtonLabelText replaces the text of the table add button. This property only will work when LayrzAppLocalizations is null.
final
additionalActions → (List<ThemedActionButton> Function(BuildContext, T)?)
Represents the additional actions generator for each row. This actions will be append before the onShow button inside the ThemedActionsButtons widget.
final
additionalButtons List<Widget>
Represents the additional buttons of the table. This buttons will be append before the onAdd button.
final
availableRowsPerPage List<int>
availableRowsPerPage represents the list of rows per page to display in the dropdown. By default, this value is 10, 25, 50, 100
final
canDelete bool Function(BuildContext, T)
canDelete represents the callback to check if the item can be deleted. If this function returns false, the delete button will be disabled. By default, this function returns true.
final
canEdit bool Function(BuildContext, T)
canEdit represents the callback to check if the item can be edited. If this function returns false, the edit button will be disabled. By default, this function returns true.
final
columns List<ThemedColumn<T>>
Represents the columns or headers of the table. This columns only will be displayed in desktop size.
final
customTitleText String?
customTitleText represents the custom title text of the table. If this property is null, the title will be generated using the module property.
final
deleteButtonLabelText String
deleteButtonLabelText replaces the text of the delete button. This property only will work when LayrzAppLocalizations is null.
final
editButtonLabelText String
editButtonLabelText replaces the text of the edit button. This property only will work when LayrzAppLocalizations is null.
final
enableMultiSelectDialog bool
Represents the automatic dialog display of the multiple selection. If this property is true, the dialog will be displayed when the user selects more than minSelectionsBeforeDialog items.
final
hashCode int
The hash code for this object.
no setterinherited
idBuilder String Function(BuildContext, T)
Represents the builder of the id of the item. This will be used to sort the items by id, and will appear as the first column of the table.
final
idEnabled bool
idEnabled refers to the id column. If this property is false, the id column will be hidden. By default, this value is true
final
idLabel String
idLabel represents the label of the id column. By default, this value is ID
final
isCooldown bool
Indicates (through buttons) that the table is in cooldown
final
isLoading bool
Represents the indicator of the buttons Indicates (through buttons) that the table is loading
final
items List<T>
Is the list of items to display
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minSelectionsBeforeDialog int
Represents the minimum selected items before show the dialog
final
mobileBreakpoint double
Represents the breakpoint to switch to mobile size. By default is kExtraSmallGrid
final
module String
Represents the module name of the table. This is used to generate the titleText and the add button label. The format of each translation key should be:
final
multiSelectionActions List<ThemedTableAction<T>>
Represents the additional actions to display when the multiple selection is enabled
final
multiSelectionCancelLabelText String
multiSelectionCancelLabelText replaces the text of the multi selection cancel button. This property only will work when LayrzAppLocalizations is null.
final
multiSelectionContentText String
multiSelectionContentText replaces the text of the multi selection content. This property only will work when LayrzAppLocalizations is null.
final
multiSelectionDeleteLabelText String
multiSelectionDeleteLabelText replaces the text of the multi selection delete button. This property only will work when LayrzAppLocalizations is null.
final
multiSelectionEnabled bool
Represents the multiple selection is enabled
final
multiSelectionTitleText String
multiSelectionTitleText replaces the text of the multi selection title. This property only will work when LayrzAppLocalizations is null.
final
onAdd VoidCallback?
Represents the callback when the user clicks on the add button.
final
onCooldown VoidCallback?
This will be called when the ThemedButton completes the cooldown
final
onDelete → (Future<void> Function(BuildContext, T)?)
onDelete will be called when the user clicks on the delete button. The delete button only will show ehen this function is not null.
final
onEdit → (Future<void> Function(BuildContext, T)?)
onEdit will be called when the user clicks on the edit button. The edit button only will show ehen this function is not null.
final
onIdTap CellTap?
onIdTap represents the callback when the user taps on a cell.
final
onMultiDelete → (Future<bool> Function(BuildContext ctx, List<T> items)?)
onMultiDelete will be called when the user selects multiple items and perform the option multiDelete. The multiDelete button only will show ehen this function is not null.
final
onRefresh VoidCallback?
This will be called when the user clicks on the refresh button
final
onSelectedItemsChanged → (void Function(BuildContext, List<T>)?)
Represents the callback when the user selects multiple items. This callback will be called when the user selects or deselects an item.
final
onShow → (Future<void> Function(BuildContext, T)?)
onShow will be called when the user clicks on the show button. On mobile size, the row click also will call this function. The show button only will show ehen this function is not null.
final
paginatorAutoText String
paginatorAutoText replaces the text of the fit screen button. This property only will work when LayrzAppLocalizations is null.
final
paginatorEndText String
paginatorEndText replaces the text of the last page button. This property only will work when LayrzAppLocalizations is null.
final
paginatorNextText String
paginatorNextText replaces the text of the next page button. This property only will work when LayrzAppLocalizations is null.
final
paginatorPreviousText String
paginatorPreviousText replaces the text of the previous page button. This property only will work when LayrzAppLocalizations is null.
final
paginatorRowsPerPageText String
paginatorRowsPerPageText replaces the text of the rows per page label. This property only will work when LayrzAppLocalizations is null.
final
paginatorShowingText String
paginatorShowingText replaces the text of the showing items label. This property only will work when LayrzAppLocalizations is null.
final
paginatorStartText String
paginatorStartText replaces the text of the first page button. This property only will work when LayrzAppLocalizations is null.
final
refreshButtonLabelText String
refreshButtonLabelText replaces the text of the refresh button. This property only will work when LayrzAppLocalizations is null.
final
rowHeight double
rowHeight represents the height of the row when the table is in desktop size. By default, this value is 40.0
final
rowsPerPage int?
rowsPerPage represents the number of rows per page. By default this value is calculated using the rowHeight and the available height of the table
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchLabelText String
searchLabelText replaces the text of the search label. This property only will work when LayrzAppLocalizations is null.
final
searchText String
Represents the default search value of the table.
final
showButtonLabelText String
showButtonLabelText replaces the text of the show button. This property only will work when LayrzAppLocalizations is null.
final
tableTitleText String
tableTitleText replaces the text of the table title. This property only will work when LayrzAppLocalizations is null.
final
title Widget?
title represents the custom title of the table. If this property is null, the title will be generated using the module property.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ThemedTable<T>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited