null safety

This commit is contained in:
efrilm 2025-09-19 19:12:35 +07:00
parent 6acfbdc4ca
commit 3022d8de9f
7 changed files with 41 additions and 39 deletions

View File

@ -160,7 +160,7 @@ class InventoryProductItem {
final String categoryName;
final int quantity;
final int reorderLevel;
final int unitCost;
final num unitCost;
final int totalValue;
final int totalIn;
final int totalOut;
@ -228,7 +228,7 @@ class InventoryIngredientItem {
final String unitName;
final int quantity;
final int reorderLevel;
final int unitCost;
final num unitCost;
final int totalValue;
final int totalIn;
final int totalOut;

View File

@ -132,7 +132,7 @@ class PaymentMethodAnalyticItem {
final int totalAmount;
final int orderCount;
final int paymentCount;
final int percentage;
final num percentage;
PaymentMethodAnalyticItem({
required this.paymentMethodId,

View File

@ -98,12 +98,12 @@ class ProfitLossData {
class ProfitLossSummary {
final int totalRevenue;
final int totalCost;
final int grossProfit;
final num totalCost;
final num grossProfit;
final double grossProfitMargin;
final int totalTax;
final int totalDiscount;
final int netProfit;
final num netProfit;
final double netProfitMargin;
final int totalOrders;
final double averageProfit;
@ -159,12 +159,12 @@ class ProfitLossSummary {
class ProfitLossItem {
final String date;
final int revenue;
final int cost;
final int grossProfit;
final num cost;
final num grossProfit;
final double grossProfitMargin;
final int tax;
final int discount;
final int netProfit;
final num netProfit;
final double netProfitMargin;
final int orders;
@ -219,12 +219,12 @@ class ProfitLossProduct {
final String categoryName;
final int quantitySold;
final int revenue;
final int cost;
final int grossProfit;
final num cost;
final num grossProfit;
final double grossProfitMargin;
final int averagePrice;
final int averageCost;
final int profitPerUnit;
final num averageCost;
final num profitPerUnit;
ProfitLossProduct({
required this.productId,

View File

@ -73,7 +73,8 @@ class ProfitLossWidget extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@ -94,6 +95,7 @@ class ProfitLossWidget extends StatelessWidget {
),
],
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
decoration: BoxDecoration(
@ -628,7 +630,7 @@ class ProfitLossWidget extends StatelessWidget {
);
}
Widget _buildProductMetric(String label, int value, Color color) {
Widget _buildProductMetric(String label, num value, Color color) {
return Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
@ -722,7 +724,7 @@ class ProfitLossWidget extends StatelessWidget {
sections: breakdownData.asMap().entries.map((entry) {
final item = entry.value;
final grossProfit = data.summary.grossProfit;
final value = item['value'] as int;
final value = item['value'] as num;
// Handle division by zero
final percentage =
@ -772,7 +774,7 @@ class ProfitLossWidget extends StatelessWidget {
),
),
Text(
_formatCurrency(item['value'] as int),
_formatCurrency(item['value'] as num),
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
@ -1154,7 +1156,7 @@ class ProfitLossWidget extends StatelessWidget {
return AppColorProfitLoss.danger;
}
String _formatCurrency(int amount) {
String _formatCurrency(num amount) {
final formatter = NumberFormat.currency(
locale: 'id_ID',
symbol: 'Rp ',
@ -1163,7 +1165,7 @@ class ProfitLossWidget extends StatelessWidget {
return formatter.format(amount);
}
String _formatCurrencyShort(int amount) {
String _formatCurrencyShort(num amount) {
if (amount >= 1000000) {
return 'Rp ${(amount / 1000000).round()}M';
} else if (amount >= 1000) {

View File

@ -41,7 +41,7 @@ class _SettingPageState extends State<SettingPage> {
vertical: 12.0,
),
width: double.infinity,
height: context.deviceHeight * 0.1,
height: context.deviceHeight * 0.12,
decoration: const BoxDecoration(
color: AppColors.white,
border: Border(

View File

@ -63,7 +63,7 @@ class _SettingsPageState extends State<SettingsPage> {
vertical: 12.0,
),
width: double.infinity,
height: context.deviceHeight * 0.1,
height: context.deviceHeight * 0.12,
decoration: const BoxDecoration(
color: AppColors.white,
border: Border(

View File

@ -23,7 +23,7 @@ class SettingsTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: context.deviceHeight * 0.1,
height: context.deviceHeight * 0.12,
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
decoration: BoxDecoration(
color: AppColors.white,