defines.dart 895 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/widgets.dart';
  2. import 'package:vitalapp/routes/route_setting.dart';
  3. /// 导航菜单项
  4. ///
  5. /// [onTap] 或 [route] 或 [pageBuilder] 不可同时为空
  6. ///
  7. /// 优先级 [onTap] > [pageBuilder] > [route]
  8. class VSideNavMenuItem {
  9. /// 标题
  10. final String title;
  11. /// 路由
  12. final VRouteSetting? route;
  13. /// 描述
  14. final String? description;
  15. /// 图标
  16. final Widget? icon;
  17. /// 是否必填
  18. final bool? isRequired;
  19. /// 单击回调
  20. final VoidCallback? onTap;
  21. /// 页面构建器
  22. final WidgetBuilder? pageBuilder;
  23. /// 是否从此项开始重排
  24. final bool shouldRearrage;
  25. VSideNavMenuItem({
  26. required this.title,
  27. this.route,
  28. this.description,
  29. this.icon,
  30. this.onTap,
  31. this.shouldRearrage = false,
  32. this.isRequired,
  33. this.pageBuilder,
  34. }) : assert(route != null || onTap != null || pageBuilder != null);
  35. }