Skip to content

Commit

Permalink
Add FWE to sidenav (#11171)
Browse files Browse the repository at this point in the history
This PR adds FWE to the sidebar, completing V2 of FWE. Resolves #11066.

* Updates the "Learn more" page to reflect the sidenav changes
* Changes the name "FWE" to "fundamentals course" and replaces "FWE" and
"First week experience" references in all links and text throughout the
site.
* Adjusts sidenav to look like this:
<img width="226" alt="Screenshot 2024-09-24 at 10 37 38 AM"
src="https://github.com/user-attachments/assets/74f0979b-8058-46c1-aecf-3d55d658a492">

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [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).
- [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.

---------

Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
Co-authored-by: Parker Lougheed <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2024
1 parent ed344b9 commit 50f5fe4
Show file tree
Hide file tree
Showing 17 changed files with 631 additions and 571 deletions.
4 changes: 3 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@
{ "source": "/cookbook/testing/widget-test-tap-drag", "destination": "/cookbook/testing/widget/tap-drag", "type": 301 },
{ "source": "/deployment/fastlane-cd", "destination": "/deployment/cd#fastlane", "type": 301 },
{ "source": "/get-started", "destination": "/get-started/install", "type": 301 },
{ "source": "/get-started/flutter-for", "destination": "/get-started/learn-more", "type": 301 },
{ "source": "/get-started/flutter-for", "destination": "/get-started/learn-flutter", "type": 301 },
{ "source": "/get-started/flutter-for/ios-devs", "destination": "/get-started/flutter-for/swiftui-devs", "type": 301 },
{ "source": "/get-started/fwe/:rest*", "destination": "/get-started/fundamentals/:rest*", "type": 301 },
{ "source": "/get-started/install/null", "destination": "/get-started/install", "type": 301 },
{ "source": "/get-started/learn-more", "destination": "/get-started/learn-flutter", "type": 301 },
{ "source": "/get-started/web", "destination": "/platform-integration/web/building", "type": 301 },
{ "source": "/ios-14", "destination": "/platform-integration/ios/ios-debugging", "type": 301 },
{ "source": "/ios-project-migration", "destination": "https://web.archive.org/web/20220614103526/https://docs.flutter.dev/development/ios-project-migration", "type": 301 },
Expand Down
63 changes: 41 additions & 22 deletions src/_data/sidenav.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,45 @@
- title: Get started
- header: Get started
- title: Set up Flutter
permalink: /get-started/install

- title: Learn Flutter
children:
- title: Install Flutter
permalink: /get-started/install
- title: Test drive
permalink: /get-started/test-drive
- title: Introduction
permalink: /get-started/learn-flutter
- title: Write your first app
permalink: /get-started/codelab
- title: Learn more
permalink: /get-started/learn-more
- divider
- title: Where to get Flutter support
permalink: /resources/support
- title: Learn the fundamentals
expanded: true
children:
- title: Introduction
permalink: /get-started/fundamentals
- title: Intro to Dart
permalink: /get-started/fundamentals/dart
- title: Widgets
permalink: /get-started/fundamentals/widgets
- title: Layouts
permalink: /get-started/fundamentals/layout
- title: State management
permalink: /get-started/fundamentals/state-management
- title: Handling user input
permalink: /get-started/fundamentals/user-input
- title: Networking and data
permalink: /get-started/fundamentals/networking
- title: Local data and caching
permalink: /get-started/fundamentals/local-caching

- title: Dart language
permalink: /resources/bootstrap-into-dart

- title: Codelabs & samples
children:
- title: Codelabs
permalink: /codelabs
- title: Cookbook
permalink: /cookbook
- title: Samples and demos
permalink: https://flutter.github.io/samples/

- title: From another platform?
permalink: /get-started/flutter-for
children:
Expand All @@ -26,13 +55,10 @@
permalink: /get-started/flutter-for/web-devs
- title: Flutter for Xamarin.Forms devs
permalink: /get-started/flutter-for/xamarin-forms-devs
- divider
- title: Introduction to declarative UI
permalink: /get-started/flutter-for/declarative
- title: Flutter versus Swift concurrency
permalink: /get-started/flutter-for/dart-swift-concurrency
- title: "Dart language overview"
permalink: https://dart.dev/overview

- title: Stay up to date
permalink: /release
Expand All @@ -51,15 +77,6 @@
- title: Compatibility policy
permalink: /release/compatibility-policy

- title: Codelabs & samples
children:
- title: Codelabs
permalink: /codelabs
- title: Cookbook
permalink: /cookbook
- title: Samples and demos
permalink: https://flutter.github.io/samples/

- title: App solutions
children:
- title: AI
Expand Down Expand Up @@ -754,6 +771,8 @@
permalink: /resources/courses
- title: Learn Dart
permalink: /resources/bootstrap-into-dart
- title: Get support
permalink: /resources/support
- header: Contributing
- title: Create useful bug reports
permalink: /resources/bug-reports
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/docs/install/flutter-doctor.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ you can start developing Flutter apps for {{work-target}}.
To continue on your learning journey, consult the following guides:

- [Learn how to write your first Flutter app][codelab]
- [First week experience of Flutter][fwe]
- [Flutter fundamentals docs][fundamentals]

[codelab]: /get-started/codelab/
[fwe]: /get-started/fwe/
[fundamentals]: /get-started/fundamentals/
2 changes: 1 addition & 1 deletion src/content/get-started/codelab.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prev:
path: /get-started/test-drive
next:
title: Learn more
path: /get-started/learn-more
path: /get-started/learn-flutter
toc: false
---

Expand Down
179 changes: 179 additions & 0 deletions src/content/get-started/fundamentals/dart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
title: Intro to Dart
description: Learn about the Dart programming language
prev:
title: Fundamentals
path: /get-started/fundamentals
next:
title: Widgets
path: /get-started/fundamentals/widgets
---

To get started with Flutter,
you need to have some familiarity with
the Dart programming language, which Flutter
applications are written in.
This page is a gentle introduction to Dart,
and if you're comfortable reading the
code examples, feel free to skip this page.
You do not need to be an expert in Dart to
continue with this series.

## Dart

Flutter applications are built in [Dart][],
a language that will look familiar
to anyone who's written Java, Javascript,
or any other C-like language.

:::note
Installing Flutter also installs Dart,
so you don't need to install Dart separately.
:::

The following example is a small program that
fetches data from dart.dev,
decodes the returned json,
and prints it to the console.
If you’re confident in your ability to
understand this program,
feel free to skip to the page.

```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
class Package {
final String name;
final String latestVersion;
final String? description;
Package(this.name, this.latestVersion, this.description);
@override
String toString() {
return 'Package{name: $name, latestVersion: $latestVersion, description: $description}';
}
}
void main() async {
final httpPackageUrl = Uri.https('dart.dev', '/f/packages/http.json');
final httpPackageResponse = await http.get(httpPackageUrl);
if (httpPackageResponse.statusCode != 200) {
print('Failed to retrieve the http package!');
return;
}
final json = jsonDecode(httpPackageResponse.body);
final package = Package(json['name'], json['latestVersion'], json['description']);
print(package);
}
```

This program has two parts:
the `Package` class declaration, and the business logic,
which is contained in the [`main`][] function.

The `Package` class contains many of the most common
features you’ll use when working with [classes in Dart][].
This class has three members,
and defines a constructor and a method.

The Dart language is [type safe][]; it uses
static type checking to ensure that
a variable's value always matches the
variable's static type.
When defining a class, annotating the members with
`String` is required,
but it is often optional due to type inference.
In the `main` function in this example
there are many lines that start with `final variableName =`.
These lines are type safe,
despite not being explicitly given a type.

Dart also has built-in [sound null safety][].
In the example, the `description` member is
declared with the type `String?`.
The `?` at the end of `String?` means that
this property can be null.
The other two members cannot be null,
and the program will not compile if
you tried to set them to null.
You can see this demonstrated in the constructor for
the ‘Package class’. It takes two required,
positional arguments and one optional, named argument.

Next in the example is the `main` function.
All Dart programs, including Flutter apps,
start with a `main` function.
The function showcases several basic Dart language features,
including using libraries, marking functions as async,
making function calls, using `if` statement control-flow,
and more.

:::note Where does initialization code go?
The main entrypoint in a starter
Flutter app is in `lib/main.dart`.
The default `main` method looks
like the following:

```dart title="lib/main.dart"
void main() {
runApp(const MyApp());
}
```

Perform any _quick_ initialization (less than a frame or two)
_before_ calling `runApp()`,
though be aware that the widget tree hasn't been created yet.
If you want to perform initialization that takes awhile,
such as loading data from disk or over a network,
do it in a way that won't block the main UI thread.
For more information, check out [Asynchronous programming][],
the [`FutureBuilder`][] API, [Deferred components][],
or the [Working with long lists][] cookbook recipe,
as appropriate.

Every stateful widget has an `initState()`
method that is called when the widget is
created and added to the widget tree.
You can override this method and perform
initialization there, though the first line of
this method _must_ be `super.initState()`.

Finally, hot reloading your app does _not_
call `initState` or `main` again.
Hot restart calls both.
:::

If these features aren’t familiar to you,
you can find resources to learn Dart on the
[Bootstrap into Dart][] page.

## Next: Widgets

This page is an introduction to Dart,
and helps you become familiar with reading
Flutter and Dart code. It's okay if you don't
feel clear on all the code on this page,
as long as you feel comfortable with the _syntax_
of the Dart language.
In the next section, you'll learn about the
building block of Flutter apps: widgets.

[Asynchronous programming]: {{site.dart-site}}/libraries/async/async-await
[Dart]: {{site.dart-site}}
[Deferred components]: /perf/deferred-components
[`main`]: {{site.dart-site}}/language#hello-world
[classes in Dart]: {{site.dart-site}}/language/classes
[`FutureBuilder`]: {{site.api}}/flutter/widgets/FutureBuilder-class
[type safe]: {{site.dart-site}}/language/type-system
[sound null safety]: {{site.dart-site}}/null-safety
[Working with long lists]: /cookbook/lists/long-lists
[Bootstrap into Dart]: /resources/bootstrap-into-dart

## Feedback

As this section of the website is evolving,
we [welcome your feedback][]!

[welcome your feedback]: https://google.qualtrics.com/jfe/form/SV_6A9KxXR7XmMrNsy?page="dart"
Loading

0 comments on commit 50f5fe4

Please sign in to comment.