Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

docs.flutter.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.

Learn more

Flutter 3.41 is live! Check out theFlutter 3.41 blog post!

The Visibility widget is no longer focusable by default when maintainState is enabled

The Visibility widget by default no longer implicitly retains focusability for its child when maintainState is enabled.

Important

Summary

#

This change was introduced to fix an issue where anIndexedStacks hidden children would be focusable with keyboard events (seeissue) due to the underlyingVisibility widgets default behavior.

Description of change

#

The core change is theVisibility widget is no longer focusable by default whenmaintainState is enabled. A new flag,maintainFocusability, must be set to true withmaintainState for a hidden widget to remain focusable.

Migration guide

#

If your app has aVisibility widget that does not setmaintainState to true, then no changes are required.

If your app has aVisibility widget that setsmaintainState to true and you relied on the previous default behavior that allowed you to focus your hidden widget, you will need to setmaintainFocusability to true.

Code before migration:

dart
child:Visibility(maintainState:true,child:SomeWidget(),)

Code after migration:

dart
child:Visibility(maintainState:true,maintainFocusability:true,child:SomeWidget(),)

Timeline

#

Landed in version: 3.34.0-pre
In stable release: 3.35

References

#

API documentation:

Relevant issues:

Relevant PRs:

Was this page's content helpful?

Unless stated otherwise, the documentation on this site reflects Flutter 3.38.6. Page last updated on 2025-10-30.View source orreport an issue.


[8]ページ先頭

©2009-2026 Movatter.jp