102 lines
3.2 KiB
Dart
102 lines
3.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../common/theme/theme.dart';
|
|
|
|
class SalesSummaryCard extends StatelessWidget {
|
|
const SalesSummaryCard({
|
|
super.key,
|
|
required this.fadeAnimation,
|
|
required this.title,
|
|
required this.value,
|
|
required this.icon,
|
|
required this.color,
|
|
required this.delay,
|
|
});
|
|
|
|
final Animation<double> fadeAnimation;
|
|
final String title;
|
|
final String value;
|
|
final IconData icon;
|
|
final Color color;
|
|
final int delay;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TweenAnimationBuilder<double>(
|
|
tween: Tween(begin: 0.0, end: 1.0),
|
|
duration: Duration(milliseconds: 800 + delay),
|
|
curve: Curves.easeOutBack,
|
|
builder: (context, animValue, child) {
|
|
return Transform.scale(
|
|
scale: animValue,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: AppColor.surface,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.05),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
TweenAnimationBuilder<double>(
|
|
tween: Tween(begin: 0.0, end: 1.0),
|
|
duration: Duration(milliseconds: 1000 + delay),
|
|
curve: Curves.bounceOut,
|
|
builder: (context, iconValue, child) {
|
|
return Transform.scale(
|
|
scale: iconValue,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: color.withOpacity(0.1),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Icon(icon, color: color, size: 20),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
const Spacer(),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
title,
|
|
style: AppStyle.sm.copyWith(
|
|
color: AppColor.textSecondary,
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
AnimatedBuilder(
|
|
animation: fadeAnimation,
|
|
builder: (context, child) {
|
|
return Text(
|
|
value,
|
|
style: AppStyle.xl.copyWith(
|
|
color: AppColor.textPrimary,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|