feat: dashboard
This commit is contained in:
@@ -1,53 +1,109 @@
|
||||
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 {
|
||||
const ReportQuickStats({super.key});
|
||||
final DashboardOverview overview;
|
||||
|
||||
const ReportQuickStats({super.key, required this.overview});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
return Column(
|
||||
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 Transaksi',
|
||||
value: '245',
|
||||
icon: Icons.receipt_long,
|
||||
color: AppColor.info,
|
||||
change: '+8.2%',
|
||||
animatedValue: 245 * value,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
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(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: 'Rata-rata',
|
||||
value: 'Rp 63.061',
|
||||
icon: Icons.trending_up,
|
||||
color: AppColor.warning,
|
||||
change: '+5.1%',
|
||||
animatedValue: 63061 * 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,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user