82 lines
2.6 KiB
Dart
Raw Normal View History

2025-08-12 20:44:27 +07:00
import 'package:flutter/material.dart';
2025-08-19 12:23:53 +07:00
import 'package:line_icons/line_icons.dart';
2025-08-12 20:44:27 +07:00
2025-08-20 13:52:49 +07:00
import '../../../../common/extension/extension.dart';
2025-08-12 20:44:27 +07:00
import '../../../../common/theme/theme.dart';
2025-08-19 12:23:53 +07:00
import '../../../../domain/analytic/analytic.dart';
2025-08-12 20:44:27 +07:00
import '../../../components/spacer/spacer.dart';
import 'stats_tile.dart';
2025-08-19 12:23:53 +07:00
import 'title.dart';
2025-08-12 20:44:27 +07:00
class HomeStats extends StatelessWidget {
2025-08-19 12:23:53 +07:00
final DashboardOverview overview;
const HomeStats({super.key, required this.overview});
2025-08-12 20:44:27 +07:00
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 24,
horizontal: AppValue.padding,
).copyWith(bottom: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2025-08-20 13:52:49 +07:00
HomeTitle(title: context.lang.today_summary),
2025-08-12 20:44:27 +07:00
const SpaceHeight(20),
Row(
children: [
Expanded(
child: HomeStatsTile(
2025-08-20 13:52:49 +07:00
title: context.lang.order,
2025-08-19 12:23:53 +07:00
value: overview.totalOrders.toString(),
icon: Icons.receipt_long_rounded,
color: AppColor.info,
2025-08-20 13:52:49 +07:00
subtitle: context.lang.today,
2025-08-12 20:44:27 +07:00
),
),
const SpaceWidth(16),
Expanded(
child: HomeStatsTile(
2025-08-20 13:52:49 +07:00
title: context.lang.new_customer,
2025-08-19 12:23:53 +07:00
value: overview.totalCustomers.toString(),
icon: Icons.person_add_outlined,
color: AppColor.primary,
subtitle: overview.totalCustomers < 1
2025-08-20 13:52:49 +07:00
? context.lang.today
: context.lang.increase,
2025-08-12 20:44:27 +07:00
),
),
],
),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: HomeStatsTile(
2025-08-20 13:52:49 +07:00
title: context.lang.refund,
2025-08-19 12:23:53 +07:00
value: overview.refundedOrders.toString(),
icon: LineIcons.alternateExchange,
2025-08-12 20:44:27 +07:00
color: AppColor.warning,
2025-08-20 13:52:49 +07:00
subtitle: context.lang.today,
2025-08-12 20:44:27 +07:00
),
),
const SpaceWidth(16),
Expanded(
child: HomeStatsTile(
2025-08-20 13:52:49 +07:00
title: context.lang.void_text,
2025-08-19 12:23:53 +07:00
value: overview.voidedOrders.toString(),
icon: Icons.cancel_rounded,
color: AppColor.error,
2025-08-20 13:52:49 +07:00
subtitle: context.lang.today,
2025-08-12 20:44:27 +07:00
),
),
],
),
],
),
);
}
}