Skip to content
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

browser back issue #3322

Open
farookfrk opened this issue Feb 28, 2025 · 0 comments
Open

browser back issue #3322

farookfrk opened this issue Feb 28, 2025 · 0 comments
Assignees

Comments

@farookfrk
Copy link

while clicking browser back button while dialog box is open.page navigates to previous screen.
example:
route to second page.open dialog box and click back button.
expected-dialog box should close instead page gets popped.

sample code:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});
@OverRide
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter Demo',
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
page: () => HomeScreen(),
),
GetPage(
name: '/second',
page: () => SecondScreen(),
),
],
);
}
}

class HomeScreen extends StatelessWidget {
HomeScreen({super.key});

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('First'),
),
body: SafeArea(
child: Center(
child: MaterialButton(
onPressed: () {
Get.toNamed('/second');
},
color: Colors.red,
child: const Text('Go to second'),
),
),
),
);
}
}

class SecondScreen extends StatelessWidget {
SecondScreen({super.key});

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Second'),
leading: const SizedBox.shrink(),
),
body: SafeArea(
child: Center(
child: MaterialButton(
onPressed: () {
Get.dialog(
AlertDialog(
content: const Text('fd'),
),
);
},
color: Colors.red,
child: const Text('Open dialog'),
),
),
),
);
}
}
version: get: ^5.0.0-release-candidate-9.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants