feat: sales page
This commit is contained in:
parent
1fd76b9741
commit
71ebb26227
@ -39,7 +39,7 @@ class HomeFeature extends StatelessWidget {
|
||||
title: 'Penjualan',
|
||||
color: const Color(0xFF4CAF50),
|
||||
icon: LineIcons.receipt,
|
||||
onTap: () {},
|
||||
onTap: () => context.router.push(SalesRoute()),
|
||||
),
|
||||
HomeFeatureTile(
|
||||
title: 'Pembelian',
|
||||
|
||||
652
lib/presentation/pages/sales/sales_page.dart
Normal file
652
lib/presentation/pages/sales/sales_page.dart
Normal file
@ -0,0 +1,652 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../components/spacer/spacer.dart';
|
||||
import 'widgets/appbar.dart';
|
||||
import 'widgets/summary_card.dart';
|
||||
|
||||
// Data Models
|
||||
class SalesData {
|
||||
final String dateFrom;
|
||||
final String dateTo;
|
||||
final SalesSummary summary;
|
||||
final List<DailySales> dailySales;
|
||||
|
||||
SalesData({
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
required this.summary,
|
||||
required this.dailySales,
|
||||
});
|
||||
}
|
||||
|
||||
class SalesSummary {
|
||||
final double totalSales;
|
||||
final int totalOrders;
|
||||
final int totalItems;
|
||||
final double averageOrderValue;
|
||||
final double totalTax;
|
||||
final double totalDiscount;
|
||||
final double netSales;
|
||||
|
||||
SalesSummary({
|
||||
required this.totalSales,
|
||||
required this.totalOrders,
|
||||
required this.totalItems,
|
||||
required this.averageOrderValue,
|
||||
required this.totalTax,
|
||||
required this.totalDiscount,
|
||||
required this.netSales,
|
||||
});
|
||||
}
|
||||
|
||||
class DailySales {
|
||||
final DateTime date;
|
||||
final double sales;
|
||||
final int orders;
|
||||
final int items;
|
||||
final double tax;
|
||||
final double discount;
|
||||
final double netSales;
|
||||
|
||||
DailySales({
|
||||
required this.date,
|
||||
required this.sales,
|
||||
required this.orders,
|
||||
required this.items,
|
||||
required this.tax,
|
||||
required this.discount,
|
||||
required this.netSales,
|
||||
});
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
class SalesPage extends StatefulWidget {
|
||||
const SalesPage({super.key});
|
||||
|
||||
@override
|
||||
State<SalesPage> createState() => _SalesPageState();
|
||||
}
|
||||
|
||||
class _SalesPageState extends State<SalesPage> with TickerProviderStateMixin {
|
||||
late AnimationController rotationAnimationController;
|
||||
late Animation<double> rotationAnimation;
|
||||
|
||||
late AnimationController slideAnimationController;
|
||||
late Animation<Offset> slideAnimation;
|
||||
|
||||
late AnimationController fadeAnimationController;
|
||||
late Animation<double> fadeAnimation;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// Rotation Animation
|
||||
rotationAnimationController = AnimationController(
|
||||
duration: const Duration(seconds: 20),
|
||||
vsync: this,
|
||||
);
|
||||
rotationAnimation =
|
||||
Tween<double>(
|
||||
begin: 0,
|
||||
end: 6.28, // 2 * PI
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: rotationAnimationController,
|
||||
curve: Curves.linear,
|
||||
),
|
||||
);
|
||||
rotationAnimationController.repeat();
|
||||
|
||||
// Slide Animation
|
||||
slideAnimationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 800),
|
||||
vsync: this,
|
||||
);
|
||||
slideAnimation =
|
||||
Tween<Offset>(begin: const Offset(0, 0.3), end: Offset.zero).animate(
|
||||
CurvedAnimation(
|
||||
parent: slideAnimationController,
|
||||
curve: Curves.easeOutCubic,
|
||||
),
|
||||
);
|
||||
|
||||
// Fade Animation
|
||||
fadeAnimationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 600),
|
||||
vsync: this,
|
||||
);
|
||||
fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(parent: fadeAnimationController, curve: Curves.easeOut),
|
||||
);
|
||||
|
||||
// Start animations
|
||||
Future.delayed(const Duration(milliseconds: 300), () {
|
||||
slideAnimationController.forward();
|
||||
fadeAnimationController.forward();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
rotationAnimationController.dispose();
|
||||
slideAnimationController.dispose();
|
||||
fadeAnimationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Sample data based on your JSON
|
||||
final SalesData salesData = SalesData(
|
||||
dateFrom: "2025-08-01T00:00:00+07:00",
|
||||
dateTo: "2025-08-15T23:59:59.999999999+07:00",
|
||||
summary: SalesSummary(
|
||||
totalSales: 4291000,
|
||||
totalOrders: 62,
|
||||
totalItems: 62,
|
||||
averageOrderValue: 69209.67741935483,
|
||||
totalTax: 0,
|
||||
totalDiscount: 0,
|
||||
netSales: 4291000,
|
||||
),
|
||||
dailySales: [
|
||||
DailySales(
|
||||
date: DateTime.parse("2025-08-13T00:00:00Z"),
|
||||
sales: 3841000,
|
||||
orders: 52,
|
||||
items: 52,
|
||||
tax: 0,
|
||||
discount: 0,
|
||||
netSales: 3841000,
|
||||
),
|
||||
DailySales(
|
||||
date: DateTime.parse("2025-08-14T00:00:00Z"),
|
||||
sales: 450000,
|
||||
orders: 10,
|
||||
items: 10,
|
||||
tax: 0,
|
||||
discount: 0,
|
||||
netSales: 450000,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
String formatCurrency(double amount) {
|
||||
return 'Rp ${amount.toStringAsFixed(0).replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]}.')}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.background,
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
// App Bar
|
||||
SliverAppBar(
|
||||
expandedHeight: 120,
|
||||
floating: false,
|
||||
pinned: true,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: SalesAppbar(rotationAnimation: rotationAnimation),
|
||||
),
|
||||
|
||||
// Date Range Header
|
||||
SliverToBoxAdapter(
|
||||
child: SlideTransition(
|
||||
position: slideAnimation,
|
||||
child: FadeTransition(
|
||||
opacity: fadeAnimation,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.date_range, color: AppColor.primary, size: 20),
|
||||
SpaceWidth(8),
|
||||
Text(
|
||||
'Aug 1 - Aug 15, 2025',
|
||||
style: AppStyle.md.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Summary Cards
|
||||
SliverToBoxAdapter(
|
||||
child: SlideTransition(
|
||||
position: slideAnimation,
|
||||
child: FadeTransition(
|
||||
opacity: fadeAnimation,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Summary',
|
||||
style: AppStyle.xxl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
const SpaceHeight(16),
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 800),
|
||||
curve: Curves.elasticOut,
|
||||
builder: (context, value, child) {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildSummaryCard(
|
||||
'Total Sales',
|
||||
formatCurrency(
|
||||
salesData.summary.totalSales,
|
||||
),
|
||||
Icons.trending_up,
|
||||
AppColor.success,
|
||||
0,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
Expanded(
|
||||
child: _buildSummaryCard(
|
||||
'Total Orders',
|
||||
'${salesData.summary.totalOrders}',
|
||||
Icons.shopping_cart,
|
||||
AppColor.info,
|
||||
100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SpaceHeight(12),
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
curve: Curves.elasticOut,
|
||||
builder: (context, value, child) {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildSummaryCard(
|
||||
'Avg Order Value',
|
||||
formatCurrency(
|
||||
salesData.summary.averageOrderValue,
|
||||
),
|
||||
Icons.attach_money,
|
||||
AppColor.warning,
|
||||
200,
|
||||
),
|
||||
),
|
||||
SpaceWidth(12),
|
||||
Expanded(
|
||||
child: _buildSummaryCard(
|
||||
'Total Items',
|
||||
'${salesData.summary.totalItems}',
|
||||
Icons.inventory,
|
||||
AppColor.primary,
|
||||
300,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Net Sales Card
|
||||
SliverToBoxAdapter(
|
||||
child: SlideTransition(
|
||||
position: slideAnimation,
|
||||
child: FadeTransition(
|
||||
opacity: fadeAnimation,
|
||||
child: TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 1200),
|
||||
curve: Curves.bounceOut,
|
||||
builder: (context, value, child) {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: AppColor.successGradient,
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.success.withOpacity(0.3),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 5),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 1500),
|
||||
curve: Curves.elasticOut,
|
||||
builder: (context, iconValue, child) {
|
||||
return Transform.rotate(
|
||||
angle: iconValue * 0.1,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.account_balance_wallet,
|
||||
color: AppColor.textWhite,
|
||||
size: 28,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SpaceWidth(16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Net Sales',
|
||||
style: TextStyle(
|
||||
color: AppColor.textWhite.withOpacity(
|
||||
0.9,
|
||||
),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SpaceHeight(4),
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(
|
||||
begin: 0.0,
|
||||
end: salesData.summary.netSales,
|
||||
),
|
||||
duration: const Duration(
|
||||
milliseconds: 2000,
|
||||
),
|
||||
curve: Curves.easeOutCubic,
|
||||
builder: (context, countValue, child) {
|
||||
return Text(
|
||||
formatCurrency(countValue),
|
||||
style: const TextStyle(
|
||||
color: AppColor.textWhite,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Daily Sales Section Header
|
||||
SliverToBoxAdapter(
|
||||
child: SlideTransition(
|
||||
position: slideAnimation,
|
||||
child: FadeTransition(
|
||||
opacity: fadeAnimation,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Text(
|
||||
'Daily Breakdown',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Daily Sales List
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
final dailySale = salesData.dailySales[index];
|
||||
return SlideTransition(
|
||||
position:
|
||||
Tween<Offset>(
|
||||
begin: Offset(index.isEven ? -1.0 : 1.0, 0),
|
||||
end: Offset.zero,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: slideAnimationController,
|
||||
curve: Interval(
|
||||
0.2 + (index * 0.1),
|
||||
0.8 + (index * 0.1),
|
||||
curve: Curves.easeOutBack,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: FadeTransition(
|
||||
opacity: Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: fadeAnimationController,
|
||||
curve: Interval(
|
||||
0.3 + (index * 0.1),
|
||||
0.9 + (index * 0.1),
|
||||
curve: Curves.easeOut,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _buildDailySalesItem(dailySale),
|
||||
),
|
||||
),
|
||||
);
|
||||
}, childCount: salesData.dailySales.length),
|
||||
),
|
||||
|
||||
// Bottom Padding
|
||||
const SliverToBoxAdapter(child: SpaceHeight(32)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSummaryCard(
|
||||
String title,
|
||||
String value,
|
||||
IconData icon,
|
||||
Color color,
|
||||
int delay,
|
||||
) {
|
||||
return SalesSummaryCard(
|
||||
fadeAnimation: fadeAnimation,
|
||||
title: title,
|
||||
value: value,
|
||||
icon: icon,
|
||||
color: color,
|
||||
delay: delay,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDailySalesItem(DailySales dailySale) {
|
||||
return ExpansionTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(Icons.calendar_today, color: AppColor.primary, size: 20),
|
||||
),
|
||||
title: Text(
|
||||
'${dailySale.date.day}/${dailySale.date.month}/${dailySale.date.year}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
formatCurrency(dailySale.sales),
|
||||
style: TextStyle(
|
||||
color: AppColor.success,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.info.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
'${dailySale.orders} orders',
|
||||
style: TextStyle(
|
||||
color: AppColor.info,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildDetailItem(
|
||||
'Items',
|
||||
'${dailySale.items}',
|
||||
Icons.inventory_2,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildDetailItem(
|
||||
'Tax',
|
||||
formatCurrency(dailySale.tax),
|
||||
Icons.receipt,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _buildDetailItem(
|
||||
'Discount',
|
||||
formatCurrency(dailySale.discount),
|
||||
Icons.local_offer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailItem(String label, String value, IconData icon) {
|
||||
return TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 600),
|
||||
curve: Curves.bounceOut,
|
||||
builder: (context, animValue, child) {
|
||||
return Transform.scale(
|
||||
scale: animValue,
|
||||
child: Column(
|
||||
children: [
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: const Duration(milliseconds: 800),
|
||||
curve: Curves.elasticOut,
|
||||
builder: (context, iconValue, child) {
|
||||
return Transform.rotate(
|
||||
angle: iconValue * 0.1,
|
||||
child: Icon(icon, color: AppColor.textSecondary, size: 20),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(color: AppColor.textSecondary, fontSize: 12),
|
||||
),
|
||||
const SpaceHeight(2),
|
||||
AnimatedBuilder(
|
||||
animation: fadeAnimation,
|
||||
builder: (context, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
96
lib/presentation/pages/sales/widgets/appbar.dart
Normal file
96
lib/presentation/pages/sales/widgets/appbar.dart
Normal file
@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
|
||||
class SalesAppbar extends StatelessWidget {
|
||||
const SalesAppbar({super.key, required this.rotationAnimation});
|
||||
|
||||
final Animation<double> rotationAnimation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FlexibleSpaceBar(
|
||||
titlePadding: const EdgeInsets.only(left: 50, bottom: 16),
|
||||
title: Text(
|
||||
'Penjualan',
|
||||
style: AppStyle.xl.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
background: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: AppColor.primaryGradient,
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
right: -20,
|
||||
top: -20,
|
||||
child: AnimatedBuilder(
|
||||
animation: rotationAnimation,
|
||||
builder: (context, child) {
|
||||
return Transform.rotate(
|
||||
angle: rotationAnimation.value,
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.white.withOpacity(0.1),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: -30,
|
||||
bottom: -30,
|
||||
child: AnimatedBuilder(
|
||||
animation: rotationAnimation,
|
||||
builder: (context, child) {
|
||||
return Transform.rotate(
|
||||
angle: -rotationAnimation.value * 0.5,
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.white.withOpacity(0.05),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 80,
|
||||
bottom: 30,
|
||||
child: AnimatedBuilder(
|
||||
animation: rotationAnimation,
|
||||
builder: (context, child) {
|
||||
return Transform.rotate(
|
||||
angle: -rotationAnimation.value * 0.2,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: AppColor.white.withOpacity(0.08),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
101
lib/presentation/pages/sales/widgets/summary_card.dart
Normal file
101
lib/presentation/pages/sales/widgets/summary_card.dart
Normal file
@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
|
||||
class SalesSummaryCard extends StatelessWidget {
|
||||
const SalesSummaryCard({
|
||||
super.key,
|
||||
required this.fadeAnimation,
|
||||
required this.title,
|
||||
required this.value,
|
||||
required this.icon,
|
||||
required this.color,
|
||||
required this.delay,
|
||||
});
|
||||
|
||||
final Animation<double> fadeAnimation;
|
||||
final String title;
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final int delay;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: Duration(milliseconds: 800 + delay),
|
||||
curve: Curves.easeOutBack,
|
||||
builder: (context, animValue, child) {
|
||||
return Transform.scale(
|
||||
scale: animValue,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
TweenAnimationBuilder<double>(
|
||||
tween: Tween(begin: 0.0, end: 1.0),
|
||||
duration: Duration(milliseconds: 1000 + delay),
|
||||
curve: Curves.bounceOut,
|
||||
builder: (context, iconValue, child) {
|
||||
return Transform.scale(
|
||||
scale: iconValue,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 20),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
AnimatedBuilder(
|
||||
animation: fadeAnimation,
|
||||
builder: (context, child) {
|
||||
return Text(
|
||||
value,
|
||||
style: AppStyle.xl.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -39,5 +39,8 @@ class AppRouter extends RootStackRouter {
|
||||
|
||||
// Inventory
|
||||
AutoRoute(page: InventoryRoute.page),
|
||||
|
||||
// Sales
|
||||
AutoRoute(page: SalesRoute.page),
|
||||
];
|
||||
}
|
||||
|
||||
@ -29,23 +29,25 @@ import 'package:apskel_owner_flutter/presentation/pages/profile/profile_page.dar
|
||||
as _i9;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/report/report_page.dart'
|
||||
as _i10;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/sales/sales_page.dart'
|
||||
as _i11;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
|
||||
as _i12;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/transaction/transaction_page.dart'
|
||||
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
|
||||
as _i13;
|
||||
import 'package:auto_route/auto_route.dart' as _i14;
|
||||
import 'package:apskel_owner_flutter/presentation/pages/transaction/transaction_page.dart'
|
||||
as _i14;
|
||||
import 'package:auto_route/auto_route.dart' as _i15;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.CustomerPage]
|
||||
class CustomerRoute extends _i14.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i14.PageRouteInfo>? children})
|
||||
class CustomerRoute extends _i15.PageRouteInfo<void> {
|
||||
const CustomerRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(CustomerRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'CustomerRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i1.CustomerPage();
|
||||
@ -55,13 +57,13 @@ class CustomerRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.DailyTasksFormPage]
|
||||
class DailyTasksFormRoute extends _i14.PageRouteInfo<void> {
|
||||
const DailyTasksFormRoute({List<_i14.PageRouteInfo>? children})
|
||||
class DailyTasksFormRoute extends _i15.PageRouteInfo<void> {
|
||||
const DailyTasksFormRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(DailyTasksFormRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'DailyTasksFormRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i2.DailyTasksFormPage();
|
||||
@ -71,13 +73,13 @@ class DailyTasksFormRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i3.HomePage]
|
||||
class HomeRoute extends _i14.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i14.PageRouteInfo>? children})
|
||||
class HomeRoute extends _i15.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i3.HomePage();
|
||||
@ -87,13 +89,13 @@ class HomeRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.InventoryPage]
|
||||
class InventoryRoute extends _i14.PageRouteInfo<void> {
|
||||
const InventoryRoute({List<_i14.PageRouteInfo>? children})
|
||||
class InventoryRoute extends _i15.PageRouteInfo<void> {
|
||||
const InventoryRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(InventoryRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'InventoryRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i4.InventoryPage();
|
||||
@ -103,13 +105,13 @@ class InventoryRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i5.LanguagePage]
|
||||
class LanguageRoute extends _i14.PageRouteInfo<void> {
|
||||
const LanguageRoute({List<_i14.PageRouteInfo>? children})
|
||||
class LanguageRoute extends _i15.PageRouteInfo<void> {
|
||||
const LanguageRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(LanguageRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LanguageRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.LanguagePage();
|
||||
@ -119,13 +121,13 @@ class LanguageRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.LoginPage]
|
||||
class LoginRoute extends _i14.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i14.PageRouteInfo>? children})
|
||||
class LoginRoute extends _i15.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(LoginRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i6.LoginPage();
|
||||
@ -135,13 +137,13 @@ class LoginRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i7.MainPage]
|
||||
class MainRoute extends _i14.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i14.PageRouteInfo>? children})
|
||||
class MainRoute extends _i15.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(MainRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'MainRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i7.MainPage();
|
||||
@ -151,13 +153,13 @@ class MainRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i8.ProductPage]
|
||||
class ProductRoute extends _i14.PageRouteInfo<void> {
|
||||
const ProductRoute({List<_i14.PageRouteInfo>? children})
|
||||
class ProductRoute extends _i15.PageRouteInfo<void> {
|
||||
const ProductRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(ProductRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ProductRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i8.ProductPage();
|
||||
@ -167,13 +169,13 @@ class ProductRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i9.ProfilePage]
|
||||
class ProfileRoute extends _i14.PageRouteInfo<void> {
|
||||
const ProfileRoute({List<_i14.PageRouteInfo>? children})
|
||||
class ProfileRoute extends _i15.PageRouteInfo<void> {
|
||||
const ProfileRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(ProfileRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ProfileRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.ProfilePage();
|
||||
@ -183,13 +185,13 @@ class ProfileRoute extends _i14.PageRouteInfo<void> {
|
||||
|
||||
/// generated route for
|
||||
/// [_i10.ReportPage]
|
||||
class ReportRoute extends _i14.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i14.PageRouteInfo>? children})
|
||||
class ReportRoute extends _i15.PageRouteInfo<void> {
|
||||
const ReportRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(ReportRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ReportRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i10.ReportPage();
|
||||
@ -198,49 +200,65 @@ class ReportRoute extends _i14.PageRouteInfo<void> {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.SchedulePage]
|
||||
class ScheduleRoute extends _i14.PageRouteInfo<void> {
|
||||
const ScheduleRoute({List<_i14.PageRouteInfo>? children})
|
||||
/// [_i11.SalesPage]
|
||||
class SalesRoute extends _i15.PageRouteInfo<void> {
|
||||
const SalesRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(SalesRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SalesRoute';
|
||||
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.SalesPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.SchedulePage]
|
||||
class ScheduleRoute extends _i15.PageRouteInfo<void> {
|
||||
const ScheduleRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(ScheduleRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'ScheduleRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.SchedulePage();
|
||||
return const _i12.SchedulePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i12.SplashPage]
|
||||
class SplashRoute extends _i14.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i14.PageRouteInfo>? children})
|
||||
/// [_i13.SplashPage]
|
||||
class SplashRoute extends _i15.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(SplashRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i12.SplashPage();
|
||||
return const _i13.SplashPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i13.TransactionPage]
|
||||
class TransactionRoute extends _i14.PageRouteInfo<void> {
|
||||
const TransactionRoute({List<_i14.PageRouteInfo>? children})
|
||||
/// [_i14.TransactionPage]
|
||||
class TransactionRoute extends _i15.PageRouteInfo<void> {
|
||||
const TransactionRoute({List<_i15.PageRouteInfo>? children})
|
||||
: super(TransactionRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'TransactionRoute';
|
||||
|
||||
static _i14.PageInfo page = _i14.PageInfo(
|
||||
static _i15.PageInfo page = _i15.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i13.TransactionPage();
|
||||
return const _i14.TransactionPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user