Skip to content

Commit

Permalink
feat: add behavior to NesPressable (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored Dec 21, 2023
1 parent bdb9010 commit ec0c5b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 0.12.0
- feat: adding `NesBlinker`.
- fix: `NesRunningText` would not update its text.
- feat: add `HitTestBehavior` property to `NesPressable`.

# 0.11.0
- feat: add ability to customize `NesContainer`s pixel sizes.
Expand Down
5 changes: 5 additions & 0 deletions lib/src/widgets/nes_pressabled.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class NesPressable extends StatefulWidget {
this.onPressEnd,
this.onPress,
this.disabled,
this.behavior,
super.key,
});

Expand All @@ -31,6 +32,9 @@ class NesPressable extends StatefulWidget {
/// Child.
final Widget child;

/// The behavior of the hit test of this widget.
final HitTestBehavior? behavior;

@override
State<NesPressable> createState() => _NesPressableState();
}
Expand All @@ -50,6 +54,7 @@ class _NesPressableState extends State<NesPressable> {
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: widget.behavior,
onTap: () {
widget.onPress?.call();
},
Expand Down

0 comments on commit ec0c5b2

Please sign in to comment.