Skip to content

Commit 3d84ba7

Browse files
committed
[modified]: 修改了格式问题
1 parent 301742b commit 3d84ba7

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/content/app-architecture/design-patterns/key-value-data.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# title: "Persistent storage architecture: Key-value data"
3-
title: 持久存储架构:键值对数据
3+
title: 持久存储架构:键值对数据
44
# description: Save application data to a user's on-device key-value store.
55
description: 以键值对形式将应用产生的数据保存到用户的设备中。
66
contentTags:
@@ -94,13 +94,16 @@ This functionality follows the recommended Flutter architecture design pattern,
9494
with a presentation and a data layer.
9595

9696
此功能遵循推荐的 Flutter 架构设计,
97-
包含展示层和数据层Data Layer
97+
包含展示层和数据层 (Data Layer)
9898

9999
- The presentation layer contains the `ThemeSwitch` widget
100100
and the `ThemeSwitchViewModel`.
101+
101102
展示层包含 `ThemeSwitch` 组件和 `ThemeSwitchViewModel`
103+
102104
- The data layer contains the `ThemeRepository`
103105
and the `SharedPreferencesService`.
106+
104107
数据层包含 `ThemeRepository``SharedPreferencesService`
105108

106109
### Theme selection presentation layer
@@ -113,9 +116,9 @@ by the public field `isDarkMode` in the `ThemeSwitchViewModel`.
113116
When the user taps the switch,
114117
the code executes the command `toggle` in the view model.
115118

116-
`ThemeSwitch` 是一个 `StatelessWidget` ,它包含一个 `Switch` 组件。
119+
`ThemeSwitch` 是一个 `StatelessWidget`,它包含一个 `Switch` 组件。
117120
开关的状态由 `ThemeSwitchViewModel` 中的公共字段 `isDarkMode` 表示。
118-
当用户点击开关时,代码执行视图模型中的命令 `toggle`
121+
当用户点击开关时,代码执行视图模型中的命令 `toggle`
119122

120123
<?code-excerpt "lib/ui/theme_config/widgets/theme_switch.dart (ThemeSwitch)"?>
121124
```dart
@@ -241,7 +244,7 @@ the `ThemeRepository` and the `SharedPreferencesService`.
241244

242245
根据架构指南,
243246
数据层被分为两部分:
244-
`ThemeRepository``SharedPreferencesService`
247+
`ThemeRepository``SharedPreferencesService`
245248

246249
The `ThemeRepository` is the single source of truth
247250
for all the theming configuration settings,
@@ -264,7 +267,7 @@ The `ThemeRepository` depends on `SharedPreferencesService`.
264267
The repository obtains the stored value from the service,
265268
and stores it when it changes.
266269

267-
`ThemeRepository` 依赖于 `SharedPreferencesService`
270+
`ThemeRepository` 依赖于 `SharedPreferencesService`
268271
该主题仓库从服务中获取存储的值,
269272
并存储其改变后的值。
270273

@@ -324,7 +327,7 @@ hiding this third-party dependency from the rest of the application
324327
A third-party dependency is a way to refer to packages and plugins
325328
developed by other programmers outside of your organization.
326329

327-
第三方依赖是指引用组织外程序员开发的 packages 和插件的一种方式。
330+
第三方依赖是指引用组织外程序员开发的 package 和插件的一种方式。
328331
:::
329332

330333
<?code-excerpt "lib/data/services/shared_preferences_service.dart (SharedPreferencesService)"?>
@@ -355,7 +358,7 @@ and passed to the `MainApp` as constructor argument dependency.
355358

356359
在本示例中,
357360
`ThemeRepository``SharedPreferencesService` 是在 `main()` 方法中创建的,
358-
并作为构造函数参数依赖项传递给 `MainApp`
361+
并作为构造函数参数依赖项传递给 `MainApp`
359362

360363
<?code-excerpt "lib/main.dart (MainTheme)"?>
361364
```dart
@@ -390,7 +393,7 @@ which listens to changes in the `ThemeRepository`
390393
and exposes the dark mode setting to the `MaterialApp` widget.
391394

392395
该示例程序还包括 `MainAppViewModel` 类,
393-
该类监听 `ThemeRepository` 的变化并向 `MaterialApp` 小部件暴露深色模式设置
396+
该类监听 `ThemeRepository` 的变化并向 `MaterialApp` widget 暴露深色模式设置
394397

395398
<?code-excerpt "lib/main_app_viewmodel.dart (MainAppViewModel)"?>
396399
```dart

0 commit comments

Comments
 (0)