feat(login): 增加 release 包服务端设置入口的开关控制
添加环境变量控制 release 包是否显示服务端设置入口,默认关闭,调试版仍直接显示。同时调整部分代码格式以保持一致性。
This commit is contained in:
1 parent
cc6dc6385a
commit
66013ee069
1 file changed
+19
-11
@@ -14,6 +14,12 @@ import '../../../shared/widgets/x_common.dart';
|
||||
import '../../../shared/widgets/x_icon.dart';
|
||||
import '../application/session_controller.dart';
|
||||
|
||||
/// 是否在 release 包里也显示「服务端设置」入口。
|
||||
///
|
||||
/// 默认关闭,因此正式交付包不会暴露改地址的口子;打包内部测试包时用
|
||||
/// `--dart-define=ENABLE_SERVER_SETTINGS=true` 打开,测试同事即可自行切换后端。
|
||||
const _serverSettingsEnabled = bool.fromEnvironment('ENABLE_SERVER_SETTINGS');
|
||||
|
||||
/// 登录页,对应 `pages/login/index.vue`。
|
||||
class LoginPage extends ConsumerStatefulWidget {
|
||||
const LoginPage({super.key});
|
||||
@@ -90,7 +96,10 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 40),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: (constraints.maxHeight - 80).clamp(0, double.infinity),
|
||||
minHeight: (constraints.maxHeight - 80).clamp(
|
||||
0,
|
||||
double.infinity,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -111,8 +120,8 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// 测试用「服务端设置」入口,仅调试版可见
|
||||
if (kDebugMode)
|
||||
// 测试用「服务端设置」入口:调试版常显,release 需显式开关
|
||||
if (kDebugMode || _serverSettingsEnabled)
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
@@ -142,9 +151,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
isScrollControlled: true,
|
||||
backgroundColor: AppColors.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(AppRadius.lg),
|
||||
),
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(AppRadius.lg)),
|
||||
),
|
||||
builder: (_) => const _ServerSettingsSheet(),
|
||||
);
|
||||
@@ -160,7 +167,10 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [AppColors.brandGradientStart, AppColors.brandGradientEnd],
|
||||
colors: [
|
||||
AppColors.brandGradientStart,
|
||||
AppColors.brandGradientEnd,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: const [
|
||||
@@ -307,9 +317,7 @@ class _SoftBlob extends StatelessWidget {
|
||||
height: size,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: RadialGradient(
|
||||
colors: [color, color.withValues(alpha: 0)],
|
||||
),
|
||||
gradient: RadialGradient(colors: [color, color.withValues(alpha: 0)]),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -405,7 +413,7 @@ class _ServerSettingsSheetState extends ConsumerState<_ServerSettingsSheet> {
|
||||
Text('服务端设置', style: AppTypography.titleSm),
|
||||
const SizedBox(height: 6),
|
||||
const Text(
|
||||
'仅调试版可见。保存后立即生效,无需重启 App。',
|
||||
'保存后立即生效,无需重启 App。',
|
||||
style: TextStyle(fontSize: 13, color: AppColors.textMuted),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Reference in new issue
Block a user