Skip to content

Commit

Permalink
Merge branch 'main' into bugfixes-december
Browse files Browse the repository at this point in the history
  • Loading branch information
remonh87 authored Dec 18, 2023
2 parents cfd1567 + ab3c0fd commit d8e73a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/stripe/lib/src/widgets/keep_visible_on_focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ class _KeepVisibleOnFocusState extends State<KeepVisibleOnFocus>
}

void onFocusChanged() {
if (widget.focusNode.hasFocus) {
if (widget.focusNode.hasFocus && !_isObserverRegistered) {
WidgetsBinding.instance.addObserver(this);
_lastBottomViewInset = MediaQuery.of(context).viewInsets.bottom;
_isObserverRegistered = true;

} else {
WidgetsBinding.instance.removeObserver(this);
_isObserverRegistered = false;
}
}

late double _lastBottomViewInset;

bool _showOnScreenScheduled = false;

bool _isObserverRegistered = false;

void _showOnScreen() {
if (_showOnScreenScheduled) {
return;
Expand Down Expand Up @@ -79,3 +84,4 @@ class _KeepVisibleOnFocusState extends State<KeepVisibleOnFocus>
super.dispose();
}
}

0 comments on commit d8e73a5

Please sign in to comment.