- Notifications
You must be signed in to change notification settings - Fork1.7k
Description
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