refactor: 完成AppTypography Token化重构,统一UI样式调用
1. 将AppTypography从静态常量类重构为ThemeExtension+静态实例模式,支持全局响应式字体调整 2. 批量替换全量代码中的AppTypography.of(context)调用为静态直接调用 3. 移除多余的rank_provider、canvas_style_middleware导入和preload静态方法 4. 修复多处UI文本样式不一致的问题,统一字体样式调用逻辑
This commit is contained in:
@@ -140,7 +140,7 @@ class _MiniEditorPageState extends ConsumerState<MiniEditorPage> {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'导出',
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -273,7 +273,7 @@ class _TabItem extends StatelessWidget {
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
label,
|
||||
style: AppTypography.of(context).caption2.copyWith(
|
||||
style: AppTypography.caption2.copyWith(
|
||||
fontSize: 10,
|
||||
color: isActive ? LightColors.primary : ext.textSecondary,
|
||||
fontWeight: isActive ? FontWeight.w600 : FontWeight.w400,
|
||||
|
||||
@@ -137,7 +137,7 @@ class _MiniEditorSheetState extends ConsumerState<MiniEditorSheet> {
|
||||
children: [
|
||||
Text(
|
||||
'✏️ 快速编辑',
|
||||
style: AppTypography.of(context).title3.copyWith(color: ext.textPrimary),
|
||||
style: AppTypography.title3.copyWith(color: ext.textPrimary),
|
||||
),
|
||||
const Spacer(),
|
||||
CupertinoButton(
|
||||
@@ -164,7 +164,7 @@ class _MiniEditorSheetState extends ConsumerState<MiniEditorSheet> {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'保存',
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -269,7 +269,7 @@ class _SheetTab extends StatelessWidget {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
label,
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: isActive ? LightColors.primary : ext.textSecondary,
|
||||
fontWeight: isActive ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
|
||||
@@ -233,7 +233,7 @@ class _InlineTab extends StatelessWidget {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
label,
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: isActive ? LightColors.primary : ext.textSecondary,
|
||||
fontWeight: isActive ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
|
||||
@@ -15,7 +15,6 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:pro_image_editor/pro_image_editor.dart' as pro;
|
||||
|
||||
import 'package:xianyan/core/router/editor_router.dart';
|
||||
import 'package:xianyan/editor/services/core/canvas_style_middleware.dart';
|
||||
import 'package:xianyan/editor/services/core/pro_editor_bridge.dart';
|
||||
import 'package:xianyan/editor/services/core/editor_theme_notifier.dart';
|
||||
import 'package:xianyan/editor/widgets/controls/editor_system_ui.dart';
|
||||
|
||||
@@ -141,7 +141,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
leading: const AdaptiveBackButton(),
|
||||
middle: Text(
|
||||
'📝 草稿箱',
|
||||
style: AppTypography.of(context).headline.copyWith(color: ext.textPrimary),
|
||||
style: AppTypography.headline.copyWith(color: ext.textPrimary),
|
||||
),
|
||||
trailing: _drafts.isNotEmpty
|
||||
? GestureDetector(
|
||||
@@ -150,7 +150,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
'清空',
|
||||
style: AppTypography.of(context).subhead.copyWith(
|
||||
style: AppTypography.subhead.copyWith(
|
||||
color: CupertinoColors.systemRed,
|
||||
),
|
||||
),
|
||||
@@ -178,12 +178,12 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
Text(
|
||||
'暂无草稿',
|
||||
style: AppTypography.of(context).headline.copyWith(color: ext.textSecondary),
|
||||
style: AppTypography.headline.copyWith(color: ext.textSecondary),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
'编辑时会自动保存草稿到这里',
|
||||
style: AppTypography.of(context).caption1.copyWith(color: ext.textHint),
|
||||
style: AppTypography.caption1.copyWith(color: ext.textHint),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -242,7 +242,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
(draft.preview['text'] as String?)?.isNotEmpty == true
|
||||
? draft.preview['text'] as String
|
||||
: '(空文字)',
|
||||
style: AppTypography.of(context).subhead.copyWith(
|
||||
style: AppTypography.subhead.copyWith(
|
||||
color: ext.textPrimary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -260,7 +260,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${draft.preview["layerCount"] ?? 0} 个图层',
|
||||
style: AppTypography.of(context).caption2.copyWith(
|
||||
style: AppTypography.caption2.copyWith(
|
||||
color: ext.textHint,
|
||||
),
|
||||
),
|
||||
@@ -273,7 +273,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
_formatTime(draft.createdAt),
|
||||
style: AppTypography.of(context).caption2.copyWith(
|
||||
style: AppTypography.caption2.copyWith(
|
||||
color: ext.textHint,
|
||||
),
|
||||
),
|
||||
@@ -328,7 +328,7 @@ class _DraftListPageState extends State<DraftListPage> {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${draft.preview["layerCount"] ?? 0}',
|
||||
style: AppTypography.of(context).caption2.copyWith(
|
||||
style: AppTypography.caption2.copyWith(
|
||||
color: ext.textHint,
|
||||
fontSize: 10,
|
||||
),
|
||||
|
||||
@@ -136,8 +136,6 @@ class ProEditorBridge {
|
||||
mainEditor: pro.MainEditorConfigs(
|
||||
enableZoom: true,
|
||||
editorMinScale: 0.5,
|
||||
editorMaxScale: 5.0,
|
||||
doubleTapZoomFactor: 2.0,
|
||||
boundaryMargin: const EdgeInsets.all(double.infinity),
|
||||
safeArea: const pro.EditorSafeArea.none(),
|
||||
widgets: pro.MainEditorWidgets(
|
||||
@@ -157,21 +155,17 @@ class ProEditorBridge {
|
||||
bodyItemsRecorded: (editor, stream) => [
|
||||
if (canvasStyle != null) ...[
|
||||
...CanvasStyleMiddleware.cornerMasks(
|
||||
canvasStyle!,
|
||||
canvasStyle,
|
||||
maskColor: canvasBackground ?? const Color(0xFF1A1A2E),
|
||||
).map(
|
||||
(w) => pro.ReactiveWidget(stream: stream, builder: (_) => w),
|
||||
),
|
||||
...CanvasStyleMiddleware.borderOverlay(
|
||||
canvasStyle!,
|
||||
borderColor: const Color(0xFFFFFFFF),
|
||||
borderWidth: 3.0,
|
||||
).map(
|
||||
...CanvasStyleMiddleware.borderOverlay(canvasStyle).map(
|
||||
(w) => pro.ReactiveWidget(stream: stream, builder: (_) => w),
|
||||
),
|
||||
],
|
||||
if (bodyItemsRecordedBuilder != null)
|
||||
...bodyItemsRecordedBuilder!(editor, stream).map(
|
||||
...bodyItemsRecordedBuilder(editor, stream).map(
|
||||
(w) => pro.ReactiveWidget(stream: stream, builder: (_) => w),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -86,7 +86,7 @@ class MiniBgBar extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'🎨 纯色',
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: ext.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -115,7 +115,7 @@ class MiniBgBar extends StatelessWidget {
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
Text(
|
||||
'🌈 渐变',
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: ext.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
@@ -75,7 +75,7 @@ class MiniCanvasPreview extends StatelessWidget {
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: textColor,
|
||||
fontFamily: AppTypography.fontFamily,
|
||||
fontFamily: AppTypography.instance.fontFamily,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -47,7 +47,7 @@ class MiniTextBar extends StatelessWidget {
|
||||
color: ext.bgSecondary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
style: AppTypography.of(context).body.copyWith(color: ext.textPrimary),
|
||||
style: AppTypography.body.copyWith(color: ext.textPrimary),
|
||||
onChanged: onTextChanged,
|
||||
controller: TextEditingController(text: text)
|
||||
..selection = TextSelection.collapsed(offset: text.length),
|
||||
|
||||
@@ -116,7 +116,7 @@ class _TipsViewState extends State<TipsView>
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.message,
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: ext.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
|
||||
@@ -73,7 +73,7 @@ class _EyeDropperButtonState extends State<EyeDropperButton> {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'🎯 取色',
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
fontSize: 11,
|
||||
color: _isActive
|
||||
? LightColors.primary
|
||||
@@ -235,7 +235,7 @@ class _EyeDropperOverlayState extends State<EyeDropperOverlay> {
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'点击或拖拽拾取颜色',
|
||||
style: AppTypography.of(context).subhead.copyWith(
|
||||
style: AppTypography.subhead.copyWith(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,7 @@ class GlassSlider extends StatelessWidget {
|
||||
width: 64,
|
||||
child: Text(
|
||||
label,
|
||||
style: AppTypography.of(context).caption1.copyWith(
|
||||
style: AppTypography.caption1.copyWith(
|
||||
color: ext.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -67,7 +67,7 @@ class GlassSlider extends StatelessWidget {
|
||||
width: 52,
|
||||
child: Text(
|
||||
'${value.toStringAsFixed(1)}$suffix',
|
||||
style: AppTypography.of(context).caption1.copyWith(color: ext.textSecondary),
|
||||
style: AppTypography.caption1.copyWith(color: ext.textSecondary),
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -63,7 +63,7 @@ class GlassPresetSheet extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'🧊 氢设计风格',
|
||||
style: AppTypography.of(context).title3.copyWith(
|
||||
style: AppTypography.title3.copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
),
|
||||
@@ -162,7 +162,7 @@ class _PresetCard extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
preset.name,
|
||||
style: AppTypography.of(context).body.copyWith(
|
||||
style: AppTypography.body.copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@@ -139,7 +139,7 @@ class _StickerPickerPanelState extends State<StickerPickerPanel> {
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'贴纸装饰',
|
||||
style: AppTypography.of(context).headline.copyWith(
|
||||
style: AppTypography.headline.copyWith(
|
||||
color: widget.ext.textPrimary,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -63,7 +63,7 @@ class TemplatePickerSheet extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'🎨 选择模板',
|
||||
style: AppTypography.of(context).title3.copyWith(color: ext.textPrimary),
|
||||
style: AppTypography.title3.copyWith(color: ext.textPrimary),
|
||||
),
|
||||
CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -211,7 +211,7 @@ class _TemplateCard extends StatelessWidget {
|
||||
),
|
||||
child: Text(
|
||||
'${template.emoji} ${template.name}',
|
||||
style: AppTypography.of(context).caption2.copyWith(
|
||||
style: AppTypography.caption2.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user