From 66013ee069dbe8f33c24e6cc7c65241ed65a5d02 Mon Sep 17 00:00:00 2001 From: andyesfly <35127884@qq.com> Date: Sun, 4 Oct 2026 09:26:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(login):=20=E5=A2=9E=E5=8A=A0=20release=20?= =?UTF-8?q?=E5=8C=85=E6=9C=8D=E5=8A=A1=E7=AB=AF=E8=AE=BE=E7=BD=AE=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=E5=BC=80=E5=85=B3=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加环境变量控制 release 包是否显示服务端设置入口,默认关闭,调试版仍直接显示。同时调整部分代码格式以保持一致性。 --- .../auth/presentation/login_page.dart | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/features/auth/presentation/login_page.dart b/lib/features/auth/presentation/login_page.dart index 29b3b02..459dc4b 100644 --- a/lib/features/auth/presentation/login_page.dart +++ b/lib/features/auth/presentation/login_page.dart @@ -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 { 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 { ), ), ), - // 测试用「服务端设置」入口,仅调试版可见 - if (kDebugMode) + // 测试用「服务端设置」入口:调试版常显,release 需显式开关 + if (kDebugMode || _serverSettingsEnabled) Positioned( top: 0, right: 0, @@ -142,9 +151,7 @@ class _LoginPageState extends ConsumerState { 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 { 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), @@ -512,4 +520,4 @@ class _ServerSettingsSheetState extends ConsumerState<_ServerSettingsSheet> { ], ); } -} \ No newline at end of file +}