118 lines
4.0 KiB
Dart
118 lines
4.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:together_mobile/models/contact_model.dart';
|
|
import 'package:together_mobile/models/init_get_it.dart';
|
|
import 'package:together_mobile/screens/contact/contact_apply_screen/applicant_profile_screen/applicant_profile_screen.dart';
|
|
import 'package:together_mobile/screens/friend_profile/friend_setting_screen/friend_setting_screen.dart';
|
|
|
|
import 'router_key.dart';
|
|
import 'package:together_mobile/screens/contact/contact_apply_screen/apply_list_screen.dart';
|
|
import 'package:together_mobile/screens/contact/contact_screen.dart';
|
|
import 'package:together_mobile/screens/contact/manage_group_screen/manage_group_screen.dart';
|
|
import 'package:together_mobile/screens/contact_add/contact_add_friend_screen/add_friend_screen.dart';
|
|
import 'package:together_mobile/screens/contact_add/search_new_screen.dart';
|
|
import 'package:together_mobile/screens/friend_profile/friend_profile_screen.dart';
|
|
import 'package:together_mobile/screens/group_chat_profile/group_chat_profile_screen.dart';
|
|
|
|
final contactRouter = GoRoute(
|
|
path: '/contact',
|
|
name: 'Contact',
|
|
builder: (context, state) {
|
|
if (state.queryParameters.isNotEmpty) {
|
|
var deletedFriendId = state.queryParameters['deletedFriendId'];
|
|
getIt.get<Contact>().removeFriend(deletedFriendId!);
|
|
getIt.get<ContactAccountProfile>().removeFriend(deletedFriendId);
|
|
}
|
|
return ContactScreen();
|
|
},
|
|
routes: [
|
|
GoRoute(
|
|
path: 'add',
|
|
name: 'AddContact',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => const SearchNewScreen() ,
|
|
routes: [
|
|
GoRoute(
|
|
path: 'friend',
|
|
name: 'AddFriend',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => AddFriendScreen(
|
|
accountProfile: state.queryParameters,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: 'apply_list',
|
|
name: 'ApplyList',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => const ApplyListScreen(),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'applicant_profile',
|
|
name: 'ApplicantProfile',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => ApplicantProfileScreen(
|
|
accountProfile: state.queryParameters,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: 'friend_group',
|
|
name: 'FriendGroup',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
pageBuilder: (context, state) {
|
|
return CustomTransitionPage(
|
|
key: state.pageKey,
|
|
child: const FriendGroupScreen(),
|
|
transitionDuration: const Duration(
|
|
milliseconds: 200,
|
|
),
|
|
reverseTransitionDuration: const Duration(milliseconds: 200),
|
|
transitionsBuilder: (
|
|
context,
|
|
animation,
|
|
secondaryAnimation,
|
|
child,
|
|
) {
|
|
const begin = Offset(1.0, 0.0);
|
|
const end = Offset.zero;
|
|
final tween = Tween(begin: begin, end: end);
|
|
final offsetAnimation = animation.drive(tween);
|
|
return SlideTransition(
|
|
position: offsetAnimation,
|
|
child: child,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
builder: (context, state) => const FriendGroupScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'friend_profile',
|
|
name: 'FriendProfile',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) =>
|
|
FriendProfileScreen(friendId: state.queryParameters['friendId']!),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'friend_setting',
|
|
name: 'FriendSetting',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => FriendSettingScreen(
|
|
friendId: state.queryParameters['friendId']!,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: 'group_chat_profile',
|
|
name: 'GroupChatProfile',
|
|
parentNavigatorKey: rootNavigatorKey,
|
|
builder: (context, state) => const GroupChatProfileScreen(),
|
|
),
|
|
],
|
|
);
|