123 lines
4.7 KiB
Dart
123 lines
4.7 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
import 'package:go_router/go_router.dart';
|
||
|
import 'package:together_mobile/models/route_state_model.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/change_group_chat_screen/change_group_chat_avatar_screen.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/group_chat_outline_screen/group_chat_outline_screen.dart';
|
||
|
|
||
|
import 'router_key.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/contact_add/create_group_chat_screen.dart';
|
||
|
import 'package:together_mobile/screens/contact_add/invite_group_chat_member_screen.dart';
|
||
|
import 'package:together_mobile/screens/friend_profile/friend_setting_screen/friend_setting_screen.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/change_group_chat_screen/change_group_chat_intro_screen.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/change_group_chat_screen/change_group_chat_name_screen.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/change_group_chat_screen/change_group_chat_remark_screen.dart';
|
||
|
import 'package:together_mobile/screens/group_chat_profile/change_group_chat_screen/change_my_remark_screen.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/add_friend_screen/add_friend_screen.dart';
|
||
|
import 'package:together_mobile/screens/contact_add/search_new_contact_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 contactRoute = GoRoute(
|
||
|
path: '/contact',
|
||
|
name: 'Contact',
|
||
|
builder: (context, state) {
|
||
|
if (state.queryParameters.isNotEmpty) {
|
||
|
var deletedFriendId = state.queryParameters['deletedFriendId'];
|
||
|
if (deletedFriendId != null) {
|
||
|
getIt.get<Contact>().removeFriend(deletedFriendId);
|
||
|
getIt.get<ContactAccountProfile>().removeFriend(deletedFriendId);
|
||
|
}
|
||
|
}
|
||
|
getIt.get<RouteState>().changeRoute('Contact');
|
||
|
return ContactScreen();
|
||
|
},
|
||
|
routes: [
|
||
|
GoRoute(
|
||
|
path: 'search_new_contact',
|
||
|
name: 'SearchNewContact',
|
||
|
parentNavigatorKey: rootNavigatorKey,
|
||
|
builder: (context, state) {
|
||
|
return const SearchNewContactScreen();
|
||
|
},
|
||
|
routes: [
|
||
|
GoRoute(
|
||
|
path: 'friend',
|
||
|
name: 'AddFriend',
|
||
|
parentNavigatorKey: rootNavigatorKey,
|
||
|
builder: (context, state) {
|
||
|
return AddFriendScreen(
|
||
|
accountProfile: state.queryParameters,
|
||
|
);
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
GoRoute(
|
||
|
path: 'create_group_chat',
|
||
|
name: 'CreateGroupChat',
|
||
|
parentNavigatorKey: rootNavigatorKey,
|
||
|
builder: (context, state) {
|
||
|
return const CreateGroupChatScreen();
|
||
|
},
|
||
|
),
|
||
|
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) {
|
||
|
return ApplicantProfileScreen(
|
||
|
accountProfile: state.queryParameters,
|
||
|
);
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
GoRoute(
|
||
|
path: 'manage_group',
|
||
|
name: 'ManageGroup',
|
||
|
parentNavigatorKey: rootNavigatorKey,
|
||
|
pageBuilder: (context, state) {
|
||
|
return CustomTransitionPage(
|
||
|
key: state.pageKey,
|
||
|
child: const ManageGroupScreen(),
|
||
|
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) {
|
||
|
return const ManageGroupScreen();
|
||
|
},
|
||
|
),
|
||
|
],
|
||
|
);
|