Surface/lib/router.dart

95 lines
2.8 KiB
Dart
Raw Normal View History

2024-11-08 16:09:46 +00:00
import 'package:go_router/go_router.dart';
import 'package:surface/screens/account.dart';
2024-11-09 17:04:39 +00:00
import 'package:surface/screens/account/profile_edit.dart';
import 'package:surface/screens/account/publishers/publisher_edit.dart';
import 'package:surface/screens/account/publishers/publisher_new.dart';
import 'package:surface/screens/account/publishers/publishers.dart';
2024-11-09 10:28:45 +00:00
import 'package:surface/screens/auth/login.dart';
import 'package:surface/screens/auth/register.dart';
2024-11-08 16:09:46 +00:00
import 'package:surface/screens/explore.dart';
import 'package:surface/screens/home.dart';
2024-11-09 17:34:58 +00:00
import 'package:surface/screens/post/post_editor.dart';
2024-11-08 16:09:46 +00:00
import 'package:surface/widgets/navigation/app_scaffold.dart';
final appRouter = GoRouter(
routes: [
ShellRoute(
builder: (context, state, child) => AppScaffold(
body: child,
showBottomNavigation: true,
),
routes: [
GoRoute(
path: '/',
name: 'home',
builder: (context, state) => const HomeScreen(),
),
GoRoute(
path: '/posts',
name: 'explore',
builder: (context, state) => const ExploreScreen(),
),
GoRoute(
path: '/account',
name: 'account',
builder: (context, state) => const AccountScreen(),
),
],
2024-11-09 10:28:45 +00:00
),
2024-11-09 17:34:58 +00:00
ShellRoute(
builder: (context, state, child) => AppScaffold(
body: child,
),
routes: [
GoRoute(
path: '/post/write/:mode',
name: 'postEditor',
2024-11-10 04:41:56 +00:00
builder: (context, state) => PostEditorScreen(
mode: state.pathParameters['mode']!,
),
2024-11-09 17:34:58 +00:00
),
],
),
2024-11-09 10:28:45 +00:00
ShellRoute(
builder: (context, state, child) => AppScaffold(
body: child,
autoImplyAppBar: true,
),
routes: [
GoRoute(
path: '/auth/login',
name: 'authLogin',
builder: (context, state) => const LoginScreen(),
),
GoRoute(
path: '/auth/register',
2024-11-09 10:28:45 +00:00
name: 'authRegister',
builder: (context, state) => const RegisterScreen(),
),
2024-11-09 17:04:39 +00:00
GoRoute(
path: '/account/profile/edit',
name: 'accountProfileEdit',
builder: (context, state) => const ProfileEditScreen(),
),
GoRoute(
path: '/account/publishers',
name: 'accountPublishers',
builder: (context, state) => const PublisherScreen(),
),
GoRoute(
path: '/account/publishers/new',
name: 'accountPublisherNew',
builder: (context, state) => const AccountPublisherNewScreen(),
),
GoRoute(
path: '/account/publishers/edit/:name',
name: 'accountPublisherEdit',
builder: (context, state) => AccountPublisherEditScreen(
name: state.pathParameters['name']!,
),
),
2024-11-09 10:28:45 +00:00
],
),
2024-11-08 16:09:46 +00:00
],
);