feat: update home ui

This commit is contained in:
Efril
2026-06-23 21:27:27 +07:00
parent e236d811ce
commit 83f4e065ed
34 changed files with 2128 additions and 1597 deletions
+128 -34
View File
@@ -1,12 +1,9 @@
import 'package:flutter/material.dart';
import 'package:line_icons/line_icons.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../../domain/analytic/analytic.dart';
import '../../../components/spacer/spacer.dart';
import 'stats_tile.dart';
import 'title.dart';
class HomeStats extends StatelessWidget {
final DashboardOverview overview;
@@ -22,54 +19,57 @@ class HomeStats extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
HomeTitle(title: context.lang.today_summary),
const SpaceHeight(20),
Text(
context.lang.today_condition,
style: AppStyle.xl.copyWith(
fontWeight: FontWeight.w800,
color: AppColor.textPrimary,
),
),
const SpaceHeight(16),
Row(
children: [
Expanded(
child: HomeStatsTile(
title: context.lang.order,
child: _StatCard(
icon: Icons.credit_card_rounded,
iconColor: const Color(0xFF00BCD4),
blobColor: const Color(0xFF00BCD4),
value: overview.totalOrders.toString(),
icon: Icons.receipt_long_rounded,
color: AppColor.info,
subtitle: context.lang.today,
label: context.lang.transaction,
),
),
const SpaceWidth(16),
const SpaceWidth(12),
Expanded(
child: HomeStatsTile(
title: context.lang.new_customer,
value: overview.totalCustomers.toString(),
icon: Icons.person_add_outlined,
color: AppColor.primary,
subtitle: overview.totalCustomers < 1
? context.lang.today
: context.lang.increase,
child: _StatCard(
icon: Icons.hexagon_outlined,
iconColor: const Color(0xFF4CAF50),
blobColor: const Color(0xFF4CAF50),
value: '0', // TODO: connect items sold data
label: context.lang.items_sold,
),
),
],
),
const SizedBox(height: 16),
const SpaceHeight(12),
Row(
children: [
Expanded(
child: HomeStatsTile(
title: context.lang.refund,
value: overview.refundedOrders.toString(),
icon: LineIcons.alternateExchange,
color: AppColor.warning,
subtitle: context.lang.today,
child: _StatCard(
icon: Icons.warning_amber_rounded,
iconColor: const Color(0xFFFF9800),
blobColor: const Color(0xFFFF9800),
value: '0', // TODO: connect low stock data
label: context.lang.low_stock_warning,
),
),
const SpaceWidth(16),
const SpaceWidth(12),
Expanded(
child: HomeStatsTile(
title: context.lang.void_text,
value: overview.voidedOrders.toString(),
icon: Icons.cancel_rounded,
color: AppColor.error,
subtitle: context.lang.today,
child: _StatCard(
icon: Icons.hexagon_outlined,
iconColor: const Color(0xFFE53935),
blobColor: const Color(0xFFE53935),
value: '0', // TODO: connect active products data
label: context.lang.active_products,
),
),
],
@@ -79,3 +79,97 @@ class HomeStats extends StatelessWidget {
);
}
}
class _StatCard extends StatelessWidget {
final IconData icon;
final Color iconColor;
final Color blobColor;
final String value;
final String label;
const _StatCard({
required this.icon,
required this.iconColor,
required this.blobColor,
required this.value,
required this.label,
});
@override
Widget build(BuildContext context) {
return Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: AppColor.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.04),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Stack(
clipBehavior: Clip.none,
children: [
// Decorative blob top-right (quarter circle)
Positioned(
top: -16,
right: -16,
child: Container(
width: 70,
height: 70,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(70),
),
color: blobColor.withOpacity(0.10),
),
),
),
// Content
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Icon
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: iconColor,
borderRadius: BorderRadius.circular(12),
),
child: Icon(icon, color: Colors.white, size: 20),
),
const SpaceHeight(16),
// Value
Text(
value,
style: AppStyle.h1.copyWith(
fontWeight: FontWeight.w900,
color: AppColor.textPrimary,
fontSize: 28,
),
),
const SpaceHeight(4),
// Label
Text(
label,
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
fontWeight: FontWeight.w500,
),
),
],
),
],
),
),
);
}
}