feat: update order detail

This commit is contained in:
efrilm
2025-08-08 10:29:17 +07:00
parent 3a07d2e7cc
commit e19d788f47
7 changed files with 401 additions and 225 deletions
+61 -18
View File
@@ -98,23 +98,7 @@ class SalesCard extends StatelessWidget {
],
),
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.green.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Text(
(order.status ?? "").toUpperCase(),
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: 0.5,
),
),
),
_buildStatus(),
],
),
const SizedBox(height: 16),
@@ -122,7 +106,10 @@ class SalesCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
(order.totalAmount ?? 0).currencyFormatRpV2,
order.status == 'pending'
? ((order.totalAmount ?? 0) - (order.totalPaid ?? 0))
.currencyFormatRpV2
: (order.totalAmount ?? 0).currencyFormatRpV2,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
@@ -142,4 +129,60 @@ class SalesCard extends StatelessWidget {
),
);
}
Widget _buildStatus() {
switch (order.status) {
case 'pending':
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.amber.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Text(
(order.status ?? "").toUpperCase(),
style: TextStyle(
color: Colors.amber,
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: 0.5,
),
),
);
case 'completed':
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.green.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Text(
(order.status ?? "").toUpperCase(),
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: 0.5,
),
),
);
default:
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.15),
borderRadius: BorderRadius.circular(16),
),
child: Text(
(order.status ?? "").toUpperCase(),
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: 0.5,
),
),
);
}
}
}