SIGN IN SIGN UP

Refactor FormField build wrappers (#185795)

## Summary

This is the refactor-only half of the sliver form field work.

`FormFieldState.build` now delegates its validation semantics wrapper
and `AutovalidateMode.onUnfocus` focus wrapper through protected
`wrapWithSemantics` and `wrapWithFocus` methods. The shared validation
result and `Focus.includeSemantics` value are kept behind small getters
so subclasses can customize only the layout-protocol-specific pieces.

There is no intended behavior change for `FormField` or existing
subclasses. The existing render-box semantics and focus behavior remain
the same.

## Issue

Preparation for #173912. This PR does not fix the issue by itself; the
sliver API can follow in a separate PR after this refactor lands.

## Tests

- `flutter analyze --no-pub packages/flutter/lib/src/widgets/form.dart
packages/flutter/test/widgets/form_test.dart
packages/flutter/test/widgets/semantics_test.dart
packages/flutter/test/material/text_form_field_test.dart
packages/flutter/test/material/text_form_field_restoration_test.dart
packages/flutter/test/material/dropdown_form_field_test.dart
packages/flutter/test/material/dropdown_menu_form_field_test.dart
packages/flutter/test/material/input_date_picker_form_field_test.dart`
- `flutter test packages/flutter/test/widgets/form_test.dart
packages/flutter/test/widgets/semantics_test.dart
packages/flutter/test/material/text_form_field_test.dart
packages/flutter/test/material/text_form_field_restoration_test.dart
packages/flutter/test/material/dropdown_form_field_test.dart
packages/flutter/test/material/dropdown_menu_form_field_test.dart
packages/flutter/test/material/input_date_picker_form_field_test.dart`

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide].
- [x] I listed at least one issue that this PR relates to in the
description above.
- [x] I added or updated tests where needed for the change I am making.
- [x] All existing and new tests are passing.

[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
S
Soroush Yousefpour committed
a5ca6d377b030d2218c0cb819d3a108cfb4c700d
Parent: 3f531e5
Committed by GitHub <noreply@github.com> on 8/27/2026, 1:08:48 AM