feat: 闲言APP v0.9.1 — 编辑器全面重写 + 迷你编辑器

- 标准编辑器: freezed数据模型 + 5Tab工具栏 + 多图层管理 + 文字增强 + 背景系统 + 导出链路
- 迷你编辑器: 极简6项功能(文字/字号/颜色/背景/预览/导出) + 三种调用方式(全屏/半屏/内嵌)
- 共享组件: GlassSlider/ColorPicker/FontPicker/TipsView
- 服务层: ExportService/ImageImportService/FontService/XycardService
- 设计系统: 统一主题令牌 + Liquid Glass风格
This commit is contained in:
Developer
2026-04-20 07:48:07 +08:00
commit 35202b51e8
461 changed files with 39318 additions and 0 deletions

137
lib/app/app.dart Normal file
View File

@@ -0,0 +1,137 @@
// ============================================================
// 闲言APP — 应用根组件
// 创建时间: 2026-04-20
// 更新时间: 2026-04-20
// 作用: MaterialApp.router + Riverpod 主题管理 + GlassTheme + flutter_animate
// 上次更新: 集成 GlassTheme 液态玻璃动态主题
// ============================================================
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:liquid_glass_widgets/liquid_glass_widgets.dart';
import '../core/router/app_router.dart';
import '../core/theme/app_theme.dart';
import '../core/storage/kv_storage.dart';
/// 主题模式 Provider (日/夜/系统)
final themeModeProvider = StateNotifierProvider<ThemeModeNotifier, ThemeMode>(
(ref) => ThemeModeNotifier(),
);
/// 主题模式状态管理
class ThemeModeNotifier extends StateNotifier<ThemeMode> {
ThemeModeNotifier() : super(_initMode());
static ThemeMode _initMode() {
final index = KvStorage.themeModeIndex;
switch (index) {
case 1:
return ThemeMode.light;
case 2:
return ThemeMode.dark;
default:
return ThemeMode.system;
}
}
void toLight() {
state = ThemeMode.light;
KvStorage.setThemeModeIndex(1);
}
void toDark() {
state = ThemeMode.dark;
KvStorage.setThemeModeIndex(2);
}
void toSystem() {
state = ThemeMode.system;
KvStorage.setThemeModeIndex(0);
}
void toggle() {
if (state == ThemeMode.light) {
toDark();
} else {
toLight();
}
}
void setMode(ThemeMode mode) {
state = mode;
switch (mode) {
case ThemeMode.light:
KvStorage.setThemeModeIndex(1);
case ThemeMode.dark:
KvStorage.setThemeModeIndex(2);
default:
KvStorage.setThemeModeIndex(0);
}
}
}
/// 闲言 App 根组件
class XianyanApp extends ConsumerWidget {
const XianyanApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final themeMode = ref.watch(themeModeProvider);
Animate.defaultDuration = 300.ms;
Animate.defaultCurve = Curves.easeOutCubic;
return ScreenUtilInit(
designSize: const Size(390, 844),
minTextAdapt: true,
splitScreenMode: true,
builder: (context, child) {
return GlassTheme(
data: const GlassThemeData(
light: GlassThemeVariant(
settings: GlassThemeSettings(
thickness: 30.0,
blur: 3.0,
refractiveIndex: 1.65,
lightIntensity: 1.2,
ambientStrength: 0.6,
saturation: 1.2,
),
),
dark: GlassThemeVariant(
settings: GlassThemeSettings(
thickness: 40.0,
blur: 5.0,
lightIntensity: 1.5,
refractiveIndex: 1.2,
saturation: 1.1,
),
),
),
child: MaterialApp.router(
title: '闲言',
debugShowCheckedModeBanner: false,
theme: AppTheme.light,
darkTheme: AppTheme.dark,
themeMode: themeMode,
routerConfig: appRouter,
builder: (context, widget) {
return MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.noScaling),
child: widget!,
);
},
),
);
},
);
}
}

9
lib/app/app_export.dart Normal file
View File

@@ -0,0 +1,9 @@
// ============================================================
// 闲言APP — 应用层导出
// 创建时间: 2026-04-20
// 更新时间: 2026-04-20
// 作用: 统一导出应用层所有模块
// 上次更新: 初始创建
// ============================================================
export 'app.dart';