Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FormBuilderTextField] Add allowClear #798

Closed
fehernyul opened this issue May 14, 2021 · 2 comments
Closed

[FormBuilderTextField] Add allowClear #798

fehernyul opened this issue May 14, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fehernyul
Copy link

Exactly the same like in FormBuilderDropdown.
I tried to make this, but the looking what it displays so wierd.

image

    child: Row(
      children: [
        Flexible(
          child: FormBuilderTextField(
            name: controlId,

            decoration: InputDecoration(
              labelText: field.dataType,
            ),

            validator: FormBuilderValidators.compose([
              FormBuilderValidators.required(ctx),
            ]),
            initialValue: field.initialValue,

            keyboardType: TextInputType.text,
          ),
        ),
        //const VerticalDivider(),
        InkWell(
          onTap: () {
            _formKey.currentState!.fields[field.fieldName]!.didChange('');
            //_formKey.currentState!.fields[field.fieldName]!.didChange(null);
          },
          child: Icon(Icons.clear),
        ),
      ],
@avdept
Copy link

avdept commented May 25, 2022

Bumping on this. Would use it too

UPD: Turned out its pretty easy to add via decoration

decoration: InputDecoration(
          suffixIcon: IconButton(
                  icon: const Icon(Icons.clear),
                  onPressed: () => {},
                ))

@deandreamatias deandreamatias added the enhancement New feature or request label Jun 10, 2022
@deandreamatias deandreamatias added the good first issue Good for newcomers label Jul 21, 2022
@deandreamatias deandreamatias changed the title need "allowClear" for FormBuilderTextField [FormBuilderTextField] Add allowClear Jul 21, 2022
@deandreamatias
Copy link
Collaborator

The answer of @avdept is correct

Currently we avoid created more parameters related with InputDecoration.
Instead, we will remove existent parameters on other fields like can see in this PR: #1078

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants