62 lines
1.9 KiB
Dart
62 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class AnalyticsSummaryCard extends StatelessWidget {
|
|
const AnalyticsSummaryCard({
|
|
super.key,
|
|
required this.title,
|
|
required this.value,
|
|
this.subtitle,
|
|
this.icon,
|
|
this.color,
|
|
});
|
|
|
|
final String title;
|
|
final String value;
|
|
final String? subtitle;
|
|
final IconData? icon;
|
|
final Color? color;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final baseColor = color ?? theme.colorScheme.primary;
|
|
final bgColor = baseColor.withValues(alpha: 0.1);
|
|
final fgColor = baseColor;
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: bgColor,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (icon != null)
|
|
Container(
|
|
width: 48,
|
|
height: 48,
|
|
decoration: BoxDecoration(color: fgColor, borderRadius: BorderRadius.circular(12)),
|
|
child: Icon(icon, color: Colors.white),
|
|
),
|
|
if (icon != null) const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(title, style: theme.textTheme.labelLarge?.copyWith(color: fgColor)),
|
|
const SizedBox(height: 4),
|
|
Text(value, style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.bold, color: fgColor)),
|
|
if (subtitle != null) ...[
|
|
const SizedBox(height: 6),
|
|
Text(subtitle!, style: theme.textTheme.bodySmall?.copyWith(color: fgColor.withValues(alpha: 0.8))),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|