Skip to content

Commit 2f1c7bb

Browse files
authored
Add AI top-level section and restructure existing AI docs (#13264)
Adds top level AI header and reorganizes our current AI landing page and AI content. ## Presubmit checklist - [X] If you are unwilling, or unable, to sign the CLA, even for a _tiny_, one-word PR, please file an issue instead of a PR. - [X] If this PR is not meant to land until a future stable release, mark it as draft with an explanation. - [X] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style)—for example, it doesn't use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first-person pronouns). - [X] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
1 parent 23ffe4b commit 2f1c7bb

26 files changed

Lines changed: 160 additions & 21 deletions

site/lib/src/components/layout/header.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class DashHeader extends StatelessComponent {
6262
label: 'Learn',
6363
isActive: activeEntry == ActiveNavEntry.learn,
6464
),
65+
_NavItem(
66+
href: '/ai/create-with-ai',
67+
label: 'AI',
68+
isActive: activeEntry == ActiveNavEntry.ai,
69+
),
6570
const _NavItem(
6671
href: 'https://api.flutter.dev',
6772
label: 'Reference',

site/lib/src/components/layout/sidenav.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ final class DashSideNav extends StatelessComponent {
4343
iconId: 'play_lesson',
4444
active: activeEntry == ActiveNavEntry.learn,
4545
),
46+
_TopNavItem(
47+
href: '/ai/create-with-ai',
48+
label: 'AI',
49+
iconId: 'auto_awesome',
50+
active: activeEntry == ActiveNavEntry.ai,
51+
),
4652
const _TopNavItem(
4753
href: 'https://api.flutter.dev',
4854
label: 'Reference',

site/lib/src/layouts/dash_layout.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ ga('send', 'pageview');
157157
final bodyClass = pageData['bodyClass'] as String?;
158158
final pageUrl = page.url.startsWith('/') ? page.url : '/${page.url}';
159159

160+
final pageSidenav = pageData['sidenav'] as String? ?? defaultSidenav;
160161
final sideNavEntries = switch (page.data['sidenav']) {
162+
_ when pageSidenav == 'ai' => switch (page.data['ai']) {
163+
final List<Object?> sidenavData => navEntriesFromData(sidenavData),
164+
_ => null,
165+
},
161166
final List<Object?> sidenavData => navEntriesFromData(sidenavData),
162167
_ => null,
163168
};

site/lib/src/utils/active_nav.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ ActiveNavEntry activeNavEntry(String pageUrlPath) {
77
return ActiveNavEntry.learn;
88
}
99

10+
if (pageUrlPath.startsWith('/ai')) {
11+
return ActiveNavEntry.ai;
12+
}
1013
return ActiveNavEntry.home;
1114
}
1215

1316
enum ActiveNavEntry {
1417
home,
1518
learn,
19+
ai,
1620
// reference,
1721
}

src/content/ai/ai-rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: AI rules for Flutter and Dart
3+
sidenav: ai
34
shortTitle: AI rules
45
description: >-
56
Learn how to add AI rules to tools that accelerate your

src/content/ai/ai-toolkit/chat-client-sample.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Chat client sample
3+
sidenav: ai
34
description: >
45
Learn about the chat client sample included in the AI Toolkit.
56
prev:

src/content/ai/ai-toolkit/custom-llm-providers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Custom LLM providers
3+
sidenav: ai
34
description: >
45
How to integrate with other Flutter features.
56
prev:

src/content/ai/ai-toolkit/feature-integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Feature integration
3+
sidenav: ai
34
description: >
45
How to integrate with other Flutter features.
56
prev:

src/content/ai/ai-toolkit/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Flutter AI Toolkit
3+
sidenav: ai
34
shortTitle: AI Toolkit
45
description: >
56
Learn how to add the AI Toolkit chatbot

src/content/ai/ai-toolkit/user-experience.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: User experience
3+
sidenav: ai
34
description: >
45
How the user will experience the AI Toolkit in your app.
56
prev:

0 commit comments

Comments
 (0)