Files
jiu/client/lib/core/config/app_info.dart
T
wangjia ced407ea87 feat(client): 移动端布局适配 + 信息架构整理
- 入库/出库详情页:窄屏商品明细切换为卡片竖排,顶部操作收入溢出菜单
- 基础数据:新增「仓库」tab,使用 DataTableCard + mobileCards 适配窄屏
- 系统设置:移除仓库 tab(已迁入基础数据),新增「授权」tab,数据导入改名「数据管理」
- 关于我们:移除授权信息,补充帮助与文档/扫码防伪/法律信息/系统信息等模块
- AppInfo 新增 phone/wechat/termsUrl/privacyUrl/docsUrl 字段(可选,空则不渲染)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 20:16:34 +08:00

39 lines
1.3 KiB
Dart

import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
/// 应用「关于我们」等品牌信息,从配置文件 assets/config/app_info.json 读取,
/// 不硬编码、不走环境变量。在 main() 启动时调用 [load] 加载一次。
class AppInfo {
const AppInfo._();
static const _assetPath = 'assets/config/app_info.json';
static String provider = '';
static String website = '';
static String email = '';
static String phone = '';
static String wechat = '';
static String termsUrl = '';
static String privacyUrl = '';
static String docsUrl = '';
/// 加载配置文件。失败时保留为空(不影响应用启动)。
static Future<void> load() async {
try {
final raw = await rootBundle.loadString(_assetPath);
final map = jsonDecode(raw) as Map<String, dynamic>;
provider = (map['provider'] as String?) ?? '';
website = (map['website'] as String?) ?? '';
email = (map['email'] as String?) ?? '';
phone = (map['phone'] as String?) ?? '';
wechat = (map['wechat'] as String?) ?? '';
termsUrl = (map['terms_url'] as String?) ?? '';
privacyUrl = (map['privacy_url'] as String?) ?? '';
docsUrl = (map['docs_url'] as String?) ?? '';
} catch (e) {
debugPrint('AppInfo.load failed: $e');
}
}
}