TableColumnControlHandlesPopupRoute.realtime constructor
TableColumnControlHandlesPopupRoute.realtime({
- required BuildContext controlCellBuildContext,
- required int columnIndex,
- required Listenable? tableViewChanged,
- required ColumnResizeCallback? onColumnResize,
- required ColumnMoveCallback? onColumnMove,
- required ColumnTranslateCallback? onColumnTranslate,
- int leadingImmovableColumnCount = 0,
- int trailingImmovableColumnCount = 0,
- Color? barrierColor,
- ResizeHandleBuilder resizeHandleBuilder = _defaultResizeHandleBuilder,
- DragHandleBuilder dragHandleBuilder = _defaultDragHandleBuilder,
- PopupBuilder? popupBuilder,
- EdgeInsets popupPadding = const EdgeInsets.all(16.0),
- Duration transitionDuration = const Duration(milliseconds: 200),
- ColumnTranslationDurationFunctor columnTranslationDuration = _defaultColumnTranslationDuration,
- Curve columnTranslationCurve = Curves.fastOutSlowIn,
Creates TableColumnControlHandlesPopupRoute that updates columns in realtime as soon as the gesture happens. Although this results in a better user experience, depending on the complexity of a table and the end platform, frequent rebuilds can cause performance issues.
The position of the controls and TableView/SliverTableView to control are determined by the
controlCellBuildContext
passed. It is intended that the BuildContext passed to the cellBuilder function
is used.
columnIndex
is the position of the controlled column.
Other parameters are used as initial values for corresponding ValueNotifier properties of the route that can be changed later in the lifecycle of the route. Refer to their documentation comments for their usage.
Implementation
factory TableColumnControlHandlesPopupRoute.realtime({
required BuildContext controlCellBuildContext,
required int columnIndex,
required Listenable? tableViewChanged,
required ColumnResizeCallback? onColumnResize,
required ColumnMoveCallback? onColumnMove,
required ColumnTranslateCallback? onColumnTranslate,
int leadingImmovableColumnCount = 0,
int trailingImmovableColumnCount = 0,
Color? barrierColor,
ResizeHandleBuilder resizeHandleBuilder = _defaultResizeHandleBuilder,
DragHandleBuilder dragHandleBuilder = _defaultDragHandleBuilder,
PopupBuilder? popupBuilder,
EdgeInsets popupPadding = const EdgeInsets.all(16.0),
Duration transitionDuration = const Duration(milliseconds: 200),
ColumnTranslationDurationFunctor columnTranslationDuration =
_defaultColumnTranslationDuration,
Curve columnTranslationCurve = Curves.fastOutSlowIn,
}) {
var tableContentLayoutState = controlCellBuildContext
.findAncestorStateOfType<TableContentLayoutState>();
assert(
tableContentLayoutState != null,
'No TableView ancestor found.'
' Make sure to pass a correct BuildContext.'
' It is intended to use a BuildContext passed to a cellBuilder function.',
);
var cellRenderObject = controlCellBuildContext.findRenderObject();
assert(cellRenderObject is RenderBox);
var state = controlCellBuildContext
.findAncestorStateOfType<TableColumnControlsControllable>();
assert(state != null, 'No TableView ancestor found');
state = state!;
assert(
onColumnMove == null || state.columns[columnIndex].key != null,
_movingColumnsWithoutKeyAssertionMessage,
);
controlCellBuildContext.findRenderObject() as RenderBox;
return TableColumnControlHandlesPopupRoute._(
state,
tableContentLayoutState!,
cellRenderObject as RenderBox,
columnIndex,
state.columns[columnIndex].key!,
transitionDuration: transitionDuration,
columnTranslationDuration: columnTranslationDuration,
columnTranslationCurve: columnTranslationCurve,
barrierColor: barrierColor,
dragHandleBuilder: dragHandleBuilder,
leadingImmovableColumnCount: leadingImmovableColumnCount,
onColumnMove: onColumnMove,
onColumnResize: onColumnResize,
onColumnTranslate: onColumnTranslate,
popupBuilder: popupBuilder,
popupPadding: popupPadding,
resizeHandleBuilder: resizeHandleBuilder,
trailingImmovableColumnCount: trailingImmovableColumnCount,
tableViewChanged: tableViewChanged,
);
}