This commit is contained in:
2026-04-06 00:24:54 +08:00
parent 40ed445ae5
commit 7bbc75a457
4 changed files with 75 additions and 119 deletions

View File

@@ -4,10 +4,10 @@ import '../../../../core/theme/app_spacing.dart';
import '../../../../core/theme/app_theme.dart';
/// 单行菜单项:图标 + 标题 + 尾部组件 (chevron)
right)
///
/// 图标颜色 (通常是使用主题色)
class MenuRow extends StatelessWidget {
final IconData icon;
final Color iconColor;
final String title;
final Widget? trailing;
@@ -15,10 +15,10 @@ class MenuRow extends StatelessWidget {
const MenuRow({
super.key,
required this.icon,
required this.iconColor,
required this.title,
this.trailing,
super.key, required this.iconColor = required this.title,
this.onTap,
});
@@ -26,7 +26,7 @@ class MenuRow extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Padding(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
child: Row(
children: [
@@ -59,7 +59,6 @@ class MenuRow extends StatelessWidget {
size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
],
],
),
),

View File

@@ -1,17 +1,17 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:provider/provider.dart';
import '../../../../core/theme/app_color_scheme.dart';
import '../../../../core/theme/app_spacing.dart';
import '../../../../core/theme/app_theme.dart';
import '../../../../core/providers/theme_provider.dart';
import '../../../../providers/theme_provider.dart';
/// KYC 状态徽章 (e.g. "已认证" green badge + chevron)
///
///
/// 根据 [kycStatus] 显示不同状态:
/// - 2: 已认证(绿色)
/// - 1: 审核中(橙色)
/// - 其他: 仅显示 chevron
*/
/// - 其他: 仅显示 chevron
class KycBadge extends StatelessWidget {
final int kycStatus;
const KycBadge({super.key, required this.kycStatus});
@@ -20,64 +20,66 @@ class KycBadge extends StatelessWidget {
Widget build(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
final green = AppColorScheme.getUpColor(isDark);
final colorScheme = Theme.of(context).colorScheme;
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: green.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
'已认证',
style: AppTextStyles.labelMedium(context).copyWith(
color: green,
if (kycStatus == 2) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: green.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
'已认证',
style: AppTextStyles.labelMedium(context).copyWith(
color: green,
),
),
),
),
const SizedBox(width: 8),
Icon(
LucideIcons.chevronRight,
size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
],
);
}
const SizedBox(width: 8),
Icon(
LucideIcons.chevronRight,
size: 16,
color: colorScheme.onSurfaceVariant,
),
],
);
}
if (kycStatus == 1) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: AppColorScheme.warning.withOpacity(0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
'审核中',
style: AppTextStyles.labelMedium(context).copyWith(
color: AppColorScheme.warning,
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: AppColorScheme.warning.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(AppRadius.sm),
),
child: Text(
'审核中',
style: AppTextStyles.labelMedium(context).copyWith(
color: AppColorScheme.warning,
),
),
),
),
const SizedBox(width: 8),
Icon(
LucideIcons.chevronRight,
size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
],
);
}
const SizedBox(width: 8),
Icon(
LucideIcons.chevronRight,
size: 16,
color: colorScheme.onSurfaceVariant,
),
],
);
}
return Icon(
LucideIcons.chevronRight,
size: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
color: colorScheme.onSurfaceVariant,
);
}
}
@@ -95,8 +97,9 @@ class RedDotIndicator extends StatelessWidget {
width: 8,
height: 8,
decoration: BoxDecoration(
color: AppColorScheme.down,
shape: BoxShape.circle,
color: AppColorScheme.down,
shape: BoxShape.circle,
),
),
const SizedBox(width: 8),
Icon(
@@ -149,9 +152,6 @@ class DarkModeRow extends StatelessWidget {
),
),
// Toggle switch - matching .pen design (44x24 rounded pill)
// thumb
custom radius
12)
GestureDetector(
onTap: () => themeProvider.toggleTheme(),
child: AnimatedContainer(
@@ -164,7 +164,7 @@ class DarkModeRow extends StatelessWidget {
? colorScheme.surfaceContainerHigh
: colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(12),
),
),
child: AnimatedAlign(
duration: const Duration(milliseconds: 200),
alignment:
@@ -179,8 +179,9 @@ class DarkModeRow extends StatelessWidget {
),
),
),
],
),
),
),
],
),
);
}