TCrudConfig<T, K> class

Configuration for TCrudTable.

TCrudConfig defines permission checks, UI labels, tabs, and actions available in the CRUD interface.

Constructors

TCrudConfig({Future<bool> canView(T)?, Future<bool> canEdit(T)?, Future<bool> canDelete(T)?, Future<bool> canArchive(T)?, Future<bool> canRestore(T)?, bool canViewFlat = false, bool canEditFlat = false, bool canDeleteFlat = false, bool canArchiveFlat = false, bool canRestoreFlat = false, String addButtonText = 'Add New', List<TTab<int>>? tabs, List<TCrudTableContent<T, K>> tabContents = const [], String searchPlaceholder = 'Search...', bool showActions = true, int itemsPerPage = 0, List<int> itemsPerPageOptions = const [5, 10, 15, 25, 50], List<TCrudCustomAction<T>> activeActions = const [], List<TCrudCustomAction<T>> archiveActions = const [], List<Widget> topBarActions = const [], bool enableBulkActions = false, List<Widget> bulkActionsBuilder(BuildContext context, TListController<T, K> controller)?, double actionButtonWidth = 50.0, void onTabChange(int tab)?, bool? dense, bool flatActions = true, bool? optionalPaginationBar, TKeyValueMode? cardKeyValueMode, List<TFilterDef<T>>? filters, bool? showFilter = true, String? storageKey, bool? persistSettings = true})
Creates a CRUD configuration.
const

Properties

actionButtonWidth → double
Width of the action buttons column.
final
activeActions → List<TCrudCustomAction<T>>
Custom actions available for active items.
final
addButtonText → String
Text for the "Add New" button.
final
archiveActions → List<TCrudCustomAction<T>>
Custom actions available for archived items.
final
bulkActionsBuilder → List<Widget> Function(BuildContext context, TListController<T, K> controller)?
Builds the top-bar content shown while one or more rows are selected (only used when enableBulkActions is true). Receives the active TListController so actions can read TListController.selectedItems / TListController.selectedCount and call TListController.clearSelection when done. Replaces topBarActions for the duration of the selection; falls back to the normal top bar (create button + topBarActions) when nothing is selected.
final
canArchive → Future<bool> Function(T)?
Check if archiving is allowed.
final
canArchiveFlat → bool
Whether the archive action should render flat (inline).
final
canDelete → Future<bool> Function(T)?
Check if deletion is allowed.
final
canDeleteFlat → bool
Whether the delete action should render flat (inline).
final
canEdit → Future<bool> Function(T)?
Check if editing is allowed.
final
canEditFlat → bool
Whether the edit action should render flat (inline).
final
canRestore → Future<bool> Function(T)?
Check if restoring is allowed.
final
canRestoreFlat → bool
Whether the restore action should render flat (inline).
final
canView → Future<bool> Function(T)?
Check if viewing details is allowed.
final
canViewFlat → bool
Whether the view action should render flat (inline).
final
cardKeyValueMode → TKeyValueMode?
Default layout presentation mode for items in card view. Defaults to TKeyValueMode.inlineFlow.
final
dense → bool?
Whether the table layout should be dense.
final
enableBulkActions → bool
Whether rows can be multi-selected via checkboxes, enabling bulk actions.
final
filters → List<TFilterDef<T>>?
Explicit filter field definitions for the table. If omitted for client-side tables, filter fields are automatically inferred from TTableHeader definitions. For server-side tables, filters must be explicitly provided.
final
flatActions → bool
Whether to render action buttons flat (inline/independently) instead of the default hoverable dropdown menu.
final
hashCode → int
The hash code for this object.
no setterinherited
itemsPerPage → int
Default number of items per page.
final
itemsPerPageOptions → List<int>
Options for items per page dropdown.
final
onTabChange → void Function(int tab)?
Callback fired when a tab is selected.
final
optionalPaginationBar → bool?
Whether the footer pagination bar is skipped when there's only 1 page and no more items.
final
persistSettings → bool?
Whether to persist table layout settings (dense layout, view mode, card layout) per route or storageKey. Defaults to true.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchPlaceholder → String
Placeholder text for the search bar.
final
showActions → bool
Whether to show the actions column.
final
showFilter → bool?
Whether to show the filter button in the top bar. Defaults to true.
final
storageKey → String?
Optional unique key to identify and persist table layout settings (dense layout, view mode, card layout). If null, settings are automatically persisted by the current route name.
final
tabContents → List<TCrudTableContent<T, K>>
Content definitions for each tab.
final
tabs → List<TTab<int>>?
Tab definitions for the table view.
final
topBarActions → List<Widget>
Custom actions to display in the top bar.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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