Skip to content

Commit 352aeb3

Browse files
authored
Merge pull request #479 from lm83680/docs/translations-zh
Synced newly added hooks to the zh_doc
2 parents 9a2245f + a6de7d9 commit 352aeb3

File tree

1 file changed

+58
-48
lines changed
  • packages/flutter_hooks/resources/translations/zh_cn

1 file changed

+58
-48
lines changed

packages/flutter_hooks/resources/translations/zh_cn/README.md

Lines changed: 58 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -276,76 +276,86 @@ useC();
276276
}
277277
```
278278

279-
## 已有的钩子
279+
## 已有的 Hook
280280

281281
Flutter_Hooks 已经包含一些不同类别的可复用的钩子:
282282

283283
### 基础类别
284284

285285
与组件不同生命周期交互的低级钩子。
286286

287-
| 名称 | 介绍 |
288-
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
289-
| [useEffect](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useEffect.html) | 对副作用很有用,可以选择取消它们 |
290-
| [useState](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useState.html) | 创建并订阅一个变量 |
291-
| [useMemoized](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useMemoized.html) | 缓存复杂对象的实例 |
292-
| [useRef](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useRef.html) | 创建一个包含单个可变属性的对象 |
293-
| [useCallback](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useCallback.html) | 缓存一个函数的实例 |
294-
| [useContext](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useContext.html) | 包含构建中的 `HookWidget``BuildContext` |
295-
| [useValueChanged](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueChanged.html) | 监听一个值并在其改变时触发回调 |
287+
| 名称 | 描述 |
288+
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
289+
| [useEffect](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useEffect.html) | 用于处理副作用,并可选择性地进行清理 |
290+
| [useState](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useState.html) | 创建一个变量并订阅它的变化 |
291+
| [useMemoized](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useMemoized.html) | 缓存复杂对象的实例 |
292+
| [useRef](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useRef.html) | 创建一个包含单个可变属性的对象 |
293+
| [useCallback](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useCallback.html) | 缓存函数实例 |
294+
| [useContext](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useContext.html) | 获取当前 `HookWidget``BuildContext` |
295+
| [useValueChanged](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueChanged.html) | 监听某个值的变化,并在值发生变化时触发回调 |
296296

297-
### 绑定对象
297+
### 对象绑定(Object-binding)
298298

299-
这类钩子用以操作现有的 Flutter 及 Dart 对象\
300-
它们负责创建、更新以及 dispose 对象
299+
这类钩子用于操作现有的 Flutter 及 Dart 对象\
300+
它们负责创建、更新以及 dispose 对象
301301

302302
#### dart:async 相关
303303

304-
| 名称 | 介绍 |
304+
| 名称 | 描述 |
305305
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
306-
| [useStream](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useStream.html) | 订阅一个 `Stream`,并以 `AsyncSnapshot` 返回它目前的状态 |
307-
| [useStreamController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useStreamController.html) | 创建一个会自动 dispose 的 `StreamController` |
308-
| [useOnStreamChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnStreamChange.html) | 订阅一个 `Stream`,注册处理函数,返回 `StreamSubscription` |
309-
| [useFuture](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFuture.html) | 订阅一个 `Future` 并以 `AsyncSnapshot` 返回它目前的状态 |
306+
| [useStream](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useStream.html) | 订阅一个 `Stream` 并返回其当前状态(`AsyncSnapshot` |
307+
| [useStreamController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useStreamController.html) | 创建一个 `StreamController`,会在不再使用时自动释放 |
308+
| [useOnStreamChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnStreamChange.html) | 订阅 `Stream`,注册处理函数,并返回 `StreamSubscription` |
309+
| [useFuture](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFuture.html) | 订阅一个 `Future` 并返回其当前状态(`AsyncSnapshot` |
310310

311311
#### Animation 相关
312312

313-
| 名称 | 介绍 |
314-
| ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
315-
| [useSingleTickerProvider](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useSingleTickerProvider.html) | 创建单一用途的 `TickerProvider` |
316-
| [useAnimationController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAnimationController.html) | 创建一个会自动 dispose 的 `AnimationController` |
317-
| [useAnimation](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAnimation.html) | 订阅一个 `Animation` 并返回它的值 |
313+
| 名称 | 描述 |
314+
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ |
315+
| [useSingleTickerProvider](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useSingleTickerProvider.html) | 创建单次使用的 `TickerProvider` |
316+
| [useAnimationController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAnimationController.html) | 创建并会自动释放的 `AnimationController` |
317+
| [useAnimation](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAnimation.html) | 订阅一个 `Animation` 并返回其当前值 |
318318

319319
#### Listenable 相关
320320

321-
| 名称 | 介绍 |
322-
| -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
323-
| [useListenable](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useListenable.html) | 订阅一个 `Listenable` 并在 listener 调用时将组件标脏 |
324-
| [useListenableSelector](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useListenableSelector.html) |`useListenable` 类似,但支持过滤 UI 重建 |
325-
| [useValueNotifier](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueNotifier.html) | 创建一个会自动 dispose 的 `ValueNotifier` |
326-
| [useValueListenable](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueListenable.html) | 订阅一个 `ValueListenable` 并返回它的值 |
321+
| 名称 | 描述 |
322+
| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
323+
| [useListenable](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useListenable.html) | 订阅一个 `Listenable`,当回调触发时标记组件需要重建 |
324+
| [useListenableSelector](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useListenableSelector.html) | 类似于 `useListenable`,但允许过滤 UI 重建 |
325+
| [useValueNotifier](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueNotifier.html) | 创建一个 `ValueNotifier`,并在不再使用时自动释放 |
326+
| [useValueListenable](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useValueListenable.html) | 订阅一个 `ValueListenable` 并返回其值 |
327+
| [useOnListenableChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnListenableChange.html) |`Listenable` 添加回调,并在不再需要时自动移除 |
327328

328329
#### 杂项
329330

330-
一组无明确主题的钩子。
331-
332-
| 名称 | 介绍 |
333-
| ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------- |
334-
| [useReducer](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useReducer.html) | 对于更复杂的状态,用以替代 `useState` |
335-
| [usePrevious](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/usePrevious.html) | 返回调用 `usePrevious` 的上一个参数 |
336-
| [useTextEditingController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTextEditingController-constant.html) | 创建一个 `TextEditingController` |
337-
| [useFocusNode](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFocusNode.html) | 创建一个 `FocusNode` |
338-
| [useTabController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTabController.html) | 创建并自动 dispose 一个 `TabController` |
339-
| [useScrollController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useScrollController.html) | 创建并自动 dispose 一个 `ScrollController` |
340-
| [usePageController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/usePageController.html) | 创建并自动 dispose 一个 `PageController` |
341-
| [useAppLifecycleState](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAppLifecycleState.html) | 返回当前的 `AppLifecycleState`,并在改变时重建组件 |
342-
| [useOnAppLifecycleStateChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnAppLifecycleStateChange.html) | 监听 `AppLifecycleState` 并在其改变时触发回调 |
343-
| [useTransformationController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTransformationController.html) | 创建并自动 dispose 一个 `TransformationController` |
344-
| [useIsMounted](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useIsMounted.html) | 对钩子而言和 `State.mounted` 一样 |
345-
| [useAutomaticKeepAlive](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAutomaticKeepAlive.html) | 对钩子而言和 `AutomaticKeepAlive` 一样 |
346-
| [useOnPlatformBrightnessChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnPlatformBrightnessChange.html) | 监听平台 `Brightness` 并在其改变时触发回调 |
347-
| [useWidgetStatesController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useWidgetStatesController.html) | 创建并自动 dispose 一个 `WidgetStatesController` |
348-
| [useExpansionTileController](https://api.flutter.dev/flutter/material/ExpansionTileController-class.html) | 创建一个 `ExpansionTileController` |
331+
一组无明确主题的钩子
332+
333+
| 名称 | 描述 |
334+
| -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
335+
| [useReducer](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useReducer.html) | `useState` 的替代方案,适用于更复杂的状态管理 |
336+
| [usePrevious](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/usePrevious.html) | 返回上一次调用 `usePrevious` 时的参数 |
337+
| [useTextEditingController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTextEditingController-constant.html) | 创建一个 `TextEditingController` |
338+
| [useFocusNode](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFocusNode.html) | 创建一个 `FocusNode` |
339+
| [useTabController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTabController.html) | 创建并自动释放一个 `TabController` |
340+
| [useScrollController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useScrollController.html) | 创建并自动释放一个 `ScrollController` |
341+
| [usePageController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/usePageController.html) | 创建并自动释放一个 `PageController` |
342+
| [useFixedExtentScrollController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useFixedExtentScrollController.html) | 创建并自动释放一个 `FixedExtentScrollController` |
343+
| [useAppLifecycleState](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAppLifecycleState.html) | 返回当前的 `AppLifecycleState`,并在其变化时触发组件重建 |
344+
| [useOnAppLifecycleStateChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnAppLifecycleStateChange.html) | 监听 `AppLifecycleState` 的变化,并在变化时触发回调 |
345+
| [useTransformationController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTransformationController.html) | 创建并自动释放一个 `TransformationController` |
346+
| [useIsMounted](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useIsMounted.html) | Hook 版本的 `State.mounted` |
347+
| [useAutomaticKeepAlive](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useAutomaticKeepAlive.html) | Hook 版本的 `AutomaticKeepAlive` 组件 |
348+
| [useOnPlatformBrightnessChange](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOnPlatformBrightnessChange.html) | 监听平台亮度(`Brightness`)变化,并在变化时触发回调 |
349+
| [useSearchController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useSearchController.html) | 创建并自动释放一个 `SearchController` |
350+
| [useWidgetStatesController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useWidgetStatesController.html) | 创建并自动释放一个 `WidgetStatesController` |
351+
| [useExpansibleController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useExpansibleController.html) | 创建一个 `ExpansibleController` |
352+
| [useDebounced](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useDebounced.html) | 返回一个防抖后的值,在指定延时后触发更新 |
353+
| [useDraggableScrollableController](https://api.flutter.dev/flutter/widgets/DraggableScrollableController-class.html) | 创建一个 `DraggableScrollableController` |
354+
| [useCarouselController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useCarouselController.html) | 创建并自动释放一个 `CarouselController` |
355+
| [useTreeSliverController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useTreeSliverController.html) | 创建一个 `TreeSliverController` |
356+
| [useOverlayPortalController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useOverlayPortalController.html) | 创建并管理一个 `OverlayPortalController`,用于控制覆盖层内容的可见性,会在不再需要时自动释放 |
357+
| [useSnapshotController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useSnapshotController.html) | 创建并管理一个 `SnapshotController` |
358+
| [useCupertinoController](https://pub.dev/documentation/flutter_hooks/latest/flutter_hooks/useCupertinoController.html) | 创建并管理一个 `CupertinoController` |
349359

350360
## 贡献
351361

0 commit comments

Comments
 (0)