|
- import 'package:flutter/material.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
-
- class FNNavigatorObserver extends NavigatorObserver {
- factory FNNavigatorObserver() => _getInstance();
- static FNNavigatorObserver get instance => _getInstance();
- static FNNavigatorObserver _instance;
-
- NavigatorObserver curContext;
-
- FNNavigatorObserver._();
- static FNNavigatorObserver _getInstance() {
- if (_instance == null) {
- _instance = new FNNavigatorObserver._();
- }
- return _instance;
- }
-
- String topRouteName = "";
-
- void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
- notifyHide(previousRoute);
- notifyShow(route);
- }
-
- void didPop(Route<dynamic> route, Route<dynamic> previousRoute) {
- notifyHide(route);
- notifyShow(previousRoute);
- }
-
- void didRemove(Route<dynamic> route, Route<dynamic> previousRoute) {
- notifyHide(route);
- notifyShow(previousRoute);
- }
-
- /// The [Navigator] replaced `oldRoute` with `newRoute`.
- void didReplace({Route<dynamic> newRoute, Route<dynamic> oldRoute}) {
- notifyHide(oldRoute);
- notifyShow(newRoute);
- }
-
- void notifyShow(Route<dynamic> route) {}
-
- void notifyHide(Route<dynamic> route) {}
- }
|