Solian/lib/router.dart

118 lines
3.7 KiB
Dart
Raw Normal View History

2024-04-12 16:38:20 +00:00
import 'package:go_router/go_router.dart';
2024-04-26 17:36:54 +00:00
import 'package:solian/models/call.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-25 15:03:16 +00:00
import 'package:solian/screens/account/friend.dart';
2024-05-02 10:56:40 +00:00
import 'package:solian/screens/account/personalize.dart';
2024-05-01 09:37:34 +00:00
import 'package:solian/screens/auth/signup.dart';
2024-04-26 17:36:54 +00:00
import 'package:solian/screens/chat/call.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-25 13:33:53 +00:00
import 'package:solian/screens/chat/manage.dart';
2024-04-26 12:49:21 +00:00
import 'package:solian/screens/chat/channel/editor.dart';
import 'package:solian/screens/chat/channel/member.dart';
2024-04-12 16:38:20 +00:00
import 'package:solian/screens/explore.dart';
2024-04-24 15:19:26 +00:00
import 'package:solian/screens/notification.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-05-01 09:37:34 +00:00
import 'package:solian/screens/auth/signin.dart';
2024-04-12 16:38:20 +00:00
final router = GoRouter(
routes: [
GoRoute(
path: '/',
name: 'explore',
builder: (context, state) => const ExploreScreen(),
),
2024-04-25 15:03:16 +00:00
GoRoute(
path: '/notification',
name: 'notification',
builder: (context, state) => const NotificationScreen(),
),
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',
2024-05-01 09:37:34 +00:00
builder: (context, state) =>
ChannelEditorScreen(editing: state.extra as Channel?),
),
GoRoute(
path: '/chat/c/:channel',
2024-04-17 15:00:53 +00:00
name: 'chat.channel',
2024-05-01 09:37:34 +00:00
builder: (context, state) =>
ChatScreen(alias: state.pathParameters['channel'] as String),
2024-04-17 15:00:53 +00:00
),
2024-04-26 17:36:54 +00:00
GoRoute(
path: '/chat/c/:channel/call',
name: 'chat.channel.call',
builder: (context, state) => ChatCall(call: state.extra as Call),
),
2024-04-25 13:33:53 +00:00
GoRoute(
path: '/chat/c/:channel/manage',
name: 'chat.channel.manage',
2024-05-01 09:37:34 +00:00
builder: (context, state) =>
ChatManageScreen(channel: state.extra as Channel),
2024-04-25 13:33:53 +00:00
),
2024-04-26 12:49:21 +00:00
GoRoute(
path: '/chat/c/:channel/member',
name: 'chat.channel.member',
2024-05-01 09:37:34 +00:00
builder: (context, state) =>
ChatMemberScreen(channel: state.extra as Channel),
2024-04-26 12:49:21 +00:00
),
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',
2024-05-01 09:37:34 +00:00
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;
2024-05-01 09:37:34 +00:00
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-05-01 09:37:34 +00:00
GoRoute(
path: '/auth/sign-up',
name: 'auth.sign-up',
builder: (context, state) => SignUpScreen(),
),
2024-04-25 15:03:16 +00:00
GoRoute(
path: '/account/friend',
name: 'account.friend',
builder: (context, state) => const FriendScreen(),
),
2024-05-02 10:56:40 +00:00
GoRoute(
path: '/account/personalize',
name: 'account.personalize',
builder: (context, state) => const PersonalizeScreen(),
),
2024-04-12 16:38:20 +00:00
],
);