toggleAction method

Future<void> toggleAction(
  1. int index, {
  2. Curve curve = Curves.easeInOut,
  3. Duration duration = const Duration(milliseconds: 150),
})

toggle the action item at index according to the openedPosition if index has been expanded, it would collapse if index has not been expanded, it would expand

if the openedPosition is null, it would do nothing

Implementation

Future<void> toggleAction(
  int index, {
  Curve curve = Curves.easeInOut,
  Duration duration = const Duration(milliseconds: 150),
}) async {
  switch (openedPosition) {
    case ActionPosition.pre:
      await preActionController?.toggle(
        index,
        curve: curve,
        duration: duration,
      );
      break;
    case ActionPosition.post:
      await postActionController?.toggle(
        index,
        curve: curve,
        duration: duration,
      );
      break;
    default:
      break;
  }
}