Skip to content

Make "fields" in FormState not a private member #67283

Description

@panudetjt

Use case

I want to implement feature that when form validated fail scroll to that FormField.

currently I implement with copy form.dart file and change _field to field to make it public

and do some validation like document said

and scroll to specify field with

formKey.currentState.validate();
Scrollable.ensureVisible(formKey.currentState.fields.first.context,
        duration: Duration(milliseconds: 500));

Proposal

form.dart

...
class FormState extends State<Form> {
  int _generation = 0;
  final Set<FormFieldState<dynamic>> fields = <FormFieldState<dynamic>>{};
...

What do you think ?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: text inputEntering text in a text field or keyboard related problemsc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions