TCrudTable<T, K, F extends TFormBase> constructor

const TCrudTable<T, K, F extends TFormBase>({
  1. Key? key,
  2. required List<TTableHeader<T>> headers,
  3. List<T>? items,
  4. TLoadListener<T>? onLoad,
  5. List<T>? archivedItems,
  6. TLoadListener<T>? onArchiveLoad,
  7. F createForm()?,
  8. F editForm(
    1. T item
    )?,
  9. Future<T?> onCreate(
    1. F form
    )?,
  10. Future<void> onView(
    1. T item
    )?,
  11. Future<T?> onEdit(
    1. T item,
    2. F form
    )?,
  12. Future<bool> onArchive(
    1. T item
    )?,
  13. Future<bool> onRestore(
    1. T item
    )?,
  14. Future<bool> onDelete(
    1. T item
    )?,
  15. TCrudConfig<T, K> config = const TCrudConfig(),
  16. TListController<T, K>? controller,
  17. TListController<T, K>? archiveController,
  18. Widget expandedBuilder(
    1. T item,
    2. int index
    )?,
})

Implementation

const TCrudTable({
  super.key,
  required this.headers,
  this.items,
  this.onLoad,
  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.archiveController,
  this.expandedBuilder,
})  : assert(
        (controller == null && (items != null || onLoad != null)) || (controller != null && items == null && onLoad == null),
        'Provide either `controller` OR (`items` / `onLoad`), not both.',
      ),
      assert(
        (archiveController == null && (archivedItems != null || onArchiveLoad != null)) ||
            (archiveController != null && archivedItems == null && onArchiveLoad == null),
        'Provide either `archiveController` OR (`archivedItems` / `onArchiveLoad`), not both.',
      );