fix(flutter): 增加首页服务器设置并更新真机默认地址

This commit is contained in:
Zhou Weidong committed 2026-10-17 23:12:47 +08:00
1 parent 9fe62d13cb
commit c4694c6f18
13 files changed
+264 -143

No files matched your search

+4 -6
View File
@@ -4,18 +4,16 @@ import 'package:flutter/foundation.dart';
/// 客户端与后端约定的运行时配置。
///
/// 接口地址的优先级:`--dart-define=API_BASE_URL=...` > 按运行环境判断的默认值。
/// 接口地址优先级:运行时设置 > `--dart-define=API_BASE_URL=...` > 平台默认值。
/// 开发机的局域网地址会随网络变化,换网络后改 [devHostBaseUrl] 即可。
class AppConfig {
const AppConfig._();
/// 开发机的局域网地址。真机上的 `127.0.0.1` 指向手机自己,只能走这个地址。
/// 真机默认使用的开发机局域网地址。
///
/// 这个地址跟着电脑所在的网络走,换网络后要用
/// `ipconfig getifaddr en0` 重新确认并改这里;
/// 也可以换成 Bonjour 名字 `http://<LocalHostName>.local:8081`(本机是
/// `jiangdeMacBook-Air.local`),换网络不用改,但部分办公网会拦组播解析。
static const String devHostBaseUrl = 'http://jiangdeMacBook-Air.local:8081';
/// `ipconfig getifaddr en0` 重新确认。默认值只改这一行。
static const String devHostBaseUrl = 'http://10.157.242.1:8081';
static const String _loopbackBaseUrl = 'http://127.0.0.1:8081';