fix(theme): 修复组件主题硬编码问题

- asset_card: Colors.white/black → colorScheme
- gradient_button: Colors.white → onPrimary
- trade_button: Colors.white → onPrimary
- 支持亮/暗主题动态切换
This commit is contained in:
2026-03-24 08:45:54 +08:00
parent 13841b1958
commit b4eeb61aa1
3 changed files with 34 additions and 22 deletions

View File

@@ -96,6 +96,9 @@ class GradientButton extends StatelessWidget {
final buttonGradient = gradient ??
(isDark ? AppColorScheme.darkCtaGradient : AppColorScheme.lightCtaGradient);
// 主题感知颜色 - 在渐变背景上使用 onPrimary
final textColor = colorScheme.onPrimary;
return Container(
width: isFullWidth ? double.infinity : null,
height: height,
@@ -114,23 +117,23 @@ class GradientButton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (isLoading)
const SizedBox(
SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
color: textColor,
),
)
else ...[
if (icon != null) ...[
Icon(icon, size: 18, color: Colors.white),
Icon(icon, size: 18, color: textColor),
SizedBox(width: AppSpacing.sm),
],
Text(
text,
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: textColor,
fontSize: 16,
fontWeight: FontWeight.w600,
),