second commit
This commit is contained in:
563
lib/View/Dashboard/Dashboardview.dart
Normal file
563
lib/View/Dashboard/Dashboardview.dart
Normal file
@@ -0,0 +1,563 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../Controller/Dashboard/Dashboardcontroller.dart';
|
||||
import '../../Controller/Dashboard/Tabs/Ordercontroller.dart';
|
||||
import '../../Controller/products/product_controller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
import '../../widgets/product_bottom_sheet.dart';
|
||||
import '../More/Notification/Notificationview.dart';
|
||||
import '../Orders/orderDetails.dart';
|
||||
|
||||
class DashboardView extends StatelessWidget {
|
||||
DashboardView({super.key});
|
||||
|
||||
final DashboardController dashboardController = Get.put(DashboardController());
|
||||
final CurrentOrderController currentOrderController = Get.put(CurrentOrderController());
|
||||
final ProductController productController = Get.put(ProductController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent, // or your color
|
||||
statusBarIconBrightness: Brightness.dark, // Android icons
|
||||
statusBarBrightness: Brightness.light, // iOS icons
|
||||
),
|
||||
);
|
||||
|
||||
return DefaultTabController(
|
||||
length: 4,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final TabController tabController = DefaultTabController.of(context);
|
||||
|
||||
// Listen to tab changes (tap or swipe)
|
||||
tabController.addListener(() {
|
||||
if (!tabController.indexIsChanging) {
|
||||
String status;
|
||||
switch (tabController.index) {
|
||||
case 0:
|
||||
status = 'created';
|
||||
break;
|
||||
case 1:
|
||||
status = 'ongoing';
|
||||
break;
|
||||
case 2:
|
||||
status = 'delivered';
|
||||
break;
|
||||
case 3:
|
||||
status = 'cancelled';
|
||||
break;
|
||||
default:
|
||||
status = 'created';
|
||||
}
|
||||
|
||||
// Only fetch if not already loaded
|
||||
currentOrderController.getOrder(status);
|
||||
if (!currentOrderController.hasLoaded(status)) {
|
||||
currentOrderController.getOrder(status);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return GetBuilder<DashboardController>(
|
||||
initState: (_) {
|
||||
logger.i('Init state triggered in View : ');
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
dashboardController.getDetails();
|
||||
dashboardController.getTenantInfo();
|
||||
currentOrderController.getOrder('created'); // Initial fetch for Placed tab
|
||||
});
|
||||
},
|
||||
builder: (dashboardCtrl) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: 70,
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(() => NotificationView());
|
||||
},
|
||||
child: Icon(
|
||||
Icons.notifications,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
title: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: dashboardCtrl.tenantInfo?.tenantname ?? '',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on_outlined, color: ColorConstants.darkGreyColor, size: 15),
|
||||
TextWidget(
|
||||
text: dashboardCtrl.tenantInfo?.locationname ?? '',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
bottom: TabBar(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
tabs: [
|
||||
Tab(text: 'Placed'),
|
||||
Tab(text: 'Ongoing'),
|
||||
Tab(text: 'Completed'),
|
||||
Tab(text: 'Cancelled'),
|
||||
],
|
||||
labelColor: ColorConstants.primaryColor,
|
||||
unselectedLabelColor: ColorConstants.darkGreyColor?.withOpacity(0.5),
|
||||
indicatorColor: ColorConstants.primaryColor,
|
||||
labelStyle: TextStyle(fontWeight: FontWeight.w600, fontSize: 14),
|
||||
unselectedLabelStyle: TextStyle(fontWeight: FontWeight.w400, fontSize: 12),
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
OrderTabView(orderStatus: 'created'),
|
||||
OrderTabView(orderStatus: 'ongoing'),
|
||||
OrderTabView(orderStatus: 'delivered'),
|
||||
OrderTabView(orderStatus: 'cancelled'),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OrderTabView extends StatelessWidget {
|
||||
final String orderStatus;
|
||||
final CurrentOrderController currentOrderController = Get.find<CurrentOrderController>();
|
||||
|
||||
OrderTabView({
|
||||
super.key,
|
||||
required this.orderStatus,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final orders = currentOrderController.getOrdersByStatus(orderStatus);
|
||||
final isLoading = currentOrderController.getLoadingByStatus(orderStatus).value;
|
||||
// Show shimmer only on first load
|
||||
if (isLoading && !currentOrderController.hasLoaded(orderStatus)) {
|
||||
return Center(child: ShimmerListView(height: 200));
|
||||
}
|
||||
|
||||
if (orders.isEmpty) {
|
||||
return emptyOrdersWidget();
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
itemCount: orders.length,
|
||||
itemBuilder: (context, index) {
|
||||
final order = orders[index];
|
||||
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
final orderId = order.orderheaderid ?? 0;
|
||||
final productController = Get.find<ProductController>();
|
||||
await productController.getProductDetails(orderId);
|
||||
|
||||
if (context.mounted) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => OrderDetailsPage(
|
||||
orderDetails: order,
|
||||
productDetails: productController.productDetail,
|
||||
controller: currentOrderController,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: OrderCard(
|
||||
orderStatus: order.orderstatus ?? '',
|
||||
orderId: order.orderid ?? '',
|
||||
orderDateTime: order.orderdate ?? '',
|
||||
customerName: order.deliverycustomer ?? '',
|
||||
phoneNumber: order.deliverycontactno ?? '',
|
||||
deliveryLocation: order.deliveryaddress ?? '',
|
||||
onInfoTap: () async {
|
||||
final orderId = order.orderheaderid ?? 1;
|
||||
final productController = Get.find<ProductController>();
|
||||
await productController.getProductDetails(orderId);
|
||||
|
||||
for (var product in productController.productDetail ?? []) {
|
||||
if (product.productimage != null) {
|
||||
precacheImage(
|
||||
CachedNetworkImageProvider(product.productimage ?? ''),
|
||||
context,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (context.mounted) {
|
||||
ProductBottomSheet.show(context, productController.productDetail ?? []);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Shimmer Card widget
|
||||
class ShimmerListView extends StatelessWidget {
|
||||
final double height;
|
||||
const ShimmerListView({super.key, required this.height});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 10,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: Colors.grey.shade300,
|
||||
highlightColor: Colors.grey.shade100,
|
||||
child: Container(
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
margin: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade400,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 14,
|
||||
width: double.infinity,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
showConfirmationBottomSheet(
|
||||
BuildContext context, {
|
||||
required VoidCallback onAccept,
|
||||
VoidCallback? onCancel,
|
||||
String title = "Confirmation",
|
||||
String message = "Are you sure you want to continue?",
|
||||
}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
builder: (context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 20, 20, 30),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
message,
|
||||
style: TextStyle(fontSize: 15, color: Colors.grey[700]),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Future.microtask(() => onCancel?.call());
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: Colors.grey),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Future.microtask(() => onAccept());
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text('Accept'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class OrderCard extends StatelessWidget {
|
||||
final String orderId;
|
||||
final String orderDateTime;
|
||||
final String customerName;
|
||||
final String phoneNumber;
|
||||
final String orderStatus;
|
||||
final String deliveryLocation;
|
||||
final VoidCallback? onInfoTap;
|
||||
|
||||
const OrderCard({
|
||||
super.key,
|
||||
required this.orderId,
|
||||
required this.orderDateTime,
|
||||
required this.customerName,
|
||||
required this.phoneNumber,
|
||||
required this.orderStatus,
|
||||
required this.deliveryLocation,
|
||||
this.onInfoTap,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
DateTime dateTime = DateTime.parse(orderDateTime);
|
||||
logger.i('orderDateTime : ${dateTime}');
|
||||
|
||||
final dataStr = dateTime.toLocal().toString().split(' ')[0];
|
||||
final timeStr = DateFormat('h:mm a').format(dateTime);
|
||||
|
||||
return Card(
|
||||
elevation: 0,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.confirmation_number_outlined, color: Colors.deepPurple),
|
||||
const SizedBox(width: 6),
|
||||
TextWidget(
|
||||
text: 'Order ID: $orderId',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.info_outline_rounded, color: Colors.grey),
|
||||
onPressed: onInfoTap ?? () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 5),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.calendar_today_outlined, size: 20, color: Colors.teal),
|
||||
const SizedBox(width: 6),
|
||||
TextWidget(text: '$dataStr • $timeStr'),
|
||||
Spacer(),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: _getStatusColor(orderStatus).withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: TextWidget(
|
||||
text: orderStatus,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
color: _getStatusColor(orderStatus),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const Divider(height: 24, thickness: 0.7),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.person_outline, color: Colors.indigo, size: 20,),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: TextWidget(
|
||||
text: customerName,
|
||||
fontWeight: FontWeight.w500,
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.phone_outlined, color: Colors.green, size: 20),
|
||||
const SizedBox(width: 6),
|
||||
TextWidget(text: phoneNumber),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Icon(Icons.location_on_outlined, color: Colors.redAccent, size: 20),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: TextWidget(
|
||||
text: deliveryLocation,
|
||||
textHeight: 1.4,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Color _getStatusColor(String status) {
|
||||
switch (status.toLowerCase()) {
|
||||
case 'created':
|
||||
return Colors.blueGrey;
|
||||
case 'assigned':
|
||||
return Colors.indigo;
|
||||
case 'accepted':
|
||||
return Colors.teal;
|
||||
case 'arrived':
|
||||
return Colors.blue;
|
||||
case 'picked':
|
||||
return Colors.deepPurple;
|
||||
case 'delivered':
|
||||
return Colors.green;
|
||||
case 'cancelled':
|
||||
return Colors.red;
|
||||
default:
|
||||
return Colors.grey;
|
||||
}
|
||||
}
|
||||
|
||||
Widget emptyOrdersWidget() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height:10),
|
||||
Image.asset(
|
||||
AssetConstants.noOrdersFound,
|
||||
height: 200,
|
||||
width: 200,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
TextWidget(
|
||||
text: 'No Orders Yet!',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextWidget(
|
||||
text: 'Stay tuned, your next order will appear here soon!',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
1002
lib/View/Dashboard/Orderdetails/Orderdetailsview.dart
Normal file
1002
lib/View/Dashboard/Orderdetails/Orderdetailsview.dart
Normal file
File diff suppressed because it is too large
Load Diff
683
lib/View/Dashboard/Tabs/Cancelledview.dart
Normal file
683
lib/View/Dashboard/Tabs/Cancelledview.dart
Normal file
@@ -0,0 +1,683 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../Controller/Dashboard/Tabs/Cancelledordercontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../Orderdetails/Orderdetailsview.dart';
|
||||
|
||||
class CancelledView extends StatelessWidget {
|
||||
CancelledView({super.key});
|
||||
|
||||
CancelledOrderController completedOrderController = Get.put(CancelledOrderController()) ;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body:Stack(
|
||||
children: [
|
||||
GetBuilder<CancelledOrderController>(
|
||||
initState: (_){
|
||||
completedOrderController.shimmer.value = true;
|
||||
completedOrderController.getCancelledOrder();
|
||||
},
|
||||
builder: (controller) {
|
||||
return
|
||||
controller.getCancelledOrderList.isEmpty &&
|
||||
!controller.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
|
||||
Text(
|
||||
"No orders at this moment",
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 18),
|
||||
),
|
||||
],
|
||||
)) :controller.shimmer.value
|
||||
? orderShimmerCard(context)
|
||||
:
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 8),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 70),
|
||||
itemCount:
|
||||
controller.shimmer.value
|
||||
? 5
|
||||
:controller.getCancelledOrderList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailsView(data: controller.getCancelledOrderList[index],));
|
||||
|
||||
},
|
||||
child: Card(
|
||||
color: Colors.red[100]!.withAlpha(100),
|
||||
// Utility.getLightColors(controller.getOrderAllList[index].tenantname![0]).withAlpha(100),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 180,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 12,bottom: 0),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCancelledOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Text(
|
||||
DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCancelledOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 0,bottom: 5),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
// radius: 22,
|
||||
// backgroundColor: Colors.white70,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("hh:mm").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCancelledOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
Text(
|
||||
DateFormat("a").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCancelledOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 6,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.business,color: ColorConstants.primaryColor,size: 20),
|
||||
// const SizedBox(width: 5,),
|
||||
// SizedBox(
|
||||
// width: Get.width*0.30,
|
||||
// child: Text(
|
||||
// "${controller.getCompletedOrderList[index].tenantname}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// fontSize: 16),
|
||||
// maxLines: 1,
|
||||
// ),
|
||||
// ),
|
||||
// const Spacer(),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 10,right: 10),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// decoration: BoxDecoration(
|
||||
// color: ColorConstants.primaryColor,
|
||||
// borderRadius: BorderRadius.circular(12)),
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child: Text(
|
||||
// "${controller.getCompletedOrderList[index].orderid}",
|
||||
// style: const TextStyle(
|
||||
// fontSize: 11, color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on_rounded,
|
||||
// size: 20,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Flexible(
|
||||
// child: (Text(
|
||||
// "${controller.getCompletedOrderList[index].pickupaddress}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// overflow: TextOverflow.visible,
|
||||
// fontSize: 14),
|
||||
// maxLines: 1,
|
||||
// )))
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// )),
|
||||
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20),
|
||||
const SizedBox(width: 5,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.getCancelledOrderList[index].deliverycustomer??'',
|
||||
style: const TextStyle(
|
||||
color: Colors.black87, fontSize: 16),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4,)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on_rounded,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCancelledOrderList[index].deliveryaddress}.",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCancelledOrderList[index].deliverycontactno}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCancelledOrderList[index].orderid}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Container(
|
||||
height: 190,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
child: Card(
|
||||
color: Colors.grey[300],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 9,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 22,
|
||||
color: Colors.black38,
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 17),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
Container(
|
||||
height: 28,
|
||||
width: 28,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.green,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
683
lib/View/Dashboard/Tabs/Completedview.dart
Normal file
683
lib/View/Dashboard/Tabs/Completedview.dart
Normal file
@@ -0,0 +1,683 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../Controller/Dashboard/Tabs/Completedordercontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../Orderdetails/Orderdetailsview.dart';
|
||||
|
||||
class CompletedView extends StatelessWidget {
|
||||
CompletedView({super.key});
|
||||
|
||||
CompletedOrderController completedOrderController = Get.put(CompletedOrderController()) ;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body:Stack(
|
||||
children: [
|
||||
GetBuilder<CompletedOrderController>(
|
||||
initState: (_){
|
||||
completedOrderController.shimmer.value = true;
|
||||
completedOrderController.getCompletedOrder();
|
||||
},
|
||||
builder: (controller) {
|
||||
return
|
||||
controller.getCompletedOrderList.isEmpty &&
|
||||
!controller.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
|
||||
Text(
|
||||
"No orders at this moment",
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 18),
|
||||
),
|
||||
],
|
||||
)) :controller.shimmer.value
|
||||
? orderShimmerCard(context)
|
||||
:
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 8),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 70),
|
||||
itemCount:
|
||||
controller.shimmer.value
|
||||
? 5
|
||||
:controller.getCompletedOrderList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailsView(data: controller.getCompletedOrderList[index],));
|
||||
|
||||
},
|
||||
child: Card(
|
||||
color: Colors.red[100]!.withAlpha(100),
|
||||
// Utility.getLightColors(controller.getOrderAllList[index].tenantname![0]).withAlpha(100),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 180,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 12,bottom: 0),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCompletedOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Text(
|
||||
DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCompletedOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 0,bottom: 5),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
// radius: 22,
|
||||
// backgroundColor: Colors.white70,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("hh:mm").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCompletedOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
Text(
|
||||
DateFormat("a").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCompletedOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 6,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.business,color: ColorConstants.primaryColor,size: 20),
|
||||
// const SizedBox(width: 5,),
|
||||
// SizedBox(
|
||||
// width: Get.width*0.30,
|
||||
// child: Text(
|
||||
// "${controller.getCompletedOrderList[index].tenantname}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// fontSize: 16),
|
||||
// maxLines: 1,
|
||||
// ),
|
||||
// ),
|
||||
// const Spacer(),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 10,right: 10),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// decoration: BoxDecoration(
|
||||
// color: ColorConstants.primaryColor,
|
||||
// borderRadius: BorderRadius.circular(12)),
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child: Text(
|
||||
// "${controller.getCompletedOrderList[index].orderid}",
|
||||
// style: const TextStyle(
|
||||
// fontSize: 11, color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on_rounded,
|
||||
// size: 20,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Flexible(
|
||||
// child: (Text(
|
||||
// "${controller.getCompletedOrderList[index].pickupaddress}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// overflow: TextOverflow.visible,
|
||||
// fontSize: 14),
|
||||
// maxLines: 1,
|
||||
// )))
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// )),
|
||||
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20),
|
||||
const SizedBox(width: 5,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.getCompletedOrderList[index].deliverycustomer??'',
|
||||
style: const TextStyle(
|
||||
color: Colors.black87, fontSize: 16),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4,)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on_rounded,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCompletedOrderList[index].deliveryaddress}.",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCompletedOrderList[index].deliverycontactno}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCompletedOrderList[index].orderid}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Container(
|
||||
height: 190,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
child: Card(
|
||||
color: Colors.grey[300],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 9,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 22,
|
||||
color: Colors.black38,
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 17),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
Container(
|
||||
height: 28,
|
||||
width: 28,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.green,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
566
lib/View/Dashboard/Tabs/Createdview.dart
Normal file
566
lib/View/Dashboard/Tabs/Createdview.dart
Normal file
@@ -0,0 +1,566 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
import '../../../Controller/Orders/Ordercontroller.dart';
|
||||
import '../../../Controller/products/product_controller.dart';
|
||||
import '../../../Globalwidgets/textwidget.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/Logger.dart';
|
||||
import '../../../Model/Response/Summary/Getsummarysresponse.dart';
|
||||
import '../../../widgets/product_bottom_sheet.dart';
|
||||
import '../../Orders/Deliverydetails/delivery_detail_view.dart';
|
||||
import '../Dashboardview.dart';
|
||||
|
||||
|
||||
class OrderView extends StatelessWidget {
|
||||
const OrderView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final OrderController controller = Get.put(OrderController());
|
||||
controller.getOrders('today');
|
||||
|
||||
return DefaultTabController(
|
||||
length: 4,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: Obx(() {
|
||||
return controller.searchMode.value
|
||||
? TextField(
|
||||
controller: controller.searchController,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search Orders',
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.close, color: ColorConstants.primaryColor),
|
||||
onPressed: () {
|
||||
controller.searchController.clear();
|
||||
controller.searchMode.value = false;
|
||||
controller.search('');
|
||||
},
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
controller.search(value);
|
||||
},
|
||||
)
|
||||
: const TextWidget(
|
||||
text: 'Orders',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
);
|
||||
}),
|
||||
|
||||
actions: [
|
||||
/// Search icon — hidden when searchMode is ON
|
||||
Obx(() {
|
||||
if (controller.currentTabIndex.value == 3) {
|
||||
return SizedBox();
|
||||
}
|
||||
|
||||
return controller.searchMode.value
|
||||
? SizedBox() // <- Hides extra close icon
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.search, color: ColorConstants.primaryColor),
|
||||
onPressed: () {
|
||||
controller.searchMode.value = true;
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
|
||||
bottom: TabBar(
|
||||
indicatorColor: ColorConstants.primaryColor,
|
||||
labelColor: ColorConstants.primaryColor,
|
||||
unselectedLabelColor: ColorConstants.darkGreyColor,
|
||||
onTap: (index) {
|
||||
controller.currentTabIndex.value = index;
|
||||
|
||||
switch (index) {
|
||||
case 0: controller.getOrders('today'); break;
|
||||
case 1: controller.getOrders('week'); break;
|
||||
case 2: controller.getOrders('month'); break;
|
||||
case 3: controller.getSummary(); break;
|
||||
}
|
||||
|
||||
controller.searchMode.value = false;
|
||||
controller.searchController.clear();
|
||||
controller.update();
|
||||
},
|
||||
tabs: const [
|
||||
Tab(text: 'Today'),
|
||||
Tab(text: 'This Week'),
|
||||
Tab(text: 'This Month'),
|
||||
Tab(text: 'Summary'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
/// Today Tab
|
||||
OrderListView(controller: controller),
|
||||
/// Week Tab
|
||||
OrderListView(controller: controller),
|
||||
/// Month Tab
|
||||
OrderListView(controller: controller),
|
||||
/// Summary Tab
|
||||
GetBuilder<OrderController>(
|
||||
builder: (_) {
|
||||
return OrderInsightsGrid(
|
||||
total: controller.orderSummaryDetails.total ?? 0,
|
||||
pending: controller.orderSummaryDetails.pending ?? 0,
|
||||
delivered: controller.orderSummaryDetails.delivered ?? 0,
|
||||
cancelled: controller.orderSummaryDetails.cancelled ?? 0,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Widget to display the list of orders
|
||||
class OrderListView extends StatelessWidget {
|
||||
final OrderController controller;
|
||||
|
||||
OrderListView({super.key, required this.controller});
|
||||
|
||||
final ProductController productController = Get.put(ProductController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<OrderController>(
|
||||
builder: (controller) {
|
||||
if (controller.isOrdersLoading.value) {
|
||||
return const Center(child: ShimmerListView(height: 180));
|
||||
}
|
||||
final displayList = controller.searchMode.value ?
|
||||
controller.searchOrderList :
|
||||
controller.orderAllList;
|
||||
logger.i('orderAllList : ${controller.orderAllList}');
|
||||
logger.i('SearchList : ${controller.searchOrderList}');
|
||||
logger.i('DisplayList : ${displayList}');
|
||||
return Column(
|
||||
children: [
|
||||
// Visibility(
|
||||
// visible: controller.currentTabIndex.value != 3 && controller.orderAllList.isNotEmpty,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(12.0),
|
||||
// child: TextField(
|
||||
// controller: controller.searchController,
|
||||
// decoration: InputDecoration(
|
||||
// hintText: 'Search Orders',
|
||||
// filled: true,
|
||||
// fillColor: ColorConstants.secondaryColor,
|
||||
// border: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(8.0),
|
||||
// ),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
// borderRadius: BorderRadius.circular(8.0),
|
||||
// ),
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: ColorConstants.primaryColor, width: 2),
|
||||
// borderRadius: BorderRadius.circular(8.0),
|
||||
// ),
|
||||
// suffixIcon: Visibility(
|
||||
// visible: controller.searchController.text.isNotEmpty,
|
||||
// child: IconButton(
|
||||
// icon: const Icon(
|
||||
// Icons.cancel,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// controller.searchController.clear();
|
||||
// controller.search(controller.searchController.text);
|
||||
// controller.searchMode.value = false;
|
||||
// FocusScope.of(context).unfocus();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// onChanged: (value) {
|
||||
// controller.search(value);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: displayList.isEmpty && !controller.isOrdersLoading.value
|
||||
? emptyOrdersWidget()
|
||||
: ListView.builder(
|
||||
itemCount: displayList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final order = displayList[index];
|
||||
logger.i('FinalOrder : ${order.orderid}');
|
||||
return OrderListItem(
|
||||
order: order,
|
||||
controller: controller,
|
||||
index: index,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Order List Items
|
||||
class OrderListItem extends StatelessWidget {
|
||||
final DeliveriesDetails order;
|
||||
final int index;
|
||||
final dynamic controller;
|
||||
|
||||
OrderListItem({
|
||||
Key? key,
|
||||
required this.order,
|
||||
required this.index,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
final ProductController productController = Get.put(ProductController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final currentOrder = controller.orderAllList[index];
|
||||
|
||||
logger.i('Current Order List : ${order.orderid}');
|
||||
|
||||
final date = order.deliverydate != ""
|
||||
? DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(order.deliverydate!)
|
||||
: null;
|
||||
|
||||
final formattedDate = date != null ? DateFormat("dd MMM yyyy").format(date) : "--";
|
||||
final time = date != null ? DateFormat("hh:mm a").format(date) : "--:--";
|
||||
logger.i('Current Order : ${order.actualkms}');
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
onTap: () async {
|
||||
final orderId = order.orderheaderid ?? 0;
|
||||
print("order id :${orderId}");
|
||||
// Fetch products for this order
|
||||
await productController.getProductDetails(orderId);
|
||||
|
||||
|
||||
Get.to(() => OrderDetailsPage(
|
||||
productDetails: productController.productDetail,
|
||||
orderDetails: order,
|
||||
)
|
||||
);
|
||||
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Order ID, Date, and Info Icon Row
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Order ID: ${order.orderid}",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
formattedDate,
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Container(
|
||||
height: 10,
|
||||
width: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
time,
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: const Icon(Icons.info_outline, size: 20),
|
||||
onPressed: () async {
|
||||
final orderId = order.orderheaderid ?? 1;
|
||||
await productController.getProductDetails(orderId);
|
||||
if (context.mounted) {
|
||||
ProductBottomSheet.show(context, productController.productDetail, isAmountReceived: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Distance Row
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.delivery_dining, size: 20, color: Colors.orange),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"${order.actualkms != null && order.actualkms != 'null' ? order.actualkms : '0.0'} Km",
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Rider and Customer Info
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Icon(Icons.person, size: 20, color: Colors.teal),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Rider: ${order.ridername ?? "Unknown"}",
|
||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
"Customer: ${order.deliverycustomer ?? "Unknown"}",
|
||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
|
||||
// Payment and Status Row
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.wallet, size: 20, color: Colors.green),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"₹ ${order.orderamount ?? 0}",
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: _getStatusColor(order.orderstatus),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
order.orderstatus?.toUpperCase() ?? "-",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Color _getStatusColor(String? status) {
|
||||
switch (status) {
|
||||
case 'delivered':
|
||||
return Colors.green;
|
||||
case 'cancelled':
|
||||
return Colors.red;
|
||||
default:
|
||||
return Colors.orange;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class OrderInsightsGrid extends StatelessWidget {
|
||||
final int total;
|
||||
final int pending;
|
||||
final int delivered;
|
||||
final int cancelled;
|
||||
|
||||
OrderInsightsGrid({
|
||||
super.key,
|
||||
required this.total,
|
||||
required this.pending,
|
||||
required this.delivered,
|
||||
required this.cancelled,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 16,
|
||||
crossAxisSpacing: 16,
|
||||
childAspectRatio: .70,
|
||||
children: [
|
||||
_buildInsightCard(
|
||||
label: "Total Orders",
|
||||
count: total,
|
||||
icon: Icons.list_alt,
|
||||
color: Colors.blue,
|
||||
showChart: false,
|
||||
),
|
||||
_buildInsightCard(
|
||||
label: "Pending",
|
||||
count: pending,
|
||||
percent: total > 0 ? pending / total : 0.0,
|
||||
icon: Icons.schedule,
|
||||
color: Colors.orange,
|
||||
),
|
||||
_buildInsightCard(
|
||||
label: "Delivered",
|
||||
count: delivered,
|
||||
percent: total > 0 ? delivered / total : 0.0,
|
||||
icon: Icons.check_circle,
|
||||
color: Colors.green,
|
||||
),
|
||||
_buildInsightCard(
|
||||
label: "Cancelled",
|
||||
count: cancelled,
|
||||
percent: total > 0 ? cancelled / total : 0.0,
|
||||
icon: Icons.cancel,
|
||||
color: Colors.red,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInsightCard({
|
||||
required String label,
|
||||
required int count,
|
||||
double percent = 1.0,
|
||||
required IconData icon,
|
||||
required Color color,
|
||||
bool showChart = true,
|
||||
}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (showChart)
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 60,
|
||||
child: CircularPercentIndicator(
|
||||
radius: 30,
|
||||
lineWidth: 5,
|
||||
percent: percent.clamp(0.0, 1.0),
|
||||
center: Icon(icon, color: color, size: 24),
|
||||
backgroundColor: color.withOpacity(0.1),
|
||||
progressColor: color,
|
||||
animation: true,
|
||||
),
|
||||
)
|
||||
else
|
||||
Icon(icon, color: color, size: 32),
|
||||
const SizedBox(height: 12),
|
||||
TextWidget(
|
||||
text: "$count",
|
||||
fontWeight: FontWeight.w700,
|
||||
color: color,
|
||||
fontSize: 20,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
TextWidget(
|
||||
text: label,
|
||||
fontSize: 16,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (showChart)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: TextWidget(
|
||||
text: "${(percent * 100).toStringAsFixed(1)}%",
|
||||
fontSize: 14,
|
||||
color: ColorConstants.darkGreyColor?.withOpacity(0.5),
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
681
lib/View/Dashboard/Tabs/Ongoingview.dart
Normal file
681
lib/View/Dashboard/Tabs/Ongoingview.dart
Normal file
@@ -0,0 +1,681 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/Dashboard/Tabs/Ongoingordercontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/utility.dart';
|
||||
import '../Orderdetails/Orderdetailsview.dart';
|
||||
|
||||
class OnGoingView extends StatelessWidget {
|
||||
OnGoingView({super.key});
|
||||
|
||||
OnGoingOrderController onGoingOrderController = Get.put(OnGoingOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body:Stack(
|
||||
children: [
|
||||
GetBuilder<OnGoingOrderController>(
|
||||
initState: (_){
|
||||
onGoingOrderController.shimmer.value = true;
|
||||
onGoingOrderController.getCurrentOrder();
|
||||
},
|
||||
builder: (controller) {
|
||||
return
|
||||
controller.getCurrentOrderList.isEmpty &&
|
||||
!controller.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
|
||||
Text(
|
||||
"No orders at this moment",
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 18),
|
||||
),
|
||||
],
|
||||
)) :controller.shimmer.value
|
||||
? orderShimmerCard(context)
|
||||
:
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 8),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 70),
|
||||
itemCount:
|
||||
controller.shimmer.value
|
||||
? 5
|
||||
:controller.getCurrentOrderList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailsView(data: controller.getCurrentOrderList[index],));
|
||||
},
|
||||
child: Card(
|
||||
color: Colors.red[100]!.withAlpha(100),
|
||||
// Utility.getLightColors(controller.getOrderAllList[index].tenantname![0]).withAlpha(100),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 180,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 12,bottom: 0),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCurrentOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Text(
|
||||
DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.getCurrentOrderList[index].orderdate!)),
|
||||
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
width:45,
|
||||
margin: const EdgeInsets.only(left: 8,right: 0,top: 0,bottom: 5),
|
||||
padding: const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
// shape: BoxShape.circle
|
||||
),
|
||||
// radius: 22,
|
||||
// backgroundColor: Colors.white70,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("hh:mm").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCurrentOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
Text(
|
||||
DateFormat("a").format(DateFormat("yyyy-mm-dd'T'HH:mm:ss", "en_US").parse(controller.getCurrentOrderList[index].deliverydate??'')),
|
||||
style: const TextStyle(fontSize: 11,color: Colors.black,fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 2,),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
// Expanded(
|
||||
// flex: 3,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 6,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.business,color: ColorConstants.primaryColor,size: 20),
|
||||
// const SizedBox(width: 5,),
|
||||
// SizedBox(
|
||||
// width: Get.width*0.30,
|
||||
// child: Text(
|
||||
// "${controller.getCurrentOrderList[index].tenantname}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// fontSize: 16),
|
||||
// maxLines: 1,
|
||||
// ),
|
||||
// ),
|
||||
// const Spacer(),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 10,right: 10),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// decoration: BoxDecoration(
|
||||
// color: ColorConstants.primaryColor,
|
||||
// borderRadius: BorderRadius.circular(12)),
|
||||
// // height:Get.height*0.03,
|
||||
// // width: Get.width*0.3,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child: Text(
|
||||
// "${controller.getCurrentOrderList[index].orderid}",
|
||||
// style: const TextStyle(
|
||||
// fontSize: 11, color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on_rounded,
|
||||
// size: 20,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Flexible(
|
||||
// child: (Text(
|
||||
// "${controller.getCurrentOrderList[index].pickupaddress}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.black87,
|
||||
// overflow: TextOverflow.visible,
|
||||
// fontSize: 14),
|
||||
// maxLines: 1,
|
||||
// )))
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// )),
|
||||
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20),
|
||||
const SizedBox(width: 5,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.getCurrentOrderList[index].deliverycustomer??'',
|
||||
style: const TextStyle(
|
||||
color: Colors.black87, fontSize: 16),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4,)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on_rounded,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCurrentOrderList[index].deliveryaddress}.",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCurrentOrderList[index].deliverycontactno}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height:5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 20,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Text(
|
||||
"${controller.getCurrentOrderList[index].orderid}",
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
overflow: TextOverflow.visible,
|
||||
fontSize: 14),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Container(
|
||||
height: 190,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
child: Card(
|
||||
color: Colors.grey[300],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Container(
|
||||
height: 45,
|
||||
width: 45,
|
||||
decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 9,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
size: 22,
|
||||
color: Colors.black38,
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 17),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
Container(
|
||||
height: 28,
|
||||
width: 28,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.green,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user