route_setting.dart 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. typedef VPageBuilder = Widget Function();
  4. /// 页面路由
  5. ///
  6. /// [name] 路由地址
  7. ///
  8. /// [title] 标题
  9. ///
  10. /// [binding] 依赖绑定 - 使用已定义的继承自[Bindings]的类实例,或者使用[BindingsBuilder.put]
  11. ///
  12. /// [transition] 转场动画
  13. ///
  14. /// [transitionDuration] 转场动画时长
  15. ///
  16. /// [children] 子路由
  17. ///
  18. /// [middlewares] 中间件
  19. ///
  20. /// [navigatorId] 导航ID - 在[]中定义
  21. class VRouteSetting<T> extends GetPage<T> {
  22. VRouteSetting(
  23. String name,
  24. Widget Function() pageBuilder, {
  25. String? title,
  26. Bindings? binding,
  27. Transition? transition,
  28. List<GetPage>? children,
  29. List<GetMiddleware>? middlewares,
  30. bool fullscreenDialog = false,
  31. this.navigatorId,
  32. }) : super(
  33. name: name,
  34. page: pageBuilder,
  35. title: title,
  36. binding: binding,
  37. transition: Transition.rightToLeft,
  38. transitionDuration: const Duration(milliseconds: 500),
  39. // customTransition: FTransitions.sharedAxisHorizontal,
  40. children: children ?? const [],
  41. middlewares: middlewares,
  42. fullscreenDialog: fullscreenDialog,
  43. popGesture: false,
  44. );
  45. /// 导航ID
  46. final int? navigatorId;
  47. }