@@ -14,9 +14,11 @@ List<GoRoute> getChatStoryRoutes(
1414 GoRoute (
1515 path: ChatUserStoryRoutes .chatScreen,
1616 pageBuilder: (context, state) {
17+ var service = configuration.chatServiceBuilder? .call (context) ??
18+ configuration.chatService;
1719 var chatScreen = ChatScreen (
1820 unreadMessageTextStyle: configuration.unreadMessageTextStyle,
19- service: configuration.chatService ,
21+ service: service ,
2022 options: configuration.chatOptionsBuilder (context),
2123 onNoChats: () async =>
2224 context.push (ChatUserStoryRoutes .newChatScreen),
@@ -34,7 +36,8 @@ List<GoRoute> getChatStoryRoutes(
3436 configuration.onDeleteChat? .call (context, chat) ??
3537 configuration.chatService.chatOverviewService.deleteChat (chat),
3638 deleteChatDialog: configuration.deleteChatDialog,
37- translations: configuration.translations,
39+ translations: configuration.translationsBuilder? .call (context) ??
40+ configuration.translations,
3841 );
3942 return buildScreenWithoutTransition (
4043 context: context,
@@ -53,23 +56,26 @@ List<GoRoute> getChatStoryRoutes(
5356 path: ChatUserStoryRoutes .chatDetailScreen,
5457 pageBuilder: (context, state) {
5558 var chatId = state.pathParameters['id' ];
59+ var service = configuration.chatServiceBuilder? .call (context) ??
60+ configuration.chatService;
5661 var chatDetailScreen = ChatDetailScreen (
5762 chatTitleBuilder: configuration.chatTitleBuilder,
5863 usernameBuilder: configuration.usernameBuilder,
5964 loadingWidgetBuilder: configuration.loadingWidgetBuilder,
6065 iconDisabledColor: configuration.iconDisabledColor,
6166 pageSize: configuration.messagePageSize,
6267 options: configuration.chatOptionsBuilder (context),
63- translations: configuration.translations,
64- service: configuration.chatService,
68+ translations: configuration.translationsBuilder? .call (context) ??
69+ configuration.translations,
70+ service: service,
6571 chatId: chatId! ,
6672 textfieldBottomPadding: configuration.textfieldBottomPadding ?? 0 ,
67- onPressUserProfile: (userId ) async {
73+ onPressUserProfile: (user ) async {
6874 if (configuration.onPressUserProfile != null ) {
69- return configuration.onPressUserProfile? .call ();
75+ return configuration.onPressUserProfile? .call (context, user );
7076 }
7177 return context.push (
72- ChatUserStoryRoutes .chatProfileScreenPath (chatId, userId ),
78+ ChatUserStoryRoutes .chatProfileScreenPath (chatId, user.id ),
7379 );
7480 },
7581 onMessageSubmit: (message) async {
@@ -120,10 +126,14 @@ List<GoRoute> getChatStoryRoutes(
120126 GoRoute (
121127 path: ChatUserStoryRoutes .newChatScreen,
122128 pageBuilder: (context, state) {
129+ var service = configuration.chatServiceBuilder? .call (context) ??
130+ configuration.chatService;
123131 var newChatScreen = NewChatScreen (
124132 options: configuration.chatOptionsBuilder (context),
125- translations: configuration.translations,
126- service: configuration.chatService,
133+ translations: configuration.translationsBuilder? .call (context) ??
134+ configuration.translations,
135+ service: service,
136+ showGroupChatButton: configuration.enableGroupChatCreation,
127137 onPressCreateChat: (user) async {
128138 configuration.onPressCreateChat? .call (user);
129139 if (configuration.onPressCreateChat != null ) return ;
@@ -163,10 +173,13 @@ List<GoRoute> getChatStoryRoutes(
163173 GoRoute (
164174 path: ChatUserStoryRoutes .newGroupChatScreen,
165175 pageBuilder: (context, state) {
176+ var service = configuration.chatServiceBuilder? .call (context) ??
177+ configuration.chatService;
166178 var newGroupChatScreen = NewGroupChatScreen (
167179 options: configuration.chatOptionsBuilder (context),
168- translations: configuration.translations,
169- service: configuration.chatService,
180+ translations: configuration.translationsBuilder? .call (context) ??
181+ configuration.translations,
182+ service: service,
170183 onPressGroupChatOverview: (users) async => context.push (
171184 ChatUserStoryRoutes .newGroupChatOverviewScreen,
172185 extra: users,
@@ -188,11 +201,14 @@ List<GoRoute> getChatStoryRoutes(
188201 GoRoute (
189202 path: ChatUserStoryRoutes .newGroupChatOverviewScreen,
190203 pageBuilder: (context, state) {
204+ var service = configuration.chatServiceBuilder? .call (context) ??
205+ configuration.chatService;
191206 var users = state.extra! as List <ChatUserModel >;
192207 var newGroupChatOverviewScreen = NewGroupChatOverviewScreen (
193208 options: configuration.chatOptionsBuilder (context),
194- translations: configuration.translations,
195- service: configuration.chatService,
209+ translations: configuration.translationsBuilder? .call (context) ??
210+ configuration.translations,
211+ service: service,
196212 users: users,
197213 onPressCompleteGroupChatCreation: (users, groupChatName) async {
198214 configuration.onPressCompleteGroupChatCreation
@@ -232,18 +248,21 @@ List<GoRoute> getChatStoryRoutes(
232248 var chatId = state.pathParameters['id' ];
233249 var userId = state.pathParameters['userId' ];
234250 var id = userId == 'null' ? null : userId;
251+ var service = configuration.chatServiceBuilder? .call (context) ??
252+ configuration.chatService;
235253 var profileScreen = ChatProfileScreen (
236- translations: configuration.translations,
237- chatService: configuration.chatService,
254+ translations: configuration.translationsBuilder? .call (context) ??
255+ configuration.translations,
256+ chatService: service,
238257 chatId: chatId! ,
239258 userId: id,
240259 onTapUser: (user) async {
241260 if (configuration.onPressUserProfile != null ) {
242- return configuration.onPressUserProfile! .call ();
261+ return configuration.onPressUserProfile! .call (context, user );
243262 }
244263
245264 return context.push (
246- ChatUserStoryRoutes .chatProfileScreenPath (chatId, user),
265+ ChatUserStoryRoutes .chatProfileScreenPath (chatId, user.id ),
247266 );
248267 },
249268 );
0 commit comments