feat: lang
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../application/analytic/inventory_analytic_loader/inventory_analytic_loader_bloc.dart';
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../injection.dart';
|
||||
@@ -95,11 +96,11 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
String getStatusText(String status) {
|
||||
switch (status) {
|
||||
case 'available':
|
||||
return 'Tersedia';
|
||||
return context.lang.available;
|
||||
case 'low_stock':
|
||||
return 'Stok Rendah';
|
||||
return context.lang.low_stock;
|
||||
case 'out_of_stock':
|
||||
return 'Habis';
|
||||
return context.lang.out_of_stock;
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
@@ -189,7 +190,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
),
|
||||
child: const Row(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@@ -199,7 +200,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
Text('Produk'),
|
||||
Text(context.lang.product),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -210,7 +211,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
),
|
||||
child: const Row(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@@ -220,7 +221,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
Text('Bahan'),
|
||||
Text(context.lang.ingredients),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -254,7 +255,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
pinned: true,
|
||||
elevation: 0,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: CustomAppBar(title: 'Inventaris'),
|
||||
flexibleSpace: CustomAppBar(title: context.lang.inventory),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -308,7 +309,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Total Produk',
|
||||
context.lang.total_products,
|
||||
inventory.totalProducts.toString(),
|
||||
Icons.inventory_2_rounded,
|
||||
AppColor.primary,
|
||||
@@ -317,7 +318,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Produk Terjual',
|
||||
context.lang.total_sold,
|
||||
inventory.totalSoldProducts.toString(),
|
||||
Icons.check_circle_rounded,
|
||||
AppColor.success,
|
||||
@@ -330,7 +331,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Stok Rendah',
|
||||
context.lang.low_stock,
|
||||
inventory.lowStockProducts.toString(),
|
||||
Icons.warning_rounded,
|
||||
AppColor.warning,
|
||||
@@ -339,7 +340,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Stok Kosong',
|
||||
context.lang.zero_stock,
|
||||
inventory.zeroStockProducts.toString(),
|
||||
Icons.error_rounded,
|
||||
AppColor.error,
|
||||
@@ -361,7 +362,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Total Bahan',
|
||||
context.lang.total_ingredients,
|
||||
inventory.totalIngredients.toString(),
|
||||
Icons.restaurant_menu_rounded,
|
||||
AppColor.primary,
|
||||
@@ -370,7 +371,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Bahan Terjual',
|
||||
context.lang.total_sold,
|
||||
inventory.totalSoldIngredients.toString(),
|
||||
Icons.check_circle_rounded,
|
||||
AppColor.success,
|
||||
@@ -383,7 +384,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Stok Kurang',
|
||||
context.lang.low_stock,
|
||||
inventory.lowStockIngredients.toString(),
|
||||
Icons.warning_rounded,
|
||||
AppColor.warning,
|
||||
@@ -392,7 +393,7 @@ class _InventoryPageState extends State<InventoryPage>
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
'Habis',
|
||||
context.lang.zero_stock,
|
||||
inventory.zeroStockIngredients.toString(),
|
||||
Icons.error_rounded,
|
||||
AppColor.error,
|
||||
|
||||
@@ -182,7 +182,11 @@ class InventoryProductTile extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
_getStatusText(),
|
||||
item.isZeroStock
|
||||
? context.lang.out_of_stock
|
||||
: item.isLowStock
|
||||
? context.lang.low_stock
|
||||
: context.lang.available,
|
||||
style: AppStyle.xs.copyWith(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -202,7 +206,7 @@ class InventoryProductTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildInfoItem(
|
||||
LineIcons.boxes,
|
||||
'Stok',
|
||||
context.lang.stock,
|
||||
'${NumberFormat('#,###', 'id_ID').format(item.quantity)} pcs',
|
||||
_getQuantityColor(),
|
||||
),
|
||||
@@ -212,7 +216,7 @@ class InventoryProductTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildInfoItem(
|
||||
LineIcons.dollarSign,
|
||||
'Nilai',
|
||||
context.lang.value_text,
|
||||
_formatCurrencyShort(item.totalValue),
|
||||
AppColor.info,
|
||||
),
|
||||
@@ -259,14 +263,19 @@ class InventoryProductTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Stok Menipis',
|
||||
context.lang.low_stock,
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.warning,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Segera reorder minimal ${NumberFormat('#,###', 'id_ID').format(item.reorderLevel)} pcs',
|
||||
context.lang.low_stock_desc(
|
||||
NumberFormat(
|
||||
'#,###',
|
||||
'id_ID',
|
||||
).format(item.reorderLevel),
|
||||
),
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -301,14 +310,14 @@ class InventoryProductTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Stok Habis',
|
||||
context.lang.out_of_stock,
|
||||
style: AppStyle.sm.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColor.error,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Produk tidak tersedia untuk dijual',
|
||||
context.lang.out_of_stock_desc,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -330,7 +339,7 @@ class InventoryProductTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildMovementInfo(
|
||||
LineIcons.arrowUp,
|
||||
'Masuk',
|
||||
context.lang.in_text,
|
||||
'${NumberFormat('#,###', 'id_ID').format(item.totalIn)} pcs',
|
||||
AppColor.success,
|
||||
),
|
||||
@@ -341,7 +350,7 @@ class InventoryProductTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildMovementInfo(
|
||||
LineIcons.arrowDown,
|
||||
'Keluar',
|
||||
context.lang.out_text,
|
||||
'${NumberFormat('#,###', 'id_ID').format(item.totalOut)} pcs',
|
||||
AppColor.error,
|
||||
),
|
||||
@@ -476,12 +485,6 @@ class InventoryProductTile extends StatelessWidget {
|
||||
return AppColor.textPrimary;
|
||||
}
|
||||
|
||||
String _getStatusText() {
|
||||
if (item.isZeroStock) return 'HABIS';
|
||||
if (item.isLowStock) return 'MINIM';
|
||||
return 'TERSEDIA';
|
||||
}
|
||||
|
||||
IconData _getCategoryIcon() {
|
||||
final category = item.categoryName.toLowerCase();
|
||||
if (category.contains('elektronik') || category.contains('gadget')) {
|
||||
|
||||
Reference in New Issue
Block a user