first bang implementation
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:bang_navigator/core/routing/dialog_page.dart';
|
||||
import 'package:bang_navigator/features/about/presentation/screens/about.dart';
|
||||
import 'package:bang_navigator/features/bangs/presentation/screens/bang.dart';
|
||||
import 'package:bang_navigator/features/bangs/presentation/screens/search.dart';
|
||||
import 'package:bang_navigator/features/chat_archive/presentation/screens/detail.dart';
|
||||
import 'package:bang_navigator/features/chat_archive/presentation/screens/list.dart';
|
||||
import 'package:bang_navigator/features/search_browser/presentation/screens/browser.dart';
|
||||
@@ -17,11 +19,19 @@ part 'routes.g.dart';
|
||||
name: 'AboutRoute',
|
||||
path: 'about',
|
||||
),
|
||||
TypedGoRoute<BangRoute>(
|
||||
name: 'BangRoute',
|
||||
path: 'bangs',
|
||||
routes: [
|
||||
TypedGoRoute<BangSearchRoute>(
|
||||
name: 'BangSearchRoute',
|
||||
path: 'search',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
class KagiRoute extends GoRouteData {
|
||||
KagiRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const KagiScreen();
|
||||
@@ -35,6 +45,20 @@ class AboutRoute extends GoRouteData {
|
||||
}
|
||||
}
|
||||
|
||||
class BangRoute extends GoRouteData {
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const BangScreen();
|
||||
}
|
||||
}
|
||||
|
||||
class BangSearchRoute extends GoRouteData {
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const BangSearchScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@TypedGoRoute<SettingsRoute>(
|
||||
name: 'SettingsRoute',
|
||||
path: '/settings',
|
||||
|
||||
@@ -22,6 +22,18 @@ RouteBase get $kagiRoute => GoRouteData.$route(
|
||||
name: 'AboutRoute',
|
||||
factory: $AboutRouteExtension._fromState,
|
||||
),
|
||||
GoRouteData.$route(
|
||||
path: 'bangs',
|
||||
name: 'BangRoute',
|
||||
factory: $BangRouteExtension._fromState,
|
||||
routes: [
|
||||
GoRouteData.$route(
|
||||
path: 'search',
|
||||
name: 'BangSearchRoute',
|
||||
factory: $BangSearchRouteExtension._fromState,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -59,6 +71,40 @@ extension $AboutRouteExtension on AboutRoute {
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
extension $BangRouteExtension on BangRoute {
|
||||
static BangRoute _fromState(GoRouterState state) => BangRoute();
|
||||
|
||||
String get location => GoRouteData.$location(
|
||||
'/bangs',
|
||||
);
|
||||
|
||||
void go(BuildContext context) => context.go(location);
|
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||
|
||||
void pushReplacement(BuildContext context) =>
|
||||
context.pushReplacement(location);
|
||||
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
extension $BangSearchRouteExtension on BangSearchRoute {
|
||||
static BangSearchRoute _fromState(GoRouterState state) => BangSearchRoute();
|
||||
|
||||
String get location => GoRouteData.$location(
|
||||
'/bangs/search',
|
||||
);
|
||||
|
||||
void go(BuildContext context) => context.go(location);
|
||||
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||
|
||||
void pushReplacement(BuildContext context) =>
|
||||
context.pushReplacement(location);
|
||||
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
RouteBase get $settingsRoute => GoRouteData.$route(
|
||||
path: '/settings',
|
||||
name: 'SettingsRoute',
|
||||
|
||||
Reference in New Issue
Block a user