router.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import 'package:flutter/material.dart';
  2. import 'package:video/screen/detail.dart';
  3. import 'package:video/screen/home.dart';
  4. import 'package:video/screen/page/changLog.dart';
  5. import 'package:video/screen/widget/searchBottomWidget.dart';
  6. import 'package:video/screen/widget/searchResult.dart';
  7. Route<dynamic> generateRoute(RouteSettings settings) {
  8. switch (settings.name) {
  9. case 'home':
  10. return MaterialPageRoute(
  11. builder: (context) => Home(),
  12. );
  13. case 'detail':
  14. var arguments = settings.arguments as Map;
  15. return MaterialPageRoute(
  16. builder: (context) => MovieDetail(
  17. url: arguments["url"],
  18. video: arguments["video"],
  19. ),
  20. );
  21. case 'search':
  22. return MaterialPageRoute(
  23. builder: (context) => SearchBottom(),
  24. );
  25. case 'searchResult':
  26. var arguments = settings.arguments as Map;
  27. return MaterialPageRoute(
  28. builder: (context) => SearchResult(
  29. query: arguments["query"],
  30. ),
  31. );
  32. case 'changLog':
  33. return MaterialPageRoute(
  34. builder: (context) => ChangeLogPage(),
  35. );
  36. default:
  37. return MaterialPageRoute(
  38. builder: (context) => Home(),
  39. );
  40. }
  41. }