Files
daily_mobileapp_merchant/lib/View/Createorder/Createorderview.dart
2026-05-27 10:35:09 +05:30

2732 lines
185 KiB
Dart

import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_expanded_tile/flutter_expanded_tile.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../Controller/Createorder/Createordercontroller.dart';
import '../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
import '../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
import '../../Helper/Constants/Apiconstants.dart';
import '../../Helper/Constants/Assetconstants.dart';
import '../../Helper/Constants/Colorconstants.dart';
import '../../Helper/Logger.dart';
import '../../Helper/custombutton.dart';
import '../../Helper/toast.dart';
import '../../Helper/utility.dart';
import '../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
import '../../Model/Response/Customers/GetCustomerById/Getdropcustomerbytenantid.dart';
import '../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart';
import '../Googlemap/Googlemapview.dart';
import '../Home/Homeview.dart';
import 'Droplocation/Tabs/Dropcustomertabmainpage.dart';
import 'Pickuplocation/Googlemap/Googlemapview.dart';
import 'Pickuplocation/Tabs/Pickupcustomertabmainpage.dart';
class CreateOrderView extends StatelessWidget {
final GetCustomerByTenantIdDetails? pickUpData;
final GetDropCustomerByTenantIdDetails? dropData;
final bool isDashboard;
bool pickupSavedAddress;
bool dropSavedAddress;
CreateOrderView({super.key, required this.isDashboard, this.pickUpData,this.dropData,this.pickupSavedAddress = false,this.dropSavedAddress= false});
CreateOrderController createOrderController = Get.put(CreateOrderController());
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
TenantDropCustomerController tenantDropCustomerController = Get.put(TenantDropCustomerController());
ScrollController listScrollController = ScrollController();
final ScrollController scrollController = ScrollController();
@override
Widget build(BuildContext context) {
return GetBuilder<CreateOrderController>(
initState: (_)async{
createOrderController.appConfigurationService.getAppConfig("${ApiConstants.configUrl}?configid=1");
createOrderController.loader = true;
createOrderController.startTimer();
// createOrderController.getDetails();
createOrderController.getTenantLocation();
createOrderController.getLocation();
if(isDashboard == true) {
createOrderController.getCurrentLocation();
}
if(createOrderController.fromLatitude!= null&&createOrderController.fromLongitude!= null&&createOrderController.toLatitude!= null&&createOrderController.toLongitude != null){
SharedPreferences prefs = await SharedPreferences.getInstance();
var distanceInMeters = createOrderController.calculateDistance(
double.parse(createOrderController.toLatitude.toString()),
double.parse(createOrderController.toLongitude.toString()),
double.parse(createOrderController.fromLatitude.toString()),
double.parse(createOrderController.fromLongitude.toString()),
);
createOrderController.distanceKm = distanceInMeters.round();
print('distanceKmIninit ${createOrderController.distanceKm}');
createOrderController.appRadius = prefs.getInt('appRadius')??0;
logger.i(createOrderController.appRadius);
if(createOrderController.appRadius != 0 &&createOrderController.distanceKm != null) {
try {
int appRadiusInt = int.parse(createOrderController.appRadius.toString());
int distanceKmInt = int.parse(createOrderController.distanceKm.toString());
if(appRadiusInt <= distanceKmInt) {
AwesomeDialog(
context: Get.context!,
dialogType: DialogType.warning,
//animType: AnimType.BOTTOMSLIDE,
descTextStyle: const TextStyle(fontSize: 16,),
desc: 'Service not available at this location.',
dismissOnTouchOutside: false,
btnOkText: 'Ok',
// btnCancelOnPress: () {
// Get.to(OrderDetails(data: data));
// },
btnOkOnPress: () async{
Get.to(()=>CreateOrderView(isDashboard: false,));
},
).show();
}
} catch (e) {
print("Error parsing integers: $e");
}
} else {
print('appRadiusinit ${createOrderController.appRadius}');
print('distanceKminit ${createOrderController.distanceKm}');
print("One or both of the values are null.");
}
}
createOrderController.getTenantInfo();
createOrderController.getTenantPricing();
// createOrderController.getTenantSubCategories();
createOrderController.getAdminToken();
createOrderController.pickupExpandedTileController = ExpandedTileController(isExpanded:createOrderController.pickupPredictions.isNotEmpty?false:true);
createOrderController.dropExpandedTileController = ExpandedTileController(isExpanded:false);
// createOrderController.listenLocationExpansion();
// deliveryDetailsController.customerEmail =data.email??'';
},
builder: (controller) {
return WillPopScope(
onWillPop: () async{
Get.to(()=> HomeView(selectedIndex: 0));
return false;
},
child: Scaffold(
appBar: AppBar(
backgroundColor: ColorConstants.primaryColor,
elevation: 0.3,
leading: Padding(
padding: const EdgeInsets.all(5.0),
child: InkWell(
onTap: (){
Get.to(HomeView(selectedIndex: 0));
},
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
),
title: Text('Delivery',style: TextStyle(fontSize: 18,color: ColorConstants.secondaryColor,),
),
actions: [
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// '${DateFormat("dd-MM-yyyy").format(DateTime.now())}',
// style: TextStyle(fontSize: 17,color: ColorConstants.secondaryColor,fontWeight: FontWeight.normal),),
// SizedBox(width: 5,),
// Text(
// '${controller.currentTime.value.hour.toString().padLeft(2, '0')}:${controller.currentTime.value.minute.toString().padLeft(2, '0')}:${controller.currentTime.value.second.toString().padLeft(2, '0')} ${controller.amPm.value}',
//
// // '${DateFormat("hh.mm a").format(DateTime.now())}',
// style: TextStyle(fontSize: 17,color: ColorConstants.secondaryColor,fontWeight: FontWeight.normal),),
// ],
// ),
// Padding(
// padding: const EdgeInsets.only(top: 5),
// child: SizedBox(
// width: Get.width*0.4,
// child: DropdownButtonHideUnderline(
// child: DropdownButtonFormField2<TenantLocationDetails>(
// isExpanded: true,
//
// style: TextStyle(color: ColorConstants.secondaryColor!),
// decoration: InputDecoration(
// // Add Horizontal padding using menuItemStyleData.padding so it matches
// // the menu padding when button's width is not specified.
// contentPadding: const EdgeInsets.only(bottom: 15),
//
// // fillColor:ColorConstants.secondaryColor ,
// // filled: true,
// border: InputBorder.none
// // Add more decoration..
// ),
// hint: Text(
// 'Select location',
// style: TextStyle(fontSize: 14,color: ColorConstants.secondaryColor),
// ),
//
// items: controller.tenantLocations
// .map((item) => DropdownMenuItem<TenantLocationDetails>(
// value: item,
// child: Row(
//
// children: [
// // Icon(Icons.business,color: ColorConstants.darkGreyColor),
// // SizedBox(width: 5,),
// Expanded(
// child: Text(
// "${item.locationname}",
// maxLines: 2,
// style: TextStyle(
// fontSize: 14,
// color: ColorConstants.darkGreyColor!
// ),
// ),
// ),
// ],
// ),
// ))
// .toList(),
// validator: (value) {
// if (value == null) {
// return 'Please select location.';
// }
// return null;
// },
// onChanged: (value) {
// //Do something when selected item is changed.
// },
// onSaved: (location) async{
// controller.selectedValue = location;
// SharedPreferences prefs = await SharedPreferences.getInstance();
// controller.appLocationId = location?.applocationid??0;
// controller.locationId = location?.locationid??0;
// controller.tenantLocationName = location?.locationname??"";
// prefs.setInt('partnerAppLocationId', location?.applocationid??0);
// controller.update();
// },
// buttonStyleData: const ButtonStyleData(
// padding: EdgeInsets.only(right: 8),
// ),
// iconStyleData: IconStyleData(
// icon: Icon(
// Icons.arrow_drop_down,
// color: ColorConstants.secondaryColor,
// ),
// iconSize: 24,
// ),
// dropdownStyleData: DropdownStyleData(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(15),
// ),
// ),
// menuItemStyleData: const MenuItemStyleData(
// padding: EdgeInsets.symmetric(horizontal: 16),
// ),
// ),
// ),
// ),
// ),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
controller.tenantLocationName.isEmpty?Text('Select Location',style: TextStyle(fontSize: 16,color: ColorConstants.secondaryColor,)):
Text('${controller.tenantLocationName}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 16,color: ColorConstants.secondaryColor,),
),
SizedBox(width: 0,),
PopupMenuButton<TenantLocationDetails>(
position: PopupMenuPosition.under,
icon: const Icon(Icons.reorder,size: 30,),
onSelected: (TenantLocationDetails result) {
// Handle menu item selection
print('Selected: ${result.locationname}');
},
itemBuilder: (BuildContext context) {
return controller.tenantLocations.map((TenantLocationDetails location) {
return PopupMenuItem<TenantLocationDetails>(
value: location,
child: ListTile(
onTap: ()async{
SharedPreferences prefs = await SharedPreferences.getInstance();
controller.appLocationId = location.applocationid??0;
controller.locationId = location.locationid??0;
controller.tenantLocationName = location.locationname??'';
prefs.setInt('partnerAppLocationId', location.applocationid??0);
Navigator.pop(context);
},
title: Text("${location.locationname}"),
// subtitle: Text("${location.applocationid}"),
),
);
}).toList();
},
),
],
),
SizedBox(width: 10,)
],
titleSpacing: 0,
),
backgroundColor: Colors.grey[100],
body:ListView(
controller: listScrollController,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10,),
Padding(
padding: const EdgeInsets.only(left: 10,right: 10) ,
child: Column(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(color:ColorConstants.secondaryColor),
child:SizedBox(
// height: 185,
child: Container(
decoration: BoxDecoration(
color: ColorConstants.secondaryColor,
shape: BoxShape.rectangle,
border: Border(top:BorderSide(color: Colors.grey[600]!),left:BorderSide(color: Colors.grey[600]!),right: BorderSide(color: Colors.grey[600]!)),
// borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:Radius.circular(10) )
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 6,top: 6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
InkWell(
onTap:(){
if (controller.resultPosition != null) {
Get.to(PickupGoogleMapView (lat: controller.resultPosition!.latitude, long: controller.resultPosition!.longitude));
}
},
child: Row(
children: [
Icon(Icons.location_on, color: ColorConstants.primaryColor,),
const SizedBox(
width: 6,
),
Text(
'Pickup',
style: TextStyle(
color: ColorConstants.primaryColor,
fontWeight: FontWeight.bold,
fontSize: 16),
),
],
)),
Spacer(),
// Icon(Icons.edit,color: ColorConstants.primaryColor,),
InkWell(
onTap:(){
Get.to(()=> PickupCustomerView());
},
child: Container(
padding:const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,border: Border.all(color: Colors.grey[400]!),borderRadius: BorderRadius.circular(5)),
child: Text(
'Saved address',
style: TextStyle(
color: ColorConstants.darkGreyColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
),
const SizedBox(
width: 6,
),
],
),
),
// Padding(
// padding: const EdgeInsets.only(left: 5,top: 5,bottom: 0,right: 5),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// TextField(
// controller: tenantPickupCustomerController.searchController,
// textAlignVertical: TextAlignVertical.center,
// // focusNode: controller.focusNode,
// onChanged: (data){
// var keyword = data;
// print('keyword................${keyword}');
// if(data.isEmpty){
// tenantPickupCustomerController.getCustomerBytenantId.clear();
// tenantPickupCustomerController.update();
// }
// else {
// // if(data.isNotEmpty) {
// tenantPickupCustomerController.shimmer.value = true;
// tenantPickupCustomerController.getSearchCustomerData(keyword);
// }
// // else{
// // tenantPickupCustomerController.shimmer.value = true;
// // tenantPickupCustomerController.refreshData();
// // FocusScope.of(context).unfocus();
// // }
// },
// decoration: InputDecoration(
// border: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// focusedBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// disabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
// prefixIcon: IconButton(
// icon: const Icon(Icons.search),
// color: Colors.grey[500]!,
// onPressed: () {
//
// },
// ),
// hintText: 'Search by contactno',
// hintStyle: TextStyle(
// color: Colors.grey[500]!,
//
//
// ),
// suffixIcon: tenantPickupCustomerController.searchController.text.isEmpty ? const SizedBox() : IconButton(
// icon: const Icon(Icons.cancel),
// color: Colors.grey[500]!,
// onPressed: () {
// tenantPickupCustomerController.searchController.clear();
// tenantPickupCustomerController.shimmer.value = true;
// tenantPickupCustomerController.getCustomerBytenantId.clear();
// // tenantPickupCustomerController.refreshData();
// FocusManager.instance.primaryFocus?.unfocus();
// },
// ),
// ),
// ),
// ],
// ),
// ),
// tenantPickupCustomerController.getCustomerBytenantId.isNotEmpty
// ? Container(
// height: Get.height*0.20,
// width: Get.width,
// decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(1)),
// child: Obx(() {
// return ListView.builder(
// itemCount: tenantPickupCustomerController.getCustomerBytenantId.length,
// itemBuilder: (
// BuildContext context,
// int index) {
// return Padding(
// padding: const EdgeInsets
// .only(
// top: 5,
// left: 5,
// right: 5,
//
// ),
// child: InkWell(
// onTap: () async {
// createOrderController.pickupCustomerId = tenantPickupCustomerController.getCustomerBytenantId[index].customerid;
// createOrderController.pickUpCustomerName = "${tenantPickupCustomerController.getCustomerBytenantId[index].firstname}" + "${tenantPickupCustomerController.getCustomerBytenantId[index].lastname}";
// createOrderController.pickUpCustomerContactNo = tenantPickupCustomerController.getCustomerBytenantId[index].contactno;
// createOrderController.pickUpLandMark = tenantPickupCustomerController.getCustomerBytenantId[index].landmark;
// createOrderController.pickUpDoorNo = tenantPickupCustomerController.getCustomerBytenantId[index].doorno;
// createOrderController.pickupLocationId = tenantPickupCustomerController.getCustomerBytenantId[index].deliverylocationid;
// createOrderController.pickupTenantLocationId = tenantPickupCustomerController.getCustomerBytenantId[index].tenantlocationid;
// createOrderController.fromLatitude = tenantPickupCustomerController.getCustomerBytenantId[index].latitude;
// createOrderController.fromLongitude = tenantPickupCustomerController.getCustomerBytenantId[index].longitude;
// createOrderController.fromAddress = tenantPickupCustomerController.getCustomerBytenantId[index].address;
// createOrderController.pickupAddressController.text = tenantPickupCustomerController.getCustomerBytenantId[index].address ?? '';
// createOrderController.pickupContactNameController.text = "${tenantPickupCustomerController.getCustomerBytenantId[index].firstname}" + "${tenantPickupCustomerController.getCustomerBytenantId[index].lastname}";
// createOrderController.pickupContactNoController.text = tenantPickupCustomerController.getCustomerBytenantId[index].contactno ?? '';
// createOrderController.pickupDoorNoController.text = tenantPickupCustomerController.getCustomerBytenantId[index].doorno ?? '';
// createOrderController.pickupLandMarkController.text = tenantPickupCustomerController.getCustomerBytenantId[index].landmark ?? '';
// createOrderController.pickupStateController.text = tenantPickupCustomerController.getCustomerBytenantId[index].state ?? '';
// createOrderController.pickupCityController.text = tenantPickupCustomerController.getCustomerBytenantId[index].city ?? '';
// createOrderController.pickupSuburbController.text = tenantPickupCustomerController.getCustomerBytenantId[index].suburb ?? '';
// createOrderController.pickupPostcodeController.text = tenantPickupCustomerController.getCustomerBytenantId[index].postcode ?? '';
//
// logger.i(createOrderController.pickupCustomerId);
// logger.i(createOrderController.dropCustomerId);
//
// if (createOrderController.pickupCustomerId == createOrderController.dropCustomerId) {
// Toast.showToast(
// 'Please select different customer it already selected');
// }
// else {
// FocusManager.instance.primaryFocus?.unfocus();
// tenantPickupCustomerController.getCustomerBytenantId.clear();
// tenantPickupCustomerController.searchController.clear();
// tenantPickupCustomerController.update();
// print('ontapgetCustomerBytenantId ${tenantPickupCustomerController.getCustomerBytenantId}');
//
// // Get.to(CreateOrderView(pickUpData:tenantPickupCustomerController.getCustomerBytenantId[index], isDashboard: false,pickupSavedAddress: true,));
//
// }
// },
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.only(right: 5,top: 10,left: 5,bottom: 10),
// margin: const EdgeInsets.only(top: 2,bottom: 2),
// decoration: BoxDecoration(
// color: ColorConstants.secondaryColor,
// border:Border.all(color: ColorConstants.darkGreyColor!),
// borderRadius: const BorderRadius.all(Radius.circular(3)),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
//
// Expanded(
// flex: 8,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Row(
// children: [
// Icon(
// Icons.person,
// color: ColorConstants.primaryColor,
// size: 20,
// ),
// const SizedBox(
// width: 5,
// ),
// Row(
// children: [
// Text(
// tenantPickupCustomerController.getCustomerBytenantId[index].firstname ?? "",
// style: TextStyle(
// fontSize: 16,
// color: Colors.grey[600],
// fontWeight: FontWeight.w300),
// ),
// ],
// ),
// Spacer(),
// Icon(
// Icons.call,
// color: ColorConstants.primaryColor,
// size: 20,
// ),
// const SizedBox(
// width: 5,
// ),
// Text(
// '${tenantPickupCustomerController.getCustomerBytenantId[index].contactno}',
// style: TextStyle(
// color: ColorConstants.darkGreyColor,
// fontSize: 14,
// fontWeight:
// FontWeight.w300),
// ),
//
// ],
// ),
//
// ],
// )),
// ],
// ),
// ),
//
// ],
// ),
// ),
// );
// }
// );
// })
// ):SizedBox(),
Padding(
padding: const EdgeInsets.only(left: 5,top: 5,bottom: 0,right: 5),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
TextField(
onTap: () async {
},
onChanged: (text)async {
if(text.isEmpty){
controller.pickupPredictions.clear();
FocusManager.instance.primaryFocus?.unfocus();
controller.update();
}
else {
controller.onSearchPickupTextChanged(text);
}
},
controller: controller.pickupAddressController,
maxLines: 2,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
// prefixIcon:Icon( Icons.location_on,color: ColorConstants.primaryColor,) ,
suffixIcon: InkWell(
onTap: (){
controller.pickupAddressController.clear();
controller.pickupSuburbController.clear();
controller.pickupCityController.clear();
controller.pickupStateController.clear();
controller.pickupPostcodeController.clear();
controller.pickupSaveAddress = false;
// controller.pickupContactNameController.clear();
// controller.pickupContactNoController.clear();
// controller.pickupDoorNoController.clear();
// controller.pickupLandMarkController.clear();
controller.pickupPredictions.clear();
FocusManager.instance.primaryFocus?.unfocus();
// pickupSavedAddress = false;
controller.pickupExpandedTileController.collapse();
controller.update();
print('isExpandedTextfield');
},
child: Icon(Icons.close,color: Colors.red,)),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Pickup address"),
),
],
),
),
SizedBox(height: 5,)
],
),
),
),
),
Container(
decoration: BoxDecoration(
color: ColorConstants.secondaryColor,
shape: BoxShape.rectangle,
border: Border(right:BorderSide(color: Colors.grey[600]!),left:BorderSide(color: Colors.grey[600]!),bottom: BorderSide(color: Colors.grey[600]!),top:BorderSide(color: Colors.grey[300]!)),
// borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:Radius.circular(10) )
),
child: ExpandedTile(
theme: ExpandedTileThemeData(
// headerRadius: 24.0,
headerPadding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
headerColor: ColorConstants.secondaryColor,
contentBackgroundColor: ColorConstants.secondaryColor,
contentPadding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
),
controller: controller.pickupExpandedTileController,
title: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
createOrderController.pickupPredictions.isNotEmpty?Container(
height: Get.height*0.20,
width: Get.width,
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(1)),
child: Obx(() {
return ListView.builder(
itemCount: createOrderController.pickupPredictions.length,
itemBuilder: (context, index) {
final prediction =
createOrderController.pickupPredictions[index]['description'];
return ListTile(
title: Text(prediction,style: TextStyle(color: ColorConstants.darkGreyColor),),
onTap: () {
final placeId =
createOrderController.pickupPredictions[index]['place_id'];
createOrderController.getPickupPlaceDetails(placeId,prediction);
controller.pickupExpandedTileController.expand();
FocusManager.instance.primaryFocus?.unfocus();
},
);
},
);
}),):SizedBox(),
createOrderController.pickupPredictions.isNotEmpty?SizedBox():Text('Pickup details :',style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),),
],
),
content: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 0,),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(width:5),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
textCapitalization: TextCapitalization.sentences,
inputFormatters: <TextInputFormatter>[
UpperCaseTextFormatter()
],
onTap: () async {
},
onChanged: (name){
print('pickupCustomerName $name');
createOrderController.pickUpCustomerName = name;
},
controller: createOrderController.pickupContactNameController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
maxLength: 25,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.person,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Contact name"),
),
),
SizedBox(width: 3,),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child:
// IntlPhoneField(
// focusNode: controller.pickupFocusNode,
// flagsButtonPadding: EdgeInsets.only(left: 5),
// invalidNumberMessage: "Invalid number",
// textAlignVertical: TextAlignVertical.center,
// cursorHeight: 10,
// showDropdownIcon: false,
// // autovalidateMode: AutovalidateMode.always,
// decoration: InputDecoration(
// fillColor: Colors.white,
// filled: true,
// labelText: '',
// hintText: "Contact no",
// counterText: "",
// contentPadding: EdgeInsets.only(top: 10),
// border: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// focusedBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// disabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
// ),
// initialCountryCode: 'IN',
// showCountryFlag: false,
// countries: [],
// controller: createOrderController.pickupContactNoController,
// keyboardType: TextInputType.number,
// // maxLines: 1,
// cursorColor: ColorConstants.textFieldColor,
// style: TextStyle(
// color: ColorConstants.textFieldColor,
// fontSize: 14,
// ),
// onChanged: (contactNo){
// createOrderController.pickUpCustomerContactNo = contactNo.completeNumber;
// //
// if(controller.pickupContactNoController.text.length ==10){
// FocusScope.of(context).unfocus();
// }
// },
// ),
// InternationalPhoneNumberInput(
// // Callback for when the input changes
// onInputChanged: (PhoneNumber contactNo) {
// createOrderController.pickUpCustomerContactNo = contactNo.phoneNumber;
//
// if(contactNo.phoneNumber?.length==10){
// FocusScope.of(context).unfocus();
// }
// },
// // Callback for when the input is validated
// onInputValidated: (bool value) {
// // You can perform additional validation here if needed
// },
// // Configuration for the country selector
// textAlignVertical: TextAlignVertical.center,
// // Ignore blank input
// ignoreBlank: false,
// countrySelectorScrollControlled: false,
// spaceBetweenSelectorAndTextField: 5,
//
//
// // Auto-validation mode
// autoValidateMode: AutovalidateMode.onUserInteraction,
// // Style for the country selector
// selectorTextStyle: TextStyle(color: Colors.black),
// keyboardType: TextInputType.number,
// // maxLines: 1,
// cursorColor: ColorConstants.textFieldColor,
//
// // Initial value for the phone number input
// initialValue:controller.number,
// // Controller for the text field
// textFieldController: createOrderController.pickupContactNoController,
// // Decoration for the input field
// inputDecoration: InputDecoration(
// fillColor: Colors.white,
// filled: true,
// border: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// focusedBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[100]!)),
// disabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(1)),
// borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
// counterText: "",
// hintText: "Contact no"
// ),
// // Format input (e.g., adding spaces between digits)
// formatInput: false,
// ),
TextField(
onChanged: (contactNo){
createOrderController.pickUpCustomerContactNo = contactNo;
createOrderController.pickUpCustomerContactNoCheck = createOrderController.pickUpCustomerContactNo;
if(createOrderController.pickUpCustomerContactNoCheck == createOrderController.pickUpCustomerContactNo){
controller.pickupSaveAddress = true;
if(contactNo.length==10){
FocusManager.instance.primaryFocus?.unfocus();
}
}
// else if(contactNo.length==10){
// FocusManager.instance.primaryFocus?.unfocus();
// }
},
controller: createOrderController.pickupContactNoController,
keyboardType: TextInputType.number,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
maxLength: 10,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.phone,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Contact no"),
),
),
],
),
const SizedBox(height: 5,),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(width:5),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
onTap: () async {
},
onChanged: (doorno){
print('pickUpDoorNo $doorno');
createOrderController.pickUpDoorNo = doorno;
},
maxLength: 25,
controller: createOrderController.pickupDoorNoController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.door_back_door_outlined,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "House / Door no"),
),
),
SizedBox(width: 3,),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
onTap: () async {
},
onChanged: (landmark){
print('pickUpLandMark $landmark');
createOrderController.pickUpLandMark = landmark;
},
controller: createOrderController.pickupLandMarkController,
maxLength: 25,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.house,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Landmark"),
),
),
],
),
const SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width:5),
!controller.pickupSaveAddress?Container():InkWell(
onTap:(){
if( controller.pickupAddressController.text.isEmpty){
Toast.showToast('Pickup address should not be empty');
}
else if( controller.pickupContactNameController.text.isEmpty){
Toast.showToast('Pickup customer name should not be empty');
}
else if( controller.pickupContactNoController.text.isEmpty){
Toast.showToast('Pickup customer no should not be empty');
}
else if( controller.pickupContactNoController.text.length!=10){
Toast.showToast('Please enter correct pickup customer no');
}
// else if( controller.pickupContactNameController.text.length!=3 ){
// Toast.showToast('Pickup customer name should be minimum 3 characters required');
// }
else {
// controller.pickupSaveAddress = true;
// controller.pickupCustomerId = 0;
}
},
child: !controller.pickupSaveAddress?Container():Row(
children: [
InkWell(
onTap: (){
pickupSave();
},
child: Container(height: 21,width: 22,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3),color: controller.pikUpSaveChecking==true?Colors.green:Colors.white,border: Border.all(
color: controller.pikUpSaveChecking?Colors.green:Colors.grey[400]!
)
),
child:controller.pikUpSaveChecking ==true?const Icon(Icons.check,color: Colors.white,size: 19,):const SizedBox(),
),
),
SizedBox(width: 10,),
Text('Save for later',style: TextStyle(color:ColorConstants.primaryColor),),
],
),
),
Spacer(),
InkWell(
onTap:(){
controller.pickupExpandedTileController.collapse();
},
child: Container(
padding: const EdgeInsets.only(left: 20,bottom: 7,top: 7,right:20),
decoration: BoxDecoration(color:ColorConstants.primaryColor,borderRadius: BorderRadius.circular(5)),
child: Text('Ok',style: TextStyle(color:ColorConstants.secondaryColor),),
),
),
SizedBox(width:5)
],
),
const SizedBox(height: 5,),
],
),
onTap: () {
debugPrint("tapped!!");
},
onLongTap: () {
debugPrint("long tapped!!");
},
),
),
],
),
],
),
),
SizedBox(height: 10,),
Padding(
padding: const EdgeInsets.only(left: 8,right: 8) ,
child: Column(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(color:ColorConstants.secondaryColor),
child:SizedBox(
// height: 120,
child: Container(
decoration: BoxDecoration(
color: ColorConstants.secondaryColor,
shape: BoxShape.rectangle,
border: Border(top:BorderSide(color: Colors.green[300]!),left:BorderSide(color: Colors.green[300]!),right: BorderSide(color: Colors.green[300]!)),
// borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:Radius.circular(10) )
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 6,top: 6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
InkWell(
onTap:()async{
if (controller.resultPosition != null) {
Get.to(DropGoogleMapView (lat: controller.resultPosition!.latitude, long: controller.resultPosition!.longitude));
}
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Icon(Icons.location_on, color: ColorConstants.primaryColor,),
const SizedBox(
width: 6,
),
Text(
'Drop',
style: TextStyle(
color: ColorConstants.primaryColor,
fontWeight: FontWeight.bold,
fontSize: 16),
),
],
),
),
Spacer(),
// Icon(Icons.edit,color: ColorConstants.primaryColor,),
InkWell(
onTap:(){
Get.to(()=> DropCustomerView());
},
child: Container(
padding:const EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,border: Border.all(color: Colors.grey[400]!),borderRadius: BorderRadius.circular(5)),
child: Text(
'Saved address',
style: TextStyle(
color: ColorConstants.darkGreyColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
),
const SizedBox(
width: 6,
),
],
),
),
// Padding(
// padding: const EdgeInsets.only(left: 5,top: 5,bottom: 0,right: 5),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// TextField(
// controller: tenantDropCustomerController.searchController,
// textAlignVertical: TextAlignVertical.center,
// // focusNode: controller.focusNode,
// onChanged: (data){
// var keyword = data;
// print('keyword................${keyword}');
// if(data.isEmpty){
// tenantDropCustomerController.getCustomerBytenantId.clear();
// tenantDropCustomerController.update();
// }
// else {
// // if(data.isNotEmpty) {
// tenantDropCustomerController.shimmer.value = true;
// tenantDropCustomerController.getSearchCustomerData(keyword);
//
// }
// // else{
// // tenantDropCustomerController.shimmer.value = true;
// // tenantDropCustomerController.refreshData();
// // FocusScope.of(context).unfocus();
// // }
//
// },
// onTap:(){
// if (listScrollController.hasClients) {
// final position =
// listScrollController.position.minScrollExtent +
// 300;
// listScrollController.animateTo(
// position,
// duration: const Duration(seconds: 1),
// curve: Curves.easeOut,
// );
// }
// },
// decoration: InputDecoration(
// border: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// enabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// focusedBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(
// width: 1.5,
// color: Colors.grey[300]!)),
// disabledBorder: OutlineInputBorder(
// borderRadius: BorderRadius.all(Radius.circular(2)),
// borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
// prefixIcon: IconButton(
// icon: const Icon(Icons.search),
// color: Colors.grey[500]!,
// onPressed: () {
//
// },
// ),
// hintText: 'Search by contactno',
// hintStyle: TextStyle(
// color: Colors.grey[500]!,
//
//
// ),
// suffixIcon: tenantDropCustomerController.searchController.text.isEmpty ? const SizedBox() : IconButton(
// icon: const Icon(Icons.cancel),
// color: Colors.grey[500]!,
// onPressed: () {
// tenantDropCustomerController.searchController.clear();
// tenantDropCustomerController.shimmer.value = true;
// tenantDropCustomerController.getCustomerBytenantId.clear();
// // tenantPickupCustomerController.refreshData();
// FocusManager.instance.primaryFocus?.unfocus();
// },
// ),
// ),
// ),
// ],
// ),
// ),
// tenantDropCustomerController.getCustomerBytenantId.isNotEmpty
// ? Container(
// height: Get.height*0.20,
// width: Get.width,
// decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(1)),
// child: Obx(() {
// return ListView.builder(
// itemCount: tenantDropCustomerController.getCustomerBytenantId.length,
// itemBuilder: (
// BuildContext context,
// int index) {
// return Padding(
// padding: const EdgeInsets.only(top: 5, left: 5, right: 5,),
// child: InkWell(
// onTap: () async {
// createOrderController.dropCustomerId = tenantDropCustomerController.getCustomerBytenantId[index].customerid;
// createOrderController.dropCustomerName = "${tenantDropCustomerController.getCustomerBytenantId[index].firstname}" + "${tenantDropCustomerController.getCustomerBytenantId[index].lastname}";
// createOrderController.dropCustomerContactNo = tenantDropCustomerController.getCustomerBytenantId[index].contactno;
// createOrderController.dropLandMark = tenantDropCustomerController.getCustomerBytenantId[index].landmark;
// createOrderController.dropDoorNo = tenantDropCustomerController.getCustomerBytenantId[index].doorno;
// createOrderController.dropLocationId = tenantDropCustomerController.getCustomerBytenantId[index].deliverylocationid;
// createOrderController.dropTenantLocationId = tenantDropCustomerController.getCustomerBytenantId[index].tenantlocationid;
// createOrderController.toLatitude = tenantDropCustomerController.getCustomerBytenantId[index].latitude;
// createOrderController.toLongitude = tenantDropCustomerController.getCustomerBytenantId[index].longitude;
// createOrderController.toAddress =tenantDropCustomerController.getCustomerBytenantId[index].address;
//
// createOrderController.dropAddressController.text = tenantDropCustomerController.getCustomerBytenantId[index].address??'';
// createOrderController.dropContactNameController.text = "${tenantDropCustomerController.getCustomerBytenantId[index].firstname}" + "${tenantDropCustomerController.getCustomerBytenantId[index].lastname}";
// createOrderController.dropContactNoController.text = tenantDropCustomerController.getCustomerBytenantId[index].contactno??'';
// createOrderController.dropDoorNoController.text = tenantDropCustomerController.getCustomerBytenantId[index].doorno??'';
// createOrderController.dropLandMarkController.text = tenantDropCustomerController.getCustomerBytenantId[index].landmark??'';
// createOrderController.dropStateController.text = tenantDropCustomerController.getCustomerBytenantId[index].state ??'';
// createOrderController.dropCityController.text = tenantDropCustomerController.getCustomerBytenantId[index].city??'' ;
// createOrderController.dropSuburbController.text = tenantDropCustomerController.getCustomerBytenantId[index].suburb??'';
// createOrderController.dropPostcodeController.text = tenantDropCustomerController.getCustomerBytenantId[index].postcode??'' ;
//
// logger.i (createOrderController.pickupCustomerId);
// logger.i (createOrderController.dropCustomerId);
//
// if(createOrderController.dropCustomerId == createOrderController.pickupCustomerId){
// Toast.showToast('Please select different customer it already selected');
// }
//
// else {
// FocusManager.instance.primaryFocus?.unfocus();
//
// tenantDropCustomerController.getCustomerBytenantId.clear();
// tenantDropCustomerController.searchController.clear();
// tenantDropCustomerController.update();
// print('ontapgetCustomerBytenantId ${tenantDropCustomerController.getCustomerBytenantId}');
//
// // Get.to(CreateOrderView(dropData:tenantPickupCustomerController.getCustomerBytenantId[index], isDashboard: false,pickupSavedAddress: true,));
//
// }
// },
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.only(right: 5,top: 10,left: 5,bottom: 10),
// margin: const EdgeInsets.only(top: 2,bottom: 2),
// decoration: BoxDecoration(
// color: ColorConstants.secondaryColor,
// border:Border.all(color: ColorConstants.darkGreyColor!),
// borderRadius: const BorderRadius.all(Radius.circular(3)),
// ),
// // height: Get.height * 0.15,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Expanded(
// flex: 8,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.spaceEvenly,
// children: [
// Row(
// children: [
// Icon(
// Icons.person,
// color: ColorConstants.primaryColor,
// size: 20,
// ),
// const SizedBox(
// width: 5,
// ),
// Row(
// children: [
// Text(
// tenantDropCustomerController.getCustomerBytenantId[index].firstname ?? "",
// style: TextStyle(
// fontSize: 16,
// color: Colors
// .grey[600],
// fontWeight:
// FontWeight
// .w600),
// ),
// ],
// ),
// Spacer(),
// Icon(
// Icons.call,
// color: ColorConstants.primaryColor,
// size: 20,
// ),
// const SizedBox(
// width: 5,
// ),
// Text(
// '${tenantDropCustomerController.getCustomerBytenantId[index].contactno}',
// style: TextStyle(
// color: ColorConstants.darkGreyColor,
// fontSize: 14,
// fontWeight:
// FontWeight
// .bold),
// ),
// ],
// ),
//
// ],
// )),
// ],
// ),
// ),
//
// ],
// ),
// ),
// );
// }
// );
// })
// ):SizedBox(),
Padding(
padding: const EdgeInsets.only(left: 5,top: 5,bottom: 0,right: 5),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
TextField(
onTap: () async {
if (listScrollController.hasClients) {
final position =
listScrollController.position.minScrollExtent +
300;
listScrollController.animateTo(
position,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
}
},
onChanged: (text) {
if(text.isEmpty){
controller.dropPredictions.clear();
FocusManager.instance.primaryFocus?.unfocus();
controller.update();
}
else {
controller
.onSearchDropTextChanged(
text);
}
},
controller: controller.dropAddressController,
maxLines: 2,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
// prefixIcon:Icon( Icons.location_on,color: ColorConstants.primaryColor,) ,
suffixIcon: InkWell(
onTap: (){
controller.dropAddressController.clear();
controller.dropSuburbController.clear();
controller.dropCityController.clear();
controller.dropStateController.clear();
controller.dropPostcodeController.clear();
controller.dropSaveAddress = false;
// controller.dropContactNameController.clear();
// controller.dropContactNoController.clear();
// controller.dropDoorNoController.clear();
// controller.dropLandMarkController.clear();
controller.dropPredictions.clear();
FocusManager.instance.primaryFocus?.unfocus();
// dropSavedAddress = false;
controller.dropExpandedTileController.collapse();
controller.update();
print('isDropExpandedTextfield');
},
child: Icon(Icons.close,color: Colors.red,)),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Drop address"),
),
],
),
),
SizedBox(height: 5,)
],
),
),
),
),
Container(
decoration: BoxDecoration(
color: ColorConstants.secondaryColor,
shape: BoxShape.rectangle,
border: Border(right:BorderSide(color: Colors.green[300]!),left:BorderSide(color: Colors.green[300]!),bottom: BorderSide(color: Colors.green[300]!),top:BorderSide(color: Colors.green[300]!)),
// borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:Radius.circular(10) )
),
child: ExpandedTile(
theme: ExpandedTileThemeData(
// headerRadius: 24.0,
headerPadding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
headerColor: ColorConstants.secondaryColor,
contentBackgroundColor: ColorConstants.secondaryColor,
contentPadding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 5),
),
controller: controller.dropExpandedTileController,
title: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
createOrderController.dropPredictions.isNotEmpty?Container(
height: Get.height*0.20,
width: Get.width,
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(1)),
child: Obx(() {
return ListView.builder(
itemCount: createOrderController.dropPredictions.length,
itemBuilder: (context, index) {
final prediction =
createOrderController.dropPredictions[index]['description'];
return ListTile(
title: Text(prediction,style: TextStyle(color: ColorConstants.darkGreyColor),),
onTap: () {
final placeId =
createOrderController.dropPredictions[index]['place_id'];
createOrderController.getDropPlaceDetails(placeId,prediction);
controller.dropExpandedTileController.expand();
FocusManager.instance.primaryFocus?.unfocus();
},
);
},
);
}),):SizedBox(),
createOrderController.dropPredictions.isNotEmpty?SizedBox():Text('Drop details :',style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),),
],
),
content: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 0,),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(width:5),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
textCapitalization: TextCapitalization.sentences,
inputFormatters: <TextInputFormatter>[
UpperCaseTextFormatter()
],
onTap: () async {
},
onChanged: (name){
print('dropCustomerName $name');
createOrderController.dropCustomerName = name;
print('dropContactNameControllerlength ${createOrderController.dropContactNameController.text.length}');
},
controller: createOrderController.dropContactNameController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
maxLength: 25,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.person,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Contact name"),
),
),
SizedBox(width: 3,),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
onChanged: (contactNo){
createOrderController.dropCustomerContactNo = contactNo;
createOrderController.dropCustomerContactNo = contactNo;
createOrderController.dropCustomerContactNoCheck = createOrderController.dropCustomerContactNo;
if(createOrderController.dropCustomerContactNoCheck == createOrderController.dropCustomerContactNo){
controller.dropSaveAddress = true;
if(contactNo.length==10){
FocusManager.instance.primaryFocus?.unfocus();
}
}
// else if(contactNo.length==10){
// FocusManager.instance.primaryFocus?.unfocus();
// }
},
keyboardType: TextInputType.number,
controller: createOrderController.dropContactNoController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
maxLength: 10,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.phone,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Contact no"),
),
),
],
),
const SizedBox(height: 5,),
Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(width:5),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
onTap: () async {
},
maxLength: 25,
onChanged: (doorno){
print('dropDoorNo $doorno');
createOrderController.dropDoorNo = doorno;
},
controller: createOrderController.dropDoorNoController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.door_back_door_outlined,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "House / Door no"),
),
),
SizedBox(width: 3,),
Container(
height: Get.height * 0.07,
width: Get.width * 0.45,
child: TextField(
onTap: () async {
},
maxLength: 25,
onChanged: (landmark){
print('dropLandMark $landmark');
createOrderController.dropLandMark = landmark;
},
controller: createOrderController.dropLandMarkController,
// maxLines: 1,
cursorColor: ColorConstants.textFieldColor,
style: TextStyle(
color: ColorConstants.textFieldColor,
fontSize: 14,
),
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
prefixIcon:Icon( Icons.house,color: ColorConstants.darkGreyColor,) ,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[100]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(1)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Landmark"),
),
),
],
),
const SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width: 5,),
!controller.dropSaveAddress?Container():InkWell(
onTap:(){
if( controller.dropAddressController.text.isEmpty){
Toast.showToast('Drop address should not be empty');
}
else if( controller.dropContactNameController.text.isEmpty){
Toast.showToast('Drop customer name should not be empty');
}
else if( controller.dropContactNoController.text.isEmpty){
Toast.showToast('Drop customer no should not be empty');
}
else if( controller.dropContactNoController.text.length!=10){
Toast.showToast('Please enter correct drop customer no');
}
// else if( controller.dropContactNameController.text.length!=3){
// Toast.showToast('Drop customer name should be minimum 3 characters required');
// }
else {
// controller.dropSaveAddress = true;
// controller.dropCustomerId = 0;
}
},
child: !controller.dropSaveAddress?Container():Row(
children: [
InkWell(
onTap: (){
dropSave();
},
child: Container(height: 21,width: 22,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3),color: controller.dropSaveChecking==true?Colors.green:Colors.white,border: Border.all(
color: controller.dropSaveChecking?Colors.green:Colors.grey[400]!
)
),
child:controller.dropSaveChecking ==true?const Icon(Icons.check,color: Colors.white,size: 19,):const SizedBox(),
),
),
SizedBox(width: 10,),
Text('Save for later',style: TextStyle(color:ColorConstants.primaryColor),),
],
),
),
Spacer(),
InkWell(
onTap:(){
controller.dropExpandedTileController.collapse();
},
child: Container(
padding: const EdgeInsets.only(left: 20,bottom: 7,top: 7,right:20),
decoration: BoxDecoration(color:ColorConstants.primaryColor,borderRadius: BorderRadius.circular(5)),
child: Text('Ok',style: TextStyle(color:ColorConstants.secondaryColor),),
),
),
SizedBox(width:5)
],
),
const SizedBox(height: 5,),
],
),
onTap: () {
if (listScrollController.hasClients) {
final position =
listScrollController.position.minScrollExtent +
300;
listScrollController.animateTo(
position,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
}
debugPrint("drop tapped!!");
},
onLongTap: () {
debugPrint("long tapped!!");
},
),
),
],
),
],
),
),
SizedBox(height: 10,),
Container(
height: Get.height*0.55,
child:controller.loader?shimmer(): Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 15),
child: Text('Pickup time :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child:
Container(
height:Get.height*0.04,
child: controller.scheduleType!=null?controller.scheduleType =='Now'?Padding(
padding: const EdgeInsets.only(left: 10),
child: Row(
children: [
InkWell(
onTap:(){
// timeSheet(context);
},
child: Container(
// width: Get.width*0.50,
padding: EdgeInsets.only(right: 10,left: 10,top: 6,bottom: 6),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5),border: Border.all(color: ColorConstants.primaryColor)),
child:Center(
child:
// Text("Pickup time : ${DateFormat("hh:mm a").format(DateFormat("yyyy-MM-dd HH:mm:ss").parse(controller.datetime.toString()))}",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),)
Text("Now",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),)
),
),
),
SizedBox(width: 10,),
InkWell(
onTap:(){
controller.scheduleType=null;
controller.scheduleIndex = -1;
controller.datetime = DateTime.now();
controller.selectedDate = DateTime.now();
controller.main();
},
child: Center(child: Icon(Icons.refresh_rounded,color:ColorConstants.primaryColor)),
)
],
),
):Row(
children: [
Text("Pickup time :",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),),
SizedBox(width: 5,),
InkWell(
onTap:(){
dateSheet(context);
},
child: Container(
width: Get.width*0.24,
padding: EdgeInsets.only(right: 5,left: 5,top: 6,bottom: 6),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5),border: Border.all(color: ColorConstants.primaryColor)),
child: Text("${
DateFormat("dd-MM-yyyy").format(DateFormat("yyyy-MM-dd").parse(controller.selectedDate.toString()))
}",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
),
SizedBox(width: 5,),
InkWell(
onTap:(){
timeSheet(context);
},
child: Container(
width: Get.width*0.20,
padding: EdgeInsets.only(right: 5,left: 5,top: 6,bottom: 6),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5),border: Border.all(color: ColorConstants.primaryColor)),
child: Text("${
DateFormat("hh:mm a").format(DateFormat("yyyy-MM-dd HH:mm:ss").parse(controller.datetime.toString()))
}",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
),
SizedBox(width: 10,),
InkWell(
onTap:(){
controller.scheduleType=null;
controller.scheduleIndex = -1;
controller.datetime = DateTime.now();
controller.selectedDate = DateTime.now();
controller.main();
},
child: Center(child: Icon(Icons.refresh_rounded,color:ColorConstants.primaryColor)),
)
],
):ListView.builder(
padding: EdgeInsets.only(left: 0),
scrollDirection: Axis.horizontal,
physics: ScrollPhysics(),
itemCount: controller.schedule.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: (){
controller.scheduleIndex = index;
controller.scheduleType = controller.schedule[index]['scheduleType'];
print('scheduleTypeonTap ${controller.scheduleType}');
if(controller.scheduleType == 'Now'){
if (listScrollController.hasClients) {
final position =
listScrollController.position.maxScrollExtent +
300;
listScrollController.animateTo(
position,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
}
// timeSheet(context);
}
else{
if (listScrollController.hasClients) {
final position =
listScrollController.position.maxScrollExtent +
300;
listScrollController.animateTo(
position,
duration: const Duration(seconds: 1),
curve: Curves.easeOut,
);
}
dateSheet(context);
}
controller.update();
},
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: Container(
padding: EdgeInsets.only(right: 15,left: 15,top: 6,bottom: 6),
decoration: BoxDecoration(color: controller.scheduleIndex == index?ColorConstants.primaryColor:Colors.grey[300],borderRadius: BorderRadius.circular(5)),
child:Center(
child:
Text("${controller.schedule[index]['scheduleType']}",style: TextStyle(color: controller.scheduleIndex ==index?ColorConstants.secondaryColor:ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),)
),
),
)
);
},
),
),
),
Padding(
padding: const EdgeInsets.only(left: 15,top: 20),
child: Text('Weight :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child: Container(
height: Get.height*0.04,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: controller.weightRange.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: (){
controller.weightSelectedIndex = index;
controller.weight = controller.weightRange[index]['weight'];
print('deliveryDetailsControllerweightRange${controller.weight}');
controller.update();
},
child:Padding(
padding: const EdgeInsets.only(left: 10),
child: Container(
padding: EdgeInsets.only(right: 15,left: 15,top: 6,bottom: 6),
decoration: BoxDecoration(color: controller.weightSelectedIndex == index?ColorConstants.secondaryColor:Colors.grey[300],borderRadius: BorderRadius.circular(5),border: Border.all(color: controller.weightSelectedIndex == index?ColorConstants.primaryColor:Colors.grey[300]!)),
child: Column(
children: [
Center(child: Text(controller.weightRange[index]['weight'],style: TextStyle(color: controller.weightSelectedIndex == index?ColorConstants.darkGreyColor:ColorConstants.darkGreyColor,fontSize: 15,fontWeight: FontWeight.bold),)),
],
),
),
)
);
}, ),
),
),
Padding(
padding: const EdgeInsets.only(left: 15,top: 20),
child: Text('Item category :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child: Container(
height: Get.height*0.05,
child: InkWell(
onTap: (){
showModalBottomSheet(
isDismissible: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15.0), topRight: Radius.circular(15)),
),
context: context,
builder: (builder) {
return Container(
height: Get.height,
child:Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 10,left: 10),
child: Text('Select categories :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 18,fontWeight: FontWeight.bold,),),
),
SizedBox(height: 20,),
Expanded(
child: GridView.builder(
itemCount: controller.subCategoryLists.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
crossAxisSpacing: 4,
mainAxisSpacing: 4,
childAspectRatio: 8.5,
),
itemBuilder: (
context,
index,
) {
print('subCategoryListslengthinview${controller.subCategoryLists.length}');
return InkWell(
onTap: () {
controller.catSelectedIndex = index;
controller.subCatId =(controller.subCategoryLists[index].subcategoryid);
controller.subCatName =(controller.subCategoryLists[index].subcategoryname);
controller.update();
print('SubCategoryListSubcategoryid ${controller.subCategoryLists[index].subcategoryid}');
print('SubCategoryListSubcategoryname ${controller.subCategoryLists[index].subcategoryname}');
Get.back();
// Navigator.pop(context);
},
child:
Stack(
children: [
Row(
children: [
SizedBox(
width: 15,
),
// Text(
// '${controller.subCategoryLists[index].subcategoryname}',style: TextStyle(fontSize: 17,fontWeight: FontWeight.bold,),),
],
),
controller.subCategoryLists[index].subcategoryid == controller.subCatId
? Positioned(
right: 10,
top: 8,
child: Icon(
Icons.check_circle_outline,
color: Colors.green,
))
: Positioned(
right: 10,
top: 8,
child: Icon(
Icons.check_circle_outline,
color: Colors.grey[400],
))
],
),
);
}),
),
],
),
);
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 0,left: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
controller.subCatName==null?
Container(
padding: EdgeInsets.only(left: 10,right: 10,top: 10,bottom: 10),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(10),border: Border.all(color:ColorConstants.primaryColor)),
child: Center(
child: Text("${controller.subcategoryName}" ??"",style: TextStyle(fontSize: 15,color:ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)))):
Container(
// height:Get.height*0.04,
// width: Get.width*0.3,
padding: EdgeInsets.only(left: 10,right: 10,top: 10,bottom: 10),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(10),border: Border.all(color:ColorConstants.primaryColor)),
child: Center(
child: Text("${controller.subCatName}" ??"",style: TextStyle(fontSize: 15,color:ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)))),
],
),
)
],
),
),
),
),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 10,top: 20),
child: Text('Instructions :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
],
),
const SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.only(top: 5,left: 10,right: 10,bottom: 5),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(
width: 1.5,
color: Colors.grey[300]!)),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(width: 1, color: Colors.grey.shade50)),
counterText: "",
hintText: "Instructions if any?"),
controller: createOrderController.tecNotes,
keyboardType: TextInputType.text,
maxLines: 3,
maxLength: 180,
onChanged: (notes) {
// widget.model.Ordernotes = notes;
},
),
],
),
),
],
),
],
),
),
],
),
],
),
bottomNavigationBar: SizedBox(
height: Get.height*0.08,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Padding(
padding: const EdgeInsets.only(bottom: 11,top: 0),
child: RoundedButton(
onPressed: () {
if(controller.timeSlotsnew.isEmpty){
AwesomeDialog(
context: Get.context!,
dialogType: DialogType.error,
//animType: AnimType.BOTTOMSLIDE,
descTextStyle: const TextStyle(fontSize: 16,),
title: 'Warning',
desc: 'We are unable to process the order at this time. Kindly schedule it for an other day.',
dismissOnTouchOutside: false,
// btnCancelOnPress: () {
// },
btnOkOnPress: () {
Get.to(()=>CreateOrderView( isDashboard: isDashboard,));
},
).show();
controller.btnController.reset();
}
else {
controller.describeValidation();
}
},
color:ColorConstants.primaryColor,
title: 'Proceed',
controller: createOrderController.btnController,
textStyle: const TextStyle(
fontSize: 18,
fontFamily: "Lato",
color: Colors.white,
fontWeight: FontWeight.bold),
height: Get.height*0.06,
width: Get.width*0.8,
),
)),
],
),
),
),
);
}
);
}
dateSheet(context) async{
DateTime? picked = await showDatePicker(
context: context,
initialDate: createOrderController.selectedDate,
firstDate: DateTime(2000),
lastDate: DateTime(2101),
builder: (context, child) {
return GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.light(
primary: ColorConstants.primaryColor,
onPrimary: ColorConstants.secondaryColor!,
onSurface: Colors.black,
),
// backgroundColor: ColorConstants.secondaryColor,
dialogBackgroundColor: ColorConstants.secondaryColor,
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
// backgroundColor: ColorConstants.primaryColor,
// Colors.red,
),
),
),
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: child!),
),
);
},
);
if (picked != null && picked != createOrderController.selectedDate) {
createOrderController.selectedDate = picked;
createOrderController.datetime = picked;
createOrderController.timeSelectIndex = -1;
createOrderController.main();
createOrderController.update();
}
}
timeSheet(context) {
showModalBottomSheet(
isDismissible: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15.0), topRight: Radius.circular(15)),
),
context: context,
builder: (builder) {
return Padding(
padding: const EdgeInsets.only(left: 8,right: 10),
child: Container(
height: Get.height*0.40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 5,),
createOrderController.timeSlotsnew.isEmpty?
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image(
height: 160,
width: 160,
image: AssetImage(AssetConstants.NoRecords),
),
SizedBox(
height: 8,
),
Text('No slots available at this time',style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.grey[600]),),
],
)
)
: Expanded(
child: GetBuilder<CreateOrderController>(
builder: (controller) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 10,left: 10),
child: Text('Select pickuptime :',style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold,color: Colors.grey[600]),),
),
SizedBox(height: 15,),
Container(
height: Get.height*0.32,
child: GridView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 5),
itemCount: controller.timeSlotsnew.length,
itemBuilder: (ctx, index) {
print('deliveryTime..........${controller.timeSlotsnew.length}');
return Container(
height: Get.height*0.06,
width: Get.width*0.3,
child: InkWell(
onTap: (){
controller.timeSelectIndex = index;
controller.datetime = DateTime.parse(controller.timeSlotsnew[index].toString());
controller.update();
Get.back();
print('deliveryTime................${controller.datetime}');
},
child: Card(
color: controller.timeSelectIndex == index?
ColorConstants.primaryColor1 :
Colors.grey[100],
elevation: 2,
child: Center(child: Text('${DateFormat("hh.mm a").format(DateFormat("yyyy-MM-dd HH:mm:ss").parse(controller.timeSlotsnew[index]))}',style: TextStyle(fontSize: 14,fontWeight: FontWeight.bold),)),
),
),
);
},
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 2.0,
crossAxisSpacing: 0.0,
mainAxisSpacing: 1,
mainAxisExtent: 50,
),
),
),
],
);
}
),
),
],
),
),
);
});
}
bool pickupSave() {
createOrderController.update();
createOrderController.pikUpSaveChecking = !createOrderController.pikUpSaveChecking;
print('pikUpSaveCheckingpickupSave ${ createOrderController.pikUpSaveChecking}');
return createOrderController.pikUpSaveChecking;
}
bool dropSave() {
createOrderController.update();
createOrderController.dropSaveChecking = !createOrderController.dropSaveChecking;
print('dropSaveCheckingCheckingdropSave ${ createOrderController.dropSaveChecking}');
return createOrderController.dropSaveChecking;
}
shimmer(){
return Container(
height: Get.height*0.55,
child: Shimmer.fromColors(
enabled: true,
highlightColor: ColorConstants.lightGreyBg!,
baseColor: Colors.grey[300]!,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 15),
child: Text('Pickup time :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child:
Container(
height:Get.height*0.04,
child: ListView.builder(
padding: EdgeInsets.only(left: 0),
scrollDirection: Axis.horizontal,
physics: ScrollPhysics(),
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: (){
},
child: Padding(
padding: const EdgeInsets.only(left: 10),
child: Container(
width : Get.width*0.20,
padding: EdgeInsets.only(right: 15,left: 15,top: 6,bottom: 6),
decoration: BoxDecoration(color:Colors.grey[300],borderRadius: BorderRadius.circular(5)),
child:Center(
child:
Text("",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 16,fontWeight: FontWeight.bold),)
),
),
)
);
},
),
),
),
Padding(
padding: const EdgeInsets.only(left: 15,top: 20),
child: Text('Weight :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child: Container(
height: Get.height*0.04,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 3,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: (){
},
child:Padding(
padding: const EdgeInsets.only(left: 10),
child: Container(
width : Get.width*0.20,
padding: EdgeInsets.only(right: 15,left: 15,top: 6,bottom: 6),
decoration: BoxDecoration(color: Colors.grey[300],borderRadius: BorderRadius.circular(5),border: Border.all(color: Colors.grey[300]!)),
child: Column(
children: [
Center(child: Text("",style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 15,fontWeight: FontWeight.bold),)),
],
),
),
)
);
}, ),
),
),
Padding(
padding: const EdgeInsets.only(left: 15,top: 20),
child: Text('Item category :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.only(left: 25,top: 15),
child: Container(
height: Get.height*0.05,
child: InkWell(
onTap: (){
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 0,left: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width : Get.width*0.20,
// height:Get.height*0.04,
// width: Get.width*0.3,
padding: EdgeInsets.only(left: 10,right: 10,top: 10,bottom: 10),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(10),border: Border.all(color:ColorConstants.primaryColor)),
child: Center(
child: Text("",style: TextStyle(fontSize: 15,color:ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)))),
],
),
)
],
),
),
),
),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 10,top: 20),
child: Text('Instructions :',style: TextStyle(color: ColorConstants.primaryColor,fontSize: 16,fontWeight: FontWeight.bold),),
),
],
),
const SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.only(top: 5,left: 10,right: 10,bottom: 5),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: Get.height*0.08,
width : Get.width*0.95,
// padding: EdgeInsets.only(left: 10,right: 10,top: 10,bottom: 10),
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(10),border: Border.all(color:ColorConstants.primaryColor)),
child: Center(
child: Text("",style: TextStyle(fontSize: 15,color:ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)))),
],
),
),
],
),
],
),
),
);
}
}
class UpperCaseTextFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
return TextEditingValue(
text: capitalize(newValue.text),
selection: newValue.selection,
);
}
}
String capitalize(String value) {
if(value.trim().isEmpty) return "";
return "${value[0].toUpperCase()}${value.substring(1)}";
}