second commit

This commit is contained in:
Anbarasu
2026-05-27 10:35:09 +05:30
parent c53794c04c
commit 1435ac47b0
501 changed files with 52818 additions and 0 deletions

View File

@@ -0,0 +1,292 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../Controller/Tenantlocation/Tenantlocationcontroller.dart';
import '../../Helper/Constants/Colorconstants.dart';
import '../../Helper/custombutton.dart';
import '../../Helper/toast.dart';
import '../../Helper/utility.dart';
import '../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
import '../Createorder/Createorderview.dart';
class TenantLocations extends StatelessWidget {
final GetCustomerByTenantIdDetails data;
TenantLocations({super.key, required this.data});
TenantLocationController tenantLocationController = Get.put(TenantLocationController());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: ColorConstants.primaryColor,
elevation: 0.3,
leading: Padding(
padding: const EdgeInsets.all(5.0),
child:InkWell(
onTap: (){
Get.back();
},
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
),
title: Text('Locations'),
titleSpacing: 0,
),
backgroundColor: Colors.grey[100],
body: GetBuilder<TenantLocationController>(
initState: (_){
tenantLocationController.getTenantLocation();
},
builder: (controller) {
return Column(
children: [
Container(
height: Get.height*0.8,
child: ListView.builder(
padding: EdgeInsets.only(bottom: 70),
itemCount: controller.getLocations.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.only(top: 8,left: 10,right: 10),
child: InkWell(
onTap: (){
controller.selectedAddressIndex = index;
controller.locationId = controller.getLocations[index].locationid!;
controller.latitude = controller.getLocations[index].locationlatitude!;
controller.longitude = controller.getLocations[index].locationlong!;
controller.address = controller.getLocations[index].locationaddress!;
print('tenatlocationid${controller.locationId}');
print('tenatlongitude${controller.latitude}');
print('tenatlongitude${controller.longitude}');
print('tenataddress${controller.address}');
controller.update();
},
child: Card(
// color: Colors.grey[150],
elevation: 0.6,
child: Container(
height: Get.height*0.15,
child: Row(
children: [
Expanded(
flex: 2,
child: Container(
decoration: BoxDecoration(
color: UtilityPromotion.getLightColors(
controller.getLocations[index].locationname![0] ??
'A'.toString().trimLeft())
.withAlpha(200),
borderRadius: BorderRadius.circular(5),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
children: [
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white70,
shape: BoxShape.circle),
child: Icon(
Icons.storefront,
color: ColorConstants.primaryColor,
size: 50,
)),
],
)
],
),
),
),
SizedBox(
width: 10,
),
Expanded(
flex: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// SizedBox(
// height: 3,
// ),
Row(
children: [
Icon(
Icons.location_on,
color: Colors.black45,
size: 17,
),
SizedBox(
width: 5,
),
Flexible(
flex: 3,
child: Text(
'${controller.getLocations[index].locationname}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
color: Colors.black54,
fontWeight: FontWeight.w600),
),
),
SizedBox(
width: 3,
),
],
),
Row(
children: [
Icon(
Icons.phone_android_sharp,
color: Colors.black45,
size: 16,
),
SizedBox(
width: 5,
),
Text(
'${controller.getLocations[index].locationcontact}',
style: TextStyle(
fontSize: 15,
color: Colors.black87,
fontWeight: FontWeight.w400),
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
Icons.location_on_outlined,
size: 16,
color: Colors.black45,
),
SizedBox(
width: 4,
),
Flexible(
child: Text(
'${controller.getLocations[index].locationsuburb}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15, color: Colors.black87
// fontWeight: FontWeight.w600
),
),
),
],
),
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Icon(
// Icons.location_on_outlined,
// size: 16,
// color: Colors.black45,
// ),
// SizedBox(
// width: 4,
// ),
// Container(
// width: Get.width*0.44,
// child: Text(
// '${controller.getLocations[index].address}',
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// fontSize: 15, color: Colors.black87
// // fontWeight: FontWeight.w600
// ),
// ),
// ),
// ],
// )
],
),
),
SizedBox(
width: 10,
),
Expanded(
flex: 1,
child: InkWell(
onTap: (){
controller.selectedAddressIndex = index;
controller.locationId = controller.getLocations[index].locationid!;
controller.latitude = controller.getLocations[index].locationlatitude!;
controller.longitude = controller.getLocations[index].locationlong!;
controller.address = controller.getLocations[index].locationaddress!;
controller.update();
},
child: CircleAvatar(
radius: 12,
backgroundColor:controller.selectedAddressIndex==index?Colors.green:Colors.grey[300],
child: Icon(Icons.check,color: ColorConstants.secondaryColor,size: 20),
),
),
)
],
),
)
),
),
);
},
),
),
Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Padding(
padding: const EdgeInsets.only(bottom: 11,top: 0),
child: Center(
child: RoundedButton(
onPressed: () {
if(controller.selectedAddressIndex!=-1){
Get.to(CreateOrderView(isDashboard: false,));
controller.btnController.reset();
}
else{
controller.btnController.reset();
Toast.showToast('Please Select location address');
}
},
color:ColorConstants.primaryColor,
title: 'Continue',
controller: controller.btnController,
textStyle: const TextStyle(
fontSize: 18,
fontFamily: "Lato",
color: Colors.white,
fontWeight: FontWeight.bold),
height: Get.height*0.06,
width: Get.width*0.8,
)
),
)),
],
),
],
);
}
),
);
}
}