Skip to content

Commit

Permalink
feat: remove unused resources
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekAbdelouahed committed Oct 10, 2023
1 parent a40b15f commit a8ebd81
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions lib/src/widgets/reaction_button.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_reaction_button/flutter_reaction_button.dart';
import 'package:flutter_reaction_button/src/enums/reaction.dart';
Expand Down Expand Up @@ -87,17 +85,15 @@ class ReactionButton<T> extends StatefulWidget {
class _ReactionButtonState<T> extends State<ReactionButton<T>> {
final GlobalKey _globalKey = GlobalKey();

OverlayEntry? _overlayEntry;

late Reaction<T>? _selectedReaction =
_isChecked ? widget.selectedReaction : widget.placeholder;

late bool _isChecked = widget.isChecked;

Timer? _hoverTimer;

bool get _isContainer => widget._type == ReactionType.container;

OverlayEntry? _overlayEntry;

void _updateReaction(Reaction<T>? reaction) {
_isChecked = reaction != widget.placeholder;
widget.onReactionChanged.call(reaction);
Expand All @@ -106,18 +102,7 @@ class _ReactionButtonState<T> extends State<ReactionButton<T>> {
});
}

void _onHover(Offset offset) {
_hoverTimer?.cancel();
_hoverTimer = Timer(
widget.hoverDuration,
() {
_onShowReactionsBox(offset);
},
);
}

void _onCheck() {
_hoverTimer?.cancel();
_isChecked = !_isChecked;
_updateReaction(
_isChecked
Expand All @@ -127,7 +112,6 @@ class _ReactionButtonState<T> extends State<ReactionButton<T>> {
}

void _onShowReactionsBox([Offset? offset]) {
_hoverTimer?.cancel();
_overlayEntry = OverlayEntry(
builder: (context) {
return ReactionsBox<T>(
Expand Down Expand Up @@ -166,7 +150,6 @@ class _ReactionButtonState<T> extends State<ReactionButton<T>> {

@override
void dispose() {
_hoverTimer?.cancel();
_disposeOverlayEntry();
super.dispose();
}
Expand Down

0 comments on commit a8ebd81

Please sign in to comment.