Skip to content

Commit

Permalink
fix: format docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marwfair committed Sep 16, 2024
1 parent 10f8cd8 commit 0f45f4f
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
"tailwindcss",
"Tappable",
"Tcsh",
"texttheme",
"themedata",
"todos",
"tsconfigs",
"Vala",
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/architecture/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ When using layered architecture, data should only flow from the bottom up, and a
}
}
```

</TabItem>
<TabItem label="Bad ❗️">
```dart
Expand Down Expand Up @@ -193,6 +194,7 @@ When using layered architecture, data should only flow from the bottom up, and a
}
}
```

</TabItem>
</Tabs>

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/code_style/code_style.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The above example will compile, but it is not immediately obvious what value `us
// do stuff
}
```

</TabItem>
</Tabs>

Expand Down
23 changes: 22 additions & 1 deletion src/content/docs/navigation/navigation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Structure your routes in a way that makes logical sense. Avoid placing all of yo

<Tabs>
<TabItem label="Good ✅">

```txt
/
/flutter
Expand All @@ -28,8 +29,10 @@ Structure your routes in a way that makes logical sense. Avoid placing all of yo
/android/news
/android/chat
```

</TabItem>
<TabItem label="Bad ❗️">

```txt
/
/flutter
Expand All @@ -39,6 +42,7 @@ Structure your routes in a way that makes logical sense. Avoid placing all of yo
/android-news
/android-chat
```

</TabItem>
</Tabs>

Expand All @@ -52,6 +56,7 @@ GoRouter allows you to define [type-safe routes](https://pub.dev/documentation/g

<Tabs>
<TabItem label="Good ✅">

```dart
@TypedGoRoute<CategoriesPageRoute>(
name: 'categories',
Expand Down Expand Up @@ -79,6 +84,7 @@ GoRouter allows you to define [type-safe routes](https://pub.dev/documentation/g

</TabItem>
<TabItem label="Bad ❗️">

```dart
GoRoute(
name: 'categories',
Expand All @@ -90,6 +96,7 @@ GoRouter allows you to define [type-safe routes](https://pub.dev/documentation/g
}
)
```

</TabItem>
</Tabs>

Expand All @@ -106,16 +113,18 @@ For reasons listed in the [Prefer navigating by name over path](#prefer-navigati

<Tabs>
<TabItem label="Navigating by name">

```dart
context.goNamed('categories', queryParameters: {'size': 'small', 'color': 'blue'})
```

</TabItem>
<TabItem label="Navigating by path">
Navigating by path:

```dart
context.go('/categories?size=small&color=blue');
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -153,15 +162,19 @@ Mobile app users will likely never see your route's path, but web app users can

<Tabs>
<TabItem label="Good ✅">

```txt
/user/update-address
```

</TabItem>
<TabItem label="Bad ❗️">

```txt
/user/update_address
/user/updateAddress
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -226,14 +239,18 @@ GoRouter provides extension methods on `BuildContext` to simplify navigation. Fo

<Tabs>
<TabItem label="Good ✅">

```dart
context.goNamed('flutterNews');
```

</TabItem>
<TabItem label="Bad ❗️">

```dart
GoRouter.of(context).goNamed('flutterNews');
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -336,6 +353,7 @@ The `extra` option used during navigation does not work on the web and cannot be

<Tabs>
<TabItem label="Bad ❗️">

```dart
@TypedGoRoute<FlutterArticlePageRoute>(
name: 'flutterArticle',
Expand All @@ -359,13 +377,15 @@ The `extra` option used during navigation does not work on the web and cannot be
```dart
FlutterArticlePageRoute(article: article).go(context);
```

</TabItem>
</Tabs>

In this example, we are passing the `article` object to the article details page. If your app is designed to only work on mobile and there are no plans of deep linking to the articles details page, then this is fine. But, if the requirements change and now you want to support the web or deep link users directly to the details of a particular article, changes will need to be made. Instead, pass the identifier of the article as a path parameter and fetch the article information from inside of your article details page.

<Tabs>
<TabItem label="Good ✅">

```dart
FlutterArticlePageRoute(id: state.article.id).go(context);
```
Expand All @@ -389,6 +409,7 @@ In this example, we are passing the `article` object to the article details page
}
}
```

</TabItem>
</Tabs>

Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/testing/golden_file_testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Golden tests should be tagged to make it easier to run them separately from othe
},
);
```

</TabItem>
<TabItem label="Bad ❗️">
```dart
Expand All @@ -43,6 +44,7 @@ Golden tests should be tagged to make it easier to run them separately from othe
);
});
```

</TabItem>
</Tabs>

Expand Down
Loading

0 comments on commit 0f45f4f

Please sign in to comment.