feat: change total to amount
Build Android APK (split per ABI) / build-apk (push) Waiting to run
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run

This commit is contained in:
efrilm
2026-10-20 18:22:02 +07:00
parent 7c8b36b65d
commit 24f94fa747
11 changed files with 326 additions and 87 deletions
@@ -3,6 +3,7 @@ import 'package:shimmer/shimmer.dart';
import '../../../../../common/extension/extension.dart';
import '../../../../../common/theme/theme.dart';
import '../../../../../domain/order/order.dart';
import '../../../../components/spacer/spacer.dart';
import '../../../../components/widgets/particle_card.dart';
@@ -10,8 +11,8 @@ import '../../../../components/widgets/particle_card.dart';
const Color _pendingColor = Color(0xFFFFB300);
class OrderSummary extends StatelessWidget {
final int totalOrder;
final int totalPendingOrder;
final OrderTotal totalOrder;
final OrderTotal totalPendingOrder;
final bool isLoading;
const OrderSummary({
@@ -23,8 +24,8 @@ class OrderSummary extends StatelessWidget {
@override
Widget build(BuildContext context) {
final pendingRatio = totalOrder > 0
? (totalPendingOrder / totalOrder).clamp(0.0, 1.0)
final pendingRatio = totalOrder.count > 0
? (totalPendingOrder.count / totalOrder.count).clamp(0.0, 1.0)
: 0.0;
return ParticleCard(
@@ -39,7 +40,8 @@ class OrderSummary extends StatelessWidget {
Expanded(
child: _SummaryStat(
title: context.lang.total_orders,
value: totalOrder,
value: totalOrder.count,
amount: totalOrder.amount,
icon: Icons.receipt_long_rounded,
iconBackground: AppColor.white.withOpacity(0.2),
isLoading: isLoading,
@@ -53,7 +55,8 @@ class OrderSummary extends StatelessWidget {
Expanded(
child: _SummaryStat(
title: context.lang.pending_order,
value: totalPendingOrder,
value: totalPendingOrder.count,
amount: totalPendingOrder.amount,
icon: Icons.hourglass_top_rounded,
iconBackground: _pendingColor,
isLoading: isLoading,
@@ -83,6 +86,7 @@ class OrderSummary extends StatelessWidget {
class _SummaryStat extends StatelessWidget {
final String title;
final int value;
final int amount;
final IconData icon;
final Color iconBackground;
final bool isLoading;
@@ -90,6 +94,7 @@ class _SummaryStat extends StatelessWidget {
const _SummaryStat({
required this.title,
required this.value,
required this.amount,
required this.icon,
required this.iconBackground,
required this.isLoading,
@@ -125,20 +130,11 @@ class _SummaryStat extends StatelessWidget {
],
),
const SpaceHeight(12),
if (isLoading)
Shimmer.fromColors(
baseColor: AppColor.white.withOpacity(0.2),
highlightColor: AppColor.white.withOpacity(0.45),
child: Container(
width: 56,
height: 30,
decoration: BoxDecoration(
color: AppColor.white,
borderRadius: BorderRadius.circular(6),
),
),
)
else
if (isLoading) ...[
_shimmerBox(width: 56, height: 30),
const SpaceHeight(6),
_shimmerBox(width: 96, height: 16),
] else ...[
TweenAnimationBuilder<int>(
tween: IntTween(begin: 0, end: value),
duration: const Duration(milliseconds: 900),
@@ -160,11 +156,45 @@ class _SummaryStat extends StatelessWidget {
),
),
),
const SpaceHeight(6),
TweenAnimationBuilder<int>(
tween: IntTween(begin: 0, end: amount),
duration: const Duration(milliseconds: 900),
curve: Curves.easeOutCubic,
builder: (context, animatedValue, _) => FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
child: Text(
animatedValue.currencyFormatRp,
maxLines: 1,
style: AppStyle.md.copyWith(
color: AppColor.white.withOpacity(0.9),
fontWeight: FontWeight.w700,
),
),
),
),
],
],
);
}
}
Widget _shimmerBox({required double width, required double height}) {
return Shimmer.fromColors(
baseColor: AppColor.white.withOpacity(0.2),
highlightColor: AppColor.white.withOpacity(0.45),
child: Container(
width: width,
height: height,
decoration: BoxDecoration(
color: AppColor.white,
borderRadius: BorderRadius.circular(6),
),
),
);
}
class _PendingRatioBar extends StatelessWidget {
final double ratio;