Skip to content

Commit

Permalink
Merge pull request #5 from mrn/main
Browse files Browse the repository at this point in the history
Add hit test behavior parameter
  • Loading branch information
MingSern committed Jan 3, 2023
2 parents 22b6388 + 346e75d commit 652be0f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/bounceable.dart
Expand Up @@ -22,6 +22,9 @@ class Bounceable extends StatefulWidget {
/// The scale factor of the child widget. The valid range of `scaleFactor` is from `0.0` to `1.0`.
final double scaleFactor;

/// How the internal gesture detector should behave during hit testing.
final HitTestBehavior? hitTestBehavior;

final Widget child;

const Bounceable({
Expand All @@ -36,6 +39,7 @@ class Bounceable extends StatefulWidget {
this.curve = Curves.decelerate,
this.reverseCurve = Curves.decelerate,
this.scaleFactor = 0.8,
this.hitTestBehavior,
}) : assert(
scaleFactor >= 0.0 && scaleFactor <= 1.0,
"The valid range of scaleFactor is from 0.0 to 1.0.",
Expand Down Expand Up @@ -102,6 +106,7 @@ class _BounceableState extends State<Bounceable>
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: widget.hitTestBehavior,
onTapCancel: widget.onTap != null ? _onTapCancel : null,
onTapDown: widget.onTap != null ? _onTapDown : null,
onTapUp: widget.onTap != null ? _onTapUp : null,
Expand Down

0 comments on commit 652be0f

Please sign in to comment.