starwork_flutter/lib/flavors.dart

77 lines
1.9 KiB
Dart
Raw Permalink 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:
return 'https://192.168.1.136: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://192.168.1.136:8112/api';
2025-09-06 15:42:26 +08:00
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 'W3rrBEg2ZFEpZQ3o5eu2tWLEJP4t7a8X';
2025-09-05 14:55:38 +08:00
case Flavor.xhj:
return 'W3rrBEg2ZFEpZQ3o5eu2tWLEJP4t7a8X';
2025-09-05 14:55:38 +08:00
}
}
static String get starCloudSecret {
switch (appFlavor) {
case Flavor.sky:
return 'v8WaKjljfnQFv0inIQnZ17DieFgVQEzJ';
2025-09-05 14:55:38 +08:00
case Flavor.xhj:
return 'v8WaKjljfnQFv0inIQnZ17DieFgVQEzJ';
2025-09-05 14:55:38 +08:00
}
}
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.136: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
}