minor changes

This commit is contained in:
divya abdar
2025-12-23 11:44:56 +05:30
parent e85ac4bf8c
commit d419e4ed60
11 changed files with 483 additions and 481 deletions

View File

@@ -84,7 +84,6 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
children: [
_headerCard(scale),
// SUMMARY SECTION
_sectionHeader("Invoice Summary", Icons.receipt, s1, () {
setState(() => s1 = !s1);
}, scale),
@@ -92,12 +91,8 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
_detailRow(Icons.numbers, "Invoice No", invoice['invoice_number'], scale),
_detailRow(Icons.calendar_month, "Invoice Date", invoice['invoice_date'], scale),
_detailRow(Icons.date_range, "Due Date", invoice['due_date'], scale),
// _detailRow(Icons.payment, "Payment Method", invoice['payment_method'], scale),
// _detailRow(Icons.confirmation_number, "Reference No",
// invoice['reference_no'], scale),
], scale),
// AMOUNT SECTION
_sectionHeader("Amount Details", Icons.currency_rupee, s2, () {
setState(() => s2 = !s2);
}, scale),
@@ -109,7 +104,6 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
invoice['final_amount_with_gst'], scale),
], scale),
// CUSTOMER SECTION
_sectionHeader("Customer Details", Icons.person, s3, () {
setState(() => s3 = !s3);
}, scale),
@@ -121,7 +115,6 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
_detailRow(Icons.location_on, "Address", invoice['customer_address'], scale),
], scale),
// ITEMS SECTION
_sectionHeader("Invoice Items", Icons.shopping_cart, s4, () {
setState(() => s4 = !s4);
}, scale),
@@ -139,44 +132,63 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
// ---------------- HEADER CARD ----------------
Widget _headerCard(double scale) {
final statusColor = getInvoiceStatusColor(invoice["status"]);
return Container(
padding: EdgeInsets.all(18 * scale),
margin: EdgeInsets.only(bottom: 18 * scale),
decoration: BoxDecoration(
gradient:
LinearGradient(colors: [Colors.indigo.shade400, Colors.blue.shade600]),
gradient: LinearGradient(
colors: [Colors.indigo.shade400, Colors.blue.shade600],
),
borderRadius: BorderRadius.circular(16 * scale),
boxShadow: [
BoxShadow(
blurRadius: 10 * scale,
color: Colors.black.withOpacity(.15),
offset: Offset(0, 3 * scale))
blurRadius: 10 * scale,
color: Colors.black.withOpacity(.15),
offset: Offset(0, 3 * scale),
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Invoice #${invoice['invoice_number'] ?? '-'}",
style: TextStyle(
fontSize: 22 * scale,
fontWeight: FontWeight.bold,
color: Colors.white)),
Text(
"Invoice #${invoice['invoice_number'] ?? '-'}",
style: TextStyle(
fontSize: 22 * scale,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
SizedBox(height: 6 * scale),
Text("Date: ${invoice['invoice_date'] ?? '-'}",
style: TextStyle(color: Colors.white70, fontSize: 14 * scale)),
Text(
"Date: ${invoice['invoice_date'] ?? '-'}",
style: TextStyle(color: Colors.white70, fontSize: 14 * scale),
),
SizedBox(height: 10 * scale),
Container(
padding: EdgeInsets.symmetric(
vertical: 6 * scale, horizontal: 14 * scale),
decoration: BoxDecoration(
color: Colors.white.withOpacity(.2),
color: Colors.white, // ✅ Always white
borderRadius: BorderRadius.circular(50 * scale),
border: Border.all(
color: statusColor, // ✅ Different for each status
width: 1.4 * scale,
),
),
child: Text(
invoice["status"]?.toString() ?? "Unknown",
style: TextStyle(color: Colors.white, fontSize: 14 * scale),
(invoice["status"] ?? "Unknown").toString().toUpperCase(),
style: TextStyle(
color: statusColor, // ✅ Text color changes
fontSize: 14 * scale,
fontWeight: FontWeight.bold,
letterSpacing: 0.5,
),
),
)
],
),
);
@@ -199,11 +211,14 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
children: [
Icon(icon, color: Colors.white, size: 20 * scale),
SizedBox(width: 10 * scale),
Text(title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15 * scale,
color: Colors.white)),
Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15 * scale,
color: Colors.white,
),
),
const Spacer(),
AnimatedRotation(
turns: expanded ? .5 : 0,
@@ -234,9 +249,10 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 8 * scale,
offset: Offset(0, 3 * scale),
color: Colors.black.withOpacity(.08)),
blurRadius: 8 * scale,
offset: Offset(0, 3 * scale),
color: Colors.black.withOpacity(.08),
),
],
),
child: Column(children: children),
@@ -256,16 +272,19 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
Icon(icon, color: Colors.blueGrey, size: 20 * scale),
SizedBox(width: 10 * scale),
Expanded(
child: Text(label,
style: TextStyle(
color: Colors.grey.shade700, fontSize: 14 * scale)),
child: Text(
label,
style: TextStyle(color: Colors.grey.shade700, fontSize: 14 * scale),
),
),
Expanded(
child: Text(
value?.toString() ?? "N/A",
textAlign: TextAlign.end,
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 15 * scale),
fontWeight: FontWeight.bold,
fontSize: 15 * scale,
),
),
)
],
@@ -287,16 +306,16 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 8 * scale,
offset: Offset(0, 3 * scale),
color: Colors.black.withOpacity(.08)),
blurRadius: 8 * scale,
offset: Offset(0, 3 * scale),
color: Colors.black.withOpacity(.08),
),
],
border: Border.all(color: Colors.grey.shade300, width: 1),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// TITLE
Row(
children: [
Container(
@@ -313,15 +332,14 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
child: Text(
item['description'] ?? "Item",
style: TextStyle(
fontSize: 16 * scale, fontWeight: FontWeight.w600),
fontSize: 16 * scale,
fontWeight: FontWeight.w600,
),
),
),
],
),
SizedBox(height: 14 * scale),
// QTY & PRICE
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -329,10 +347,7 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
_itemBadge(Icons.currency_rupee, "Price", "$price", false, scale),
],
),
SizedBox(height: 12 * scale),
// TOTAL
Container(
padding: EdgeInsets.symmetric(
vertical: 10 * scale, horizontal: 14 * scale),
@@ -384,8 +399,9 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
borderRadius: BorderRadius.circular(12 * scale),
color: highlight ? Colors.indigo.shade50 : Colors.grey.shade100,
border: Border.all(
color: highlight ? Colors.indigo : Colors.grey.shade300,
width: highlight ? 1.5 * scale : 1),
color: highlight ? Colors.indigo : Colors.grey.shade300,
width: highlight ? 1.5 * scale : 1,
),
),
child: Row(
children: [
@@ -414,3 +430,22 @@ class _OrderInvoiceScreenState extends State<OrderInvoiceScreen>
);
}
}
// ---------------- STATUS COLOR HELPER ----------------
Color getInvoiceStatusColor(String? status) {
final s = (status ?? '')
.toLowerCase()
.replaceAll('_', ' ')
.replaceAll('-', ' ')
.trim();
if (s == 'paid') return Colors.green.shade600;
if (s == 'pending') return Colors.orange.shade600;
if (s == 'overdue') return Colors.red.shade600;
if (s == 'cancelled' || s == 'canceled') return Colors.grey.shade600;
if (s == 'in progress') return Colors.blue.shade600;
if (s == 'draft') return Colors.purple.shade600;
return Colors.blueGrey;
}