TCrudTable<T, K, F extends TFormBase> constructor

const TCrudTable<T, K, F extends TFormBase>({
  1. Key? key,
  2. required List<TTableHeader<T, K>> headers,
  3. List<T>? items,
  4. TLoadListener<T>? onLoad,
  5. ItemKeyAccessor<T, K>? itemKey,
  6. List<T>? itemChildren(
    1. T item
    )?,
  7. List<T>? archivedItems,
  8. TLoadListener<T>? onArchiveLoad,
  9. F createForm()?,
  10. F editForm(
    1. T item
    )?,
  11. Future<T?> onCreate(
    1. F form
    )?,
  12. Future<void> onView(
    1. T item
    )?,
  13. Future<T?> onEdit(
    1. T item,
    2. F form
    )?,
  14. Future<bool?> onArchive(
    1. T item
    )?,
  15. Future<bool?> onRestore(
    1. T item
    )?,
  16. Future<bool?> onDelete(
    1. T item
    )?,
  17. TCrudConfig<T, K> config = const TCrudConfig(),
  18. TListController<T, K>? controller,
  19. TControllerReadyListener<T, K>? onControllerReady,
  20. TListController<T, K>? archiveController,
  21. void onArchiveControllerReady(
    1. TListController<T, K> controller
    )?,
  22. TListExpandedBuilder<T, K>? expandedBuilder,
  23. TTableDetails<T, K>? expandedDetails,
  24. TTableExpansionMode expansionMode = TTableExpansionMode.dialog,
  25. TTableExpansionMode? createMode,
  26. double? dialogWidth,
  27. double? createDialogWidth,
  28. double? sideOverlayWidth,
  29. double? createSideOverlayWidth,
  30. String? itemTitle(
    1. T x
    )?,
  31. String? itemSubTitle(
    1. T x
    )?,
  32. String? itemDescription(
    1. T x
    )?,
  33. String? itemImageUrl(
    1. T x
    )?,
  34. List<TKeyValue>? itemInfo(
    1. T x
    )?,
  35. bool itemInfoGridInline = true,
  36. TTableTheme? theme,
  37. Widget rowBuilder(
    1. BuildContext ctx,
    2. TListItem<T, K> item,
    3. int index,
    4. Widget row,
    )?,
  38. Color? rowColorBuilder(
    1. TListItem<T, K> item,
    2. int index
    )?,
})

Creates a CRUD table.

Implementation

const TCrudTable({
  super.key,
  required this.headers,
  this.items,
  this.onLoad,
  this.itemKey,
  this.itemChildren,
  this.archivedItems,
  this.onArchiveLoad,
  this.createForm,
  this.editForm,
  this.onCreate,
  this.onView,
  this.onEdit,
  this.onArchive,
  this.onRestore,
  this.onDelete,
  this.config = const TCrudConfig(),
  this.controller,
  this.onControllerReady,
  this.archiveController,
  this.onArchiveControllerReady,
  this.expandedBuilder,
  this.expandedDetails,
  this.expansionMode = TTableExpansionMode.dialog,
  this.createMode,
  this.dialogWidth,
  this.createDialogWidth,
  this.sideOverlayWidth,
  this.createSideOverlayWidth,
  this.itemTitle,
  this.itemSubTitle,
  this.itemDescription,
  this.itemImageUrl,
  this.itemInfo,
  this.itemInfoGridInline = true,
  this.theme,
  this.rowBuilder,
  this.rowColorBuilder,
})  : assert(
        controller == null || (items == null && onLoad == null && onControllerReady == null && itemKey == null && itemChildren == null),
        'Provide either `controller` OR (`items` / `onLoad` / `onControllerReady` / `itemKey`), not both.',
      ),
      assert(
        archiveController == null || (archivedItems == null && onArchiveLoad == null && onArchiveControllerReady == null),
        'Provide either `archiveController` OR (`archivedItems` / `onArchiveLoad` / `onArchiveControllerReady`), not both.',
      );