selfprivacy.org.app/lib/logic/get_it/navigation.dart

17 lines
441 B
Dart
Raw Normal View History

2021-02-15 18:58:29 +00:00
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class NavigationService {
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
2021-03-15 15:39:44 +00:00
NavigatorState? get navigator => navigatorKey.currentState;
2021-02-15 18:58:29 +00:00
void showPopUpDialog(AlertDialog dialog) {
2021-03-15 15:39:44 +00:00
final context = navigatorKey.currentState!.overlay!.context;
2021-02-15 18:58:29 +00:00
showDialog(
context: context,
builder: (_) => dialog,
);
}
}