Skip to content

Commit

Permalink
TW-1841: Fix back screen when use go_router and navigator (#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and Te-Z committed Jun 18, 2024
1 parent 1776080 commit 383e217
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:go_router/go_router.dart';
import 'package:linagora_design_flutter/colors/linagora_ref_colors.dart';
import 'package:linagora_design_flutter/colors/linagora_sys_colors.dart';
import 'package:matrix/matrix.dart';
Expand Down Expand Up @@ -129,7 +128,7 @@ class ParticipantListItem extends StatelessWidget {
userId: member.id,
onUpdatedMembers: onUpdatedMembers,
onNewChatOpen: () {
dialogContext.pop();
Navigator.of(dialogContext).pop();
},
);
},
Expand Down Expand Up @@ -228,15 +227,15 @@ class ParticipantListItem extends StatelessWidget {
child: Padding(
padding: ParticipantListItemStyle.closeButtonPadding,
child: IconButton(
onPressed: () => dialogContext.pop(),
onPressed: () => Navigator.of(dialogContext).pop(),
icon: const Icon(Icons.close),
),
),
),
ProfileInfoBody(
user: member,
onNewChatOpen: () {
dialogContext.pop();
Navigator.of(dialogContext).pop();
},
onUpdatedMembers: onUpdatedMembers,
),
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/invitation_selection/invitation_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

import 'package:go_router/go_router.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:matrix/matrix.dart';
Expand Down Expand Up @@ -94,7 +93,7 @@ class InvitationSelectionController
}

void inviteSuccessAction() {
context.pop();
Navigator.of(context).pop();
}

@override
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/new_group/contacts_selection_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:fluffychat/widgets/twake_components/twake_fab.dart';
import 'package:fluffychat/widgets/twake_components/twake_text_button.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:linagora_design_flutter/linagora_design_flutter.dart';

class ContactsSelectionView extends StatelessWidget {
Expand Down Expand Up @@ -140,7 +139,7 @@ class ContactsSelectionView extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: [
TwakeTextButton(
onTap: () => context.pop(),
onTap: () => Navigator.of(context).pop(),
message: L10n.of(context)!.cancel,
borderHover: ContactsSelectionViewStyle.webActionsButtonBorder,
margin: ContactsSelectionViewStyle.webActionsButtonMargin,
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/profile_info/profile_info_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:fluffychat/pages/profile_info/profile_info_page.dart';
import 'package:fluffychat/pages/profile_info/profile_info_body/profile_info_body.dart';
import 'package:fluffychat/pages/profile_info/profile_info_view_style.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:linagora_design_flutter/colors/linagora_state_layer.dart';
import 'package:linagora_design_flutter/colors/linagora_sys_colors.dart';
Expand Down Expand Up @@ -43,7 +42,7 @@ class ProfileInfoView extends StatelessWidget {
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onPressed: () => context.pop(),
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.arrow_back),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/app_bars/searchable_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class SearchableAppBar extends StatelessWidget {
] else ...[
if (displayBackButton)
TwakeIconButton(
onTap: () => context.pop(),
onTap: () => Navigator.of(context).pop(),
tooltip: L10n.of(context)!.close,
icon: Icons.close,
paddingAll: SearchableAppBarStyle.closeButtonPaddingAll,
Expand Down

0 comments on commit 383e217

Please sign in to comment.