Skip to content

General cleanup of the packages pages and the cookbook.#2711

Merged
sfshaza2 merged 7 commits intomasterfrom
old-pr
Jun 12, 2019
Merged

General cleanup of the packages pages and the cookbook.#2711
sfshaza2 merged 7 commits intomasterfrom
old-pr

Conversation

@sfshaza2
Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 commented May 29, 2019

Inspired by PR #2048, which I'm closing.
Also fixes: #2630, which I'm also closing.

Staged: https://sz-flutter.firebaseapp.com/docs/development/packages-and-plugins/using-packages

@sfshaza2 sfshaza2 requested a review from kwalrath May 29, 2019 17:07
@googlebot googlebot added the cla: yes Contributor has signed the Contributor License Agreement label May 29, 2019
@sfshaza2 sfshaza2 mentioned this pull request May 29, 2019
Comment thread pubspec.lock
Copy link
Copy Markdown
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

Most of the changes look good, but of course, I found nits to pick...

forcing the use of a particular version.

Forcing the use of `url_launcher` version `0.4.3` in `counter/pubspec.yaml`:
To force the use of `url_launcher` version `0.4.3` in the app's `pubspec.yaml`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be a complete sentence (https://developers.google.com/style/code-samples?hl=ru#intros). Sentence fragments introducing code samples seem to occur a lot in this page.


Forcing the use of `guava` version `23.0` in `counter/android/build.gradle`:
To force the use of `guava` version `23.0` in the app's
`android/build.gradle` file:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This, too, should be a complete sentence.

