common_util.dart 721 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/foundation.dart';
  3. class Util {
  4. /// 页面跳转
  5. static void gotoPage(BuildContext context, Widget widget) {
  6. Navigator.push(
  7. context,
  8. PageRouteBuilder(
  9. transitionDuration: const Duration(milliseconds: 400),
  10. pageBuilder: ((context, animation, secondaryAnimation) {
  11. return FadeTransition(
  12. opacity: animation,
  13. child: widget,
  14. );
  15. })));
  16. }
  17. static bool isWeb(){
  18. if (defaultTargetPlatform == TargetPlatform.android ||
  19. defaultTargetPlatform == TargetPlatform.iOS) {
  20. return false;
  21. } else {
  22. return true;
  23. }
  24. }
  25. }