112 lines
3.7 KiB
Dart
112 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../common/extension/extension.dart';
|
|
import '../../../../common/theme/theme.dart';
|
|
import '../../../../domain/analytic/analytic.dart';
|
|
import 'stat_tile.dart';
|
|
|
|
class ReportQuickStats extends StatelessWidget {
|
|
final DashboardOverview overview;
|
|
|
|
const ReportQuickStats({super.key, required this.overview});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0, end: 1),
|
|
duration: const Duration(milliseconds: 800),
|
|
builder: (context, value, child) {
|
|
return Transform.scale(
|
|
scale: value,
|
|
child: ReportStatTile(
|
|
title: 'Total Orders',
|
|
value: overview.totalOrders.toString(),
|
|
icon: Icons.receipt_long,
|
|
color: AppColor.info,
|
|
animatedValue: overview.totalOrders * value,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0, end: 1),
|
|
duration: const Duration(milliseconds: 1000),
|
|
builder: (context, value, child) {
|
|
return Transform.scale(
|
|
scale: value,
|
|
child: ReportStatTile(
|
|
title: 'Average Order',
|
|
value: overview.averageOrderValue
|
|
.round()
|
|
.currencyFormatRp,
|
|
icon: Icons.trending_up,
|
|
color: AppColor.warning,
|
|
animatedValue: overview.averageOrderValue * value,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0, end: 1),
|
|
duration: const Duration(milliseconds: 1200),
|
|
builder: (context, value, child) {
|
|
return Transform.scale(
|
|
scale: value,
|
|
child: ReportStatTile(
|
|
title: 'Customers',
|
|
value: overview.totalCustomers.toString(),
|
|
icon: Icons.people,
|
|
color: AppColor.success,
|
|
animatedValue: overview.totalCustomers * value,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0, end: 1),
|
|
duration: const Duration(milliseconds: 1400),
|
|
builder: (context, value, child) {
|
|
return Transform.scale(
|
|
scale: value,
|
|
child: ReportStatTile(
|
|
title: 'Void + Refund',
|
|
value: (overview.voidedOrders + overview.refundedOrders)
|
|
.toString(),
|
|
|
|
icon: Icons.cancel,
|
|
color: AppColor.error,
|
|
animatedValue:
|
|
(overview.voidedOrders + overview.refundedOrders) *
|
|
value,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|