inject_route_aware.dart 702 B

123456789101112131415161718192021222324252627282930313233343536
  1. import 'package:flutter/material.dart';
  2. import 'package:sport/application.dart';
  3. mixin InjectRouteAware<T extends StatefulWidget> on State<T> implements RouteAware {
  4. @override
  5. void didChangeDependencies() {
  6. super.didChangeDependencies();
  7. routeObserver.subscribe(this, ModalRoute.of(context));
  8. }
  9. @override
  10. void dispose() {
  11. routeObserver.unsubscribe(this);
  12. super.dispose();
  13. }
  14. @override
  15. void didPop() {
  16. print("666666666666666666666666");
  17. }
  18. @override
  19. void didPopNext() {
  20. print("7777777777777777777777");
  21. }
  22. @override
  23. void didPush() {
  24. print("88888888888888888888");
  25. }
  26. @override
  27. void didPushNext() {
  28. print("99999999999999999999");
  29. }
  30. }