- Convert instance methods to static methods in AppColorScheme for getChangeColor and getChangeBackgroundColor - Update main.dart to use ShadThemeData with AppColorScheme color schemes instead of createLight/DarkShadTheme functions - Add app_theme.dart import to main.dart - Refactor asset_card.dart and coin_card.dart to call static methods via AppColorScheme class - Add app_spacing.dart import to action_buttons_row.dart - Replace SizedBox with proper spacing constants in action buttons row
68 lines
2.0 KiB
Dart
68 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
|
import '../../../../core/theme/app_spacing.dart';
|
|
import '../../../../core/theme/app_theme.dart';
|
|
import 'avatar_circle.dart';
|
|
|
|
/// 用户资料卡片 - 头像 + 用户名 + 徽章 + chevron
|
|
class ProfileCard extends StatelessWidget {
|
|
final dynamic user;
|
|
const ProfileCard({super.key, required this.user});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: isDark
|
|
? colorScheme.surfaceContainer
|
|
: colorScheme.surfaceContainerHigh,
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
border: Border.all(
|
|
color: colorScheme.outlineVariant.withValues(alpha: 0.15),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
// Avatar
|
|
AvatarCircle(
|
|
radius: 24,
|
|
fontSize: 18,
|
|
text: user?.avatarText,
|
|
),
|
|
const SizedBox(width: 12),
|
|
// Name + badge column
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
user?.username ?? '未登录',
|
|
style: AppTextStyles.headlineLarge(context),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
'普通用户',
|
|
style: AppTextStyles.bodyMedium(context).copyWith(
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// Chevron
|
|
Icon(
|
|
LucideIcons.chevronRight,
|
|
size: 16,
|
|
color: colorScheme.onSurfaceVariant,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|