-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 'Cancel' and 'Delete' actions of showDeleteConfirmationDialog
pop the current view
#212
Comments
Hi @tahamaddam, can you please provide a complete minimal reproducible code sample so that we can investigate this issue? I tested with the plugin example app and it works just fine for me. screen-20231211-112128.mp4 |
Thanks for your attention. My app is a (Bottom) tab based app, which is set up using the final _rootNavigatorKey = GlobalKey<NavigatorState>();
final _sectionNavigatorKey = GlobalKey<NavigatorState>();
final goRouterConfig = GoRouter(
navigatorKey: _rootNavigatorKey,
initialLocation: '/explore',
routes: [
StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) =>
ScaffoldWithNavBar(navigationShell: navigationShell),
branches: [
StatefulShellBranch(
navigatorKey: _sectionNavigatorKey,
routes: [
GoRoute(
path: '/explore',
name: "explore",
builder: (context, state) => const ExploreView(),
routes: [
]),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/library',
name: "library",
builder: (context, state) => const LibraryView(),
routes: []
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/playing',
name: "episodes-player",
builder: (context, state) => const EpisodesPlayer(),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/settings',
name: "settings",
builder: (context, state) => const SettingsView(),
routes: [
GoRoute(
path: 'profile',
name: 'profile',
builder: (context, state) => const ProfileView(),
),
GoRoute(
path: 'inapp',
name: 'inappInfo',
builder: (context, state) => const InAppInfo(),
),
// Add other routes here...
],
),
],
),
],
),
],
); The import 'package:firebase_auth/firebase_auth.dart' hide EmailAuthProvider;
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:firebase_ui_oauth_apple/firebase_ui_oauth_apple.dart';
import 'package:firebase_ui_oauth_google/firebase_ui_oauth_google.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../configurations/constants/google_client_id.dart';
class ProfileView extends StatefulWidget {
const ProfileView({super.key});
@override
State<ProfileView> createState() => _ProfileViewState();
}
class _ProfileViewState extends State<ProfileView> {
final user = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Profile'),
),
body: ProfileScreen(
providers: [
EmailAuthProvider(),
AppleProvider(),
GoogleProvider(clientId: googleClientID),
],
showDeleteConfirmationDialog: true,
showUnlinkConfirmationDialog: true,
actions: [
SignedOutAction((context) {
context.goNamed('login');
}),
AccountDeletedAction((context, user) {
context.goNamed('login');
})
],
),
);
}
} The issue is with both the cancel and Delete action, which pop the view out. I suspect this might be due to conflict with go_router navigation? I don't see any other code in my project, that is relevant for this issue that needs to be shared. |
Hi @tahamaddam, if you use navigator instead of go_router, do you still get this issue? |
Actually, the first action (SignedOutAction) is correctly working with context.goNamed(). For AccountDeletedAction , I tried to use Navigator too but that doesn't solve the issue as the issue lies in the alert dialog which doesn't dismiss (when choose Cancel or Yes, Delete) as well as pop the view (as can be seen in the shared video) |
That's odd. I just tried the plugin example app again and it worked just fine. I did notice one thing, however, your |
Thanks, just tried but no luck. |
Hi @tahamaddam, it would help our investigation if you could provide a complete minimal reproducible code sample in a repo that we can clone. It doesn't have to be your actual project. Just enough code that we can use to reproduce and start investigating. |
Thanks, I will try that and share the repo with you. I forgot to share the exception when the dialog stays on screen even after tap on cancel or Delete
|
I have added you as a collaborator on the repository. After Sign-in, go to Settings> Tap the button and then from the ProfileScreen() view you can try to delete the account. |
Thanks for the sample, I can reproduce the issue. I think this might have to do with go_router's indexed stack or how go_router interacts with dialogs, but I can't say for sure. The action already calls Navigator.pop internally which is why it pops to the previous page but not the dialog. Perhaps exposing the pop action for the DeleteAccountButton might help. This did not reproduce with the plugin example app (it doesn't use go_router, so that may be why). Labeling for further investigation. cc @lesnitsky Added code sample below (zipped) |
Thanks a lot for looking into this and confirming the bug. I would like to add:
|
As a workaround, is there a way to exclude the Account Delete Button from the ProfileScreen()? |
If you don't include the |
I tried excluding ++ I also realized even when I am not using the |
Hello, sorry to bother you on holidays. Is there any solution or workaround for this problem in short run? Thanks. |
Hi @tahamaddam, unfortunately, I am not aware of any workarounds at this time |
Any update on this matter? @lesnitsky |
I am facing the same issue, has there been any updates, solutions or workarounds for this? |
Same issue for me. Would it not be sufficient to just add the context as a parameter to the pop() function?
->
Afterwards, the confirmation dialog should be popped and not the route below. EDIT: Just tried it out and it is working |
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Auth
What platform(s) does this bug affect?
Android, iOS
List of dependencies used.
flutter pub deps -s list
transitive dependencies:
Steps to reproduce
This is the code for my
ProfileScreen()
The confirmation dialog does appear when press the 'Delete Account' button, but choosing either 'Cancel' or 'Yes, Delete' pops out the current view and dialog can't be dismissed. Video below:
firebase_ui_auth_account_delete_dialog.mp4
Expected Behavior
Actual Behavior
Additional Information
No response
The text was updated successfully, but these errors were encountered: