update home ui

This commit is contained in:
efrilm
2026-05-12 15:47:38 +07:00
parent 86d581f5ea
commit 9076c9c66e
16 changed files with 442 additions and 95 deletions
@@ -11,6 +11,7 @@ import '../../components/button/button.dart';
import '../../components/spacer/spacer.dart';
import 'widgets/feature.dart';
import 'widgets/header.dart';
import 'widgets/promo_banner.dart';
import 'widgets/stats.dart';
import 'widgets/top_product.dart';
@@ -170,6 +171,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const HomePromoBanner(),
HomeFeature(),
HomeStats(overview: state.dashboard.overview),
HomeTopProduct(
@@ -4,6 +4,7 @@ import 'package:line_icons/line_icons.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../components/assets/assets.gen.dart';
import '../../../router/app_router.gr.dart';
import 'feature_tile.dart';
@@ -38,26 +39,22 @@ class HomeFeature extends StatelessWidget {
children: [
HomeFeatureTile(
title: context.lang.sales,
color: const Color(0xFF4CAF50),
icon: LineIcons.receipt,
iconPath: Assets.icons.icReportSales.path,
onTap: () => context.router.push(SalesRoute()),
),
HomeFeatureTile(
title: context.lang.purchase,
color: const Color(0xFF2196F3),
icon: LineIcons.shoppingCart,
iconPath: Assets.icons.icReportPurchase.path,
onTap: () => context.router.push(PurchaseRoute()),
),
HomeFeatureTile(
title: context.lang.profit_loss,
color: const Color(0xFF8BC34A),
icon: LineIcons.moneyCheck,
iconPath: Assets.icons.icReportProfitLoss.path,
onTap: () => context.router.push(FinanceRoute()),
),
HomeFeatureTile(
title: context.lang.product,
color: const Color(0xFFFF9800),
icon: LineIcons.box,
iconPath: Assets.icons.icReportProduct.path,
onTap: () => context.router.push(ProductAnalyticRoute()),
),
],
@@ -5,14 +5,12 @@ import '../../../components/spacer/spacer.dart';
class HomeFeatureTile extends StatelessWidget {
final String title;
final IconData icon;
final Color color;
final String iconPath;
final Function() onTap;
const HomeFeatureTile({
super.key,
required this.title,
required this.icon,
required this.color,
required this.iconPath,
required this.onTap,
});
@@ -32,14 +30,13 @@ class HomeFeatureTile extends StatelessWidget {
height: 56,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [color.withOpacity(0.1), color.withOpacity(0.05)],
colors: [AppColor.primary.withOpacity(0.1), AppColor.primary.withOpacity(0.05)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(16),
border: Border.all(color: color.withOpacity(0.2), width: 1),
),
child: Icon(icon, color: color, size: 28),
child: Image.asset(iconPath),
),
const SpaceHeight(12),
Text(
@@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:line_icons/line_icon.dart';
import 'package:line_icons/line_icons.dart';
@@ -7,11 +9,35 @@ import '../../../../common/extension/extension.dart';
import '../../../../domain/user/user.dart';
import '../../../components/spacer/spacer.dart';
class HomeOmsetBalance extends StatelessWidget {
class HomeOmsetBalance extends StatefulWidget {
final int totalOmset;
final User user;
const HomeOmsetBalance({super.key, required this.totalOmset, required this.user});
@override
State<HomeOmsetBalance> createState() => _HomeOmsetBalanceState();
}
class _HomeOmsetBalanceState extends State<HomeOmsetBalance> {
late DateTime _now;
late Timer _timer;
bool _isBalanceVisible = true;
@override
void initState() {
super.initState();
_now = DateTime.now();
_timer = Timer.periodic(const Duration(seconds: 1), (_) {
setState(() => _now = DateTime.now());
});
}
@override
void dispose() {
_timer.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
@@ -36,34 +62,41 @@ class HomeOmsetBalance extends StatelessWidget {
Widget _bottom(BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
// context.router.push(BillingHistoryRoute());
},
onTap: () {},
child: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.2),
borderRadius: BorderRadius.vertical(
color: AppColor.white,
border: Border(top: BorderSide(color: AppColor.border)),
borderRadius: const BorderRadius.vertical(
bottom: Radius.circular(16),
),
),
child: Row(
children: [
LineIcon(LineIcons.calendar, color: AppColor.white, size: 14),
LineIcon(LineIcons.calendar, color: AppColor.black, size: 14),
SpaceWidth(6),
Expanded(
child: IgnorePointer(
child: Text(
DateTime.now().toDate,
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
child: Text(
_now.toDate,
style: AppStyle.md.copyWith(
color: AppColor.black,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
),
),
LineIcon(LineIcons.clock, color: AppColor.textSecondary, size: 14),
SpaceWidth(4),
Text(
_now.toHourMinuteSecond,
style: AppStyle.md.copyWith(
color: AppColor.textSecondary,
fontWeight: FontWeight.w500,
fontFeatures: [const FontFeature.tabularFigures()],
),
),
],
),
),
@@ -73,7 +106,7 @@ class HomeOmsetBalance extends StatelessWidget {
Container _middle(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
decoration: BoxDecoration(color: AppColor.white.withOpacity(0.3)),
decoration: BoxDecoration(color: AppColor.white),
child: Row(
children: [
Expanded(
@@ -85,25 +118,65 @@ class HomeOmsetBalance extends StatelessWidget {
Text(
context.lang.sales_today,
style: AppStyle.sm.copyWith(
color: AppColor.white,
color: AppColor.black,
fontWeight: FontWeight.w400,
letterSpacing: 0.3,
),
),
SpaceHeight(2),
Text(
totalOmset.currencyFormatRp,
style: AppStyle.xl.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w900,
letterSpacing: 0.3,
),
AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
transitionBuilder: (child, animation) {
return FadeTransition(
opacity: animation,
child: SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 0.3),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.easeOutCubic,
)),
child: child,
),
);
},
child: _isBalanceVisible
? Text(
widget.totalOmset.currencyFormatRp,
key: const ValueKey('visible'),
style: AppStyle.xl.copyWith(
color: AppColor.black,
fontWeight: FontWeight.w900,
letterSpacing: 0.3,
),
)
: Text(
'Rp ••••••••',
key: const ValueKey('hidden'),
style: AppStyle.xl.copyWith(
color: AppColor.black,
fontWeight: FontWeight.w900,
letterSpacing: 2,
),
),
),
],
),
),
),
LineIcon(LineIcons.eye, color: AppColor.white, size: 16),
GestureDetector(
onTap: () => setState(() => _isBalanceVisible = !_isBalanceVisible),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 200),
child: LineIcon(
_isBalanceVisible ? LineIcons.eye : LineIcons.eyeSlash,
key: ValueKey(_isBalanceVisible),
color: AppColor.primary,
size: 16,
),
),
),
],
),
);
@@ -115,8 +188,8 @@ class HomeOmsetBalance extends StatelessWidget {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.2),
borderRadius: BorderRadius.vertical(
gradient: LinearGradient(colors: AppColor.primaryGradient),
borderRadius: const BorderRadius.vertical(
top: Radius.circular(16),
),
),
@@ -128,24 +201,13 @@ class HomeOmsetBalance extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Enaklo Bakso Bakmi 343',
'Semua Outlet',
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
),
SpaceHeight(2),
Text(
'Jl. Tawes No.53, Rawamangun, Kec. Pulo Gadung',
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
),
@@ -0,0 +1,79 @@
import 'package:flutter/material.dart';
import '../../../../common/theme/theme.dart';
import '../../../components/spacer/spacer.dart';
import '../../../components/widgets/particle_card.dart';
class HomePromoBanner extends StatelessWidget {
const HomePromoBanner({super.key});
static const _outlets = [
'ENAKLO RAWAMANGUNG',
'ENAKLO WOKU PEDAS\nKELAPA GADING',
];
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(
AppValue.padding,
24,
AppValue.padding,
0,
),
child: Row(
children: [
for (int i = 0; i < _outlets.length; i++) ...[
Expanded(
child: ParticleCard(
height: 100,
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 12,
),
decorationOpacity: 0.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7,
vertical: 2,
),
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
),
child: Text(
'OUTLET',
style: AppStyle.xs.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w700,
letterSpacing: 1.0,
fontSize: 10,
),
),
),
const SpaceHeight(6),
Text(
_outlets[i],
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w800,
height: 1.25,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
if (i < _outlets.length - 1) const SpaceWidth(12),
],
],
),
);
}
}
@@ -1,5 +1,6 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';
import 'package:line_icons/line_icon.dart';
import 'package:line_icons/line_icons.dart';
@@ -27,22 +28,22 @@ class _MainBottomNavbarState extends State<MainBottomNavbar> {
type: BottomNavigationBarType.fixed,
items: [
BottomNavigationBarItem(
icon: LineIcon(LineIcons.home),
icon: HugeIcon(icon: HugeIcons.strokeRoundedHome01),
label: context.lang.home,
tooltip: context.lang.home,
),
BottomNavigationBarItem(
icon: LineIcon(LineIcons.moneyBill),
icon: HugeIcon(icon: HugeIcons.strokeRoundedBorderFull),
label: context.lang.order,
tooltip: context.lang.order,
),
BottomNavigationBarItem(
icon: LineIcon(LineIcons.barChart),
icon: HugeIcon(icon: HugeIcons.strokeRoundedChart03),
label: context.lang.report,
tooltip: context.lang.report,
),
BottomNavigationBarItem(
icon: LineIcon(LineIcons.user),
icon: HugeIcon(icon: HugeIcons.strokeRoundedUser),
label: context.lang.profile,
tooltip: context.lang.profile,
),