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

Change the example code to match the code description #9088

Merged
merged 5 commits into from
Jul 25, 2023
Merged

Change the example code to match the code description #9088

merged 5 commits into from
Jul 25, 2023

Conversation

eshfield
Copy link
Contributor

The code description says:

Put the text in a Container

but the code itself uses a Padding widget

The code description says "Put the text in a Container" but the code itself uses a Padding widget
Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me but, @DemX86, you have to run tools/refresh-code/excerpts. That's why the build is breaking.

@atsansone atsansone added the review.await-update Awaiting Updates after Edits label Jul 24, 2023
@eshfield
Copy link
Contributor Author

I am sorry but I have failed to run tool/refresh-code-excerpts.sh script — it doesn't work on my WSL installation.
I have updated the code example examples/layout/lakes/step4/lib/main.dart manually with second commit but with no luck for test passing.
Can anyone help me and run the script on your machine?

@parlough
Copy link
Member

parlough commented Jul 24, 2023

I'm super sorry about the issues with WSL and windows in general. I hope to look further into the compatibility issues once I get a chance. I appreciate all of the fixes and help you provide despite those challenges though.

I'd be happy to regenerate the snippets for you. Looks like we'll need to adjust a few more source examples for other steps first though to be consistent (and to avoid issues with the generated diff excerpt): step5 and step6.

Would you like to update those source .dart files or would you prefer I do?

Thanks again for your help!

@eshfield
Copy link
Contributor Author

@parlough Thanks for help! I didn’t guess that it was necessary to fix the example code of the rest steps too

@domesticmouse
Copy link
Contributor

In this case I feel like the text is correct, using a container for padding is inefficient. Maybe updating the text to agree with the code would be a better fix.

@eshfield
Copy link
Contributor Author

In this case I feel like the text is correct, using a container for padding is inefficient. Maybe updating the text to agree with the code would be a better fix.

This option also exists.

I think that way: the article introduces to reader only the Container widget — it's already used prior Step 4 and has a mention about in the text — the tutorial has no word about the Padding widget in the description. So I decided that whole article uses a Container widget to control the padding and margin in the layout.

@domesticmouse
Copy link
Contributor

What I meant to say is that the text is incorrect.

But yes, this is a major rewrite to correct. I'm happy to see this PR landed so the code and text agree, but we do need to take an action item to update it to reflect the fact that the code, as written, will probably generate linter warnings for the ineffeciency of using a container when a padding widget does the job much more efficiently =)

Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domesticmouse Is right and we should consider modifying the text to introduce Padding in that section, but matching the code with the text seems good to do for now. I opened #9118 to track that improvement.

Thanks again for this and fixing those build failures!

@parlough parlough merged commit 07c07e7 into flutter:main Jul 25, 2023
9 checks passed
atsansone pushed a commit to atsansone/website that referenced this pull request Jul 25, 2023
…ter#9088)

The code description says:
> Put the text in a `Container`

but the code itself uses a `Padding` widget

---------

Co-authored-by: Brett Morgan <brettmorgan@google.com>
@eshfield eshfield deleted the patch-1 branch July 26, 2023 05:32
@sfshaza2 sfshaza2 removed the review.await-update Awaiting Updates after Edits label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants