- 新增 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>
193 lines
6.1 KiB
Dart
193 lines
6.1 KiB
Dart
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'],
|
|
),
|
|
);
|
|
}
|