flutter / website

Flutter documentation web site
https://docs.flutter.dev
Other
2.82k stars 3.23k forks source link

Add example on setting `text` on 'Handle changes to a text field' page #3387

Open feinstein opened 4 years ago

feinstein commented 4 years ago

Page URL: https://docs.flutter.dev/cookbook/forms/text-field-changes Page source: https://github.com/flutter/website/tree/master/src/docs/cookbook/forms/text-field-changes.md

Description of issue:

There should be also an example on how to set the text, specially when the docs of the text property make it sound not so obvious on where we can update text.

sfshaza2 commented 1 year ago

@miquelbeltran, please weigh in

miquelbeltran commented 1 year ago

Hi @feinstein do you mean setting the text programmatically, as in calling myController.text = "new text"?

The documentation for the TextEditingController has an example for that https://api.flutter.dev/flutter/widgets/TextEditingController-class.html

If we would add this to the cookbook example, IMO it should be a different cookbook recipe, maybe something titled like "Create a text field with a default value" or "Changing a text field value programmatically".

Alternatively, on the cookbook recipe Retrieve the value of a text field we could add a short section explaining how you can also set the value of the TextEditingController.

feinstein commented 1 year ago

Yes, that's what I mean.

I would appreciate if you stopped sending the documentation on my Cookbook's suggestions. The docs are very complete, they are unrelated with the idea of Cookbooks, which are for jump starting begginers and promoting best practices.

I think this is creating some confusion between my suggestions and the way you evaluate my suggestions.

miquelbeltran commented 1 year ago

Hi @feinstein the team has asked me to review a series of older tickets in the repo and see if there is some work that could be acted on.

It's perfectly fine to disagree with my suggestions, but asking me to stop them is rude and goes against the project code of conduct, hopefully this is just a misunderstanding.

For me, the idea of Cookbook recipes is that they complement existing documentation providing answers to general questions developers may have, and they come from a time in which the documentation in the Flutter website was less complete. They are indeed, as you say, beginner focused.

I think there is no clear answer between deciding if something should be in a cookbook recipe when there is already documentation about that on the website, because that can create duplicated documentation and can generate confusion if it is not kept updated, on the other hand if the existing documentation is not beginner-friendly enough, that is something that should be worked on as well.

feinstein commented 1 year ago

It's a misunderstanding, I am not saying you shouldn't expose your opinions or suggestions, I am just saying that IMHO the docs are not an argument for a Cookbook, as the docs already cover all the API details, for many years, including when the cookbooks first appeared.

My understanding is that Cookbooks are for beginners, or people looking for quick examples and practice, hence why I say the docs shouldn't be mentioned. Now, if you have a different understanding, maybe it's useful to ask for @sfshaza2 or others from the Flutter content team what's the official goal of the Cookbooks and what's the criteria for selecting what's useful and what's not.

miquelbeltran commented 1 year ago

Understood, my apologies, hopefully we can get a second opinion from them.