基础库
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_comm/zhiying_comm.dart';
  3. class FNNavigatorObserver extends NavigatorObserver {
  4. factory FNNavigatorObserver() => _getInstance();
  5. static FNNavigatorObserver get instance => _getInstance();
  6. static FNNavigatorObserver _instance;
  7. NavigatorObserver curContext;
  8. FNNavigatorObserver._();
  9. static FNNavigatorObserver _getInstance() {
  10. if (_instance == null) {
  11. _instance = new FNNavigatorObserver._();
  12. }
  13. return _instance;
  14. }
  15. String topRouteName = "";
  16. void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
  17. notifyHide(previousRoute);
  18. notifyShow(route);
  19. }
  20. void didPop(Route<dynamic> route, Route<dynamic> previousRoute) {
  21. notifyHide(route);
  22. notifyShow(previousRoute);
  23. }
  24. void didRemove(Route<dynamic> route, Route<dynamic> previousRoute) {
  25. notifyHide(route);
  26. notifyShow(previousRoute);
  27. }
  28. /// The [Navigator] replaced `oldRoute` with `newRoute`.
  29. void didReplace({Route<dynamic> newRoute, Route<dynamic> oldRoute}) {
  30. notifyHide(oldRoute);
  31. notifyShow(newRoute);
  32. }
  33. void notifyShow(Route<dynamic> route) {}
  34. void notifyHide(Route<dynamic> route) {}
  35. }