chore(project): 初始化项目基础配置文件
- 添加 CodeGraph、Android 和通用 gitignore 配置 - 创建项目元数据文件跟踪 Flutter 项目属性 - 添加 Codex AI 指导文档 AGENTS.md 说明项目架构 - 配置代码分析选项 analysis_options.yaml - 设置 Android 应用清单权限和 Kiosk 模式配置 - 实现中英文国际化支持 AppLocalizations - 配置 GoRouter 应用路由导航 - 创建明亮工业控制风格的主题配置 AppTheme
This commit is contained in:
24
lib/shared/utils/constants.dart
Normal file
24
lib/shared/utils/constants.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
/// 常量定义
|
||||
class Constants {
|
||||
// 速度选项
|
||||
static const List<String> speedOptions = ['低速', '中速', '高速'];
|
||||
|
||||
// 下针速度档位
|
||||
static const List<int> needleSpeedLevels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
|
||||
// 孔位列表
|
||||
static const List<String> positions = [
|
||||
'A1', 'A2', 'A3', 'A4', 'A5', 'A6',
|
||||
'B1', 'B2', 'B3', 'B4', 'B5', 'B6',
|
||||
'C1', 'C2', 'C3', 'C4', 'C5', 'C6',
|
||||
'D1', 'D2', 'D3', 'D4', 'D5', 'D6',
|
||||
];
|
||||
|
||||
// 默认步骤名称
|
||||
static const List<String> defaultStepNames = ['混合', '吸磁', '吹气', '下针'];
|
||||
|
||||
// 时间单位
|
||||
static const String timeUnitSeconds = '秒';
|
||||
static const String timeUnitMinutes = '分钟';
|
||||
static const String volumeUnit = 'μL';
|
||||
}
|
||||
49
lib/shared/utils/responsive_layout.dart
Normal file
49
lib/shared/utils/responsive_layout.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 响应式布局工具类
|
||||
/// 目标屏幕: 1920x1080
|
||||
class ResponsiveLayout {
|
||||
static const double targetWidth = 1920;
|
||||
static const double targetHeight = 1080;
|
||||
|
||||
/// 获取屏幕宽度比例
|
||||
static double widthPercent(BuildContext context, double percent) {
|
||||
return MediaQuery.of(context).size.width * percent;
|
||||
}
|
||||
|
||||
/// 获取屏幕高度比例
|
||||
static double heightPercent(BuildContext context, double percent) {
|
||||
return MediaQuery.of(context).size.height * percent;
|
||||
}
|
||||
|
||||
/// 基于目标屏幕缩放宽度
|
||||
static double scaleWidth(BuildContext context, double targetValue) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return targetValue * (screenWidth / targetWidth);
|
||||
}
|
||||
|
||||
/// 基于目标屏幕缩放高度
|
||||
static double scaleHeight(BuildContext context, double targetValue) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
return targetValue * (screenHeight / targetHeight);
|
||||
}
|
||||
|
||||
/// 基于目标屏幕缩放字体
|
||||
static double scaleFont(BuildContext context, double targetFontSize) {
|
||||
return scaleWidth(context, targetFontSize);
|
||||
}
|
||||
|
||||
/// 预设布局尺寸
|
||||
static double sidebarWidth(BuildContext context) => widthPercent(context, 0.25); // 480px on 1920
|
||||
static double detailWidth(BuildContext context) => widthPercent(context, 0.21); // 400px on 1920
|
||||
static double navWidth(BuildContext context) => widthPercent(context, 0.15); // 280px on 1920
|
||||
static double cardWidth(BuildContext context) => widthPercent(context, 0.30); // ~576px
|
||||
}
|
||||
|
||||
/// 响应式间距
|
||||
class ResponsiveSpacing {
|
||||
static double small(BuildContext context) => ResponsiveLayout.scaleWidth(context, 8);
|
||||
static double medium(BuildContext context) => ResponsiveLayout.scaleWidth(context, 16);
|
||||
static double large(BuildContext context) => ResponsiveLayout.scaleWidth(context, 24);
|
||||
static double xlarge(BuildContext context) => ResponsiveLayout.scaleWidth(context, 32);
|
||||
}
|
||||
Reference in New Issue
Block a user