Solian/lib/router.dart

69 lines
2.1 KiB
Dart
Raw Normal View History

2024-04-12 16:38:20 +00:00
import 'package:go_router/go_router.dart';
import 'package:solian/models/channel.dart';
2024-04-14 10:38:44 +00:00
import 'package:solian/models/post.dart';
import 'package:solian/screens/account.dart';
2024-04-17 15:00:53 +00:00
import 'package:solian/screens/chat/chat.dart';
2024-04-16 14:29:58 +00:00
import 'package:solian/screens/chat/index.dart';
2024-04-12 16:38:20 +00:00
import 'package:solian/screens/explore.dart';
import 'package:solian/screens/posts/comment_editor.dart';
2024-04-14 10:38:44 +00:00
import 'package:solian/screens/posts/moment_editor.dart';
2024-04-13 17:07:57 +00:00
import 'package:solian/screens/posts/screen.dart';
2024-04-21 12:55:17 +00:00
import 'package:solian/screens/signin.dart';
import 'package:solian/widgets/chat/channel_editor.dart';
2024-04-12 16:38:20 +00:00
final router = GoRouter(
routes: [
GoRoute(
path: '/',
name: 'explore',
builder: (context, state) => const ExploreScreen(),
),
2024-04-16 14:29:58 +00:00
GoRoute(
path: '/chat',
name: 'chat',
builder: (context, state) => const ChatIndexScreen(),
),
2024-04-17 15:00:53 +00:00
GoRoute(
path: '/chat/create',
name: 'chat.channel.editor',
builder: (context, state) => ChannelEditor(editing: state.extra as Channel?),
),
GoRoute(
path: '/chat/c/:channel',
2024-04-17 15:00:53 +00:00
name: 'chat.channel',
builder: (context, state) => ChatScreen(alias: state.pathParameters['channel'] as String),
),
GoRoute(
path: '/account',
name: 'account',
builder: (context, state) => const AccountScreen(),
),
2024-04-13 17:45:27 +00:00
GoRoute(
path: '/posts/publish/moments',
2024-04-14 10:38:44 +00:00
name: 'posts.moments.editor',
builder: (context, state) => MomentEditorScreen(editing: state.extra as Post?),
2024-04-13 17:45:27 +00:00
),
GoRoute(
path: '/posts/publish/comments',
name: 'posts.comments.editor',
builder: (context, state) {
final args = state.extra as CommentPostArguments;
return CommentEditorScreen(editing: args.editing, related: args.related);
},
),
2024-04-13 17:07:57 +00:00
GoRoute(
path: '/posts/:dataset/:alias',
name: 'posts.screen',
builder: (context, state) => PostScreen(
alias: state.pathParameters['alias'] as String,
dataset: state.pathParameters['dataset'] as String,
),
),
2024-04-21 12:55:17 +00:00
GoRoute(
path: '/auth/sign-in',
name: 'auth.sign-in',
builder: (context, state) => SignInScreen(),
),
2024-04-12 16:38:20 +00:00
],
);