null safety
This commit is contained in:
parent
6acfbdc4ca
commit
3022d8de9f
@ -160,7 +160,7 @@ class InventoryProductItem {
|
|||||||
final String categoryName;
|
final String categoryName;
|
||||||
final int quantity;
|
final int quantity;
|
||||||
final int reorderLevel;
|
final int reorderLevel;
|
||||||
final int unitCost;
|
final num unitCost;
|
||||||
final int totalValue;
|
final int totalValue;
|
||||||
final int totalIn;
|
final int totalIn;
|
||||||
final int totalOut;
|
final int totalOut;
|
||||||
@ -228,7 +228,7 @@ class InventoryIngredientItem {
|
|||||||
final String unitName;
|
final String unitName;
|
||||||
final int quantity;
|
final int quantity;
|
||||||
final int reorderLevel;
|
final int reorderLevel;
|
||||||
final int unitCost;
|
final num unitCost;
|
||||||
final int totalValue;
|
final int totalValue;
|
||||||
final int totalIn;
|
final int totalIn;
|
||||||
final int totalOut;
|
final int totalOut;
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class PaymentMethodAnalyticItem {
|
|||||||
final int totalAmount;
|
final int totalAmount;
|
||||||
final int orderCount;
|
final int orderCount;
|
||||||
final int paymentCount;
|
final int paymentCount;
|
||||||
final int percentage;
|
final num percentage;
|
||||||
|
|
||||||
PaymentMethodAnalyticItem({
|
PaymentMethodAnalyticItem({
|
||||||
required this.paymentMethodId,
|
required this.paymentMethodId,
|
||||||
|
|||||||
@ -98,12 +98,12 @@ class ProfitLossData {
|
|||||||
|
|
||||||
class ProfitLossSummary {
|
class ProfitLossSummary {
|
||||||
final int totalRevenue;
|
final int totalRevenue;
|
||||||
final int totalCost;
|
final num totalCost;
|
||||||
final int grossProfit;
|
final num grossProfit;
|
||||||
final double grossProfitMargin;
|
final double grossProfitMargin;
|
||||||
final int totalTax;
|
final int totalTax;
|
||||||
final int totalDiscount;
|
final int totalDiscount;
|
||||||
final int netProfit;
|
final num netProfit;
|
||||||
final double netProfitMargin;
|
final double netProfitMargin;
|
||||||
final int totalOrders;
|
final int totalOrders;
|
||||||
final double averageProfit;
|
final double averageProfit;
|
||||||
@ -159,12 +159,12 @@ class ProfitLossSummary {
|
|||||||
class ProfitLossItem {
|
class ProfitLossItem {
|
||||||
final String date;
|
final String date;
|
||||||
final int revenue;
|
final int revenue;
|
||||||
final int cost;
|
final num cost;
|
||||||
final int grossProfit;
|
final num grossProfit;
|
||||||
final double grossProfitMargin;
|
final double grossProfitMargin;
|
||||||
final int tax;
|
final int tax;
|
||||||
final int discount;
|
final int discount;
|
||||||
final int netProfit;
|
final num netProfit;
|
||||||
final double netProfitMargin;
|
final double netProfitMargin;
|
||||||
final int orders;
|
final int orders;
|
||||||
|
|
||||||
@ -219,12 +219,12 @@ class ProfitLossProduct {
|
|||||||
final String categoryName;
|
final String categoryName;
|
||||||
final int quantitySold;
|
final int quantitySold;
|
||||||
final int revenue;
|
final int revenue;
|
||||||
final int cost;
|
final num cost;
|
||||||
final int grossProfit;
|
final num grossProfit;
|
||||||
final double grossProfitMargin;
|
final double grossProfitMargin;
|
||||||
final int averagePrice;
|
final int averagePrice;
|
||||||
final int averageCost;
|
final num averageCost;
|
||||||
final int profitPerUnit;
|
final num profitPerUnit;
|
||||||
|
|
||||||
ProfitLossProduct({
|
ProfitLossProduct({
|
||||||
required this.productId,
|
required this.productId,
|
||||||
|
|||||||
@ -73,26 +73,28 @@ class ProfitLossWidget extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Expanded(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(
|
children: [
|
||||||
title,
|
Text(
|
||||||
style: TextStyle(
|
title,
|
||||||
fontSize: 18,
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontSize: 18,
|
||||||
color: Color(0xFF0F172A),
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xFF0F172A),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 6),
|
||||||
const SizedBox(height: 6),
|
Text(
|
||||||
Text(
|
'Analisis profitabilitas dan margin keuntungan',
|
||||||
'Analisis profitabilitas dan margin keuntungan',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 14,
|
||||||
fontSize: 14,
|
color: Colors.grey[600],
|
||||||
color: Colors.grey[600],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||||
@ -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(
|
return Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -722,7 +724,7 @@ class ProfitLossWidget extends StatelessWidget {
|
|||||||
sections: breakdownData.asMap().entries.map((entry) {
|
sections: breakdownData.asMap().entries.map((entry) {
|
||||||
final item = entry.value;
|
final item = entry.value;
|
||||||
final grossProfit = data.summary.grossProfit;
|
final grossProfit = data.summary.grossProfit;
|
||||||
final value = item['value'] as int;
|
final value = item['value'] as num;
|
||||||
|
|
||||||
// Handle division by zero
|
// Handle division by zero
|
||||||
final percentage =
|
final percentage =
|
||||||
@ -772,7 +774,7 @@ class ProfitLossWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
_formatCurrency(item['value'] as int),
|
_formatCurrency(item['value'] as num),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -1154,7 +1156,7 @@ class ProfitLossWidget extends StatelessWidget {
|
|||||||
return AppColorProfitLoss.danger;
|
return AppColorProfitLoss.danger;
|
||||||
}
|
}
|
||||||
|
|
||||||
String _formatCurrency(int amount) {
|
String _formatCurrency(num amount) {
|
||||||
final formatter = NumberFormat.currency(
|
final formatter = NumberFormat.currency(
|
||||||
locale: 'id_ID',
|
locale: 'id_ID',
|
||||||
symbol: 'Rp ',
|
symbol: 'Rp ',
|
||||||
@ -1163,7 +1165,7 @@ class ProfitLossWidget extends StatelessWidget {
|
|||||||
return formatter.format(amount);
|
return formatter.format(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _formatCurrencyShort(int amount) {
|
String _formatCurrencyShort(num amount) {
|
||||||
if (amount >= 1000000) {
|
if (amount >= 1000000) {
|
||||||
return 'Rp ${(amount / 1000000).round()}M';
|
return 'Rp ${(amount / 1000000).round()}M';
|
||||||
} else if (amount >= 1000) {
|
} else if (amount >= 1000) {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
vertical: 12.0,
|
vertical: 12.0,
|
||||||
),
|
),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: context.deviceHeight * 0.1,
|
height: context.deviceHeight * 0.12,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: AppColors.white,
|
color: AppColors.white,
|
||||||
border: Border(
|
border: Border(
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
vertical: 12.0,
|
vertical: 12.0,
|
||||||
),
|
),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: context.deviceHeight * 0.1,
|
height: context.deviceHeight * 0.12,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: AppColors.white,
|
color: AppColors.white,
|
||||||
border: Border(
|
border: Border(
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class SettingsTitle extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
height: context.deviceHeight * 0.1,
|
height: context.deviceHeight * 0.12,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.white,
|
color: AppColors.white,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user