2024-05-18 10:17:16 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:solian/screens/account.dart';
|
2024-05-23 13:12:47 +00:00
|
|
|
import 'package:solian/screens/account/friend.dart';
|
2024-05-22 15:18:01 +00:00
|
|
|
import 'package:solian/screens/account/personalize.dart';
|
2024-05-23 13:12:47 +00:00
|
|
|
import 'package:solian/screens/contact.dart';
|
2024-05-23 12:00:26 +00:00
|
|
|
import 'package:solian/screens/social.dart';
|
2024-05-19 10:01:00 +00:00
|
|
|
import 'package:solian/screens/posts/publish.dart';
|
2024-05-22 15:18:01 +00:00
|
|
|
import 'package:solian/shells/basic_shell.dart';
|
2024-05-18 10:17:16 +00:00
|
|
|
import 'package:solian/shells/nav_shell.dart';
|
|
|
|
|
2024-05-18 16:56:32 +00:00
|
|
|
abstract class AppRouter {
|
2024-05-18 10:17:16 +00:00
|
|
|
static GoRouter instance = GoRouter(
|
|
|
|
routes: [
|
|
|
|
ShellRoute(
|
2024-05-21 16:05:03 +00:00
|
|
|
builder: (context, state, child) =>
|
2024-05-23 14:11:42 +00:00
|
|
|
NavShell(state: state, child: child, showAppBar: false),
|
2024-05-18 10:17:16 +00:00
|
|
|
routes: [
|
|
|
|
GoRoute(
|
2024-05-22 15:18:01 +00:00
|
|
|
path: '/',
|
2024-05-23 12:00:26 +00:00
|
|
|
name: 'social',
|
|
|
|
builder: (context, state) => const SocialScreen(),
|
2024-05-18 10:17:16 +00:00
|
|
|
),
|
2024-05-23 13:12:47 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/contact',
|
|
|
|
name: 'contact',
|
|
|
|
builder: (context, state) => const ContactScreen(),
|
|
|
|
),
|
2024-05-18 10:17:16 +00:00
|
|
|
GoRoute(
|
2024-05-22 15:18:01 +00:00
|
|
|
path: '/account',
|
|
|
|
name: 'account',
|
2024-05-18 10:17:16 +00:00
|
|
|
builder: (context, state) => const AccountScreen(),
|
|
|
|
),
|
2024-05-22 15:18:01 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
ShellRoute(
|
|
|
|
builder: (context, state, child) =>
|
|
|
|
BasicShell(state: state, child: child),
|
|
|
|
routes: [
|
2024-05-23 13:12:47 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/account/friend',
|
|
|
|
name: 'accountFriend',
|
|
|
|
builder: (context, state) => const FriendScreen(),
|
|
|
|
),
|
2024-05-22 15:18:01 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/account/personalize',
|
|
|
|
name: 'accountPersonalize',
|
|
|
|
builder: (context, state) => const PersonalizeScreen(),
|
|
|
|
),
|
2024-05-18 10:17:16 +00:00
|
|
|
],
|
|
|
|
),
|
2024-05-19 10:01:00 +00:00
|
|
|
GoRoute(
|
2024-05-22 15:18:01 +00:00
|
|
|
path: '/posts/publish',
|
|
|
|
name: 'postPublishing',
|
2024-05-21 16:05:03 +00:00
|
|
|
builder: (context, state) {
|
|
|
|
final arguments = state.extra as PostPublishingArguments?;
|
|
|
|
return PostPublishingScreen(
|
|
|
|
edit: arguments?.edit,
|
|
|
|
reply: arguments?.reply,
|
|
|
|
repost: arguments?.repost,
|
|
|
|
realm: state.uri.queryParameters['realm'],
|
|
|
|
);
|
|
|
|
},
|
2024-05-19 10:01:00 +00:00
|
|
|
),
|
2024-05-18 10:17:16 +00:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|