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

@@ -34,7 +34,6 @@ class _OrdersScreenState extends State<OrdersScreen> {
final screenWidth = MediaQuery.of(context).size.width;
final scale = (screenWidth / 420).clamp(0.85, 1.15);
// FILTER ORDERS
final filteredOrders = provider.orders.where((o) {
final q = searchQuery.toLowerCase();
return o["order_id"].toString().toLowerCase().contains(q) ||
@@ -45,7 +44,7 @@ class _OrdersScreenState extends State<OrdersScreen> {
return Column(
children: [
// ⭐⭐ WHITE ELEVATED SEARCH BAR ⭐⭐
// SEARCH BAR
Container(
margin: EdgeInsets.fromLTRB(16 * scale, 16 * scale, 16 * scale, 10 * scale),
padding: EdgeInsets.symmetric(horizontal: 14 * scale),
@@ -63,11 +62,8 @@ class _OrdersScreenState extends State<OrdersScreen> {
),
child: Row(
children: [
Icon(Icons.search,
size: 22 * scale, color: Colors.grey.shade700),
Icon(Icons.search, size: 22 * scale, color: Colors.grey.shade700),
SizedBox(width: 10 * scale),
Expanded(
child: TextField(
onChanged: (value) => setState(() => searchQuery = value),
@@ -86,7 +82,7 @@ class _OrdersScreenState extends State<OrdersScreen> {
),
),
// LIST OF ORDERS
// ORDER LIST
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(16 * scale),
@@ -101,7 +97,6 @@ class _OrdersScreenState extends State<OrdersScreen> {
);
}
// ORDER CARD UI
Widget _orderCard(Map<String, dynamic> o, double scale) {
final progress = getProgress(o['status']);
final badgeColor = getStatusColor(o['status']);
@@ -118,7 +113,6 @@ class _OrdersScreenState extends State<OrdersScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// TOP ROW
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -151,12 +145,7 @@ class _OrdersScreenState extends State<OrdersScreen> {
),
SizedBox(height: 10 * scale),
Text(
o['description'],
style: TextStyle(fontSize: 14 * scale),
),
Text(o['description'], style: TextStyle(fontSize: 14 * scale)),
SizedBox(height: 5 * scale),
Text(
@@ -168,12 +157,9 @@ class _OrdersScreenState extends State<OrdersScreen> {
),
SizedBox(height: 18 * scale),
_AnimatedProgressBar(progress: progress, scale: scale),
SizedBox(height: 18 * scale),
// BUTTONS
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -193,21 +179,14 @@ class _OrdersScreenState extends State<OrdersScreen> {
);
}
// BUTTON UI
Widget _btn(IconData icon, String text, Color fg, Color bg,
VoidCallback onTap, double scale) {
return InkWell(
borderRadius: BorderRadius.circular(12 * scale),
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 20 * scale,
vertical: 12 * scale,
),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(12 * scale),
),
padding: EdgeInsets.symmetric(horizontal: 20 * scale, vertical: 12 * scale),
decoration: BoxDecoration(color: bg, borderRadius: BorderRadius.circular(12 * scale)),
child: Row(
children: [
Icon(icon, size: 18 * scale, color: fg),
@@ -226,30 +205,24 @@ class _OrdersScreenState extends State<OrdersScreen> {
);
}
// NAVIGATION
void _openOrderDetails(String id) {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => OrderDetailScreen(orderId: id)),
);
Navigator.push(context,
MaterialPageRoute(builder: (_) => OrderDetailScreen(orderId: id)));
}
void _openInvoice(String id) {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => OrderInvoiceScreen(orderId: id)),
);
Navigator.push(context,
MaterialPageRoute(builder: (_) => OrderInvoiceScreen(orderId: id)));
}
void _openTrack(String id) {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => OrderTrackScreen(orderId: id)),
);
Navigator.push(context,
MaterialPageRoute(builder: (_) => OrderTrackScreen(orderId: id)));
}
}
// PROGRESS BAR
// ================= PROGRESS BAR =================
class _AnimatedProgressBar extends StatelessWidget {
final double progress;
final double scale;
@@ -258,61 +231,65 @@ class _AnimatedProgressBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final maxW = constraints.maxWidth;
return Stack(
children: [
Container(
height: 10 * scale,
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(20 * scale),
return LayoutBuilder(builder: (context, constraints) {
return Stack(
children: [
Container(
height: 10 * scale,
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(20 * scale),
),
),
AnimatedContainer(
duration: const Duration(milliseconds: 650),
curve: Curves.easeInOut,
height: 10 * scale,
width: constraints.maxWidth * progress,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20 * scale),
gradient: const LinearGradient(
colors: [
Color(0xFF4F8CFF),
Color(0xFF8A4DFF),
],
),
),
AnimatedContainer(
duration: const Duration(milliseconds: 650),
curve: Curves.easeInOut,
height: 10 * scale,
width: maxW * progress,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20 * scale),
gradient: const LinearGradient(
colors: [
Color(0xFF4F8CFF),
Color(0xFF8A4DFF),
],
),
),
),
],
);
},
);
),
],
);
});
}
}
// PROGRESS VALUES
// ================= FIXED STATUS LOGIC =================
double getProgress(String? status) {
final s = (status ?? '').toLowerCase();
final s = (status ?? '')
.toLowerCase()
.replaceAll('_', ' ')
.replaceAll('-', ' ')
.trim();
if (s == "pending") return 0.25;
if (s == "loading") return 0.40;
if (s == "in transit" || s == "intransit") return 0.65;
if (s.contains("transit")) return 0.65;
if (s == "dispatched") return 0.85;
if (s == "delivered") return 1.0;
return 0.05;
}
// STATUS COLORS
Color getStatusColor(String? status) {
final s = (status ?? '').toLowerCase();
final s = (status ?? '')
.toLowerCase()
.replaceAll('_', ' ')
.replaceAll('-', ' ')
.trim();
if (s == "pending") return Colors.orange;
if (s == "loading") return Colors.amber.shade800;
if (s == "in transit" || s == "intransit") return Colors.red;
if (s.contains("transit")) return Colors.red;
if (s == "dispatched") return Colors.blue.shade700;
if (s == "delivered") return Colors.green.shade700;