Skip to content

Commit

Permalink
feat: remove mouse region
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekAbdelouahed committed Oct 9, 2023
1 parent cfd0234 commit cb50276
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions lib/src/widgets/reaction_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,30 +173,21 @@ class _ReactionButtonState<T> extends State<ReactionButton<T>> {

@override
Widget build(BuildContext context) {
return MouseRegion(
onHover: (details) {
if (!_isContainer) {
_onHover(details.position);
}
final Widget? child = _isContainer
? widget.child
: (_selectedReaction ?? widget.reactions.first)!.icon;

return GestureDetector(
key: _globalKey,
onTap: () {
widget.toggle ? _onCheck() : _onShowReactionsBox();
},
onExit: (details) {
_hoverTimer?.cancel();
onLongPressStart: (details) {
widget.toggle
? _onShowReactionsBox(_isContainer ? details.globalPosition : null)
: null;
},
child: GestureDetector(
key: _globalKey,
onTap: () {
widget.toggle ? _onCheck() : _onShowReactionsBox();
},
onLongPressStart: (details) {
widget.toggle
? _onShowReactionsBox(
_isContainer ? details.globalPosition : null)
: null;
},
child: _isContainer
? widget.child
: (_selectedReaction ?? widget.reactions.first)!.icon,
),
child: child,
);
}
}

0 comments on commit cb50276

Please sign in to comment.