6 changed files with 97 additions and 73 deletions
-
3lib/core/routers/my_routes.dart
-
26lib/core/widgets/pop_scope/my_pop_scope.dart
-
6lib/features/home/presentation/bloc/home_bloc.dart
-
7lib/features/home/presentation/ui/home_page.dart
-
5lib/features/level/presentation/ui/level_page.dart
-
5lib/features/question/presentation/ui/question_page.dart
@ -0,0 +1,26 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:hadi_hoda_flutter/core/widgets/dialog/exit_dialog.dart'; |
||||
|
|
||||
|
class MyPopScope extends StatelessWidget { |
||||
|
const MyPopScope({super.key, required this.child}); |
||||
|
|
||||
|
final Widget child; |
||||
|
|
||||
|
void onPopInvokedWithResult( |
||||
|
bool didPop, |
||||
|
dynamic result, |
||||
|
BuildContext context, |
||||
|
) { |
||||
|
showExitDialog(context: context); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return PopScope( |
||||
|
canPop: false, |
||||
|
onPopInvokedWithResult: (didPop, result) => |
||||
|
onPopInvokedWithResult(didPop, result, context), |
||||
|
child: child, |
||||
|
); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue