enums.dart 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //页面状态
  2. enum ViewState {
  3. loading, // 加载中
  4. success, // 加载成功
  5. empty, // 空数据
  6. error, // 错误
  7. }
  8. enum SplashType {
  9. normal, // 正常
  10. signin, // 登录
  11. signup, // 注册
  12. google, // 谷歌登录
  13. apple, // 苹果登录
  14. facebook, // 脸书登录
  15. logout, // 退出登录
  16. }
  17. enum RegisterMode {
  18. auto(1, 'Auto'),
  19. manual(2, 'Manual'),
  20. buy(3, 'Buy'),
  21. gen(4, 'Gen');
  22. final int value;
  23. final String label;
  24. const RegisterMode(this.value, this.label);
  25. }
  26. enum AccountType {
  27. activate, // 激活
  28. changePassword, // 修改密码
  29. }
  30. enum BannerAction {
  31. notice, // 弹窗通知
  32. page, // 路由跳转
  33. urlOut, // 网页外部跳转
  34. urlIn, // 网页内部跳转
  35. deepLink, // scheme跳转
  36. openPkg, // 打开app
  37. }
  38. enum LogLevel { info, error, warn, debug, verbose }
  39. enum FirebaseEvent {
  40. launch,
  41. launchCache,
  42. launchSuccess,
  43. launchCacheSuccess,
  44. register,
  45. login,
  46. logout,
  47. deleteAccount,
  48. startBoost,
  49. cancelBoost,
  50. errorBoost,
  51. stopBoost,
  52. subscribe,
  53. restore,
  54. }
  55. enum LogModule {
  56. NM_Metrics, //游戏指标
  57. NM_Log, // core es 日志
  58. NM_BoostResult, // 加速结果
  59. NM_PeekLog, // 探针日志
  60. NM_ApiLaunchLog, // launch接口报错
  61. NM_ApiRouterLog, // router接口报错
  62. NM_ApiOtherLog, // 其他接口报错
  63. NM_RateLog, // 评分统计
  64. NM_FeedbackLog, // 反馈提交
  65. }
  66. enum ConnectionState {
  67. disconnected, // 默认断开状态
  68. connectingVirtual, // 虚拟连接中(点击按钮会触发虚拟连接)
  69. connecting, // 真实连接中
  70. connected, // 连接成功状态
  71. disconnecting, // 断开中状态
  72. error, // 连接错误状态
  73. }
  74. enum MemberLevel {
  75. guest(1, 'Guest'),
  76. normal(2, 'Normal');
  77. final int level;
  78. final String label;
  79. const MemberLevel(this.level, this.label);
  80. // 从 int 值获取枚举
  81. static MemberLevel? fromLevel(int? level) {
  82. if (level == null) return null;
  83. return MemberLevel.values.firstWhere(
  84. (e) => e.level == level,
  85. orElse: () => MemberLevel.guest,
  86. );
  87. }
  88. }
  89. enum VpnStatus {
  90. idle(0, '空闲状态'), // 空闲状态
  91. connecting(1, '连接中状态'), // 连接中状态
  92. connected(2, '连接成功状态'), // 连接成功状态
  93. error(3, '连接错误状态'); // 连接错误状态
  94. final int value;
  95. final String label;
  96. const VpnStatus(this.value, this.label);
  97. static VpnStatus fromValue(int value) {
  98. return VpnStatus.values.firstWhere(
  99. (e) => e.value == value,
  100. orElse: () => VpnStatus.idle,
  101. );
  102. }
  103. }