Skip to content
pubscout

ensure_visible_when_focused

1.2.0, released 3 years ago by rodrigobastos.dev

A widget that automatically scrolls its child into view when the child gains focus.

WASM-ready
$ flutter pub add ensure_visible_when_focused
Source repository

What it does

Ensures that a target widget, such as a text field, automatically scrolls into the viewport whenever it receives focus. You wrap your widget in the provided widget and pass the corresponding FocusNode.

AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You have large forms with multiple fields that need to scroll into view automatically upon focusing.
  • You want to improve user experience on mobile or web forms by keeping focused inputs visible.

Skip it when

  • You already manage scrolling manually through complex scroll controllers on every focus event.

Strengths

  • Simple integration by wrapping the target widget
  • Configurable scroll duration and curve
  • Solves a common form-scrolling issue with minimal boilerplate

Weaknesses

  • Limited to focus-driven scrolling scenarios
  • Requires passing a FocusNode to both the wrapper and the target widget

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
EnsureVisibleWhenFocused(
    focusNode: _focusNode,
    child: TextFormField(
        focusNode: _focusNode,
    ),
)

Alternatives

Packages that do the same job and could replace ensure_visible_when_focused.