null safety
This commit is contained in:
@@ -73,26 +73,28 @@ class ProfitLossWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF0F172A),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF0F172A),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'Analisis profitabilitas dan margin keuntungan',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'Analisis profitabilitas dan margin keuntungan',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
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(
|
||||
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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user