Skip to content

Setting dismissType onSwipe also allows toast to be closed by tapping on it #77

Description

@vpohrebniakov-zco

A bug was found in the _buildDismissibleChild() method of top_snack_bar.dart. Here, for DismissType.onSwipe, the onTap also reverses the animation:

      case DismissType.onSwipe:
        var childWidget = widget.child;
        for (final direction in widget.dismissDirections) {
          childWidget = TapBounceContainer(
            onTap: () {
              widget.onTap?.call();
              if (!widget.persistent && mounted) {
                _animationController.reverse();
              }
            },
            child: Dismissible(
              direction: direction,
              key: UniqueKey(),
              dismissThresholds: const {DismissDirection.up: 0.2},
              confirmDismiss: (direction) async {
                if (!widget.persistent && mounted) {
                  if (direction == DismissDirection.down) {
                    await _animationController.reverse();
                  } else {
                    _animationController.reset();
                  }
                }
                return false;
              },
              child: childWidget,
            ),
          );
        }
        return childWidget;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions