Skip to content

Commit

Permalink
feat: Add the Query suffix to the built query class.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Dec 9, 2022
1 parent 82ef9a6 commit 66ba131
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 77 deletions.
24 changes: 13 additions & 11 deletions packages/katana_router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class HomePage extends StatelessWidget {
const HomePage();
@pageRouteQuery
static const query = _$HomePage();
static const query = _$HomePageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -139,7 +139,9 @@ Define the Widget as a page in `@PagePath("path name")` Annotation.

You can create a query for page transitions by defining a query field by giving `@pageRouteQuery` annotation.

Widget parameters can be defined as is.
Specify `_$(widget class name)Query` for the query value.

Widget parameters can be defined as they are.

```dart
// user.dart
Expand All @@ -159,7 +161,7 @@ class UserPage extends StatelessWidget {
final String userId;
@pageRouteQuery
static const query = _$UserPage();
static const query = _$UserPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -285,7 +287,7 @@ class SearchPage extends StatelessWidget {
final String searchQuery;
@pageRouteQuery
static const query = _$SearchPage();
static const query = _$SearchPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -345,7 +347,7 @@ class UserPage extends StatelessWidget {
final String userId;
@pageRouteQuery
static const query = _$UserPage();
static const query = _$UserPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -424,7 +426,7 @@ class NestedContainerPage extends StatefulWidget {
});
@pageRouteQuery
static const query = _$NestedContainerPage();
static const query = _$NestedContainerPageQuery();
@override
State<StatefulWidget> createState() => _NestedContainerPageState();
Expand Down Expand Up @@ -458,7 +460,7 @@ Therefore, it is possible to use the `NestedPage` annotation exclusively.
class InnerPage1 extends StatelessWidget {
const InnerPage1({super.key});
static const query = _$InnerPage1();
static const query = _$InnerPage1Query();
@override
Widget build(BuildContext context) {
Expand All @@ -478,7 +480,7 @@ class InnerPage1 extends StatelessWidget {
class InnerPage2 extends StatelessWidget {
const InnerPage2({super.key});
static const query = _$InnerPage2();
static const query = _$InnerPage2Query();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -516,7 +518,7 @@ class NestedContainerPage extends StatefulWidget {
});
@pageRouteQuery
static const query = _$NestedContainerPage();
static const query = _$NestedContainerPageQuery();
@override
State<StatefulWidget> createState() => _NestedContainerPageState();
Expand Down Expand Up @@ -576,7 +578,7 @@ class _NestedContainerPageState extends State<NestedContainerPage> {
class InnerPage1 extends StatelessWidget {
const InnerPage1({super.key});
static const query = _$InnerPage1();
static const query = _$InnerPage1Query();
@override
Widget build(BuildContext context) {
Expand All @@ -596,7 +598,7 @@ class InnerPage1 extends StatelessWidget {
class InnerPage2 extends StatelessWidget {
const InnerPage2({super.key});
static const query = _$InnerPage2();
static const query = _$InnerPage2Query();
@override
Widget build(BuildContext context) {
Expand Down
20 changes: 10 additions & 10 deletions packages/katana_router/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -283,33 +283,33 @@ packages:
source: hosted
version: "4.7.0"
katana:
dependency: "direct overridden"
dependency: transitive
description:
path: "../../katana"
relative: true
source: path
name: katana
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.10"
katana_router:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "1.9.7"
version: "1.9.8"
katana_router_annotation:
dependency: "direct overridden"
description:
path: "/Users/mathru/Documents/github/flutter_masamune/packages/katana_router/example/../../katana_router_annotation"
relative: false
path: "../../katana_router_annotation"
relative: true
source: path
version: "1.9.7"
version: "1.9.8"
katana_router_builder:
dependency: "direct dev"
description:
path: "../../katana_router_builder"
relative: true
source: path
version: "1.9.8"
version: "1.9.9"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -541,4 +541,4 @@ packages:
version: "3.1.1"
sdks:
dart: ">=2.18.1 <3.0.0"
flutter: ">=1.20.0"
flutter: ">=2.0.0"
14 changes: 7 additions & 7 deletions packages/katana_router/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ packages:
katana:
dependency: "direct main"
description:
path: "../katana"
relative: true
source: path
name: katana
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.10"
katana_router_annotation:
dependency: "direct main"
description:
path: "../katana_router_annotation"
relative: true
source: path
version: "1.9.7"
name: katana_router_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.8"
matcher:
dependency: transitive
description:
Expand Down
24 changes: 13 additions & 11 deletions packages/katana_router_annotation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class HomePage extends StatelessWidget {
const HomePage();
@pageRouteQuery
static const query = _$HomePage();
static const query = _$HomePageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -139,7 +139,9 @@ Define the Widget as a page in `@PagePath("path name")` Annotation.

You can create a query for page transitions by defining a query field by giving `@pageRouteQuery` annotation.

Widget parameters can be defined as is.
Specify `_$(widget class name)Query` for the query value.

Widget parameters can be defined as they are.

```dart
// user.dart
Expand All @@ -159,7 +161,7 @@ class UserPage extends StatelessWidget {
final String userId;
@pageRouteQuery
static const query = _$UserPage();
static const query = _$UserPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -285,7 +287,7 @@ class SearchPage extends StatelessWidget {
final String searchQuery;
@pageRouteQuery
static const query = _$SearchPage();
static const query = _$SearchPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -345,7 +347,7 @@ class UserPage extends StatelessWidget {
final String userId;
@pageRouteQuery
static const query = _$UserPage();
static const query = _$UserPageQuery();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -424,7 +426,7 @@ class NestedContainerPage extends StatefulWidget {
});
@pageRouteQuery
static const query = _$NestedContainerPage();
static const query = _$NestedContainerPageQuery();
@override
State<StatefulWidget> createState() => _NestedContainerPageState();
Expand Down Expand Up @@ -458,7 +460,7 @@ Therefore, it is possible to use the `NestedPage` annotation exclusively.
class InnerPage1 extends StatelessWidget {
const InnerPage1({super.key});
static const query = _$InnerPage1();
static const query = _$InnerPage1Query();
@override
Widget build(BuildContext context) {
Expand All @@ -478,7 +480,7 @@ class InnerPage1 extends StatelessWidget {
class InnerPage2 extends StatelessWidget {
const InnerPage2({super.key});
static const query = _$InnerPage2();
static const query = _$InnerPage2Query();
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -516,7 +518,7 @@ class NestedContainerPage extends StatefulWidget {
});
@pageRouteQuery
static const query = _$NestedContainerPage();
static const query = _$NestedContainerPageQuery();
@override
State<StatefulWidget> createState() => _NestedContainerPageState();
Expand Down Expand Up @@ -576,7 +578,7 @@ class _NestedContainerPageState extends State<NestedContainerPage> {
class InnerPage1 extends StatelessWidget {
const InnerPage1({super.key});
static const query = _$InnerPage1();
static const query = _$InnerPage1Query();
@override
Widget build(BuildContext context) {
Expand All @@ -596,7 +598,7 @@ class InnerPage1 extends StatelessWidget {
class InnerPage2 extends StatelessWidget {
const InnerPage2({super.key});
static const query = _$InnerPage2();
static const query = _$InnerPage2Query();
@override
Widget build(BuildContext context) {
Expand Down
18 changes: 9 additions & 9 deletions packages/katana_router_annotation/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "50.0.0"
version: "51.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.0"
version: "5.3.1"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -70,7 +70,7 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "1.6.1"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -151,9 +151,9 @@ packages:
katana:
dependency: "direct main"
description:
path: "../katana"
relative: true
source: path
name: katana
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.10"
logging:
dependency: transitive
Expand Down Expand Up @@ -322,21 +322,21 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.22.0"
version: "1.22.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.16"
version: "0.4.17"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.20"
version: "0.4.21"
typed_data:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 66ba131

Please sign in to comment.