* Range constraint with [*caret
* Range constraints with [*caret
syntax*]({{site.dart-site}}/tools/pub/dependencies#caret-syntax)
is similar to regular range constraints:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is -> are


If you want to upgrade to a new version of the package,
To upgrade to a new version of the package,
for example to use new features in that package, run
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For ease of reading, consider using em-dashes or parentheses instead of commas to set off the "for example...".

Finally, use the `ref` argument to pin the dependency to a
specific git commit, branch, or tag. For more details, see
[Pub Dependencies]({{site.dart-site}}/tools/pub/dependencies).
[Package Dependencies]({{site.dart-site}}/tools/pub/dependencies).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dependencies -> dependencies

and using third-party platform SDKs (like
[Firebase]({{site.github}}/flutter/plugins/blob/master/FlutterFire.md)).
and using third-party platform SDKs
([Firebase]({{site.github}}/flutter/plugins/blob/master/FlutterFire.md)).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Firebase -> FlutterFire?

If not, then maybe:
SDKs like Firebase (FlutterFire).

to the Flutter and Dart ecosystems. This allows you to quickly build
your app without having to develop everything from scratch.

Existing packages enable many use cases, for example, making network requests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

, for -> — for


If you are looking to add assets, images, or fonts, whether stored in
files or packages, please see [Assets & images](/docs/development/ui/assets-and-images).
If you are looking to develop a new package, see [developing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GLOBAL:
you are looking to -> you want to
(or "you intend to")

files or packages, please see [Assets & images](/docs/development/ui/assets-and-images).
If you are looking to develop a new package, see [developing
packages](/docs/development/packages-and-plugins/developing-packages).
If you are looking to add assets, images, or fonts,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are a lot of commas in this sentence. How about:

fonts, -> fonts —
packages, -> — packages

@@ -207,47 +214,45 @@ additional dependency options are avaialble:

* **Git** dependency on a package in a folder: By default Pub assumes the
package is located in the root of the Git repository. If that is not the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can reduce the "By default..." sentence and combine it with the following one.

@sfshaza2 sfshaza2 mentioned this pull request May 31, 2019
@sfshaza2 sfshaza2 changed the title General cleanup of the using packages page. General cleanup of the packages pages and the cookbook. Jun 3, 2019
Comment thread pubspec.lock Outdated
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1"
version: "0.5.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I usually avoid updating pubspec.lock unless I'm sure I want to do that...

Copy link
Copy Markdown
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

Here's my review up through src/docs/cookbook/forms/focus.md. The focus doc needs some work, due to its use of "focus on." Everything else looks pretty great! I'm very happy that you're making these fixes, even if it does make for a very long review...

More later.

Comment thread src/docs/codelabs/layout-basics.md Outdated
DartPad! You might encounter bugs,
malapropisms, annoyances, and other general weirdness.
If that happens, please take a moment to
If that happens, we appreciate if you take a moment to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure why "we appreciate if you" is better than "please". Maybe we should settle on some standard wording? In https://dart.dev/codelabs/dart-cheatsheet, we used to have some similar wording. I changed it to the text in the yellow box.

Use the custom State class to define the properties you need to change over
Use the custom State class to define the properties that change over
time. In this example, that includes the width, height, color, and border
radius. In addition, you can also define the default value of each property.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd drop "In addition," and change this to "You can also..."

a smooth experience.

In Flutter, you can achieve this task using the [`AnimatedOpacity`][] Widget.
In Flutter, achieve by using the [`AnimatedOpacity`][] widget.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's a missing word or two here. And "Flutter" seems unnecessary. Maybe something like this:

The ... widget makes it easy to perform opacity animations.
OR
This page shows how to use the ... widget to perform opacity animations.

@@ -112,23 +115,23 @@ FloatingActionButton(
## 4. Fade the box in and out

You've got a green box on screen. You've got a button to toggle the visibility
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"You've got" rubs me the wrong way (thank you, Dad). How about "You have"?

(I seem to be in the minority: https://www.quickanddirtytips.com/education/grammar/is-have-got-acceptable-english is the only place I've found that kind of, sort of, backs me up.)

Comment thread src/docs/cookbook/design/fonts.md Outdated
While Android and iOS offer high quality system fonts, one of the most common
requests from designers is to use custom fonts. For example, you may have a
custom-built font from a designer, or maybe you downloaded a font from
While Android and iOS offer high quality system fonts,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While -> Although
(to avoid implying time, which might confuse non-native english speakers)

Comment thread src/docs/cookbook/design/themes.md Outdated
returns that. If not, it returns the App theme.
The `Theme.of(context)` method looks up the widget tree and returns
the nearest `Theme` in the tree. If you have a stand-alone
`Theme` defined above your widget, it returns that.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unclear antecedent to "it". Maybe, "that's returned"?

Comment thread src/docs/cookbook/design/themes.md Outdated
The `Theme.of(context)` method looks up the widget tree and returns
the nearest `Theme` in the tree. If you have a stand-alone
`Theme` defined above your widget, it returns that.
If not, it returns the app's theme.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto. "the app's theme is returned"?

Comment thread src/docs/cookbook/forms/focus.md Outdated
the user navigates to the search screen, we can focus the search term text field.
flow. For example, say you have a search screen with a text field.
When the user navigates to the search screen,
you can focus on the search term text field.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"focus on" isn't right here. Maybe "set the focus to the text field for the search term."

Comment thread src/docs/cookbook/forms/focus.md Outdated

In this recipe, we'll learn how to focus a text field as soon as it's visible
as well as how to focus a text field when a button is tapped.
In this recipe, learn how to focus on a text field as soon as it's visible,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"focus on" sounds wrong, throughout. "give the focus to " might be right.

https://webaim.org/techniques/keyboard/ uses "has keyboard focus", "focused element", and "receive keyboard focus", "lose focus", ... https://en.wikipedia.org/wiki/Focus_(computing) has "has the focus", "moving the focus", "getting the focus", "giving [an element]...the focus", "can receive focus", ... https://documentation.basis.com/BASISHelp/WebHelp/events/keyboard_focus_navigation_and_default_button.htm is the top results and might also be helpful.

For more information on handling input and creating text fields, please see the
[Forms section of the cookbook](/docs/cookbook#forms).
For more information on handling input and creating text fields,
see the [Forms](/docs/cookbook#forms) section of the cookbook.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Other places you've used Cookbook (capitalized). (I rather like it uncapitalized.)

Copy link
Copy Markdown
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

I'm quittin' for the night, but here are comments through src/docs/cookbook/navigation/passing-data.md.

steps.
To retrieve the text a user has entered into a text field, create a
[`TextEditingController`]({{site.api}}/flutter/widgets/TextEditingController-class.html)
and supply it to a `TextField` in the next steps.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

-> and supply it to a TextField or TextFormField.

[`TextEditingController`]({{site.api}}/flutter/widgets/TextEditingController-class.html)
and supply it to a `TextField` in the next steps.

Once a `TextEditingController` is supplied to a `TextField` or `TextFormField`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Delete this paragraph?

are finished using it. This will ensure we discard any resources used by the
object.
{{site.alert.note}}
It is important to `dispose` of the `TextEditingController` when
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is important to dispose -> Important: Call dispose on the ...
when -> when you've

to a `TextField` or `TextFormField` Widget as the `controller` property.
Now that you have a `TextEditingController`, wire it up
to a specific text field. To do this, supply the `TextEditingController`
to a `TextField` or `TextFormField` widget as the `controller` property.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could reduce redundancy and shorten this by saying something like this:

wire it up to a text field, using the controller property:


In this example, we will display an alert dialog with the current value of
the text field when the user taps on a floating action button.
In this example, display an alert dialog with the current value of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This reads a little funny. I'm tempted to switch to "The following code displays...".

the item that's been tapped.

Remember: Screens are Just Widgets™.
In this example, create a List of Todos.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

List -> list
(to be consistent with the rest of the page)

Maybe also Todo -> todo unless it's in code font? Or consistently use Todo (not todo).

For example, you might want to pass information about
the item that's been tapped.

Remember: Screens are Just Widgets™.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if we should be using trademarks this lightly.


Since it's a normal `StatelessWidget`, we'll simply require that users creating
the Screen pass through a `Todo`! Then, we'll build a UI using the given Todo.
Since it's a normal `StatelessWidget`, require that the user
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unclear what "it" refers to.

Since it's a normal `StatelessWidget`, we'll simply require that users creating
the Screen pass through a `Todo`! Then, we'll build a UI using the given Todo.
Since it's a normal `StatelessWidget`, require that the user
enters a `Todo` in the UI. Then, build the UI using the given Todo.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that the user enters -> the user to enter

[`onTap`]({{site.api}}/flutter/material/ListTile/onTap.html)
callback for our `ListTile` Widget. Within our `onTap` callback, we'll once
again employ the [`Navigator.push`]({{site.api}}/flutter/widgets/Navigator/push.html)
To achieve this, write an
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unclear what "this" refers to.

Copy link
Copy Markdown
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

My brain is toast. Here are my review comments (pretty minor, iirc) through docs/cookbook/testing/integration/scrolling.md.

## 2. Add a button that launches the selection screen

Now, we'll create our SelectionButton. Our selection button will:
Now, create the SelectionButton. The selection button:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

button -> button does the following

(But how can a button wait?!)

Now, we'll need to build a selection screen! It will contain two buttons. When
a user taps on a button, it should close the selection screen and let the home
screen know which button was tapped!
Now, build a selection screen. It contains two buttons. When
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

. It -> that

screen know which button was tapped.

For now, we'll define the UI, and figure out how to return data in the next
For now, define the UI, and figure out how to return data in the next
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For now... next step? Maybe:

This step defines the UI. The next step adds code to return data.

(or "will add"... that seems justified)

Now, we'll want to update the `onPressed` callback for both of our buttons! In
order to return data to the first screen, we'll need to use the
[`Navigator.pop`]({{site.api}}/flutter/widgets/Navigator/pop.html)
Now, update the `onPressed()` callback for both of our buttons. In
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

our -> the

order to return data to the first screen, we'll need to use the
[`Navigator.pop`]({{site.api}}/flutter/widgets/Navigator/pop.html)
Now, update the `onPressed()` callback for both of our buttons. In
order to return data to the first screen, use the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In order to -> To


// Call the `main()` function of your app or call `runApp` with any widget you
// are interested in testing.
// Call the `main()` function of the app or call `runApp` with
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

or -> , or

method scrolls through a list until a specific widget is visible.

While all three methods work for specific use-cases,
`scrollUntilVisible` is oftentimes the most robust option. Why?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oftentimes -> often

While all three methods work for specific use-cases,
`scrollUntilVisible` is oftentimes the most robust option. Why?

1. If using the `scroll()` method alone, you might incorrectly assume
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be bulleted, not numbered list.

renders items on-demand, whether a particular widget has been
rendered can depend on the size of the screen.

Therefore, rather than assuming that you know the height of all the items
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Therefore................................... 👎


```dart
// Imports the Flutter Driver API
// Imports the Flutter Driver API.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Flutter Driver? Flutter driver? flutter_driver?

Copy link
Copy Markdown
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

I did a very quick once-over of the remaining changes and didn't notice anything wrong. (very quick :)

@sfshaza2 sfshaza2 merged commit 1a5945d into master Jun 12, 2019
@sfshaza2 sfshaza2 deleted the old-pr branch June 13, 2019 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Contributor has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants