Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
91d19cc
feat(docs): add AI translation notice for machine-assisted pages
chenglu Jun 4, 2026
aad4bf7
docs(zh): translate remaining documentation to Simplified Chinese
chenglu Jun 4, 2026
a3acc6b
fix(zh): repair broken excerpt syntax and link reference in translation
chenglu Jun 4, 2026
d409d2e
fix(zh): correct ai-toolkit link path broken during translation
chenglu Jun 4, 2026
61c9be7
fix(zh): fix footnote anchors in apple-frameworks translation
chenglu Jun 4, 2026
8fc2fc2
fix(zh): improve list formatting, fix duplicate headings, remove 允许你
chenglu Jun 5, 2026
eefc588
fix(zh): merge duplicate :::note/tip/warning blocks into single conta…
chenglu Jun 5, 2026
b1e6979
docs: add comprehensive translation agent guide
chenglu Jun 5, 2026
a1938e2
fix(zh): 修复列表翻译格式,中文换行缩进对齐
chenglu Jun 5, 2026
b209e07
fix(zh): 修复剩余的列表编号前缀和缩进对齐问题
chenglu Jun 5, 2026
8e5e0d6
refactor: improve the AI translation notice widget
AmosHuKe Jun 7, 2026
824a14b
docs: review and format _includes/docs/add-to-app/
AmosHuKe Jun 10, 2026
8bbfd88
docs: review and format _includes/docs/debug/
AmosHuKe Jun 10, 2026
c5229a2
docs: review and format _includes/docs/get-started/
AmosHuKe Jun 10, 2026
b27c6b9
docs: review and format _includes/docs/install/
AmosHuKe Jun 10, 2026
30bd388
docs: review and format _includes/docs/resource-links
AmosHuKe Jun 10, 2026
ab8d839
docs: review and format _includes/docs/swift-package-manager
AmosHuKe Jun 10, 2026
6e37388
docs: review and format _includes/docs/vscode-flutter-bar/
AmosHuKe Jun 11, 2026
2bb2c58
docs: review and format content/add-to-app
AmosHuKe Jun 11, 2026
ce1406d
docs: AGENT_TRANSLATION_GUIDE.md
AmosHuKe Jun 11, 2026
cbb2bdc
docs: review and format content/ai/ai-toolkit/
AmosHuKe Jun 12, 2026
f44c8ae
docs: review and format content/ai/best-practices/
AmosHuKe Jun 12, 2026
861c5f2
docs: review and format content/ai/genui/
AmosHuKe Jun 12, 2026
8776ea1
docs: review and format content/ai/
AmosHuKe Jun 12, 2026
58389d9
docs: review and format content/app-architecture/case-study/
AmosHuKe Jun 13, 2026
410d503
docs: review and format content/app-architecture/case-study/testing.md
AmosHuKe Jun 13, 2026
5b4c472
docs: review and format content/app-architecture/design-patterns/
AmosHuKe Jun 13, 2026
a59c761
docs: review and format content/app-architecture/
AmosHuKe Jun 13, 2026
c307bba
docs: review and format content/app-architecture/guide.md
AmosHuKe Jun 13, 2026
1dfdfee
docs: review and format content/community/tutorials/observer-pattern-…
AmosHuKe Jun 13, 2026
c660b28
docs: review and format content/community/china-old.md
AmosHuKe Jun 13, 2026
ad27527
docs: review and format content/contribute
AmosHuKe Jun 13, 2026
9c66b65
docs: review and format content/data-and-backend
AmosHuKe Jun 13, 2026
d1bb894
docs: review and format content/deployment/linux.md
AmosHuKe Jun 13, 2026
0c7afcc
docs: review and format content/deployment/
AmosHuKe Jun 13, 2026
ee499df
docs: review and format content/embedded/
AmosHuKe Jun 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions sites/docs/lib/_sass/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@
// Must be imported last to ensure that
// the print overrides take priority over earlier defined styles.
@use 'base/print-overrides';

// flutter.cn
@use 'flutter-cn/alert-ai-translation';
2 changes: 1 addition & 1 deletion sites/docs/lib/_sass/components/_alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ aside.alert {
border-color: var(--site-alert-error-color);
--alert-title-color: var(--site-alert-error-color);
}
}
}
59 changes: 59 additions & 0 deletions sites/docs/lib/_sass/flutter-cn/_alert-ai-translation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
aside.alert.alert-ai-translation {
display: flex;
align-items: flex-start;
gap: 0.75rem;
padding: 0.85rem 1rem;
border-left: solid 0.25rem transparent;
border-image: linear-gradient(160deg,
var(--site-alert-info-color),
var(--site-alert-tip-color)) 1;
background:
linear-gradient(120deg,
oklch(from var(--site-alert-info-color) l c h / 0.08),
oklch(from var(--site-alert-tip-color) l c h / 0.05));

.ai-translation-glyph {
display: inline-flex;
align-items: center;
justify-content: center;
flex: none;
inline-size: 1.6rem;
block-size: 1.6rem;
border-radius: 50%;
background: linear-gradient(150deg,
var(--site-alert-info-color),
var(--site-alert-tip-color));

.material-symbols {
font-size: 0.9rem;
line-height: 1;
color: #fff;
user-select: none;
}
}

.ai-translation-body {
min-inline-size: 0;
}

.ai-translation-title {
margin: 0 0 0.15rem;
font-family: var(--site-ui-fontFamily);
font-size: 0.9rem;
font-weight: 500;
-webkit-font-smoothing: antialiased;
color: var(--site-base-fgColor);
}

.ai-translation-desc {
margin: 0;
font-size: 0.9rem;
line-height: 1.6;
color: var(--site-base-fgColor);

a {
font-weight: 500;
white-space: nowrap;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'package:jaspr/dom.dart';
import 'package:jaspr/jaspr.dart';
import 'package:jaspr_content/jaspr_content.dart';

import '../../../utils/page_source_info.dart';

/// A notice displayed at the top of pages whose Chinese translation
/// was produced (in whole or in part) by AI.
///
/// It invites readers to review the translation and
/// contribute improvements on GitHub.
final class AiTranslationNotice extends StatelessComponent {
const AiTranslationNotice({super.key});

@override
Component build(BuildContext context) {
final page = context.page;
final sourceInfo = page.sourceInfo;
final issueUrl = sourceInfo.issueUrl;
final pageSource = sourceInfo.sourceUrl;

return aside(
classes: 'alert alert-ai-translation',
attributes: {'role': 'note', 'data-nosnippet': 'true'},
[
const span(
classes: 'ai-translation-glyph',
attributes: {'aria-hidden': 'true', 'translate': 'no'},
[
span(classes: 'material-symbols', [.text('auto_awesome')]),
],
),
div(classes: 'ai-translation-body', [
const p(classes: 'ai-translation-title', [
.text('本页内容由 AI 翻译'),
]),
p(classes: 'ai-translation-desc', [
const .text('本页译文在人工校订的基础上借助 AI 完成。'),
const .text('如果你发现任何不准确或可以改进的地方,'),
if (pageSource case final pageSource?)
a(
href: pageSource,
target: Target.blank,
attributes: {
'rel': 'noopener',
'title': '在 GitHub 上查看并校阅本页译文',
},
[const .text('欢迎到 GitHub 参与校阅')],
)
else
const a(
href: 'https://github.com/cfug/flutter.cn',
target: Target.blank,
attributes: {
'rel': 'noopener',
'title': '在 GitHub 上参与文档校阅',
},
[.text('欢迎到 GitHub 参与校阅')],
),
const .text(' 或者 '),
a(
href: issueUrl,
attributes: {
'title': '为本页面内容提出建议',
'target': '_blank',
'rel': 'noopener',
},
[.text(pageSource == null ? '为本页面内容提出建议' : '为本页面内容提出建议')],
),
const .text(',与大家一起把它完善得更好。'),
]),
]),
],
);
}
}
8 changes: 8 additions & 0 deletions sites/docs/lib/src/layouts/doc_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:jaspr/dom.dart';
import 'package:jaspr/jaspr.dart';
import 'package:jaspr_content/jaspr_content.dart';

import '../components/common/flutter_cn/ai_translation_notice.dart';
import '../components/common/page_header.dart';
import '../components/common/prev_next.dart';
import '../components/layout/banner.dart';
Expand Down Expand Up @@ -52,6 +53,10 @@ class DocLayout extends FlutterDocsLayout {

final pageTitle = pageData['title'] as String;
final pageDescription = (pageData['description'] as String?)?.trim();
final aiTranslated =
(pageData['ai-translated'] as bool?) ??
(pageData['aiTranslated'] as bool?) ??
false;
final showBanner =
(pageData['showBanner'] as bool?) ??
(siteData['showBanner'] as bool?) ??
Expand Down Expand Up @@ -96,6 +101,9 @@ class DocLayout extends FlutterDocsLayout {
(pageData['showBreadcrumbs'] as bool? ?? true),
),

/// flutter.cn
if (aiTranslated) const AiTranslationNotice(),

child,

PrevNext(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
The concept of an initial route is available when configuring a
`FlutterActivity` or a `FlutterFragment` with a new `FlutterEngine`.

在配置带有新 `FlutterEngine` 的 `FlutterActivity` 或 `FlutterFragment` 时,
可以使用 initial route(初始路由)这一概念。

However, `FlutterActivity` and `FlutterFragment` don't offer the
concept of an initial route when using a cached engine.

但是,在使用缓存 engine 时,`FlutterActivity` 和 `FlutterFragment` 不提供 initial route 这一概念。

This is because a cached engine is expected to already be
running Dart code, which means it's too late to configure the
initial route.

这是因为缓存 engine 预期已经在运行 Dart 代码,这意味着配置 initial route 为时已晚。

Developers that would like their cached engine to begin
with a custom initial route can configure their cached
`FlutterEngine` to use a custom initial route just before
executing the Dart entrypoint. The following example
demonstrates the use of an initial route with a cached engine:

希望缓存 engine 以自定义 initial route 开始的开发者,可以在执行 Dart entrypoint 之前,为缓存的 `FlutterEngine` 配置自定义 initial route。以下示例演示了如何在缓存 engine 中使用 initial route:

<Tabs key="android-language">
<Tab name="Kotlin">

Expand Down Expand Up @@ -67,9 +78,16 @@ By setting the initial route of the navigation channel, the associated
`FlutterEngine` displays the desired route upon initial execution of the
`runApp()` Dart function.

通过设置 navigation channel 的 initial route,
关联的 `FlutterEngine` 会在首次执行 `runApp()` Dart 函数时显示所需路由。

Changing the initial route property of the navigation channel
after the initial execution of `runApp()` has no effect.
Developers who would like to use the same `FlutterEngine`
between different `Activity`s and `Fragment`s and switch
the route between those displays need to set up a method channel and
explicitly instruct their Dart code to change `Navigator` routes.

在首次执行 `runApp()` 之后更改 navigation channel 的 initial route 属性不会生效。
如果开发者希望在不同的 `Activity` 和 `Fragment` 之间复用同一个 `FlutterEngine`,
并在这些界面之间切换路由,则需要设置 method channel,并显式指示 Dart 代码更改 `Navigator` 路由。
Loading
Loading