feat: Flutter 客户端 App + Web UI APK 下载入口
- 新增 Flutter 跨平台客户端项目 (clients/flutter/)
- 29 个 Dart 文件: 服务层/状态管理/5个页面/BLE配网
- BLE 蓝牙配网: 扫描设备、写入WiFi凭据、配网状态监听
- HTTP API 客户端: 覆盖全部端点 (播放/场景/WiFi/视频/配置/文件/插件)
- WebSocket 实时通信: 事件流 + 自动重连
- 暗色主题 Material 3 UI, 中文界面
- Android 配置: minSdkVersion 21, BLE/网络权限
- PRD 产品需求文档 + 开发任务看板
- Web UI 添加 APK 下载入口 (routes.rs)
- 下载弹窗 + 二维码 + /download/{filename} 静态文件路由
- BLE 插件增加自动重连循环 (ble/mod.rs)
- BLE 默认设备名修正为 'Showen' (config.rs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
39
clients/flutter/lib/theme/app_colors.dart
Normal file
39
clients/flutter/lib/theme/app_colors.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColors {
|
||||
static const Color primary = Color(0xFF6366F1);
|
||||
static const Color secondary = Color(0xFF8B5CF6);
|
||||
static const Color accent = Color(0xFFEC4899);
|
||||
|
||||
static const Color success = Color(0xFF10B981);
|
||||
static const Color warning = Color(0xFFF59E0B);
|
||||
static const Color error = Color(0xFFEF4444);
|
||||
static const Color info = Color(0xFF3B82F6);
|
||||
|
||||
static const Color background = Color(0xFF0F172A);
|
||||
static const Color card = Color(0xFF1E293B);
|
||||
static const Color border = Color(0xFF334155);
|
||||
static const Color textPrimary = Color(0xFFF1F5F9);
|
||||
static const Color textSecondary = Color(0xFF94A3B8);
|
||||
|
||||
static const LinearGradient primaryGradient = LinearGradient(
|
||||
colors: [primary, secondary],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
);
|
||||
}
|
||||
|
||||
class AppRadius {
|
||||
static const double small = 4;
|
||||
static const double medium = 8;
|
||||
static const double large = 16;
|
||||
}
|
||||
|
||||
class AppSpacing {
|
||||
static const double xs = 4;
|
||||
static const double sm = 8;
|
||||
static const double md = 16;
|
||||
static const double lg = 24;
|
||||
static const double xl = 32;
|
||||
static const double xxl = 48;
|
||||
}
|
||||
192
clients/flutter/lib/theme/app_theme.dart
Normal file
192
clients/flutter/lib/theme/app_theme.dart
Normal file
@@ -0,0 +1,192 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_colors.dart';
|
||||
|
||||
class AppTheme {
|
||||
static ThemeData dark() {
|
||||
const colorScheme = ColorScheme.dark(
|
||||
primary: AppColors.primary,
|
||||
secondary: AppColors.secondary,
|
||||
surface: AppColors.card,
|
||||
error: AppColors.error,
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
onSurface: AppColors.textPrimary,
|
||||
onError: Colors.white,
|
||||
);
|
||||
|
||||
final base = ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: AppColors.background,
|
||||
canvasColor: AppColors.background,
|
||||
splashColor: AppColors.primary.withOpacity(0.12),
|
||||
highlightColor: AppColors.primary.withOpacity(0.08),
|
||||
dividerColor: AppColors.border,
|
||||
cardColor: AppColors.card,
|
||||
fontFamily: 'Noto Sans SC',
|
||||
textTheme: _textTheme,
|
||||
appBarTheme: const AppBarTheme(
|
||||
centerTitle: false,
|
||||
elevation: 0,
|
||||
backgroundColor: AppColors.background,
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
titleTextStyle: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Noto Sans SC',
|
||||
fontFamilyFallback: ['Inter'],
|
||||
),
|
||||
),
|
||||
cardTheme: CardThemeData(
|
||||
color: AppColors.card,
|
||||
elevation: 6,
|
||||
shadowColor: Colors.black.withOpacity(0.20),
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.large),
|
||||
side: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: AppColors.background,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 12,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.medium),
|
||||
borderSide: const BorderSide(color: AppColors.border),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.medium),
|
||||
borderSide: const BorderSide(color: AppColors.primary),
|
||||
),
|
||||
hintStyle: const TextStyle(color: AppColors.textSecondary),
|
||||
),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: AppColors.card,
|
||||
height: 64,
|
||||
indicatorColor: AppColors.primary.withOpacity(0.18),
|
||||
labelTextStyle: WidgetStateProperty.all(
|
||||
const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Inter',
|
||||
fontFamilyFallback: ['Noto Sans SC'],
|
||||
),
|
||||
),
|
||||
iconTheme: WidgetStateProperty.resolveWith(
|
||||
(states) => IconThemeData(
|
||||
size: 24,
|
||||
color: states.contains(WidgetState.selected)
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
filledButtonTheme: FilledButtonThemeData(
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
backgroundColor: AppColors.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.medium),
|
||||
),
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Inter',
|
||||
fontFamilyFallback: ['Noto Sans SC'],
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
foregroundColor: AppColors.primary,
|
||||
side: const BorderSide(color: AppColors.primary),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.medium),
|
||||
),
|
||||
),
|
||||
),
|
||||
switchTheme: SwitchThemeData(
|
||||
trackOutlineColor: WidgetStateProperty.all(Colors.transparent),
|
||||
thumbColor: WidgetStateProperty.resolveWith(
|
||||
(states) => states.contains(WidgetState.selected)
|
||||
? AppColors.primary
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
trackColor: WidgetStateProperty.resolveWith(
|
||||
(states) => states.contains(WidgetState.selected)
|
||||
? AppColors.primary.withOpacity(0.4)
|
||||
: AppColors.border,
|
||||
),
|
||||
),
|
||||
sliderTheme: const SliderThemeData(
|
||||
activeTrackColor: AppColors.primary,
|
||||
inactiveTrackColor: AppColors.border,
|
||||
thumbColor: AppColors.primary,
|
||||
trackHeight: 4,
|
||||
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 10),
|
||||
),
|
||||
);
|
||||
|
||||
return base.copyWith(
|
||||
textSelectionTheme: const TextSelectionThemeData(
|
||||
cursorColor: AppColors.primary,
|
||||
selectionColor: Color(0x446366F1),
|
||||
selectionHandleColor: AppColors.primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static const TextTheme _textTheme = TextTheme(
|
||||
headlineLarge: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Inter',
|
||||
fontFamilyFallback: ['Noto Sans SC'],
|
||||
),
|
||||
headlineMedium: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Inter',
|
||||
fontFamilyFallback: ['Noto Sans SC'],
|
||||
),
|
||||
headlineSmall: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Inter',
|
||||
fontFamilyFallback: ['Noto Sans SC'],
|
||||
),
|
||||
bodyLarge: TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.5,
|
||||
color: AppColors.textPrimary,
|
||||
fontFamily: 'Noto Sans SC',
|
||||
fontFamilyFallback: ['Inter'],
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
fontSize: 14,
|
||||
height: 1.4,
|
||||
color: AppColors.textSecondary,
|
||||
fontFamily: 'Noto Sans SC',
|
||||
fontFamilyFallback: ['Inter'],
|
||||
),
|
||||
bodySmall: TextStyle(
|
||||
fontSize: 12,
|
||||
height: 1.3,
|
||||
color: AppColors.textSecondary,
|
||||
fontFamily: 'Noto Sans SC',
|
||||
fontFamilyFallback: ['Inter'],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user