# The Form widget no longer supports being a sliver.

> The Form widget now includes a semantics widget, which prevents it from being used directly as a sliver.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## Summary

Previously, the Form widget essentially acted as a direct wrapper
around its child. This design allowed a Form containing a sliver child
(e.g., Form(child: other sliver)) to be treated as a sliver itself
 within a CustomScrollView or similar scrollable parent.

However, This PR introduced a new semantics widget
within the Form widget's internal structure. This change alters
its rendering behavior, meaning Form can no longer directly
function as a sliver.

## Context

This change is part of an ongoing effort to improve the
accessibility and semantic understanding of Flutter widgets.
By embedding a semantics widget directly within Form, the framework
can provide better information to accessibility services.

## Description of change

The core change is the integration of a semantics widget
into the Form widget's build method.

## Migration guide

If your app does not currently use the Form widget directly
as a sliver within a scrollable list
(e.g., as a direct child of CustomScrollView's slivers property),
then no changes are required.

If your app use Form as a sliver, you will need to wrap the Form
widget within a SliverToBoxAdapter. SliverToBoxAdapter is a
sliver that contains a single box widget, converting a regular
widget into a sliver that can be placed in a CustomScrollView.

Code before migration:

```dart
sliver: Form(
    key: controller.formKey,
    child: SomeWidgetWithFormFields(),
)
```

Code after migration:

```dart
sliver: SliverToBoxAdapter(
    child: Form(
        key: controller.formKey,
        child: SomeWidgetWithFormFields(),
    )
)
```

## Timeline

Landed in version: 3.35.0-pre<br>
In stable release: 3.35

## References

API documentation:

* [`Form`](https://api.flutter-io.cn/flutter/widgets/Form-class.html)

Relevant issues:

* [Issue 161628](https://github.com/flutter/flutter/issues/161628)

Relevant PRs:

* [PR 170709: Add semantics role for form](https://github.com/flutter/flutter/pull/170709)

