Skip to content

Commit ab94431

Browse files
committed
Fix router
1 parent b79352c commit ab94431

File tree

6 files changed

+104
-44
lines changed

6 files changed

+104
-44
lines changed

example/lib/pages/alert_page.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import 'package:flutter/cupertino.dart';
55
import 'package:flutter/material.dart';
66
import 'package:go_router/go_router.dart';
77

8-
class AlertRoute extends GoRouteData {
9-
const AlertRoute();
10-
@override
11-
Widget build(BuildContext context, GoRouterState state) => const AlertPage();
12-
}
13-
148
class AlertPage extends StatelessWidget {
159
const AlertPage({super.key});
1610

example/lib/pages/nested_navigator_page.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ import 'package:example/util/util.dart';
33
import 'package:flutter/material.dart';
44
import 'package:go_router/go_router.dart';
55

6-
class NestedNavigatorRoute extends GoRouteData {
7-
const NestedNavigatorRoute();
8-
@override
9-
Widget build(BuildContext context, GoRouterState state) =>
10-
const NestedNavigatorPage();
11-
}
12-
136
class NestedNavigatorPage extends StatelessWidget {
147
const NestedNavigatorPage({super.key});
158

example/lib/pages/sheet_page.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import 'package:flutter/cupertino.dart';
55
import 'package:flutter/material.dart';
66
import 'package:go_router/go_router.dart';
77

8-
class SheetRoute extends GoRouteData {
9-
const SheetRoute();
10-
@override
11-
Widget build(BuildContext context, GoRouterState state) => const SheetPage();
12-
}
13-
148
class SheetPage extends StatelessWidget {
159
const SheetPage({super.key});
1610

example/lib/pages/text_input_dialog_page.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ import 'package:flutter/material.dart';
66
import 'package:flutter_riverpod/flutter_riverpod.dart';
77
import 'package:go_router/go_router.dart';
88

9-
class TextInputDialogRoute extends GoRouteData {
10-
const TextInputDialogRoute();
11-
@override
12-
Widget build(BuildContext context, GoRouterState state) =>
13-
const TextInputDialogPage();
14-
}
15-
169
class TextInputDialogPage extends ConsumerWidget {
1710
const TextInputDialogPage({super.key});
1811

example/lib/router/router.dart

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,38 @@ final routerProvider = Provider(
2828
TypedGoRoute<NestedNavigatorRoute>(path: 'nested-navigator'),
2929
],
3030
)
31-
class HomeRoute extends GoRouteData {
31+
class HomeRoute extends GoRouteData with _$HomeRoute {
3232
const HomeRoute();
3333
@override
3434
Widget build(BuildContext context, GoRouterState state) => const HomePage();
3535
}
3636

37+
class AlertRoute extends GoRouteData with _$AlertRoute {
38+
const AlertRoute();
39+
@override
40+
Widget build(BuildContext context, GoRouterState state) => const AlertPage();
41+
}
42+
43+
class NestedNavigatorRoute extends GoRouteData with _$NestedNavigatorRoute {
44+
const NestedNavigatorRoute();
45+
@override
46+
Widget build(BuildContext context, GoRouterState state) =>
47+
const NestedNavigatorPage();
48+
}
49+
50+
class SheetRoute extends GoRouteData with _$SheetRoute {
51+
const SheetRoute();
52+
@override
53+
Widget build(BuildContext context, GoRouterState state) => const SheetPage();
54+
}
55+
56+
class TextInputDialogRoute extends GoRouteData with _$TextInputDialogRoute {
57+
const TextInputDialogRoute();
58+
@override
59+
Widget build(BuildContext context, GoRouterState state) =>
60+
const TextInputDialogPage();
61+
}
62+
3763
String pascalCaseFromRouteName(String name) => name.pascalCase;
3864
String pascalCaseFromRouteUri(Uri uri) =>
3965
pascalCaseFromRouteName(uri.toString());

example/lib/router/router.g.dart

Lines changed: 77 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)