starwork_flutter/lib/flavors.dart

77 lines
1.9 KiB
Dart
Raw Normal View History

2025-09-06 15:42:26 +08:00
import 'package:flutter/foundation.dart';
enum Flavor { sky, xhj }
2025-08-28 11:27:32 +08:00
class F {
static late final Flavor appFlavor;
static String get name => appFlavor.name;
static String get title {
switch (appFlavor) {
2025-09-05 14:55:38 +08:00
case Flavor.sky:
2025-09-06 15:42:26 +08:00
return '星勤-sky';
2025-09-05 14:55:38 +08:00
case Flavor.xhj:
2025-09-06 15:42:26 +08:00
return '星勤-xhj';
2025-08-28 11:27:32 +08:00
}
}
static String get apiHost {
2025-09-06 15:42:26 +08:00
if (kReleaseMode) {
// Release环境的API地址
switch (appFlavor) {
case Flavor.sky:
2025-09-10 10:31:54 +08:00
return 'https://192.168.1.121:8112/api'; // 生产环境API
2025-09-06 15:42:26 +08:00
case Flavor.xhj:
return 'https://api.xhjcn.ltd/api'; // 生产环境API
}
} else {
// Debug/Profile环境的API地址开发环境
switch (appFlavor) {
case Flavor.sky:
return 'http://197o136q43.oicp.vip/api';
case Flavor.xhj:
return 'https://loacl.work.star-lock.cn/api';
}
}
}
2025-09-05 14:55:38 +08:00
static String get starCloudClientId {
switch (appFlavor) {
case Flavor.sky:
return '0JLrKMhBSSHH0VlRLcIko5NrESfzDJ8B';
case Flavor.xhj:
return '0JLrKMhBSSHH0VlRLcIko5NrESfzDJ8B';
}
}
static String get starCloudSecret {
switch (appFlavor) {
case Flavor.sky:
return 'KS8KvZKPKKHgsoDbcfQCCScvyyqeolDt';
case Flavor.xhj:
return 'KS8KvZKPKKHgsoDbcfQCCScvyyqeolDt';
}
}
2025-09-06 15:42:26 +08:00
2025-09-05 14:55:38 +08:00
static String get starCloudUrl {
2025-09-06 15:42:26 +08:00
if (kReleaseMode) {
// Release环境的StarCloud地址
switch (appFlavor) {
case Flavor.sky:
return 'https://cloud.star-lock.cn'; // 生产环境
case Flavor.xhj:
return 'https://cloud.star-lock.cn'; // 生产环境
}
} else {
// Debug/Profile环境的StarCloud地址开发环境
switch (appFlavor) {
case Flavor.sky:
return 'http://192.168.1.121:8111/sdk';
2025-09-06 15:42:26 +08:00
case Flavor.xhj:
return 'http://local.cloud.star-lock.cn';
}
2025-09-05 14:55:38 +08:00
}
}
2025-08-28 11:27:32 +08:00
}