Skip to content

Commit

Permalink
[内容修订] 修复站内所有高亮提示 (#1382)
Browse files Browse the repository at this point in the history
Co-authored-by: Luke Cheng <[email protected]>
  • Loading branch information
AlexV525 and chenglu authored Nov 27, 2023
1 parent ab3a5ab commit 9adc009
Show file tree
Hide file tree
Showing 50 changed files with 116 additions and 72 deletions.
10 changes: 5 additions & 5 deletions src/_includes/docs/run-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

Do _not_ test the performance of your app with debug and
hot reload enabled.

**请勿** 在调试模式和热重载功能开启的情况下做性能测试。

{{site.alert.end}}

So far you've been running your app in *debug* mode. Debug
Expand All @@ -27,12 +27,12 @@ build modes. For more details, see [Flutter's build modes][].
[Flutter 的构建模式选择]({{site.url}}/testing/build-modes)

{{site.alert.important}}

If you're concerned about the package size of your app,
see [Measuring your app's size][].

如果你关心应用大小,请参考 [这篇文档][Measuring your app's size]

{{site.alert.end}}

[Flutter's build modes]: {{site.url}}/testing/build-modes
Expand Down
2 changes: 1 addition & 1 deletion src/add-to-app/android/add-flutter-screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ is discussed next.
那么你的 Flutter 应用会像是运行在一个大小为零的窗口中,
直至 `FlutterEngine` 附属到一个 `FlutterActivity``FlutterFragment``FlutterView`
请确保你的应用在开始预热到你展示 Flutter 内容中间的这段时间里表现正常。

{{site.alert.end}}

With a pre-warmed, cached `FlutterEngine`, you now need
Expand Down
11 changes: 8 additions & 3 deletions src/add-to-app/ios/add-flutter-screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ To launch a Flutter screen from an existing iOS, you start a
`FlutterEngine` 充当 Dart VM 和 Flutter 运行时的主机;
`FlutterViewController` 依附于 `FlutterEngine`
给 Flutter 传递 UIKit 的输入事件,并展示被 `FlutterEngine` 渲染的每一帧画面。

{{site.alert.end}}

The `FlutterEngine` might have the same lifespan as your
Expand All @@ -59,6 +60,7 @@ The `FlutterEngine` might have the same lifespan as your
logic before showing the UI.

在展示 UI 前,你的应用和 plugins 可以与 Flutter 和 Dart 逻辑交互。

{{site.alert.end}}

See [Loading sequence and performance][]
Expand Down Expand Up @@ -339,6 +341,7 @@ Now, you have a Flutter screen embedded in your iOS app.
在上一个例子中,你的默认 Dart 库的默认入口函数 `main()`,
将会在 `AppDelegate` 创建 `FlutterEngine` 并调用 `run` 方法时调用。
{{site.alert.end}}
### _Alternatively_ - Create a FlutterViewController with an implicit FlutterEngine
Expand Down Expand Up @@ -792,6 +795,7 @@ a different Dart function.
@pragma('vm:entry-point')
void myOtherEntrypoint() { ... };
```

{{site.alert.end}}

### Dart library
Expand Down Expand Up @@ -884,10 +888,11 @@ FlutterViewController* flutterViewController =
如果在 `FlutterEngine` 启动后,迫切得需要在平台侧改变你当前的 Flutter 路由,
可以使用 `FlutterViewController` 里的 [`pushRoute()`][] 或者 [`popRoute()`][]

To pop the iOS route from the Flutter side,
To pop the iOS route from the Flutter side,
call [`SystemNavigator.pop()`][].

在 Flutter 侧推出 iOS 路由,调用 [`SystemNavigator.pop()`][]

在 Flutter 侧推出 iOS 路由,调用 [`SystemNavigator.pop()`][]

{{site.alert.end}}

See [Navigation and routing][] for more about Flutter's routes.
Expand Down
1 change: 1 addition & 0 deletions src/androidx-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keywords: AndoridX, Android Studio, Flutter 里使用 AndroidX
doesn't use AndroidX.

如果 Flutter 监测到你的项目中未使用到 AndroidX,那么你会跳转到此页面。

{{site.alert.end}}

[AndroidX]({{site.android-dev}}/jetpack/androidx) is a major improvement
Expand Down
7 changes: 4 additions & 3 deletions src/codelabs/layout-basics-old.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ toc: false
work in some browsers and not others. If you encounter any, please
[create a DartPad issue](https://goo.gle/flutter_web_issue),
labeling the issue with `platform-web`.

目前 codelab 是基于 Chrome 开发测试的。可能会有一些功能(短期内)在某些浏览器上可用,而在另一些浏览器上不可用。
如果您遇到任何问题,请 [create a DartPad issue](https://goo.gle/flutter_web_issue) ,并为这个 issue 加上
`platform-web` 标签。
如果您遇到任何问题,请 [create a DartPad issue](https://goo.gle/flutter_web_issue)
并为这个 issue 加上 `platform-web` 标签。

{{site.alert.end}}

`Row` and `Column` are two very important widgets in the Flutter universe.
Expand Down
10 changes: 7 additions & 3 deletions src/codelabs/layout-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ and `Column` lays out its widgets vertically.

{{site.alert.secondary}}
{:.no_toc}

The following example displays the differences between
a `Row` and `Column`.

Expand Down Expand Up @@ -1167,7 +1168,7 @@ wrap a widget and force the widget to fill extra space.
`Flexible` 非常相似。

{{site.alert.tip}}

**What's the difference between Flexible and Expanded?**
Use `Flexible` to resize widgets in a `Row` or `Column`.
That way, you can adjust a child widget's spacing
Expand All @@ -1193,7 +1194,7 @@ wrap a widget and force the widget to fill extra space.
The following example demonstrates how the
`Expanded` widget forces its child widget to
fill extra space.

下面的例子演示了 `Expanded` widget 是如何
强制其子 widget 填满空间的。

Expand All @@ -1214,6 +1215,7 @@ wrap a widget and force the widget to fill extra space.
and run again.

选择 **Format** 按钮格式化代码,然后再次运行。

{{site.alert.end}}

```run-dartpad:theme-dark:mode-flutter:width-100%:height-400px:split-60
Expand Down Expand Up @@ -1674,6 +1676,7 @@ can create space between widgets.
Use `Spacer` when you want to create space using a `flex` property.
Use `SizedBox` when you want to create space
using a specific number of logical pixels.

**SizedBox 和 Spacer 有何不同?**
如果你想用 `flex` 属性创建一段空间,请使用 `Spacer`
如果你想创建一个拥有特定逻辑像素值的空间,请使用 `SizedBox`
Expand Down Expand Up @@ -1840,7 +1843,7 @@ for different fonts, sizes, and colors.
{:.no_toc}

{{site.alert.secondary}}

The following example displays "Hey!" three times,
but at different font sizes and in different colors.
`Row` specifies the `crossAxisAlignment`
Expand Down Expand Up @@ -2528,6 +2531,7 @@ Future<void> main() async {
],
);
```

{{site.alert.end}}

```run-dartpad:theme-dark:mode-flutter:width-100%:height-400px:split-60
Expand Down
17 changes: 10 additions & 7 deletions src/community/tutorials/memory-leak-monitoring-on-flutter.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,12 @@ Flutter 中的 Dart 是不支持反射的(为了优化打包体积,关闭了

{{site.alert.note}}

简单说明下 Library 是什么东西,
Dart 中的分包管理是根据 Library 来的,
同一个 Library 内的类名不能重复,
一般情况下一个 `.dart` 文件就是一个 Library,
当然也有例外,比如:part of 和 export。
简单说明下 Library 是什么东西,
Dart 中的分包管理是根据 Library 来的,
同一个 Library 内的类名不能重复,
一般情况下一个 `.dart` 文件就是一个 Library,
当然也有例外,比如:part of 和 export。

{{site.alert.end}}

`vm_service` 有个 [invoke(isolateId, targetId, selector, argumentIds)](https://github.com/dart-lang/sdk/blob/master/runtime/vm/service/service.md#invoke) API,
Expand Down Expand Up @@ -344,7 +345,8 @@ Dev Tools 是调用了 `vm_service` 的

{{site.alert.note}}

通过 dev_tools dump 出来的对象来看,的确泄漏了!
通过 dev_tools dump 出来的对象来看,的确泄漏了!

{{site.alert.end}}

也就是 1.9.1 Framework 里面存在着泄漏,
Expand Down Expand Up @@ -441,7 +443,8 @@ Flutter 的 widget tree 的层次是非常深的。

{{site.alert.note}}

好消息是以上泄漏都在 1.12 版本之后修复了。
好消息是以上泄漏都在 1.12 版本之后修复了。

{{site.alert.end}}

修复完上述两个泄漏之后,
Expand Down
6 changes: 3 additions & 3 deletions src/cookbook/animation/page-route-animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ To start, use a [`PageRouteBuilder`][] to create a [`Route`][].
另一个则是创建一个路由的转换器(`transitionsBuilder`)。

{{site.alert.note}}

The `child` parameter in transitionsBuilder is the widget returned from
pageBuilder. The `pageBuilder` function is only called the first time the
route is built. The framework can avoid extra work because `child` stays the
same throughout the transition.

transitionsBuilder 的 `child` 参数是通过 `pageBuilder` 方法
来返回一个 transitionsBuilder widget,这个 `pageBuilder` 方法仅会在
第一次构建路由的时候被调用。框架能够自动避免做额外的工作,因为
整个过渡期间 `child` 保存了同一个实例。

{{site.alert.end}}

The following example creates two routes: a home route with a "Go!" button, and
Expand Down
4 changes: 2 additions & 2 deletions src/cookbook/animation/physics-simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Then construct an [AnimationController][] in

继承的 `SingleTickerProviderStateMixin` 让 state 对象为 `AnimationController`
提供了 `TickerProvider` 的能力。要获得更多信息,请查看 [TickerProvider][] 文档。

{{site.alert.end}}

<?code-excerpt "lib/{starter,step1}.dart"?>
Expand Down Expand Up @@ -414,7 +414,7 @@ onPanEnd: (details) {
is no longer required.

既然动画控制器使用了模拟,就不再需要指定 `duration` 参数。

{{site.alert.end}}

## Interactive Example
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/design/package-fonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This recipe uses the following steps:
to almost 1000 open-sourced font families.

查看 [google_fonts][] 库,你将可以直接访问近 1000 个开源字体族。

{{site.alert.end}}

## 1. Add a font to a package
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/design/snackbars.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ final snackBar = SnackBar(
注意: 这个例子是当用户点击一个按钮的时候显示一个 SnackBar。
更多有关处理用户输入的信息,请查阅实用教程 (Cookbook) 的
[Gestures][] 部分。

{{site.alert.end}}

<?code-excerpt "lib/main.dart"?>
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/design/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Flutter 自带的 [Material 库][material library]
创建一个使用 tabs 布局、Cupertino 风格的 iOS 应用,
请参见这个 codelab:
[使用 Flutter 构建 iOS 风格的应用][Building a Cupertino app with Flutter]

{{site.alert.end}}

This recipe creates a tabbed example using the following steps;
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/forms/retrieve-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ we can use it to retrieve the text a user has typed into that text field.

**记住:**当不再使用 `TextEditingController` 时,
请销毁它以确保相关的资源得到释放。

{{site.alert.end}}

<?code-excerpt "lib/starter.dart (Starter)" remove="return Container();"?>
Expand Down
1 change: 1 addition & 0 deletions src/cookbook/lists/floating-app-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ CustomScrollView(
试试 [`SliverAppBar` 支持的各种属性][various properties you can pass to the `SliverAppBar` widget]
并使用热重载来查看结果。例如,你可以给 `flexibleSpace`
提供一个 `Image` widget 来创建一个背景图像,当它在屏幕外滚动时会缩小尺寸。

{{site.alert.end}}


Expand Down
4 changes: 2 additions & 2 deletions src/cookbook/navigation/hero-animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ handle animations in the next steps.

这个示例建立在 [导航到一个新页面和返回][Navigate to a new screen and back]
[处理点击事件][Handle taps] 这两个章节的基础上。

{{site.alert.end}}

<?code-excerpt "lib/main_original.dart"?>
Expand Down Expand Up @@ -191,7 +191,7 @@ Hero(
这份代码和第一个页面中的代码是相同的。
实际上,可以创建一个可复用的组件来代替这些重复的代码。
但是在这个示例中,重复的代码会更易于讲解和演示。

{{site.alert.end}}

## Interactive example
Expand Down
1 change: 1 addition & 0 deletions src/cookbook/navigation/named-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ MaterialApp(
When using `initialRoute`, **don't** define a `home` property.

当使用 `initialRoute` 时,需要确保你没有同时定义 `home` 属性。

{{site.alert.end}}

## 3. Navigate to the second screen
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/navigation/navigation-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ details about the product.

**术语**: 在 Flutter 中,**屏 (screen)****页面 (page)** 都叫做 **路由 (route)**
在下文中统称为“路由 (route)”。

{{site.alert.end}}

In Android, a route is equivalent to an Activity.
Expand Down
3 changes: 2 additions & 1 deletion src/cookbook/networking/background-parsing.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ Future<http.Response> fetchPhotos(http.Client client) async {
This makes the function easier to test and use in different environments.

在这个例子中你需要给方法添加了一个 `http.Client` 参数。
这将使得该方法测试起来更容易同时也可以在不同环境中使用。
这将使得该方法测试起来更容易,同时也可以在不同环境中使用。

{{site.alert.end}}

## 3. Parse and convert the JSON into a list of photos
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/persistence/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ print(await dogs()); // Prints Fido with age 42.
Do not use string interpolation, such as `where: "id = ${dog.id}"`!

这里不要使用字符串模板,比如: `where: "id = ${dog.id}"`

{{site.alert.end}}


Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/plugins/picture-using-camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ display a preview of the camera's feed.
**请记住**: 在使用相机前,请确保控制器已经完成初始化。
因此,你一定要等待前一个步骤创建 `_initializeControllerFuture()`
执行完毕才去展示 `CameraPreview`

{{site.alert.end}}

Use a [`FutureBuilder`][] for exactly this purpose.
Expand Down
2 changes: 1 addition & 1 deletion src/cookbook/testing/widget/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Use one of the following methods to ask Flutter to rebuild the widget.

要开始播放动画,则需要调用一次 `pump()`(不指定 duration)以启动 ticker。
如果没有这一步骤,动画将不会执行。

{{site.alert.end}}

[`tester.pumpAndSettle()`][]
Expand Down
2 changes: 1 addition & 1 deletion src/data-and-backend/google-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Examples of user-data APIs include
**不应该** 直接使用到 Flutter 应用中。
直接使用需要将服务证书作为应用程序的一部分,这是不安全的。
我们推荐创建一个中间服务,来使用这些 API。

{{site.alert.end}}

To add authentication to Firebase explicitly, check out the
Expand Down
2 changes: 2 additions & 0 deletions src/deployment/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ Release builds of your app will now be signed automatically.
现在我们 app 的发布版本就会被自动签名了。

{{site.alert.note}}

You might need to run `flutter clean` after changing the gradle file.
This prevents cached builds from affecting the signing process.

Expand Down Expand Up @@ -660,6 +661,7 @@ the Play Store.

Google Play 更推荐使用 app bundle 格式的应用,
更多信息可以参考 [Android App Bundle][bundle]

{{site.alert.end}}

### Build an app bundle
Expand Down
1 change: 1 addition & 0 deletions src/deployment/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ keychain initialize
```

{{site.alert.secondary}}

**Restore Login Keychain!**
After running `keychain initialize` you **must** run the following:<br>

Expand Down
Loading

0 comments on commit 9adc009

Please sign in to comment.