MockSwipeController class

Test double for SwipeController that records method invocations.

Use in unit tests to verify that a component calls controller methods without needing a real SwipeActionCell:

test('button calls openLeft on tap', () async {
  final mock = MockSwipeController();
  // inject mock into the widget under test
  expect(mock.openLeftCallCount, 0);
  // simulate tap
  mock.openLeft();
  expect(mock.openLeftCallCount, 1);
});
Inheritance

Constructors

MockSwipeController()

Properties

closeCallCount → int
Number of times close was called.
no setter
currentProgress → double
The current cumulative progressive value of the attached cell.
no setteroverride
currentState → SwipeState
The current state of the attached cell's state machine.
no setteroverride
hasHandle → bool
Whether a SwipeCellHandle is currently attached.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isOpen → bool
Whether the attached cell is currently in the SwipeState.revealed state.
no setterinherited
isUndoPending → bool
Whether an undo window is currently open for the attached cell.
no setterinherited
openCallCount → int
Combined openLeft + openRight call count.
no setter
openDirection → SwipeDirection?
The direction the cell is open in, or null when isOpen is false.
no setterinherited
openLeftCallCount → int
Number of times openLeft was called.
no setter
openRightCallCount → int
Number of times openRight was called.
no setter
resetProgressCallCount → int
Number of times resetProgress was called.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stubbedProgress ↔ double
Stub return value for currentProgress. Default: 0.0.
getter/setter pair
stubbedState ↔ SwipeState
Stub return value for currentState. Default: SwipeState.idle.
getter/setter pair
undoCallCount → int
Number of times undo was called.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
attach(SwipeCellHandle handle) → void
Attaches a SwipeCellHandle from SwipeActionCellState.
inherited
close() → void
Programmatically closes the attached cell, snapping it back to the resting (origin) position.
override
commitPendingUndo() → void
Force-commits the pending undo immediately (as if expired).
inherited
detach(SwipeCellHandle handle) → void
Detaches the current SwipeCellHandle.
inherited
dispose() → void
Discards any resources used by the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
openLeft() → void
Programmatically triggers a left-swipe open on the attached cell.
override
openRight() → void
Programmatically triggers a right-swipe increment on the attached cell.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reportProgress(double progress) → void
Called by SwipeActionCellState to update the cached progress value.
inherited
reportState(SwipeState state, double progress, SwipeDirection? direction) → void
Called by SwipeActionCellState to push the latest state into this controller and notify listeners.
inherited
reportUndoPending(bool isPending) → void
Called by SwipeActionCellState to update the cached progress value without a full state transition. Skips notification when the value is unchanged.
inherited
resetCalls() → void
Resets all call counts to 0. Does not modify stubs.
resetProgress() → void
Resets the progressive value of the attached cell to RightSwipeConfig.initialValue.
override
setProgress(double value) → void
Sets the progressive value of the attached cell to value, clamped to [RightSwipeConfig.minValue..RightSwipeConfig.maxValue].
inherited
toString() → String
A string representation of this object.
inherited
undo() → bool
Sets the progressive value of the attached cell to value, clamped to [RightSwipeConfig.minValue..RightSwipeConfig.maxValue].
override

Operators

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