refactor(client): widgets 颜色迁移到 context.tokens

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-24 23:12:20 +08:00
parent 1671edd913
commit b37c46fb9c
20 changed files with 151 additions and 137 deletions
+11 -11
View File
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import '../core/theme/app_theme.dart';
import '../core/theme/context_tokens.dart';
/// 移动端列表卡片的单个字段(label: value)。
class MobileCardField {
@@ -56,19 +56,19 @@ class MobileListCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DefaultTextStyle(
style: const TextStyle(
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: AppTheme.textPrimary,
color: context.tokens.text,
),
child: title,
),
if (subtitle != null) ...[
const SizedBox(height: 2),
DefaultTextStyle(
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: AppTheme.textSecondary),
color: context.tokens.muted),
child: subtitle!,
),
],
@@ -83,7 +83,7 @@ class MobileListCard extends StatelessWidget {
),
if (fields.isNotEmpty) ...[
const SizedBox(height: 10),
...fields.map(_buildField),
...fields.map((f) => _buildField(context, f)),
],
if (actions != null && actions!.isNotEmpty) ...[
const Divider(height: 18),
@@ -102,7 +102,7 @@ class MobileListCard extends StatelessWidget {
);
}
Widget _buildField(MobileCardField f) {
Widget _buildField(BuildContext context, MobileCardField f) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: Row(
@@ -112,16 +112,16 @@ class MobileListCard extends StatelessWidget {
width: 64,
child: Text(
f.label,
style: const TextStyle(
fontSize: 13, color: AppTheme.textSecondary),
style: TextStyle(
fontSize: 13, color: context.tokens.muted),
),
),
Expanded(
child: f.valueWidget ??
Text(
f.value ?? '',
style: const TextStyle(
fontSize: 13, color: AppTheme.textPrimary),
style: TextStyle(
fontSize: 13, color: context.tokens.text),
),
),
],