refactor: 替换硬编码的AppTypography为基于context的动态获取

1. 批量修改所有直接调用AppTypography静态方法的地方,改为使用AppTypography.of(context)获取主题文本样式,适配不同主题上下文
2. 新增channelOrder存储键,支持频道排序持久化
3. 修复笔记删除全部功能未重置total字段的bug
4. 调整build.yaml配置,扩展freezed和json_serializable的生成范围
5. 优化底部弹窗默认样式,使用主题色替代硬编码颜色
6. 调整主题设置中的卡片样式默认文案
This commit is contained in:
Developer
2026-05-24 09:26:55 +08:00
parent 794da27193
commit 09d68cd6aa
265 changed files with 5197 additions and 3981 deletions

View File

@@ -159,7 +159,7 @@ class _TextInputSection extends StatelessWidget {
const SizedBox(width: AppSpacing.sm),
Text(
'输入待查重文本',
style: AppTypography.title3.copyWith(color: ext.textPrimary),
style: AppTypography.of(context).title3.copyWith(color: ext.textPrimary),
),
],
),
@@ -167,7 +167,7 @@ class _TextInputSection extends StatelessWidget {
CupertinoTextField(
controller: controller,
placeholder: '粘贴或输入需要查重的文本内容...',
style: AppTypography.body.copyWith(
style: AppTypography.of(context).body.copyWith(
color: ext.textPrimary,
height: 1.6,
),
@@ -189,7 +189,7 @@ class _TextInputSection extends StatelessWidget {
children: [
Text(
'$count / 5000',
style: AppTypography.caption2.copyWith(
style: AppTypography.of(context).caption2.copyWith(
color: count > 5000
? CupertinoColors.systemRed
: ext.textHint,
@@ -237,7 +237,7 @@ class _SourceSelector extends ConsumerWidget {
const SizedBox(width: AppSpacing.sm),
Text(
'数据源',
style: AppTypography.callout.copyWith(
style: AppTypography.of(context).callout.copyWith(
color: ext.textSecondary,
),
),
@@ -245,7 +245,7 @@ class _SourceSelector extends ConsumerWidget {
if (state.selectedSources.isNotEmpty)
Text(
'已选 ${state.selectedSources.length}',
style: AppTypography.caption2.copyWith(color: ext.accent),
style: AppTypography.of(context).caption2.copyWith(color: ext.accent),
),
],
),
@@ -281,7 +281,7 @@ class _SourceSelector extends ConsumerWidget {
const SizedBox(width: 4),
Text(
src.name,
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: isSelected ? ext.accent : ext.textSecondary,
fontWeight: isSelected
? FontWeight.bold
@@ -332,7 +332,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(width: AppSpacing.sm),
Text(
'查重模式',
style: AppTypography.callout.copyWith(
style: AppTypography.of(context).callout.copyWith(
color: ext.textSecondary,
),
),
@@ -356,7 +356,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(width: 4),
Text(
'精确',
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: ext.textPrimary,
),
),
@@ -372,7 +372,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(width: 4),
Text(
'模糊',
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: ext.textPrimary,
),
),
@@ -388,7 +388,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(width: 4),
Text(
'相似度',
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: ext.textPrimary,
),
),
@@ -404,7 +404,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(width: 4),
Text(
'综合',
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: ext.textPrimary,
),
),
@@ -416,7 +416,7 @@ class _ModeSelector extends ConsumerWidget {
const SizedBox(height: AppSpacing.xs),
Text(
_modeDescription(state.selectedMode),
style: AppTypography.caption2.copyWith(color: ext.textHint),
style: AppTypography.of(context).caption2.copyWith(color: ext.textHint),
),
],
),
@@ -542,7 +542,7 @@ class _ErrorBanner extends StatelessWidget {
Expanded(
child: Text(
error,
style: AppTypography.subhead.copyWith(
style: AppTypography.of(context).subhead.copyWith(
color: CupertinoColors.systemRed,
),
),
@@ -625,7 +625,7 @@ class _CheckResultDashboard extends StatelessWidget {
const SizedBox(width: AppSpacing.sm),
Text(
'查重结果',
style: AppTypography.title3.copyWith(
style: AppTypography.of(context).title3.copyWith(
color: ext.textPrimary,
),
),
@@ -641,7 +641,7 @@ class _CheckResultDashboard extends StatelessWidget {
),
child: Text(
_riskLabel(),
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: riskColor,
fontWeight: FontWeight.bold,
),
@@ -755,7 +755,7 @@ class _SimilarityGauge extends StatelessWidget {
children: [
Text(
'${simPercent.toStringAsFixed(1)}%',
style: AppTypography.title1.copyWith(
style: AppTypography.of(context).title1.copyWith(
color: riskColor,
fontWeight: FontWeight.bold,
),
@@ -763,7 +763,7 @@ class _SimilarityGauge extends StatelessWidget {
const SizedBox(height: 2),
Text(
'相似度',
style: AppTypography.caption1.copyWith(color: ext.textHint),
style: AppTypography.of(context).caption1.copyWith(color: ext.textHint),
),
],
),
@@ -795,7 +795,7 @@ class _ResultStatItem extends StatelessWidget {
const SizedBox(height: 4),
Text(
value,
style: AppTypography.headline.copyWith(
style: AppTypography.of(context).headline.copyWith(
color: color,
fontWeight: FontWeight.bold,
),
@@ -803,7 +803,7 @@ class _ResultStatItem extends StatelessWidget {
const SizedBox(height: 2),
Text(
label,
style: AppTypography.caption2.copyWith(color: ext.textHint),
style: AppTypography.of(context).caption2.copyWith(color: ext.textHint),
),
],
);
@@ -844,12 +844,12 @@ class _MatchDetailSection extends StatelessWidget {
const SizedBox(width: AppSpacing.sm),
Text(
'匹配详情',
style: AppTypography.callout.copyWith(color: ext.textSecondary),
style: AppTypography.of(context).callout.copyWith(color: ext.textSecondary),
),
const Spacer(),
Text(
'${matches.length} 条匹配',
style: AppTypography.caption2.copyWith(color: ext.textHint),
style: AppTypography.of(context).caption2.copyWith(color: ext.textHint),
),
],
),
@@ -937,7 +937,7 @@ class _MatchCard extends StatelessWidget {
Expanded(
child: Text(
match.sourceTitle,
style: AppTypography.callout.copyWith(
style: AppTypography.of(context).callout.copyWith(
color: ext.textPrimary,
fontWeight: FontWeight.w600,
),
@@ -956,7 +956,7 @@ class _MatchCard extends StatelessWidget {
),
child: Text(
'$simPercent%',
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: riskColor,
fontWeight: FontWeight.bold,
),
@@ -984,7 +984,7 @@ class _MatchCard extends StatelessWidget {
),
child: Text(
match.matchedText,
style: AppTypography.caption1.copyWith(
style: AppTypography.of(context).caption1.copyWith(
color: ext.textSecondary,
height: 1.5,
),