feat: lang
This commit is contained in:
@@ -57,7 +57,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Payment Methods',
|
||||
context.lang.payment_methods,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
@@ -65,7 +65,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Revenue breakdown by payment method',
|
||||
context.lang.payment_methods_desc,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
),
|
||||
@@ -80,7 +80,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
|
||||
// Payment Method List
|
||||
if (paymentMethods.isEmpty)
|
||||
_buildEmptyState()
|
||||
_buildEmptyState(context)
|
||||
else
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
@@ -190,12 +190,12 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Stats row with better spacing
|
||||
_buildStatsSection(method),
|
||||
_buildStatsSection(context, method),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Enhanced progress bar section
|
||||
_buildProgressSection(method, index),
|
||||
_buildProgressSection(context, method, index),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -410,7 +410,10 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatsSection(DashboardPaymentMethod method) {
|
||||
Widget _buildStatsSection(
|
||||
BuildContext context,
|
||||
DashboardPaymentMethod method,
|
||||
) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -426,7 +429,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Total Revenue',
|
||||
context.lang.total_revenue,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -457,7 +460,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'Orders',
|
||||
context.lang.orders,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -480,7 +483,11 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgressSection(DashboardPaymentMethod method, int index) {
|
||||
Widget _buildProgressSection(
|
||||
BuildContext context,
|
||||
DashboardPaymentMethod method,
|
||||
int index,
|
||||
) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -488,7 +495,7 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Revenue Share',
|
||||
context.lang.revenue_share,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -560,11 +567,10 @@ class ReportPaymentMethod extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmptyState() {
|
||||
Widget _buildEmptyState(BuildContext context) {
|
||||
return EmptyWidget(
|
||||
title: 'No Payment Methods',
|
||||
message:
|
||||
'Payment method data will appear here once transactions are made',
|
||||
title: context.lang.no_payment_methods,
|
||||
message: context.lang.no_payment_methods_desc,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class ReportQuickStats extends StatelessWidget {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: ReportStatTile(
|
||||
title: 'Total Orders',
|
||||
title: context.lang.total_orders,
|
||||
value: overview.totalOrders.toString(),
|
||||
icon: Icons.receipt_long,
|
||||
color: AppColor.info,
|
||||
@@ -43,7 +43,7 @@ class ReportQuickStats extends StatelessWidget {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: ReportStatTile(
|
||||
title: 'Average Order',
|
||||
title: context.lang.average_price,
|
||||
value: overview.averageOrderValue
|
||||
.round()
|
||||
.currencyFormatRp,
|
||||
@@ -70,7 +70,7 @@ class ReportQuickStats extends StatelessWidget {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: ReportStatTile(
|
||||
title: 'Customers',
|
||||
title: context.lang.customer,
|
||||
value: overview.totalCustomers.toString(),
|
||||
icon: Icons.people,
|
||||
color: AppColor.success,
|
||||
@@ -89,7 +89,8 @@ class ReportQuickStats extends StatelessWidget {
|
||||
return Transform.scale(
|
||||
scale: value,
|
||||
child: ReportStatTile(
|
||||
title: 'Void + Refund',
|
||||
title:
|
||||
'${context.lang.void_text} + ${context.lang.refund}',
|
||||
value: (overview.voidedOrders + overview.refundedOrders)
|
||||
.toString(),
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class ReportRevenueSummary extends StatelessWidget {
|
||||
),
|
||||
const SpaceWidth(12),
|
||||
Text(
|
||||
'Total Pendapatan',
|
||||
context.lang.total_revenue,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@@ -37,7 +37,7 @@ class ReportSales extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Sales Chart',
|
||||
context.lang.sales_chart,
|
||||
style: AppStyle.xxl.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -46,8 +46,8 @@ class ReportSales extends StatelessWidget {
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
salesData.isEmpty
|
||||
? 'No data available'
|
||||
: '${salesData.length} days overview',
|
||||
? context.lang.no_data_available
|
||||
: context.lang.total_days_overview(salesData.length),
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
],
|
||||
@@ -71,13 +71,13 @@ class ReportSales extends StatelessWidget {
|
||||
|
||||
// Sales Summary Cards
|
||||
if (salesData.isNotEmpty) ...[
|
||||
_buildSalesSummary(),
|
||||
_buildSalesSummary(context),
|
||||
const SpaceHeight(20),
|
||||
],
|
||||
|
||||
// Chart Container
|
||||
salesData.isEmpty
|
||||
? _buildEmptyChart()
|
||||
? _buildEmptyChart(context)
|
||||
: Container(
|
||||
height: 300,
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -105,14 +105,16 @@ class ReportSales extends StatelessWidget {
|
||||
if (salesData.isNotEmpty)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [_buildLegendItem('Sales Data', AppColor.primary)],
|
||||
children: [
|
||||
_buildLegendItem(context.lang.sales_data, AppColor.primary),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSalesSummary() {
|
||||
Widget _buildSalesSummary(BuildContext context) {
|
||||
final totalSales = salesData.fold<int>(0, (sum, item) => sum + item.sales);
|
||||
final totalOrders = salesData.fold<int>(
|
||||
0,
|
||||
@@ -137,7 +139,7 @@ class ReportSales extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildSummaryItem(
|
||||
'Total Sales',
|
||||
context.lang.total_sales,
|
||||
totalSales.currencyFormatRp,
|
||||
Icons.attach_money,
|
||||
AppColor.success,
|
||||
@@ -151,7 +153,7 @@ class ReportSales extends StatelessWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: _buildSummaryItem(
|
||||
'Net Sales',
|
||||
context.lang.net_sales,
|
||||
totalNetSales.currencyFormatRp,
|
||||
Icons.trending_up,
|
||||
AppColor.primary,
|
||||
@@ -164,7 +166,7 @@ class ReportSales extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildSummaryItem(
|
||||
'Total Orders',
|
||||
context.lang.total_orders,
|
||||
totalOrders.toString(),
|
||||
Icons.shopping_cart,
|
||||
AppColor.info,
|
||||
@@ -178,7 +180,7 @@ class ReportSales extends StatelessWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: _buildSummaryItem(
|
||||
'Total Items',
|
||||
context.lang.total_items,
|
||||
totalItems.toString(),
|
||||
Icons.inventory,
|
||||
AppColor.warning,
|
||||
@@ -204,11 +206,15 @@ class ReportSales extends StatelessWidget {
|
||||
children: [
|
||||
Icon(icon, size: 16, color: color),
|
||||
const SpaceWidth(6),
|
||||
Text(
|
||||
label,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -395,10 +401,10 @@ class ReportSales extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmptyChart() {
|
||||
Widget _buildEmptyChart(BuildContext context) {
|
||||
return EmptyWidget(
|
||||
title: 'No Sales Data',
|
||||
message: 'Sales data will appear here once transactions are recorded',
|
||||
title: context.lang.no_sales_data,
|
||||
message: context.lang.no_sales_data_desc,
|
||||
emptyIcon: Icons.show_chart,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Produk Terlaris',
|
||||
context.lang.best_selling_products,
|
||||
style: AppStyle.xxl.copyWith(
|
||||
color: AppColor.textPrimary,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -42,7 +42,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
),
|
||||
const SpaceHeight(4),
|
||||
Text(
|
||||
'Ranking penjualan tertinggi',
|
||||
context.lang.highest_sales_ranking,
|
||||
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||
),
|
||||
],
|
||||
@@ -66,7 +66,11 @@ class ReportTopProduct extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildEnhancedProductItem(products[index], index + 1);
|
||||
return _buildEnhancedProductItem(
|
||||
context,
|
||||
products[index],
|
||||
index + 1,
|
||||
);
|
||||
},
|
||||
itemCount: products.length,
|
||||
),
|
||||
@@ -75,7 +79,11 @@ class ReportTopProduct extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEnhancedProductItem(DashboardTopProduct product, int rank) {
|
||||
Widget _buildEnhancedProductItem(
|
||||
BuildContext context,
|
||||
DashboardTopProduct product,
|
||||
int rank,
|
||||
) {
|
||||
final isFirst = rank == 1;
|
||||
final isTopThree = rank <= 3;
|
||||
|
||||
@@ -320,7 +328,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
const SpaceWidth(3),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Revenue',
|
||||
context.lang.revenue,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -364,7 +372,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Avg. Price',
|
||||
context.lang.average_price,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -423,7 +431,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
const SpaceWidth(3),
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Sold',
|
||||
context.lang.sold,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -465,7 +473,7 @@ class ReportTopProduct extends StatelessWidget {
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
'Orders',
|
||||
context.lang.orders,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -543,7 +551,9 @@ class ReportTopProduct extends StatelessWidget {
|
||||
const SpaceWidth(5),
|
||||
Flexible(
|
||||
child: Text(
|
||||
isFirst ? 'Best Seller' : 'Top Performer',
|
||||
isFirst
|
||||
? context.lang.best_seller
|
||||
: context.lang.top_performer,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: isFirst
|
||||
? AppColor.warning
|
||||
|
||||
Reference in New Issue
Block a user