minor changes
This commit is contained in:
@@ -16,7 +16,6 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
bool s1 = true;
|
||||
bool s2 = false;
|
||||
bool s3 = false;
|
||||
bool s4 = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -27,8 +26,12 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
duration: const Duration(milliseconds: 350),
|
||||
);
|
||||
|
||||
_slideAnimation = Tween(begin: const Offset(0, -0.1), end: Offset.zero)
|
||||
.animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut));
|
||||
_slideAnimation = Tween(
|
||||
begin: const Offset(0, -0.1),
|
||||
end: Offset.zero,
|
||||
).animate(
|
||||
CurvedAnimation(parent: _controller, curve: Curves.easeOut),
|
||||
);
|
||||
|
||||
_controller.forward();
|
||||
}
|
||||
@@ -40,13 +43,93 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// HEADER SUMMARY CARD
|
||||
// STATUS BADGE (WHITE + GRADIENT BORDER)
|
||||
// ------------------------------------------------------------------
|
||||
Widget statusBadge(String status, double scale) {
|
||||
final s = status.toLowerCase();
|
||||
|
||||
LinearGradient gradient;
|
||||
Color textColor;
|
||||
|
||||
switch (s) {
|
||||
case 'paid':
|
||||
gradient = const LinearGradient(
|
||||
colors: [Color(0xFF2ECC71), Color(0xFF27AE60)],
|
||||
);
|
||||
textColor = const Color(0xFF27AE60);
|
||||
break;
|
||||
|
||||
case 'pending':
|
||||
gradient = const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF5B8DEF), // Soft Blue
|
||||
Color(0xFF7B5CFA), // Purple Blue
|
||||
],
|
||||
);
|
||||
textColor = const Color(0xFF5B8DEF);
|
||||
break;
|
||||
|
||||
case 'overdue':
|
||||
gradient = const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFFFFB300), // Amber
|
||||
Color(0xFFFF6F00), // Deep Orange
|
||||
],
|
||||
);
|
||||
textColor = const Color(0xFFFF6F00);
|
||||
break;
|
||||
|
||||
case 'cancelled':
|
||||
case 'failed':
|
||||
gradient = const LinearGradient(
|
||||
colors: [Color(0xFFE74C3C), Color(0xFFC0392B)],
|
||||
);
|
||||
textColor = const Color(0xFFE74C3C);
|
||||
break;
|
||||
|
||||
default:
|
||||
gradient = const LinearGradient(
|
||||
colors: [Color(0xFF95A5A6), Color(0xFF7F8C8D)],
|
||||
);
|
||||
textColor = Colors.grey.shade700;
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(1.5),
|
||||
decoration: BoxDecoration(
|
||||
gradient: gradient,
|
||||
borderRadius: BorderRadius.circular(20 * scale),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 14 * scale,
|
||||
vertical: 6 * scale,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(18 * scale),
|
||||
),
|
||||
child: Text(
|
||||
status.toUpperCase(),
|
||||
style: TextStyle(
|
||||
fontSize: 12 * scale,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: textColor,
|
||||
letterSpacing: .6,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// HEADER CARD
|
||||
// ------------------------------------------------------------------
|
||||
Widget headerCard(Map invoice, double scale) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(16 * scale), // tighter
|
||||
margin: EdgeInsets.only(bottom: 14 * scale), // closer
|
||||
padding: EdgeInsets.all(16 * scale),
|
||||
margin: EdgeInsets.only(bottom: 14 * scale),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue.shade400, Colors.indigo.shade600],
|
||||
@@ -76,40 +159,34 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
"Date: ${invoice['invoice_date']}",
|
||||
style: TextStyle(color: Colors.white70, fontSize: 13 * scale),
|
||||
),
|
||||
SizedBox(height: 8 * scale),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 5 * scale, horizontal: 12 * scale),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(.2),
|
||||
borderRadius: BorderRadius.circular(40 * scale),
|
||||
),
|
||||
child: Text(
|
||||
invoice['status'] ?? "Unknown",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13 * scale,
|
||||
),
|
||||
),
|
||||
)
|
||||
SizedBox(height: 10 * scale),
|
||||
|
||||
/// STATUS BADGE
|
||||
statusBadge(invoice['status'] ?? 'Unknown', scale),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// SECTION HEADER (Closer Spacing)
|
||||
// SECTION HEADER
|
||||
// ------------------------------------------------------------------
|
||||
Widget sectionHeader(
|
||||
String title, IconData icon, bool expanded, Function() tap, double scale) {
|
||||
String title,
|
||||
IconData icon,
|
||||
bool expanded,
|
||||
VoidCallback tap,
|
||||
double scale,
|
||||
) {
|
||||
return GestureDetector(
|
||||
onTap: tap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12 * scale), // tighter
|
||||
margin: EdgeInsets.only(bottom: 8 * scale), // closer
|
||||
padding: EdgeInsets.all(12 * scale),
|
||||
margin: EdgeInsets.only(bottom: 8 * scale),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.indigo.shade500, Colors.blue.shade400]),
|
||||
colors: [Colors.indigo.shade500, Colors.blue.shade400],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12 * scale),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@@ -126,16 +203,20 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 15 * scale,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontSize: 15 * scale,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
AnimatedRotation(
|
||||
turns: expanded ? .5 : 0,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
child: Icon(Icons.keyboard_arrow_down,
|
||||
color: Colors.white, size: 20 * scale),
|
||||
child: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: Colors.white,
|
||||
size: 20 * scale,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -144,7 +225,7 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// SECTION BODY (Closer Spacing)
|
||||
// SECTION BODY
|
||||
// ------------------------------------------------------------------
|
||||
Widget sectionBody(bool visible, List<Widget> children, double scale) {
|
||||
return AnimatedCrossFade(
|
||||
@@ -155,17 +236,17 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
secondChild: SlideTransition(
|
||||
position: _slideAnimation,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(14 * scale), // tighter
|
||||
margin: EdgeInsets.only(bottom: 10 * scale), // closer
|
||||
padding: EdgeInsets.all(14 * scale),
|
||||
margin: EdgeInsets.only(bottom: 10 * scale),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(12 * scale),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 7 * scale,
|
||||
offset: Offset(0, 2 * scale),
|
||||
color: Colors.black.withOpacity(.07))
|
||||
blurRadius: 7 * scale,
|
||||
offset: Offset(0, 2 * scale),
|
||||
color: Colors.black.withOpacity(.07),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Column(children: children),
|
||||
@@ -175,11 +256,11 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// DETAIL ROW (Closer Spacing)
|
||||
// DETAIL ROW
|
||||
// ------------------------------------------------------------------
|
||||
Widget detailRow(IconData icon, String label, dynamic value, double scale) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 5 * scale), // closer
|
||||
padding: EdgeInsets.symmetric(vertical: 5 * scale),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 18 * scale, color: Colors.blueGrey),
|
||||
@@ -196,11 +277,18 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Text(
|
||||
child: label == "Status"
|
||||
? Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: statusBadge(value ?? 'Unknown', scale),
|
||||
)
|
||||
: Text(
|
||||
value?.toString() ?? "N/A",
|
||||
textAlign: TextAlign.right,
|
||||
style:
|
||||
TextStyle(fontSize: 14 * scale, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontSize: 14 * scale,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -208,60 +296,6 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// TIMELINE (Closer Spacing)
|
||||
// ------------------------------------------------------------------
|
||||
Widget invoiceTimeline(double scale) {
|
||||
final steps = ["Invoice Created", "Payment Received", "Out for Delivery", "Completed"];
|
||||
final icons = [Icons.receipt_long, Icons.payments, Icons.local_shipping, Icons.verified];
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16 * scale),
|
||||
margin: EdgeInsets.only(bottom: 16 * scale), // closer
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(14 * scale),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 7 * scale,
|
||||
color: Colors.black.withOpacity(.1),
|
||||
offset: Offset(0, 3 * scale),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: List.generate(steps.length, (i) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 4 * scale), // closer
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Icon(icons[i], size: 22 * scale, color: Colors.indigo),
|
||||
if (i < steps.length - 1)
|
||||
Container(
|
||||
height: 28 * scale,
|
||||
width: 2 * scale,
|
||||
color: Colors.indigo.shade300,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(width: 10 * scale),
|
||||
Expanded(
|
||||
child: Text(
|
||||
steps[i],
|
||||
style:
|
||||
TextStyle(fontSize: 14 * scale, fontWeight: FontWeight.w600),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// MAIN BUILD
|
||||
// ------------------------------------------------------------------
|
||||
@@ -272,21 +306,30 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
final scale = (width / 390).clamp(0.85, 1.25);
|
||||
|
||||
return ListView(
|
||||
padding: EdgeInsets.all(14 * scale), // slightly tighter
|
||||
padding: EdgeInsets.all(14 * scale),
|
||||
children: [
|
||||
headerCard(invoice, scale),
|
||||
invoiceTimeline(scale),
|
||||
|
||||
sectionHeader("Invoice Summary", Icons.receipt_long, s1,
|
||||
() => setState(() => s1 = !s1), scale),
|
||||
sectionHeader(
|
||||
"Invoice Summary",
|
||||
Icons.receipt_long,
|
||||
s1,
|
||||
() => setState(() => s1 = !s1),
|
||||
scale,
|
||||
),
|
||||
sectionBody(s1, [
|
||||
detailRow(Icons.numbers, "Invoice No", invoice['invoice_number'], scale),
|
||||
detailRow(Icons.calendar_today, "Date", invoice['invoice_date'], scale),
|
||||
detailRow(Icons.label, "Status", invoice['status'], scale),
|
||||
], scale),
|
||||
|
||||
sectionHeader("Customer Details", Icons.person, s2,
|
||||
() => setState(() => s2 = !s2), scale),
|
||||
sectionHeader(
|
||||
"Customer Details",
|
||||
Icons.person,
|
||||
s2,
|
||||
() => setState(() => s2 = !s2),
|
||||
scale,
|
||||
),
|
||||
sectionBody(s2, [
|
||||
detailRow(Icons.person_outline, "Name", invoice['customer_name'], scale),
|
||||
detailRow(Icons.mail, "Email", invoice['customer_email'], scale),
|
||||
@@ -294,22 +337,19 @@ class _InvoiceDetailViewState extends State<InvoiceDetailView>
|
||||
detailRow(Icons.location_on, "Address", invoice['customer_address'], scale),
|
||||
], scale),
|
||||
|
||||
sectionHeader("Amount Details", Icons.currency_rupee, s3,
|
||||
() => setState(() => s3 = !s3), scale),
|
||||
sectionHeader(
|
||||
"Amount Details",
|
||||
Icons.currency_rupee,
|
||||
s3,
|
||||
() => setState(() => s3 = !s3),
|
||||
scale,
|
||||
),
|
||||
sectionBody(s3, [
|
||||
detailRow(Icons.money, "Amount", invoice['final_amount'], scale),
|
||||
detailRow(Icons.percent, "GST percent %", invoice['gst_percent'], scale),
|
||||
detailRow(Icons.percent, "GST amount %", invoice['gst_amount'], scale),
|
||||
detailRow(Icons.percent, "GST %", invoice['gst_percent'], scale),
|
||||
detailRow(Icons.percent, "GST Amount", invoice['gst_amount'], scale),
|
||||
detailRow(Icons.summarize, "Total", invoice['final_amount_with_gst'], scale),
|
||||
], scale),
|
||||
|
||||
// sectionHeader("Payment Details", Icons.payment, s4,
|
||||
// () => setState(() => s4 = !s4), scale),
|
||||
// sectionBody(s4, [
|
||||
// detailRow(Icons.credit_card, "Method", invoice['payment_method'], scale),
|
||||
// detailRow(Icons.confirmation_number, "Reference",
|
||||
// invoice['reference_no'], scale),
|
||||
// ], scale),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user