ReorderableTable constructor
ReorderableTable({
- required ReorderCallback onReorder,
- List<
ReorderableTableRow> children = const <ReorderableTableRow>[], - Map<
int, TableColumnWidth> ? columnWidths, - TableColumnWidth defaultColumnWidth = const FlexColumnWidth(1.0),
- TextDirection? textDirection,
- TableBorder? border,
- TableCellVerticalAlignment defaultVerticalAlignment = TableCellVerticalAlignment.top,
- TextBaseline? textBaseline,
- Widget? header,
- DecorateDraggableFeedback? decorateDraggableFeedback,
- NoReorderCallback? onNoReorder,
- Duration? reorderAnimationDuration,
- Duration? scrollAnimationDuration,
- bool ignorePrimaryScrollController = false,
- bool needsLongPressDraggable = true,
- Key? key,
- Color? borderColor,
Creates a reorderable table.
The children, defaultColumnWidth, and defaultVerticalAlignment arguments must not be null.
Implementation
ReorderableTable({
required this.onReorder,
this.children = const <ReorderableTableRow>[],
this.columnWidths,
this.defaultColumnWidth = const FlexColumnWidth(1.0),
this.textDirection,
this.border,
this.defaultVerticalAlignment = TableCellVerticalAlignment.top,
this.textBaseline,
this.header,
this.footer,
this.decorateDraggableFeedback,
this.onNoReorder,
this.reorderAnimationDuration,
this.scrollAnimationDuration,
this.ignorePrimaryScrollController = false,
this.needsLongPressDraggable = true,
Key? key,
this.borderColor,
}) : assert(() {
if (children.any((ReorderableTableRow row1) =>
row1.key != null &&
children.any((ReorderableTableRow row2) =>
row1 != row2 && row1.key == row2.key))) {
throw FlutterError(
'Two or more ReorderableTableRow children of this Table had the same key.\n'
'All the keyed ReorderableTableRow children of a Table must have different Keys.');
}
return true;
}()),
// assert(() {
// if (children.isNotEmpty) {
// final int cellCount = children.first.children.length;
// if (children.any((ReorderableTableRow row) => row.children.length != cellCount)) {
// throw FlutterError(
// 'Table contains irregular row lengths.\n'
// 'Every ReorderableTableRow in a Table must have the same number of children, so that every cell is filled. '
// 'Otherwise, the table will contain holes.'
// );
// }
// }
// return true;
// }()),
super(key: key) {
assert(() {
final List<Widget> flatChildren = children
.expand<Widget>((ReorderableTableRow row) => row.children)
.toList(growable: false);
if (debugChildrenHaveDuplicateKeys(this, flatChildren)) {
throw FlutterError(
'Two or more cells in this Table contain widgets with the same key.\n'
'Every widget child of every TableRow in a Table must have different keys. The cells of a Table are '
'flattened out for processing, so separate cells cannot have duplicate keys even if they are in '
'different rows.');
}
return true;
}());
}