second commit
This commit is contained in:
281
lib/View/Authentication/Logiview.dart
Normal file
281
lib/View/Authentication/Logiview.dart
Normal file
@@ -0,0 +1,281 @@
|
||||
import 'package:country_currency_pickers/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:rounded_loading_button_plus/rounded_loading_button.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../Controller/Authentication/Authcontroller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Globalwidgets/web_view.dart';
|
||||
import '../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/custombutton.dart';
|
||||
import '../More/Faqview/privacy.dart';
|
||||
|
||||
class LoginView extends StatelessWidget {
|
||||
LoginView({super.key});
|
||||
|
||||
final AuthController authController = Get.put(AuthController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () {
|
||||
SystemNavigator.pop();
|
||||
return Future.value(true);
|
||||
},
|
||||
child: GetBuilder<AuthController>(
|
||||
initState: (_) {
|
||||
authController.getHintPhoneNumber(context);
|
||||
},
|
||||
builder: (controller) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Image.asset(
|
||||
AssetConstants.nearledailyImage,
|
||||
height: 300,
|
||||
width: 300,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: "Enter Your Phone Number",
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: "We will send you the 6 digit verification code",
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
TextWidget(
|
||||
text: "Let's Get Started",
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 18,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
contactNo(context),
|
||||
const SizedBox(height: 20),
|
||||
// const SizedBox(height: 0),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// child: submit(context),
|
||||
// ),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
terms();
|
||||
},
|
||||
child: Container(
|
||||
height: 20,
|
||||
width: 20,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
color: controller.termsChecking
|
||||
? Colors.green
|
||||
: Colors.white,
|
||||
border: Border.all(
|
||||
color: controller.termsChecking
|
||||
? Colors.green
|
||||
: Colors.grey[400]!,
|
||||
),
|
||||
),
|
||||
child: controller.termsChecking
|
||||
? const Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
size: 19,
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
"I agree to the Terms and &",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.darkGreyColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 3),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.to(() => const WebViewApp(
|
||||
url: 'https://nearle.in/privacy',
|
||||
appBarText: 'Privacy Policy',
|
||||
));
|
||||
},
|
||||
child: Text(
|
||||
"Privacy Policy",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.darkGreyColor,
|
||||
fontSize: 14,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 80), // Space so button doesn't overlap
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: submit(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget contactNo(context) {
|
||||
return TextFormField(
|
||||
buildCounter: (BuildContext context,
|
||||
{int? currentLength, int? maxLength, bool? isFocused}) =>
|
||||
null,
|
||||
maxLength: 10,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
controller: authController.loginPhoneNumberController,
|
||||
onChanged: (value){
|
||||
if(value.length==10){
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
}
|
||||
},
|
||||
onTap: () async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString('Code_Currency',
|
||||
authController.selectedDialogCountry.currencyCode!);
|
||||
prefs.setString('Currency_Code',
|
||||
authController.selectedDialogCountry.currencyCode!);
|
||||
prefs.setString('Country_Code',
|
||||
authController.selectedDialogCountry.isoCode!);
|
||||
prefs.setString('dialCode',
|
||||
'+${authController.selectedDialogCountry.phoneCode!}');
|
||||
prefs.setString('location_Country',
|
||||
authController.selectedDialogCountry.isoCode!);
|
||||
authController.currency();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Mobile Number',
|
||||
labelStyle: const TextStyle(color: Colors.grey),
|
||||
prefixIcon: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * 0.3,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 25,
|
||||
),
|
||||
InkWell(
|
||||
child: CountryPickerUtils.getDefaultFlagImage(
|
||||
authController.selectedDialogCountry),
|
||||
// onTap: _openCountryPickerDialog,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Text(
|
||||
"+${authController.selectedDialogCountry.phoneCode}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: const BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: const BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool terms() {
|
||||
authController.update();
|
||||
authController.termsChecking = !authController.termsChecking;
|
||||
return authController.termsChecking;
|
||||
}
|
||||
|
||||
Widget submit(context) {
|
||||
return GetBuilder<AuthController>(
|
||||
builder: (controller) {
|
||||
return RoundedLoadingButton(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: Get.width,
|
||||
controller: controller.loginController,
|
||||
onPressed: () {
|
||||
controller.loginTenant(context);
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Next',
|
||||
fontSize: 18,
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontWeight: FontWeight.w700,
|
||||
)
|
||||
);
|
||||
// RoundedButton(
|
||||
// height: Get.height*0.06,
|
||||
// width: Get.width,
|
||||
// onPressed: () {
|
||||
// controller.loginTenant(context);
|
||||
// },
|
||||
// color: ColorConstants.primaryColor,
|
||||
// title: 'Next',
|
||||
// controller: controller.btnController,
|
||||
// textStyle: const TextStyle(
|
||||
// fontSize: 18,
|
||||
// fontFamily: "Lato",
|
||||
// color: Colors.white,
|
||||
// fontWeight: FontWeight.bold),
|
||||
// );
|
||||
});
|
||||
}
|
||||
}
|
||||
334
lib/View/Authentication/Otpverification.dart
Normal file
334
lib/View/Authentication/Otpverification.dart
Normal file
@@ -0,0 +1,334 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:otp_timer_button/otp_timer_button.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:sms_autofill/sms_autofill.dart';
|
||||
import '../../Controller/Authentication/Authcontroller.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
import '../../Helper/toast.dart';
|
||||
import '../Home/Homeview.dart';
|
||||
import 'Usercreate/Usercreateview.dart';
|
||||
|
||||
class OTPVerification extends StatelessWidget {
|
||||
final String otp;
|
||||
final int authmode;
|
||||
final bool? logInStatus;
|
||||
// final int? activeStatus;
|
||||
|
||||
OTPVerification({super.key, this.otp="",this.authmode=0, this.logInStatus});
|
||||
|
||||
final AuthController authController = AuthController();
|
||||
|
||||
final defaultPinTheme = PinTheme(
|
||||
width: 60,
|
||||
height: 56,
|
||||
textStyle: const TextStyle(fontSize: 20, color: Colors.black, fontWeight: FontWeight.w600),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: ColorConstants.primaryColor),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<AuthController>(
|
||||
initState: (_) {
|
||||
// authController.loginController.reset();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 20,),
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.elliptical(40, 40),
|
||||
topRight: Radius.elliptical(40, 40)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20, vertical: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
|
||||
},
|
||||
child: Icon(Icons.arrow_back, color: Colors.grey[700],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
Text("Verification",
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontFamily: "Lato",
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[700])),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text("Please enter your 6 digit One-Time-Password",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.grey[600])),
|
||||
const SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: SizedBox(
|
||||
width: 400,
|
||||
child: PinFieldAutoFill(
|
||||
controller: TextEditingController(text: controller.otpController.text), // Correct usage
|
||||
textInputAction: TextInputAction.done,
|
||||
onCodeChanged: (code) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
if (controller.resendOtp == code) {
|
||||
if (authmode == 1) {
|
||||
code = controller.resendOtp ?? '';
|
||||
}
|
||||
if (logInStatus == true) {
|
||||
logger.i('Login status : $logInStatus');
|
||||
prefs.setString('tenantContactNo', controller.contactNo ?? '');
|
||||
prefs.setString('userFcmToken', controller.userFcmToken ?? '');
|
||||
Get.to(() => HomeView(selectedIndex: 0));
|
||||
} else {
|
||||
if (code == controller.resendOtp) {
|
||||
Get.to(() => CreateUserView(
|
||||
phNumber: controller.loginPhoneNumberController.text,),
|
||||
);
|
||||
}
|
||||
else{
|
||||
controller.otpController.clear();
|
||||
Toast.showToast('Please Enter Valid Otp');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
keyboardType:TextInputType.number ,
|
||||
autoFocus: true,
|
||||
onCodeSubmitted: (code){
|
||||
if(code != controller.resendOtp){
|
||||
controller.otpController.clear();
|
||||
logger.i('otpCompleted ${controller.resendOtp}');
|
||||
Toast.showToast('Please Enter Valid Otp');
|
||||
}
|
||||
},
|
||||
decoration: BoxLooseDecoration(
|
||||
textStyle: const TextStyle(fontSize: 20, color: Colors.black),
|
||||
radius: const Radius. circular(8.0),
|
||||
strokeColorBuilder: FixedColorBuilder(Colors.black.withOpacity(0.3)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
// child: Pinput(
|
||||
// defaultPinTheme: defaultPinTheme,
|
||||
// pinContentAlignment: Alignment.center,
|
||||
//
|
||||
// length: 6,
|
||||
// autofocus: true,
|
||||
// keyboardType: TextInputType.number,
|
||||
// androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi,
|
||||
// pinAnimationType: PinAnimationType.fade,
|
||||
// controller: controller.otpController,
|
||||
// pinputAutovalidateMode: PinputAutovalidateMode.onSubmit,
|
||||
// animationDuration: const Duration(milliseconds: 300),
|
||||
// // Pass it here
|
||||
// onChanged: (text) async{
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// // controller.smsOtp = text;
|
||||
// // Check if the entered text is a valid phone number
|
||||
// if (controller.resendOtp == text) {
|
||||
// if(authmode == 1){
|
||||
// text = controller.resendOtp??'';
|
||||
// }
|
||||
// if(logInStatus == true){
|
||||
// prefs.setString('tenantContactNo',controller.contactNo ?? '');
|
||||
// prefs.setString('tenantFcmToken', controller.userFcmToken ?? '');
|
||||
// logger.i('Inside the login true status');
|
||||
// Get.to(()=>HomeView(selectedIndex: 0));
|
||||
// }else{
|
||||
// logger.i('Inside the login false status');
|
||||
// Get.to(() => CreateUserView(phNumber: controller.loginPhoneNumberController.text,));
|
||||
// // showModalBottomSheet(
|
||||
// // context: Get.context!,
|
||||
// // isDismissible: true,
|
||||
// // backgroundColor: ColorConstants.secondaryColor,
|
||||
// // shape: const RoundedRectangleBorder(
|
||||
// // borderRadius: BorderRadius.only(
|
||||
// // topLeft: Radius.circular(20.0), topRight: Radius.circular(20)),
|
||||
// // ),
|
||||
// // builder: (context) {
|
||||
// // return Column(
|
||||
// // mainAxisAlignment: MainAxisAlignment.start,
|
||||
// // crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// // children: [
|
||||
// // SizedBox(
|
||||
// // height: Get.height * 0.3,
|
||||
// // // width: Get.width * 0.10,
|
||||
// // child: Padding(
|
||||
// // padding: const EdgeInsets.only(bottom: 0),
|
||||
// // child: Center(child: Lottie.asset('assets/images/nodatafound.json',)),
|
||||
// // ),
|
||||
// // ),
|
||||
// // const SizedBox(height: 15,),
|
||||
// // SizedBox(
|
||||
// // width: Get.width*0.85,
|
||||
// // child: Center(
|
||||
// // child: Text(
|
||||
// // "Oops, we couldn't find your account. Instead, would you like to create a new one?",
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 18,
|
||||
// // fontFamily: "Inter",
|
||||
// // fontWeight: FontWeight.normal,
|
||||
// // color: ColorConstants.blackColor),
|
||||
// // maxLines: 3,
|
||||
// // textAlign: TextAlign.center,
|
||||
// //
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// // const Spacer(),
|
||||
// // Row(
|
||||
// // mainAxisAlignment: MainAxisAlignment.center,
|
||||
// // crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// // children: [
|
||||
// // InkWell(
|
||||
// // onTap: (){
|
||||
// // Get.to(CreateUserView(phNumber: controller.loginPhoneNumberController.text,));
|
||||
// // },
|
||||
// // child: Container(
|
||||
// // height: Get.height*0.06,
|
||||
// // width: Get.width*0.4,
|
||||
// // decoration: BoxDecoration(color: ColorConstants.primaryColor,borderRadius: BorderRadius.circular(10),),
|
||||
// // child: Center(child: Text('Create Account',style: TextStyle(color: ColorConstants.secondaryColor,fontSize: 16,))),
|
||||
// // ),
|
||||
// // ),
|
||||
// // const SizedBox(width: 10,),
|
||||
// // InkWell(
|
||||
// // onTap: (){
|
||||
// // Get.back();
|
||||
// // },
|
||||
// // child: Container(
|
||||
// // height: Get.height*0.06,
|
||||
// // width: Get.width*0.4,
|
||||
// // decoration: BoxDecoration(color: ColorConstants.primaryColor,borderRadius: BorderRadius.circular(10),),
|
||||
// // child: Center(child: Text('Cancel',style: TextStyle(color: ColorConstants.secondaryColor,fontSize: 16,))),
|
||||
// // ),
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // const SizedBox(height: 20,)
|
||||
// //
|
||||
// //
|
||||
// // ],
|
||||
// // );
|
||||
// // }
|
||||
// // );
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// onCompleted:(text){
|
||||
// if( text != controller.resendOtp){
|
||||
// controller.otpController.clear();
|
||||
// print('textonCompleted $text');
|
||||
// print('otpCompleted ${controller.resendOtp}');
|
||||
// Toast.showToast('Please Enter Valid Otp');
|
||||
// }
|
||||
//
|
||||
// },
|
||||
//
|
||||
//
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
controller.authmode == 1 ?Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container()
|
||||
],
|
||||
):Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Didn't receive the code? ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.grey[600])),
|
||||
OtpTimerButton(
|
||||
controller: controller.otpTimerController,
|
||||
onPressed: () {
|
||||
controller.otpTimerController.startTimer();
|
||||
controller.textEditingController.clear();
|
||||
controller.codeSent = true;
|
||||
controller.sendSmsOtp(controller.loginPhoneNumberController.text.trim());
|
||||
controller.update();
|
||||
},
|
||||
text: Text('Resend Again',style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: "Lato",
|
||||
color: ColorConstants.primaryColor
|
||||
),),
|
||||
duration: 60,
|
||||
buttonType: ButtonType.text_button,
|
||||
textColor: ColorConstants.primaryColor,
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
|
||||
//submit(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// const Spacer(),
|
||||
// Container(
|
||||
// height: Get.height * 0.1,
|
||||
// width: Get.width,
|
||||
// decoration: const BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage(
|
||||
// AssetConstants.nearleAppbarBottom,
|
||||
// ),
|
||||
// fit: BoxFit.fill),
|
||||
// // color: ColorConstants.primaryColor,
|
||||
// borderRadius: BorderRadius.only(
|
||||
// bottomLeft: Radius.elliptical(2, 2),
|
||||
// bottomRight: Radius.elliptical(2, 2))),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
446
lib/View/Authentication/Usercreate/Usercreateview.dart
Normal file
446
lib/View/Authentication/Usercreate/Usercreateview.dart
Normal file
@@ -0,0 +1,446 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Controller/Authentication/Createtenantusercontroller.dart';
|
||||
import '../../../Globalwidgets/textwidget.dart';
|
||||
import '../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/Logger.dart';
|
||||
import '../../../Helper/custombutton.dart';
|
||||
import '../../../Helper/customederaction.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../Logiview.dart';
|
||||
|
||||
class CreateUserView extends StatelessWidget {
|
||||
final String? phNumber;
|
||||
CreateUserView({super.key, this.phNumber});
|
||||
|
||||
final CreateUserController controller = Get.put(CreateUserController());
|
||||
final ScrollController listScrollController = ScrollController();
|
||||
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
key: scaffoldKey,
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: true,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Get.to(() => LoginView());
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConstants.blackColor,
|
||||
),
|
||||
),
|
||||
title: TextWidget(
|
||||
text: 'Create Account',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
body: GetBuilder<CreateUserController>(
|
||||
initState: (_) {
|
||||
controller.contactNoController.text = phNumber ?? '';
|
||||
logger.i('Phone Number: ${controller.contactNoController.text}');
|
||||
controller.getAppLocations();
|
||||
controller.getCurrentLocation();
|
||||
controller.getAppCategory();
|
||||
|
||||
logger.i('Cat Name Is empty : ${controller.catName}');
|
||||
},
|
||||
builder: (controller) => Column(
|
||||
children: [
|
||||
// _buildHeader(),
|
||||
// const SizedBox(height: 10,),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
controller: listScrollController,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
controller.getProfileImage();
|
||||
},
|
||||
child: Container(
|
||||
width: 100,
|
||||
// Set the size to match the CircleAvatar's diameter
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: ColorConstants.primaryColor, // Border color
|
||||
width: 2.0, // Border width
|
||||
),
|
||||
),
|
||||
child: CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: ClipOval(
|
||||
child: controller.profileImage == null
|
||||
? Image.asset(
|
||||
AssetConstants.noProfile,
|
||||
width: 70,
|
||||
height: 70,
|
||||
color: ColorConstants.primaryColor,
|
||||
)
|
||||
: Image.file(
|
||||
width: 100,
|
||||
height: 100,
|
||||
File(controller.profileImage?.path ?? ''),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: CircleAvatar(
|
||||
radius: 15,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
child: Icon(
|
||||
Icons.camera_alt_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: 'Upload Company Logo',
|
||||
)),
|
||||
const SizedBox(height: 30,),
|
||||
_buildTextField(
|
||||
controller: controller.firstnameController,
|
||||
label: 'Contact Name',
|
||||
icon: Icons.person,
|
||||
formatters: [UpperCaseTextFormatter()],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildTextField(
|
||||
controller: controller.companyNameController,
|
||||
label: 'Company Name',
|
||||
icon: Icons.business,
|
||||
formatters: [UpperCaseTextFormatter()],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildTextField(
|
||||
controller: controller.emailController,
|
||||
label: 'Email',
|
||||
icon: Icons.email_outlined,
|
||||
validator: _validateEmail,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSelectionField(
|
||||
context: context,
|
||||
label: controller.selectedCategoryName.isEmpty ? 'Select Category' : controller.selectedCategoryName,
|
||||
icon: Icons.category,
|
||||
onTap: () async {
|
||||
var result = await SubCategoryService().fetchSubCategories();
|
||||
if (result != null && result.details != null) {
|
||||
final categories = result.details!
|
||||
.map((e) => e.catgeoryname ?? '')
|
||||
.toSet()
|
||||
.toList();
|
||||
|
||||
if (context.mounted) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
builder: (context) {
|
||||
return ListView.builder(
|
||||
itemCount: categories.length,
|
||||
itemBuilder: (context, index) {
|
||||
final categoryName = categories[index];
|
||||
return ListTile(
|
||||
title: Text(categoryName),
|
||||
trailing: controller.selectedCategoryName == categoryName
|
||||
? Icon(Icons.check, color: ColorConstants.primaryColor)
|
||||
: null,
|
||||
onTap: () {
|
||||
// Update controller
|
||||
controller.selectedCategoryName = categoryName;
|
||||
controller.update(); // Trigger UI rebuild
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
const SizedBox(height: 20),
|
||||
_buildTextField(
|
||||
controller: controller.gstinNumberController,
|
||||
label: 'GSTIN',
|
||||
icon: Icons.verified_user,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
_buildAddressSection(context, controller),
|
||||
const SizedBox(height: 20),
|
||||
if (controller.isEnterAddress) ...[
|
||||
_buildTextField(controller: controller.suburbController, label: 'Suburb', icon: Icons.location_on),
|
||||
const SizedBox(height: 15),
|
||||
_buildTextField(controller: controller.cityController, label: 'City', icon: Icons.location_on),
|
||||
const SizedBox(height: 15),
|
||||
_buildTextField(controller: controller.stateController, label: 'State', icon: Icons.location_on),
|
||||
const SizedBox(height: 15),
|
||||
],
|
||||
_buildTextField(controller: controller.postcodeController, label: 'Pincode', icon: Icons.location_on),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(controller),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTextField({
|
||||
required TextEditingController controller,
|
||||
required String label,
|
||||
required IconData icon,
|
||||
List<TextInputFormatter>? formatters,
|
||||
String? Function(String?)? validator,
|
||||
}) {
|
||||
return Container(
|
||||
height: Get.height * 0.07,
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: TextFormField(
|
||||
controller: controller,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: formatters,
|
||||
validator: validator,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusManager.instance.primaryFocus?.unfocus(); // Removes focus and hides keyboard
|
||||
},
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(labelTextStr: label, prefixIcon: Icon(icon, color: ColorConstants.darkGreyColor)),
|
||||
onEditingComplete: () => FocusScope.of(Get.context!).requestFocus(FocusNode()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSelectionField({
|
||||
required BuildContext context,
|
||||
required String label,
|
||||
required IconData icon,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: Colors.grey[200]!, width: 2),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: ColorConstants.darkGreyColor),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(child: Text(label, style: TextStyle(fontSize: 17, color: Colors.grey[500]))),
|
||||
Icon(Icons.arrow_drop_down, color: Colors.grey[600], size: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Widget _buildAddressSection(BuildContext context, CreateUserController controller) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on, color: ColorConstants.darkGreyColor, size: 23),
|
||||
const SizedBox(width: 5),
|
||||
const Text('Address', style: TextStyle(color: Colors.black54, fontSize: 16)),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
// Toggle the isEnterAddress state if needed for other UI logic
|
||||
controller.isEnterAddress = !controller.isEnterAddress;
|
||||
controller.update();
|
||||
},
|
||||
child: Icon(
|
||||
controller.isEnterAddress ? Icons.check : Icons.keyboard_arrow_down_sharp,
|
||||
color: Colors.grey[600],
|
||||
size: 23,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
TextFormField(
|
||||
controller: controller.addressController,
|
||||
maxLines: 3,
|
||||
cursorColor: ColorConstants.textFieldColor,
|
||||
style: TextStyle(color: ColorConstants.textFieldColor),
|
||||
decoration: CustomDecoration.textFieldStyle(),
|
||||
readOnly: true, // Make it read-only to prevent direct editing
|
||||
onTap: () async {
|
||||
// Navigate to the address search screen and wait for the result
|
||||
final selectedAddress = await Get.to(() => AddressSearchScreen(controller: controller));
|
||||
if (selectedAddress != null) {
|
||||
controller.addressController.text = selectedAddress['description'];
|
||||
controller.getPlaceDetails(selectedAddress['place_id'], selectedAddress['description']);
|
||||
controller.update();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Widget _buildBottomBar(CreateUserController controller) {
|
||||
return Container(
|
||||
height: Get.height * 0.1,
|
||||
child: RoundedButton(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.9,
|
||||
onPressed: controller.doSomething,
|
||||
color: ColorConstants.primaryColor,
|
||||
title: 'Create',
|
||||
controller: controller.btnController,
|
||||
textStyle: const TextStyle(fontSize: 18, fontFamily: 'Inter', color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String? _validateEmail(String? value) {
|
||||
const simplePattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$';
|
||||
final regex = RegExp(simplePattern);
|
||||
return value!.isNotEmpty && !regex.hasMatch(value) ? 'Enter a valid email address' : null;
|
||||
}
|
||||
}
|
||||
|
||||
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)}';
|
||||
}
|
||||
|
||||
|
||||
class AddressSearchScreen extends StatelessWidget {
|
||||
final CreateUserController controller;
|
||||
|
||||
const AddressSearchScreen({Key? key, required this.controller}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Initialize a new TextEditingController with the initial address
|
||||
final searchController = TextEditingController(text: controller.addressController.text);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: TextWidget(
|
||||
text: 'Search Address',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: ColorConstants.blackColor),
|
||||
onPressed: () => Get.back(), // Return without selecting an address
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: searchController,
|
||||
autofocus: true,
|
||||
cursorColor: ColorConstants.textFieldColor,
|
||||
style: TextStyle(color: ColorConstants.textFieldColor),
|
||||
decoration: CustomDecoration.textFieldStyle().copyWith(
|
||||
hintText: 'Enter address',
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(Icons.cancel, color: ColorConstants.blackColor),
|
||||
onPressed: () {
|
||||
searchController.clear(); // Clear the search field
|
||||
controller.predictions.clear(); // Clear predictions
|
||||
controller.update(); // Notify UI to update
|
||||
},
|
||||
),
|
||||
),
|
||||
onChanged: (text) {
|
||||
if (text.isEmpty) {
|
||||
controller.predictions.clear();
|
||||
controller.update();
|
||||
}
|
||||
controller.onSearchTextChanged(text);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Expanded(
|
||||
child: Obx(
|
||||
() => controller.predictions.isEmpty
|
||||
? const Center(child: Text('No results found'))
|
||||
: ListView.builder(
|
||||
itemCount: controller.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction = controller.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final selectedAddress = controller.predictions[index];
|
||||
controller.addressController.text = selectedAddress['description'];
|
||||
controller.getPlaceDetails(selectedAddress['place_id'], selectedAddress['description']);
|
||||
Get.back(result: selectedAddress);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
2732
lib/View/Createorder/Createorderview.dart
Normal file
2732
lib/View/Createorder/Createorderview.dart
Normal file
File diff suppressed because it is too large
Load Diff
305
lib/View/Createorder/Droplocation/Googlemap/Googlemapview.dart
Normal file
305
lib/View/Createorder/Droplocation/Googlemap/Googlemapview.dart
Normal file
@@ -0,0 +1,305 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../Controller/Createorder/Drop/Googlemap/Googlemapcontroller.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
|
||||
class DropGoogleMapView extends StatelessWidget {
|
||||
final double lat;
|
||||
final double long;
|
||||
|
||||
DropGoogleMapView ({Key? key,required this.lat, required this.long,}) : super(key: key);
|
||||
|
||||
DropGoogleMapsController googleMapController = Get.put(DropGoogleMapsController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
elevation: 0.5,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
title: const Text(
|
||||
'Select Location',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: GetBuilder<DropGoogleMapsController>(
|
||||
initState: (_){
|
||||
DropGoogleMapsController.currentLatitude =lat;
|
||||
DropGoogleMapsController.currentLongitude =long;
|
||||
DropGoogleMapsController.center = LatLng(DropGoogleMapsController.currentLatitude!, DropGoogleMapsController.currentLongitude!);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(DropGoogleMapsController.currentLatitude!, DropGoogleMapsController.currentLongitude!),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.getCountry();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
child: Column(
|
||||
// fit: StackFit.loose,
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
height: 60,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(Icons.search),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[300]!,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
labelText: 'Search',
|
||||
labelStyle: TextStyle(color: Colors.black45)),
|
||||
onChanged: (text) async {
|
||||
if(text.isEmpty){
|
||||
controller.dropPredictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.update();
|
||||
}
|
||||
else {
|
||||
controller
|
||||
.onSearchDropTextChanged(
|
||||
text);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
controller.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: controller.dropPredictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.dropPredictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction,style: TextStyle(color: ColorConstants.darkGreyColor),),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.dropPredictions[index]['place_id'];
|
||||
controller.getDropPlaceDetails(placeId,prediction);
|
||||
googleMapController.searchController.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: GoogleMap(
|
||||
myLocationButtonEnabled: true,
|
||||
myLocationEnabled: true,
|
||||
mapType: MapType.normal,
|
||||
initialCameraPosition: controller.kGooglePlex!,
|
||||
markers: controller.markers,
|
||||
onCameraMove: (position) {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
DropGoogleMapsController.center = position.target;
|
||||
controller.update();
|
||||
print('positionsssprint$position');
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
// Update the markers for the updated position.zoom
|
||||
},
|
||||
onCameraIdle: () async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
await controller.getAddressFromLatLong(
|
||||
DropGoogleMapsController.center!.latitude, DropGoogleMapsController.center!.longitude);
|
||||
controller.update();
|
||||
print("addressOnCameraIdle${controller.address}");
|
||||
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
},
|
||||
onTap: (latLong) async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
DropGoogleMapsController.center = latLong;
|
||||
print('_lastMapPosition${DropGoogleMapsController.center}');
|
||||
await controller.getAddressFromLatLong(
|
||||
DropGoogleMapsController.center!.latitude, DropGoogleMapsController.center!.longitude);
|
||||
print('address${controller.address}');
|
||||
controller.update();
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
},
|
||||
onMapCreated: (GoogleMapController controllers) {
|
||||
controller.mapController = controllers;
|
||||
controller.controllers.complete(controllers);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
if (googleMapController.markers.length >= 1) {
|
||||
googleMapController.markers.clear();
|
||||
}
|
||||
googleMapController.getAddressFromLatLong(
|
||||
lat, long);
|
||||
DropGoogleMapsController.center = LatLng(lat,long);
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(DropGoogleMapsController.center.toString()),
|
||||
position: DropGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
DropGoogleMapsController.center = latLong;
|
||||
await googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(lat, long),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.goToThePosition(googleMapController.kGooglePlex);
|
||||
googleMapController.update();
|
||||
print("addressOnCameraIdle${googleMapController.address}");
|
||||
// _onAddMarkerButtonPressed(_center!);
|
||||
},
|
||||
child: Icon(Icons.refresh, color: Colors.white)),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||
bottomNavigationBar: GetBuilder<DropGoogleMapsController>(
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
height: 120,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.dropAddressController.text??'',
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
margin: EdgeInsets.only(left: 15,right: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
createOrderController.dropCityController.text = controller.dropCityController.text;
|
||||
createOrderController.dropStateController.text = controller.dropStateController.text ;
|
||||
createOrderController.dropSuburbController.text = controller.dropSuburbController.text ;
|
||||
createOrderController.dropPostcodeController.text = controller.dropPostcodeController.text ;
|
||||
createOrderController.dropAddressController.text = controller.dropAddressController.text ;
|
||||
createOrderController.dropAddressController.text = controller.toAddress??'';
|
||||
createOrderController.toLatitude = controller.toLatitude;
|
||||
createOrderController.toLongitude = controller.toLongitude;
|
||||
print('dropAddressControllergooglemap ${controller.dropAddressController.text}');
|
||||
controller.update();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Continue',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onAddMarkerButtonPressed(latLong) {
|
||||
googleMapController.update();
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(DropGoogleMapsController.center.toString()),
|
||||
position: DropGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.address = googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
// snippet: googleMapController.address,
|
||||
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
|
||||
|
||||
class AddCustomerView extends StatelessWidget {
|
||||
AddCustomerView({super.key});
|
||||
|
||||
AddDropCustomerController addDropCustomerController = Get.put(AddDropCustomerController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<AddDropCustomerController>(
|
||||
initState: (_){
|
||||
addDropCustomerController.getLocation();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,)),
|
||||
title: Row(
|
||||
children: [
|
||||
Text('Create customer',),
|
||||
],
|
||||
),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Expanded(
|
||||
// height: Get.height,
|
||||
child: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 1.1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
customerFirstName(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
// CustomerLastName(),
|
||||
// SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
Container(
|
||||
height: 55,
|
||||
child: contactNo(Get.context),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 5,),
|
||||
Text("Address",style: TextStyle(color: Colors.grey[600],fontSize: 15),),
|
||||
// Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () async{
|
||||
// if (controller.resultPosition != null) {
|
||||
// var locationResult = await
|
||||
// Get.to(CustomerMap(lat: controller.resultPosition!.latitude, long: controller.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// controller.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on_outlined,
|
||||
// color: Colors.red,
|
||||
// size: 32,
|
||||
// )),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
address(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
height: Get.height*0.08,
|
||||
child: submit(),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
customerFirstName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addDropCustomerController.customerFirstNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
customerLastName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'LastName',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addDropCustomerController.customerLastNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
contactNo(context) {
|
||||
return GetBuilder<AddDropCustomerController>(
|
||||
builder: (controller) {
|
||||
return TextFormField(
|
||||
enabled: true,
|
||||
maxLength: 10,
|
||||
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
controller: controller.customerPhoneController,
|
||||
onChanged: (value){
|
||||
if(value.length==10){
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
}
|
||||
},
|
||||
onTap: () async {
|
||||
},
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Mobile no',
|
||||
prefixIcon: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * 0.3,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(flex: 1,),
|
||||
Flexible(
|
||||
child: Icon(
|
||||
Icons.call,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 1,),
|
||||
Flexible(flex: 3,child: Text("+${controller.selectedDialogCountry.phoneCode}",style: TextStyle(color: ColorConstants.primaryColor,fontWeight: FontWeight.bold))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),),
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
address() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// onTap: () async{
|
||||
// if (addCustomerController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(CustomerMap(lat: addCustomerController.resultPosition!.latitude, long: addCustomerController.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// addCustomerController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
onChanged: (text) => addDropCustomerController.onSearchTextChanged(text),
|
||||
|
||||
decoration: CustomDecoration.textFieldStyle(),
|
||||
|
||||
maxLines: 2,
|
||||
controller: addDropCustomerController.addressController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
addDropCustomerController.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width*0.90,
|
||||
decoration: BoxDecoration(color: Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: addDropCustomerController.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
addDropCustomerController.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
addDropCustomerController.predictions[index]['place_id'];
|
||||
addDropCustomerController.getPlaceDetails(placeId,prediction);
|
||||
addDropCustomerController.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox()
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
doorNo(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Door / Flat number',
|
||||
prefixIcon: Icon(
|
||||
Icons.door_front_door_outlined,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addDropCustomerController.doorNoController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
landmark(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Landmark',
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on_rounded,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addDropCustomerController.landMarkController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 0,bottom: 5,left: 20,right: 20),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
addDropCustomerController.describeValidation();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor!,
|
||||
title: 'Create',
|
||||
controller: addDropCustomerController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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)}";
|
||||
}
|
||||
@@ -0,0 +1,727 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Customeraddress/Customeraddresscontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
import '../../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../../Model/Response/Customers/GetCustomerById/Getdropcustomerbytenantid.dart';
|
||||
import '../../../../../../../Model/Response/Getcustomeraddress/GetCustomerAddress.dart';
|
||||
import '../../../../../Createorderview.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class CustomerDropAddressView extends StatelessWidget {
|
||||
final GetDropCustomerByTenantIdDetails? data;
|
||||
|
||||
CustomerDropAddressView({super.key, this.data});
|
||||
|
||||
DropCustomerAddressController dropCustomerAddressController = Get.put(DropCustomerAddressController());
|
||||
|
||||
|
||||
@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: (){
|
||||
dropCustomerAddressController.deliveryAddressList = false;
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
title: Text('Drop Address'),
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
dropCustomerAddressController.deliveryAddressList = true;
|
||||
dropCustomerAddressController.addressController.clear();
|
||||
dropCustomerAddressController.suburbController.clear();
|
||||
dropCustomerAddressController.cityController.clear();
|
||||
dropCustomerAddressController.stateController.clear();
|
||||
dropCustomerAddressController.postCodeController.clear();
|
||||
dropCustomerAddressController.doornoController.clear();
|
||||
dropCustomerAddressController.landmarkController.clear();
|
||||
|
||||
dropCustomerAddressController.update();
|
||||
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 25,)),
|
||||
),
|
||||
SizedBox(width: 20,)
|
||||
],
|
||||
|
||||
),
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: GetBuilder<DropCustomerAddressController>(
|
||||
initState: (_){
|
||||
dropCustomerAddressController.loader = true;
|
||||
dropCustomerAddressController.customerId =data?.customerid;
|
||||
dropCustomerAddressController.customerName ="${data?.firstname}"+ "${data?.lastname}";
|
||||
dropCustomerAddressController.customerContactNo =data?.contactno;
|
||||
dropCustomerAddressController.customerAddressInfo = data;
|
||||
dropCustomerAddressController.getDetails();
|
||||
dropCustomerAddressController.getCustomerAddress();
|
||||
},
|
||||
builder: (controller) {
|
||||
print("deliveryAddressListbool...............${controller.deliveryAddressList}");
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
addAddress(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10, top: 10, bottom: 5),
|
||||
child: Text(
|
||||
"Select delivery address :",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontSize: 16),
|
||||
textAlign: TextAlign.start,
|
||||
)),
|
||||
controller.deliveryAddressList == true
|
||||
? Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
addressWidget(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
suburb(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
city(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
state(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
postalCode(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
: Expanded(
|
||||
child: savedAddressDetailsList()
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
controller.deliveryAddressList == true
|
||||
? submit()
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
proceed(),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
// floatingActionButton:savedAddressController.deliveryAddressList == false
|
||||
// ? FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ):Container(),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
addAddress() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 0,left: 10,right: 10),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
surfaceTintColor: ColorConstants.secondaryColor,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3),color: ColorConstants.primaryColor1),
|
||||
child: Icon(Icons.delivery_dining,size: 55,color: ColorConstants.darkGreyColor),
|
||||
),
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.6,
|
||||
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(10),color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 14,left: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 25,),
|
||||
SizedBox(width: 5,),
|
||||
Expanded(child: Text('${data?.firstname} ${data?.lastname}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 1,overflow: TextOverflow.ellipsis)),
|
||||
],
|
||||
),
|
||||
// SizedBox(height: 4,),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
// SizedBox(width: 5,),
|
||||
// Expanded(child: Padding(
|
||||
// padding: const EdgeInsets.only(top: 5),
|
||||
// child: Text('${data[0].address}',style:TextStyle(fontSize: 15,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 2,overflow: TextOverflow.ellipsis,),
|
||||
// ),),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: 7,),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: Icon(Icons.phone,color: ColorConstants.primaryColor,size: 25,),
|
||||
),
|
||||
SizedBox(width: 5,),
|
||||
Text('${data?.contactno}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressWidget() {
|
||||
return GetBuilder<DropCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child:
|
||||
TextField(
|
||||
style: TextStyle(
|
||||
fontSize: 14,fontWeight: FontWeight.bold,
|
||||
// color: Colors.grey[400],
|
||||
),
|
||||
controller: controller.addressController,
|
||||
onChanged: (text) => controller.onSearchTextChanged(text),
|
||||
|
||||
decoration: InputDecoration(
|
||||
prefixIcon:Icon( Icons.location_on,color: ColorConstants.primaryColor,) ,
|
||||
suffixIcon: InkWell(
|
||||
onTap: (){
|
||||
controller.addressController.clear();
|
||||
controller.suburbController.clear();
|
||||
controller.cityController.clear();
|
||||
controller.stateController.clear();
|
||||
controller.postCodeController.clear();
|
||||
},
|
||||
child: Icon(Icons.close,color: Colors.red,)),
|
||||
// suffixIcon: InkWell(
|
||||
// onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(Icons.edit,color: ColorConstants.primaryColor,)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[400]!,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
labelText: 'Address',
|
||||
labelStyle: TextStyle(color: ColorConstants.primaryColor)),
|
||||
),
|
||||
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
controller.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: controller.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.predictions[index]['place_id'];
|
||||
controller.getPlaceDetails(placeId,prediction);
|
||||
controller.searchController.clear();
|
||||
controller.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget suburb(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Suburb",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.suburbController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget city(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "City",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.cityController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget state(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "State",
|
||||
prefixIcon: Icon(
|
||||
Icons.account_balance,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.stateController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget postalCode(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "PostCode",
|
||||
prefixIcon: Icon(
|
||||
Icons.local_post_office,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.postCodeController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget landmark(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "LandMark",
|
||||
prefixIcon: Icon(
|
||||
Icons.home,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.landmarkController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget doorNo(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Doorno",
|
||||
prefixIcon: Icon(
|
||||
Icons.door_back_door,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:dropCustomerAddressController.doornoController,
|
||||
|
||||
// focusNode: individualNameNode,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
savedAddressDetailsList() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10,left: 20),
|
||||
child: GetBuilder<DropCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return controller.getCustomeraddress.isEmpty && !controller.loader == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No delivery address available",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.loader?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
|
||||
Container(
|
||||
width: Get.width*0.90,
|
||||
child: ListView.separated(
|
||||
itemCount: controller.getCustomeraddress.length,
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return addressCard(controller.getCustomeraddress[index], index);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) =>
|
||||
Container(height: 8, color: Colors.grey[100]),
|
||||
),
|
||||
// color: Colors.white,
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressCard(CustomerAddressDetail models, int index) {
|
||||
return GetBuilder<DropCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.address = models.address??'';
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5)),
|
||||
child: ListTile(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
|
||||
// child: Icon(
|
||||
// Icons.my_location,
|
||||
// size: 25,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ),
|
||||
trailing: InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor:controller.selectedAddressIndex==index?Colors.green:Colors.grey[300],
|
||||
child: Icon(Icons.check,color: ColorConstants.secondaryColor,size: 20),
|
||||
),
|
||||
),
|
||||
title: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 4,),
|
||||
Text('${controller.getCustomeraddress[index].suburb}',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
),
|
||||
SizedBox(width: 4,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Container(
|
||||
width: Get.width*0.59,
|
||||
child: Text('${controller.getCustomeraddress[index].address}',
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// color: Colors.white,
|
||||
margin: EdgeInsets.only(bottom: 2)),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
dropCustomerAddressController.describeValidation();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Submit',
|
||||
controller: dropCustomerAddressController.submitBtnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
proceed() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20,top: 10),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
if(dropCustomerAddressController.selectedAddressIndex!=-1){
|
||||
dropCustomerAddressController.selectedAddressIndex =-1;
|
||||
// Get.to(OrderDetailsView(data:data));
|
||||
dropCustomerAddressController.btnController.success();
|
||||
Get.to(CreateOrderView( dropData: data,isDashboard: false,));
|
||||
dropCustomerAddressController.btnController.reset();
|
||||
}
|
||||
else{
|
||||
print('Please Select delivery address');
|
||||
Toast.showToast('Please Select delivery address',);
|
||||
|
||||
dropCustomerAddressController.btnController.reset();
|
||||
}
|
||||
dropCustomerAddressController.update();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Proceed',
|
||||
controller: dropCustomerAddressController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
)),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 5,left: 20),
|
||||
// child: FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../Model/Response/Customers/GetCustomerById/Getdropcustomerbytenantid.dart';
|
||||
import '../../../../Createorderview.dart';
|
||||
import 'Addcustomer/Addcustomerview.dart';
|
||||
|
||||
class TenantDropCustomerView extends StatelessWidget {
|
||||
TenantDropCustomerView({super.key});
|
||||
|
||||
TenantDropCustomerController tenantDropCustomerController = Get.put(TenantDropCustomerController());
|
||||
AddDropCustomerController addDropCustomerController = Get.put(AddDropCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// DropCustomerAddressController dropCustomerAddressController = Get.put(DropCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: GetBuilder<TenantDropCustomerController>(
|
||||
initState: (_){
|
||||
tenantDropCustomerController.progress = true;
|
||||
tenantDropCustomerController.getCustomerByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetDropCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetDropCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// dropCustomerAddressController.selectedAddressIndex = -1;
|
||||
|
||||
createOrderController.dropCustomerId = item.data.customerid;
|
||||
createOrderController.dropCustomerName ="${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.dropCustomerContactNo = item.data.contactno;
|
||||
createOrderController.dropLocationId = item.data.deliverylocationid;
|
||||
createOrderController.dropTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.toLatitude = item.data.latitude;
|
||||
createOrderController.toLongitude = item.data.longitude;
|
||||
createOrderController.toAddress = item.data.address;
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
Get.to(CreateOrderView(dropData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
'${item.data.suburb??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,878 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/Logger.dart';
|
||||
import '../../../../Helper/toast.dart';
|
||||
import '../../../../Helper/utility.dart';
|
||||
import '../../Createorderview.dart';
|
||||
|
||||
// class DropCustomerTabView extends StatelessWidget {
|
||||
// final int tabIndex;
|
||||
//
|
||||
// DropCustomerTabView({super.key, this.tabIndex = 0});
|
||||
//
|
||||
// DropCustomerTabController dropCustomerTabController = Get.put(DropCustomerTabController());
|
||||
// AddDropCustomerController addDropCustomerController = Get.put(AddDropCustomerController());
|
||||
//
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return GetBuilder<DropCustomerTabController>(
|
||||
// initState: (_){
|
||||
// if (tabIndex != 0) {
|
||||
// print('tabindex ${tabIndex}');
|
||||
// dropCustomerTabController.tabIndex =tabIndex;
|
||||
// }
|
||||
// // orderMainController.tabIndex = tabIndex;
|
||||
// dropCustomerTabController.tabController.index = tabIndex;
|
||||
// dropCustomerTabController.tabController.addListener(() {
|
||||
// if (!dropCustomerTabController.tabController.indexIsChanging) {
|
||||
// // dropCustomerTabController.update();
|
||||
// dropCustomerTabController.tabIndex = dropCustomerTabController.tabController.index;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// },
|
||||
// builder: (controller) {
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.grey[100],
|
||||
// appBar: AppBar(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child:InkWell(
|
||||
// onTap: (){
|
||||
//
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
// ),
|
||||
// titleSpacing: 0,
|
||||
//
|
||||
// title: Row(
|
||||
// children: [
|
||||
// Text("Drop address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
// const Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// addDropCustomerController.customerFirstNameController.clear();
|
||||
// addDropCustomerController.customerLastNameController.clear();
|
||||
// addDropCustomerController.customerPhoneController.clear();
|
||||
// addDropCustomerController.addressController.clear() ;
|
||||
// addDropCustomerController.doorNoController.clear() ;
|
||||
// addDropCustomerController.landMarkController.clear() ;
|
||||
// addDropCustomerController.predictions.clear();
|
||||
// Get.to(AddCustomerView());
|
||||
// },
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 3,right: 0),
|
||||
// child: Icon(
|
||||
// Icons.person_add_alt_rounded,
|
||||
// size: 35,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 10,)
|
||||
// ],
|
||||
// ),
|
||||
// elevation: 0,
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// automaticallyImplyLeading: false,
|
||||
//
|
||||
// // backwardsCompatibility: false,
|
||||
// ),
|
||||
// body: Stack(
|
||||
// children: [
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TabBar(tabs: controller.tabs,unselectedLabelColor: ColorConstants.primaryColor,indicatorColor: ColorConstants.primaryColor,indicatorSize: TabBarIndicatorSize.tab,labelColor: ColorConstants.primaryColor,controller: controller.tabController, ),
|
||||
// Expanded(
|
||||
// child: TabBarView(
|
||||
// controller: controller.tabController,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// children: [
|
||||
// TenantDropCustomerView(),
|
||||
// TenantDropTenantsView(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class DropCustomerView extends StatelessWidget {
|
||||
DropCustomerView({super.key});
|
||||
|
||||
TenantDropCustomerController tenantDropCustomerController = Get.put(TenantDropCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
void onScroll() {
|
||||
double maxScroll = scrollController.position.maxScrollExtent;
|
||||
double currentScroll = scrollController.position.pixels;
|
||||
|
||||
if (maxScroll == currentScroll && tenantDropCustomerController.hasMore.value) {
|
||||
tenantDropCustomerController.getCustomerData();
|
||||
}
|
||||
}
|
||||
|
||||
scrollController.addListener(onScroll);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
appBar: AppBar(
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child:InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
|
||||
title: Row(
|
||||
children: [
|
||||
Text("Saved address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
],
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
automaticallyImplyLeading: false,
|
||||
// backwardsCompatibility: false,
|
||||
),
|
||||
body: GetBuilder<TenantDropCustomerController>(
|
||||
initState: (_){
|
||||
tenantDropCustomerController.shimmer.value = true;
|
||||
// tenantDropCustomerController.getCustomerByTenantId();
|
||||
// tenantDropCustomerController.getCustomerData();
|
||||
tenantDropCustomerController.refreshData();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
// focusNode: controller.focusNode,
|
||||
onChanged: (data){
|
||||
var keyword = data;
|
||||
print('keyword................${keyword}');
|
||||
if(data.isNotEmpty) {
|
||||
controller.shimmer.value = true;
|
||||
controller.getSearchCustomerData(keyword);
|
||||
}
|
||||
else{
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: IconButton(
|
||||
icon: const Icon(Icons.search),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
hintText: 'Search by customer',
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey[500]!,
|
||||
|
||||
|
||||
),
|
||||
suffixIcon: controller.searchController.text.isEmpty ? const SizedBox() : IconButton(
|
||||
icon: const Icon(Icons.cancel),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
),
|
||||
border: InputBorder.none),
|
||||
),
|
||||
),
|
||||
controller.getCustomerBytenantId.isEmpty && !controller.shimmer.value
|
||||
? Center(
|
||||
heightFactor: 3.0,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.shimmer.value?Center(
|
||||
heightFactor: 15.0,
|
||||
child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
controller.shimmer.value?
|
||||
queueShimmerCard(context):
|
||||
Expanded(
|
||||
child:controller.searchController.text.isEmpty? ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: controller.hasMore.value
|
||||
? controller.getCustomerBytenantId.length + 1
|
||||
: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
if(index < controller.getCustomerBytenantId.length){
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap:(){
|
||||
|
||||
createOrderController.dropCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.dropCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.dropCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.dropLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.dropDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.dropLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.dropTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.toLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.toLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.toAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.dropAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.dropContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.dropContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.dropDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.dropLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.dropStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.dropCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.dropSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.dropPostcodeController.text = controller.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{
|
||||
createOrderController.dropSaveAddress = false;
|
||||
Get.to(CreateOrderView(dropData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString()
|
||||
)
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
else{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
):
|
||||
ListView.builder(
|
||||
itemCount: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
createOrderController.dropCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.dropCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.dropCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.dropLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.dropDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.dropLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.dropTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.toLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.toLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.toAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.dropAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.dropContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.dropContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.dropDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.dropLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.dropStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.dropCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.dropSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.dropPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;
|
||||
|
||||
if(createOrderController.dropCustomerId == createOrderController.pickupCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
createOrderController.dropSaveAddress = false;
|
||||
Get.to(CreateOrderView(dropData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString())
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
queueShimmerCard(BuildContext context) {
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.10,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: const BoxDecoration(
|
||||
color:Colors.grey,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
206
lib/View/Createorder/Droplocation/Tabs/Tenants/Tenantsview.dart
Normal file
206
lib/View/Createorder/Droplocation/Tabs/Tenants/Tenantsview.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../Controller/Dashboard/Drop/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../Model/Response/Customers/GetCustomerById/Getdropcustomerbytenantid.dart';
|
||||
import '../../../Createorderview.dart';
|
||||
|
||||
class TenantDropTenantsView extends StatelessWidget {
|
||||
|
||||
TenantDropTenantsView({super.key,});
|
||||
|
||||
TenantDropCustomerController tenantDropCustomerController = Get.put(TenantDropCustomerController());
|
||||
AddDropCustomerController addDropCustomerController = Get.put(AddDropCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// DropCustomerAddressController dropCustomerAddressController = Get.put(DropCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
|
||||
body: GetBuilder<TenantDropCustomerController>(
|
||||
initState: (_){
|
||||
tenantDropCustomerController.progress = true;
|
||||
tenantDropCustomerController.getDropTenantByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetDropCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetDropCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// dropCustomerAddressController.selectedAddressIndex = -1;
|
||||
|
||||
createOrderController.dropCustomerId = item.data.customerid;
|
||||
createOrderController.dropCustomerName ="${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.dropCustomerContactNo = item.data.contactno;
|
||||
createOrderController.dropLocationId = item.data.deliverylocationid;
|
||||
createOrderController.dropTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.toLatitude = item.data.latitude;
|
||||
createOrderController.toLongitude = item.data.longitude;
|
||||
createOrderController.toAddress = item.data.address;
|
||||
print('dropTenantLocationIdTenantview ${createOrderController.dropTenantLocationId}');
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
Get.to(CreateOrderView(dropData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
'${item.data.suburb??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1292
lib/View/Createorder/Ordersuccess/Ordersuccessview.dart
Normal file
1292
lib/View/Createorder/Ordersuccess/Ordersuccessview.dart
Normal file
File diff suppressed because it is too large
Load Diff
305
lib/View/Createorder/Pickuplocation/Googlemap/Googlemapview.dart
Normal file
305
lib/View/Createorder/Pickuplocation/Googlemap/Googlemapview.dart
Normal file
@@ -0,0 +1,305 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../Controller/Createorder/Pickup/Googlemap/Googlemapcontroller.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
|
||||
class PickupGoogleMapView extends StatelessWidget {
|
||||
final double lat;
|
||||
final double long;
|
||||
|
||||
PickupGoogleMapView ({Key? key,required this.lat, required this.long,}) : super(key: key);
|
||||
|
||||
PickupGoogleMapsController googleMapController = Get.put(PickupGoogleMapsController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
elevation: 0.5,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
title: const Text(
|
||||
'Select Location',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: GetBuilder<PickupGoogleMapsController>(
|
||||
initState: (_){
|
||||
PickupGoogleMapsController.currentLatitude =lat;
|
||||
PickupGoogleMapsController.currentLongitude =long;
|
||||
PickupGoogleMapsController.center = LatLng(PickupGoogleMapsController.currentLatitude!, PickupGoogleMapsController.currentLongitude!);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(PickupGoogleMapsController.currentLatitude!, PickupGoogleMapsController.currentLongitude!),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.getCountry();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
child: Column(
|
||||
// fit: StackFit.loose,
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
height: 60,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(Icons.search),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[300]!,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
labelText: 'Search',
|
||||
labelStyle: TextStyle(color: Colors.black45)),
|
||||
onChanged: (text) async {
|
||||
if(text.isEmpty){
|
||||
controller.pickupPredictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.update();
|
||||
}
|
||||
else {
|
||||
controller
|
||||
.onSearchPickupTextChanged(
|
||||
text);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
controller.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: controller.pickupPredictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.pickupPredictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction,style: TextStyle(color: ColorConstants.darkGreyColor),),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.pickupPredictions[index]['place_id'];
|
||||
controller.getPickupPlaceDetails(placeId,prediction);
|
||||
googleMapController.searchController.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: GoogleMap(
|
||||
myLocationButtonEnabled: true,
|
||||
myLocationEnabled: true,
|
||||
mapType: MapType.normal,
|
||||
initialCameraPosition: controller.kGooglePlex!,
|
||||
markers: controller.markers,
|
||||
onCameraMove: (position) {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
PickupGoogleMapsController.center = position.target;
|
||||
controller.update();
|
||||
print('positionsssprint$position');
|
||||
onAddMarkerButtonPressed(PickupGoogleMapsController.center!);
|
||||
// Update the markers for the updated position.zoom
|
||||
},
|
||||
onCameraIdle: () async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
await controller.getAddressFromLatLong(
|
||||
PickupGoogleMapsController.center!.latitude, PickupGoogleMapsController.center!.longitude);
|
||||
controller.update();
|
||||
print("addressOnCameraIdle${controller.address}");
|
||||
|
||||
onAddMarkerButtonPressed(PickupGoogleMapsController.center!);
|
||||
},
|
||||
onTap: (latLong) async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
PickupGoogleMapsController.center = latLong;
|
||||
print('_lastMapPosition${PickupGoogleMapsController.center}');
|
||||
await controller.getAddressFromLatLong(
|
||||
PickupGoogleMapsController.center!.latitude, PickupGoogleMapsController.center!.longitude);
|
||||
print('address${controller.address}');
|
||||
controller.update();
|
||||
onAddMarkerButtonPressed(PickupGoogleMapsController.center!);
|
||||
},
|
||||
onMapCreated: (GoogleMapController controllers) {
|
||||
controller.mapController = controllers;
|
||||
controller.controllers.complete(controllers);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
if (googleMapController.markers.length >= 1) {
|
||||
googleMapController.markers.clear();
|
||||
}
|
||||
googleMapController.getAddressFromLatLong(
|
||||
lat, long);
|
||||
PickupGoogleMapsController.center = LatLng(lat,long);
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(PickupGoogleMapsController.center.toString()),
|
||||
position: PickupGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
PickupGoogleMapsController.center = latLong;
|
||||
await googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
PickupGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(lat, long),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.goToThePosition(googleMapController.kGooglePlex);
|
||||
googleMapController.update();
|
||||
print("addressOnCameraIdle${googleMapController.address}");
|
||||
// _onAddMarkerButtonPressed(_center!);
|
||||
},
|
||||
child: Icon(Icons.refresh, color: Colors.white)),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||
bottomNavigationBar: GetBuilder<PickupGoogleMapsController>(
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
height: 120,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.pickupAddressController.text??'',
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
margin: EdgeInsets.only(left: 15,right: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
createOrderController.pickupCityController.text = controller.pickupCityController.text;
|
||||
createOrderController.pickupStateController.text = controller.pickupStateController.text ;
|
||||
createOrderController.pickupSuburbController.text = controller.pickupSuburbController.text ;
|
||||
createOrderController.pickupPostcodeController.text = controller.pickupPostcodeController.text ;
|
||||
createOrderController.pickupAddressController.text = controller.pickupAddressController.text ;
|
||||
createOrderController.pickupAddressController.text = controller.fromAddress??'';
|
||||
createOrderController.fromLatitude = controller.fromLatitude;
|
||||
createOrderController.fromLongitude = controller.fromLongitude;
|
||||
print('pickupAddressControllergooglemap ${controller.pickupAddressController.text}');
|
||||
controller.update();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Continue',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onAddMarkerButtonPressed(latLong) {
|
||||
googleMapController.update();
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(PickupGoogleMapsController.center.toString()),
|
||||
position: PickupGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
PickupGoogleMapsController.center = latLong;
|
||||
googleMapController.address = googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
PickupGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
// snippet: googleMapController.address,
|
||||
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
|
||||
|
||||
|
||||
class AddCustomerView extends StatelessWidget {
|
||||
AddCustomerView({super.key});
|
||||
|
||||
AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<AddPickupCustomerController>(
|
||||
initState: (_){
|
||||
addPickupCustomerController.getLocation();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,)),
|
||||
title: Row(
|
||||
children: [
|
||||
Text('Create customer',),
|
||||
],
|
||||
),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Expanded(
|
||||
// height: Get.height,
|
||||
child: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 1.1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
customerFirstName(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
// CustomerLastName(),
|
||||
// SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
Container(
|
||||
height: 55,
|
||||
child: contactNo(Get.context),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 5,),
|
||||
Text("Address",style: TextStyle(color: Colors.grey[600],fontSize: 15),),
|
||||
// Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () async{
|
||||
// if (controller.resultPosition != null) {
|
||||
// var locationResult = await
|
||||
// Get.to(CustomerMap(lat: controller.resultPosition!.latitude, long: controller.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// controller.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on_outlined,
|
||||
// color: Colors.red,
|
||||
// size: 32,
|
||||
// )),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
address(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
height: Get.height*0.08,
|
||||
child: submit(),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
customerFirstName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.customerFirstNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
customerLastName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'LastName',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.customerLastNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
contactNo(context) {
|
||||
return GetBuilder<AddPickupCustomerController>(
|
||||
builder: (controller) {
|
||||
return TextFormField(
|
||||
enabled: true,
|
||||
maxLength: 10,
|
||||
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
controller: controller.customerPhoneController,
|
||||
onChanged: (value){
|
||||
if(value.length==10){
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
}
|
||||
},
|
||||
onTap: () async {
|
||||
},
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Mobile no',
|
||||
prefixIcon: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * 0.3,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(flex: 1,),
|
||||
Flexible(
|
||||
child: Icon(
|
||||
Icons.call,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 1,),
|
||||
Flexible(flex: 3,child: Text("+${controller.selectedDialogCountry.phoneCode}",style: TextStyle(color: ColorConstants.primaryColor,fontWeight: FontWeight.bold))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),),
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
address() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// onTap: () async{
|
||||
// if (addCustomerController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(CustomerMap(lat: addCustomerController.resultPosition!.latitude, long: addCustomerController.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// addCustomerController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
onChanged: (text) => addPickupCustomerController.onSearchTextChanged(text),
|
||||
|
||||
decoration: CustomDecoration.textFieldStyle(),
|
||||
|
||||
maxLines: 2,
|
||||
controller: addPickupCustomerController.addressController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
addPickupCustomerController.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width*0.90,
|
||||
decoration: BoxDecoration(color: Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: addPickupCustomerController.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
addPickupCustomerController.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
addPickupCustomerController.predictions[index]['place_id'];
|
||||
addPickupCustomerController.getPlaceDetails(placeId,prediction);
|
||||
addPickupCustomerController.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox()
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
doorNo(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Door / Flat number',
|
||||
prefixIcon: Icon(
|
||||
Icons.door_front_door_outlined,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.doorNoController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
landmark(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Landmark',
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on_rounded,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.landMarkController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 0,bottom: 5,left: 20,right: 20),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
addPickupCustomerController.describeValidation();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor!,
|
||||
title: 'Create',
|
||||
controller: addPickupCustomerController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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)}";
|
||||
}
|
||||
@@ -0,0 +1,728 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Customeraddresscontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
import '../../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../../../../../Model/Response/Getcustomeraddress/GetCustomerAddress.dart';
|
||||
import '../../../../../Createorderview.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class CustomerPickupAddressView extends StatelessWidget {
|
||||
final GetCustomerByTenantIdDetails? data;
|
||||
|
||||
|
||||
CustomerPickupAddressView({super.key, required this.data});
|
||||
|
||||
PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
|
||||
@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: (){
|
||||
pickupCustomerAddressController.deliveryAddressList = false;
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
title: Text('Pickup Address'),
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
pickupCustomerAddressController.deliveryAddressList = true;
|
||||
pickupCustomerAddressController.addressController.clear();
|
||||
pickupCustomerAddressController.suburbController.clear();
|
||||
pickupCustomerAddressController.cityController.clear();
|
||||
pickupCustomerAddressController.stateController.clear();
|
||||
pickupCustomerAddressController.postCodeController.clear();
|
||||
pickupCustomerAddressController.doornoController.clear();
|
||||
pickupCustomerAddressController.landmarkController.clear();
|
||||
|
||||
pickupCustomerAddressController.update();
|
||||
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 25,)),
|
||||
),
|
||||
SizedBox(width: 20,)
|
||||
],
|
||||
|
||||
),
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: GetBuilder<PickupCustomerAddressController>(
|
||||
initState: (_){
|
||||
pickupCustomerAddressController.loader = true;
|
||||
pickupCustomerAddressController.customerId =data?.customerid;
|
||||
pickupCustomerAddressController.customerName ="${data?.firstname}"+ "${data?.lastname}";
|
||||
pickupCustomerAddressController.customerContactNo =data?.contactno;
|
||||
pickupCustomerAddressController.customerAddressInfo = data;
|
||||
pickupCustomerAddressController.getDetails();
|
||||
pickupCustomerAddressController.getCustomerAddress();
|
||||
},
|
||||
builder: (controller) {
|
||||
print("deliveryAddressListbool...............${controller.deliveryAddressList}");
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
addAddress(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10, top: 10, bottom: 5),
|
||||
child: Text(
|
||||
"Select delivery address :",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontSize: 16),
|
||||
textAlign: TextAlign.start,
|
||||
)),
|
||||
controller.deliveryAddressList == true
|
||||
? Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
addressWidget(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
suburb(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
city(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
state(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
postalCode(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
: Expanded(
|
||||
child: savedAddressDetailsList()
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
controller.deliveryAddressList == true
|
||||
? submit()
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
proceed(),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
// floatingActionButton:savedAddressController.deliveryAddressList == false
|
||||
// ? FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ):Container(),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
addAddress() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 0,left: 10,right: 10),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
surfaceTintColor: ColorConstants.secondaryColor,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3),color: ColorConstants.primaryColor1),
|
||||
child: Icon(Icons.delivery_dining,size: 55,color: ColorConstants.darkGreyColor),
|
||||
),
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.6,
|
||||
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(10),color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 14,left: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 25,),
|
||||
SizedBox(width: 5,),
|
||||
Expanded(child: Text('${data?.firstname} ${data?.lastname}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 1,overflow: TextOverflow.ellipsis)),
|
||||
],
|
||||
),
|
||||
// SizedBox(height: 4,),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
// SizedBox(width: 5,),
|
||||
// Expanded(child: Padding(
|
||||
// padding: const EdgeInsets.only(top: 5),
|
||||
// child: Text('${data[0].address}',style:TextStyle(fontSize: 15,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 2,overflow: TextOverflow.ellipsis,),
|
||||
// ),),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: 7,),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: Icon(Icons.phone,color: ColorConstants.primaryColor,size: 25,),
|
||||
),
|
||||
SizedBox(width: 5,),
|
||||
Text('${data?.contactno}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressWidget() {
|
||||
return GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child:
|
||||
TextField(
|
||||
style: TextStyle(
|
||||
fontSize: 14,fontWeight: FontWeight.bold,
|
||||
// color: Colors.grey[400],
|
||||
),
|
||||
controller: controller.addressController,
|
||||
onChanged: (text) => controller.onSearchTextChanged(text),
|
||||
|
||||
decoration: InputDecoration(
|
||||
prefixIcon:Icon( Icons.location_on,color: ColorConstants.primaryColor,) ,
|
||||
suffixIcon: InkWell(
|
||||
onTap: (){
|
||||
controller.addressController.clear();
|
||||
controller.suburbController.clear();
|
||||
controller.cityController.clear();
|
||||
controller.stateController.clear();
|
||||
controller.postCodeController.clear();
|
||||
},
|
||||
child: Icon(Icons.close,color: Colors.red,)),
|
||||
// suffixIcon: InkWell(
|
||||
// onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(Icons.edit,color: ColorConstants.primaryColor,)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[400]!,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
labelText: 'Address',
|
||||
labelStyle: TextStyle(color: ColorConstants.primaryColor)),
|
||||
),
|
||||
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
controller.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: controller.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.predictions[index]['place_id'];
|
||||
controller.getPlaceDetails(placeId,prediction);
|
||||
controller.searchController.clear();
|
||||
controller.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget suburb(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Suburb",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.suburbController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget city(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "City",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.cityController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget state(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "State",
|
||||
prefixIcon: Icon(
|
||||
Icons.account_balance,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.stateController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget postalCode(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "PostCode",
|
||||
prefixIcon: Icon(
|
||||
Icons.local_post_office,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.postCodeController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget landmark(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "LandMark",
|
||||
prefixIcon: Icon(
|
||||
Icons.home,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.landmarkController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget doorNo(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Doorno",
|
||||
prefixIcon: Icon(
|
||||
Icons.door_back_door,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.doornoController,
|
||||
|
||||
// focusNode: individualNameNode,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
savedAddressDetailsList() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10,left: 20),
|
||||
child: GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return controller.getCustomeraddress.isEmpty && !controller.loader == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No delivery address available",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.loader?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
|
||||
Container(
|
||||
width: Get.width*0.90,
|
||||
child: ListView.separated(
|
||||
itemCount: controller.getCustomeraddress.length,
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return addressCard(controller.getCustomeraddress[index], index);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) =>
|
||||
Container(height: 8, color: Colors.grey[100]),
|
||||
),
|
||||
// color: Colors.white,
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressCard(CustomerAddressDetail models, int index) {
|
||||
return GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.address = models.address??'';
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5)),
|
||||
child: ListTile(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
|
||||
// child: Icon(
|
||||
// Icons.my_location,
|
||||
// size: 25,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ),
|
||||
trailing: InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor:controller.selectedAddressIndex==index?Colors.green:Colors.grey[300],
|
||||
child: Icon(Icons.check,color: ColorConstants.secondaryColor,size: 20),
|
||||
),
|
||||
),
|
||||
title: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 4,),
|
||||
Text('${controller.getCustomeraddress[index].suburb}',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
),
|
||||
SizedBox(width: 4,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Container(
|
||||
width: Get.width*0.59,
|
||||
child: Text('${controller.getCustomeraddress[index].address}',
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// color: Colors.white,
|
||||
margin: EdgeInsets.only(bottom: 2)),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
pickupCustomerAddressController.describeValidation();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Submit',
|
||||
controller: pickupCustomerAddressController.submitBtnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
proceed() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20,top: 10),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
if(pickupCustomerAddressController.selectedAddressIndex!=-1){
|
||||
pickupCustomerAddressController.selectedAddressIndex =-1;
|
||||
// Get.to(OrderDetailsView(data:data));
|
||||
pickupCustomerAddressController.btnController.success();
|
||||
Get.to(CreateOrderView(pickUpData: data,isDashboard: false,));
|
||||
pickupCustomerAddressController.btnController.reset();
|
||||
}
|
||||
else{
|
||||
print('Please Select delivery address');
|
||||
Toast.showToast('Please Select delivery address',);
|
||||
|
||||
pickupCustomerAddressController.btnController.reset();
|
||||
}
|
||||
pickupCustomerAddressController.update();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Proceed',
|
||||
controller: pickupCustomerAddressController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
)),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 5,left: 20),
|
||||
// child: FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../../Createorderview.dart';
|
||||
|
||||
class TenantPickUpCustomerView extends StatelessWidget {
|
||||
TenantPickUpCustomerView({super.key});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.progress = true;
|
||||
tenantPickupCustomerController.getCustomerByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// pickupCustomerAddressController.selectedAddressIndex = -1;
|
||||
createOrderController.pickupCustomerId = item.data.customerid;
|
||||
createOrderController.pickUpCustomerName = "${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = item.data.contactno;
|
||||
createOrderController.pickupLocationId = item.data.deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.fromLatitude = item.data.latitude;
|
||||
createOrderController.fromLongitude = item.data.longitude;
|
||||
createOrderController.fromAddress =item.data.address;
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
Get.to(CreateOrderView(pickUpData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
'${item.data.suburb??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,898 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Pickupcustomertabscontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/Logger.dart';
|
||||
import '../../../../Helper/toast.dart';
|
||||
import '../../../../Helper/utility.dart';
|
||||
import '../../Createorderview.dart';
|
||||
import 'Allcustomers/Tenantcustomers/Tenantcustomerview.dart';
|
||||
import 'Tenants/Tenantsview.dart';
|
||||
|
||||
// class PickupCustomerTabView extends StatelessWidget {
|
||||
// final int tabIndex;
|
||||
//
|
||||
// PickupCustomerTabView({super.key, this.tabIndex = 0});
|
||||
//
|
||||
// PickupCustomerTabController pickupCustomerTabController = Get.put(PickupCustomerTabController());
|
||||
// AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
//
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return GetBuilder<PickupCustomerTabController>(
|
||||
// initState: (_){
|
||||
// if (tabIndex != 0) {
|
||||
// print('tabindex ${tabIndex}');
|
||||
// pickupCustomerTabController.tabIndex =tabIndex;
|
||||
// }
|
||||
// // orderMainController.tabIndex = tabIndex;
|
||||
// pickupCustomerTabController.tabController.index = tabIndex;
|
||||
// pickupCustomerTabController.tabController.addListener(() {
|
||||
// if (!pickupCustomerTabController.tabController.indexIsChanging) {
|
||||
// // pickupCustomerTabController.update();
|
||||
// pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// },
|
||||
// builder: (controller) {
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.grey[100],
|
||||
// appBar: AppBar(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child:InkWell(
|
||||
// onTap: (){
|
||||
//
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
// ),
|
||||
// titleSpacing: 0,
|
||||
//
|
||||
// title: Row(
|
||||
// children: [
|
||||
// Text("Pickup address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
// const Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// addPickupCustomerController.customerFirstNameController.clear();
|
||||
// addPickupCustomerController.customerLastNameController.clear();
|
||||
// addPickupCustomerController.customerPhoneController.clear();
|
||||
// addPickupCustomerController.addressController.clear() ;
|
||||
// addPickupCustomerController.doorNoController.clear() ;
|
||||
// addPickupCustomerController.landMarkController.clear() ;
|
||||
// addPickupCustomerController.predictions.clear();
|
||||
// Get.to(AddCustomerView());
|
||||
// },
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 3,right: 0),
|
||||
// child: Icon(
|
||||
// Icons.person_add_alt_rounded,
|
||||
// size: 35,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 10,)
|
||||
// ],
|
||||
// ),
|
||||
// elevation: 0,
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// automaticallyImplyLeading: false,
|
||||
//
|
||||
// // backwardsCompatibility: false,
|
||||
// ),
|
||||
// body: Stack(
|
||||
// children: [
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TabBar(
|
||||
// tabs: controller.tabs,
|
||||
// unselectedLabelColor: ColorConstants.primaryColor,
|
||||
// indicatorColor: ColorConstants.primaryColor,
|
||||
// indicatorSize: TabBarIndicatorSize.tab,
|
||||
// labelColor: ColorConstants.primaryColor,
|
||||
// controller: controller.tabController,
|
||||
// onTap: (_){
|
||||
// pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
|
||||
// print("tabIndexonTap ${pickupCustomerTabController.tabIndex}");
|
||||
// },
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: TabBarView(
|
||||
// controller: controller.tabController,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// children: [
|
||||
// TenantPickUpCustomerView(),
|
||||
// TenantPickUpTenantsView(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class PickupCustomerView extends StatelessWidget {
|
||||
PickupCustomerView({super.key});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
void onScroll() {
|
||||
double maxScroll = scrollController.position.maxScrollExtent;
|
||||
double currentScroll = scrollController.position.pixels;
|
||||
|
||||
if (maxScroll == currentScroll && tenantPickupCustomerController.hasMore.value) {
|
||||
tenantPickupCustomerController.getCustomerData();
|
||||
}
|
||||
}
|
||||
|
||||
scrollController.addListener(onScroll);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
appBar: AppBar(
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child:InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
|
||||
title: Row(
|
||||
children: [
|
||||
Text("Saved address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
],
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
automaticallyImplyLeading: false,
|
||||
// backwardsCompatibility: false,
|
||||
),
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.shimmer.value = true;
|
||||
// tenantPickupCustomerController.getCustomerByTenantId();
|
||||
// tenantPickupCustomerController.getCustomerData();
|
||||
tenantPickupCustomerController.refreshData();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
// focusNode: controller.focusNode,
|
||||
onChanged: (data){
|
||||
var keyword = data;
|
||||
print('keyword................${keyword}');
|
||||
if(data.isNotEmpty) {
|
||||
controller.shimmer.value = true;
|
||||
controller.getSearchCustomerData(keyword);
|
||||
}
|
||||
else{
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: IconButton(
|
||||
icon: const Icon(Icons.search),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
hintText: 'Search by customer',
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey[500]!,
|
||||
|
||||
|
||||
),
|
||||
suffixIcon: controller.searchController.text.isEmpty ? const SizedBox() : IconButton(
|
||||
icon: const Icon(Icons.cancel),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
),
|
||||
border: InputBorder.none),
|
||||
),
|
||||
),
|
||||
controller.getCustomerBytenantId.isEmpty && !controller.shimmer.value
|
||||
? Center(
|
||||
heightFactor: 3.0,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.shimmer.value?Center(
|
||||
heightFactor: 15.0,
|
||||
child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
controller.shimmer.value?
|
||||
queueShimmerCard(context):
|
||||
Expanded(
|
||||
child:controller.searchController.text.isEmpty? ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: controller.hasMore.value
|
||||
? controller.getCustomerBytenantId.length + 1
|
||||
: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
if(index < controller.getCustomerBytenantId.length){
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap:(){
|
||||
createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickupContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.pickupPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;
|
||||
|
||||
print('pickupCustomerIdmainpage ${createOrderController.pickupCustomerId}');
|
||||
|
||||
logger.i (createOrderController.pickupCustomerId);
|
||||
logger.i (createOrderController.dropCustomerId);
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
createOrderController.pickupSaveAddress = false;
|
||||
Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString()
|
||||
)
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
else{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
):
|
||||
ListView.builder(
|
||||
itemCount: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickupContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.pickupPostcodeController.text = controller.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{
|
||||
createOrderController.pickupSaveAddress = false;
|
||||
Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString())
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
queueShimmerCard(BuildContext context) {
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.10,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: const BoxDecoration(
|
||||
color:Colors.grey,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
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(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../Createorderview.dart';
|
||||
|
||||
class TenantPickUpTenantsView extends StatelessWidget {
|
||||
final bool? navigate;
|
||||
TenantPickUpTenantsView({super.key, this.navigate});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.progress = true;
|
||||
tenantPickupCustomerController.getTenantsByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// pickupCustomerAddressController.selectedAddressIndex = -1;
|
||||
createOrderController.pickupCustomerId = item.data.customerid;
|
||||
createOrderController.pickUpCustomerName = "${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = item.data.contactno;
|
||||
createOrderController.pickupLocationId = item.data.deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.fromLatitude = item.data.latitude;
|
||||
createOrderController.fromLongitude = item.data.longitude;
|
||||
createOrderController.fromAddress =item.data.address;
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
|
||||
Get.to(CreateOrderView(pickUpData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.data.suburb??'',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
224
lib/View/Customers/Customersview.dart
Normal file
224
lib/View/Customers/Customersview.dart
Normal file
@@ -0,0 +1,224 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
|
||||
import '../../Controller/Customers/Customercontroller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/utility.dart';
|
||||
import '../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../Dashboard/Dashboardview.dart';
|
||||
|
||||
class CustomerView extends StatelessWidget {
|
||||
CustomerView({super.key});
|
||||
|
||||
final CustomerController customerController = Get.put(CustomerController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const TextWidget(
|
||||
text: 'Customers',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
body: GetBuilder<CustomerController>(
|
||||
initState: (_) {
|
||||
customerController.getCustomerByTenantId();
|
||||
},
|
||||
builder: (controller) {
|
||||
if (controller.progress.value) {
|
||||
return Center(
|
||||
child: ShimmerListView(
|
||||
height: 100
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (controller.getCustomerBytenantId.isEmpty) {
|
||||
return emptyCustomerWidget();
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: ListView.builder(
|
||||
itemCount: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (context, index) {
|
||||
var customer = controller.getCustomerBytenantId[index];
|
||||
return CustomerCard(
|
||||
name: customer.firstname ?? '',
|
||||
address: (customer.suburb?.isNotEmpty ?? false) ?
|
||||
customer.suburb ?? '' : customer.city ?? '',
|
||||
phoneNumber: customer.contactno ?? '',
|
||||
profileImageUrl: '',
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget emptyCustomerWidget() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height:10),
|
||||
Image.asset(
|
||||
AssetConstants.noCustomersFound,
|
||||
height: 200,
|
||||
width: 200,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
TextWidget(
|
||||
text: 'No Customers Found!',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
TextWidget(
|
||||
text: 'Stay tuned - your next loyal customer could appear here soon!',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class CustomerCard extends StatelessWidget {
|
||||
final String name;
|
||||
final String address;
|
||||
final String phoneNumber;
|
||||
final String profileImageUrl;
|
||||
|
||||
const CustomerCard({
|
||||
super.key,
|
||||
required this.name,
|
||||
required this.address,
|
||||
required this.phoneNumber,
|
||||
required this.profileImageUrl,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 0, vertical: 6),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0)),
|
||||
elevation: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/// Profile image
|
||||
profileImageUrl.isNotEmpty ?? false ?
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundImage: NetworkImage(profileImageUrl),
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
) :
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
child: TextWidget(
|
||||
text: name[0],
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
fontSize: 22,
|
||||
),
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// Customer details
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person, color: ColorConstants.darkGreyColor, size: 17,),
|
||||
SizedBox(width: 5,),
|
||||
Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorConstants.darkGreyColor
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on_outlined, color: ColorConstants.darkGreyColor, size: 14,),
|
||||
SizedBox(width: 5,),
|
||||
Text(
|
||||
address,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 2),
|
||||
child: Icon(Icons.phone, color: ColorConstants.darkGreyColor, size: 14,),
|
||||
),
|
||||
SizedBox(width: 5,),
|
||||
Text(
|
||||
'+91 $phoneNumber',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Call icon
|
||||
IconButton(
|
||||
icon: const Icon(Icons.phone, color: Colors.green),
|
||||
onPressed: () {
|
||||
// TODO: Add phone call logic
|
||||
Utility.openPhoneCallApp(phoneNumber);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
303
lib/View/Googlemap/Googlemapview.dart
Normal file
303
lib/View/Googlemap/Googlemapview.dart
Normal file
@@ -0,0 +1,303 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../Controller/Createorder/Drop/Googlemap/Googlemapcontroller.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
class DropGoogleMapView extends StatelessWidget {
|
||||
final double lat;
|
||||
final double long;
|
||||
|
||||
DropGoogleMapView ({Key? key,required this.lat, required this.long,}) : super(key: key);
|
||||
|
||||
DropGoogleMapsController googleMapController = Get.put(DropGoogleMapsController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
elevation: 0.5,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
title: const Text(
|
||||
'Select Location',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: GetBuilder<DropGoogleMapsController>(
|
||||
initState: (_){
|
||||
DropGoogleMapsController.currentLatitude =lat;
|
||||
DropGoogleMapsController.currentLongitude =long;
|
||||
DropGoogleMapsController.center = LatLng(DropGoogleMapsController.currentLatitude!, DropGoogleMapsController.currentLongitude!);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(DropGoogleMapsController.currentLatitude!, DropGoogleMapsController.currentLongitude!),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.getCountry();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
child: Column(
|
||||
// fit: StackFit.loose,
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: Colors.white,
|
||||
height: 60,
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: Icon(Icons.search),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[300]!,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
labelText: 'Search',
|
||||
labelStyle: TextStyle(color: Colors.black45)),
|
||||
onChanged: (text) async {
|
||||
if(text.isEmpty){
|
||||
controller.dropPredictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
controller.update();
|
||||
}
|
||||
else {
|
||||
controller
|
||||
.onSearchDropTextChanged(
|
||||
text);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
controller.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: controller.dropPredictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.dropPredictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction,style: TextStyle(color: ColorConstants.darkGreyColor),),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.dropPredictions[index]['place_id'];
|
||||
controller.getDropPlaceDetails(placeId,prediction);
|
||||
googleMapController.searchController.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: GoogleMap(
|
||||
myLocationButtonEnabled: true,
|
||||
myLocationEnabled: true,
|
||||
mapType: MapType.normal,
|
||||
initialCameraPosition: controller.kGooglePlex!,
|
||||
markers: controller.markers,
|
||||
onCameraMove: (position) {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
DropGoogleMapsController.center = position.target;
|
||||
controller.update();
|
||||
print('positionsssprint$position');
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
// Update the markers for the updated position.zoom
|
||||
},
|
||||
onCameraIdle: () async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
await controller.getAddressFromLatLong(
|
||||
DropGoogleMapsController.center!.latitude, DropGoogleMapsController.center!.longitude);
|
||||
controller.update();
|
||||
print("addressOnCameraIdle${controller.address}");
|
||||
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
},
|
||||
onTap: (latLong) async {
|
||||
if (controller.markers.length >= 1) {
|
||||
controller.markers.clear();
|
||||
}
|
||||
DropGoogleMapsController.center = latLong;
|
||||
print('_lastMapPosition${DropGoogleMapsController.center}');
|
||||
await controller.getAddressFromLatLong(
|
||||
DropGoogleMapsController.center!.latitude, DropGoogleMapsController.center!.longitude);
|
||||
print('address${controller.address}');
|
||||
controller.update();
|
||||
onAddMarkerButtonPressed(DropGoogleMapsController.center!);
|
||||
},
|
||||
onMapCreated: (GoogleMapController controllers) {
|
||||
controller.mapController = controllers;
|
||||
controller.controllers.complete(controllers);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
if (googleMapController.markers.length >= 1) {
|
||||
googleMapController.markers.clear();
|
||||
}
|
||||
googleMapController.getAddressFromLatLong(
|
||||
lat, long);
|
||||
DropGoogleMapsController.center = LatLng(lat,long);
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(DropGoogleMapsController.center.toString()),
|
||||
position: DropGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
DropGoogleMapsController.center = latLong;
|
||||
await googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
googleMapController.kGooglePlex = CameraPosition(
|
||||
target: LatLng(lat, long),
|
||||
zoom: 14.4746,
|
||||
);
|
||||
googleMapController.goToThePosition(googleMapController.kGooglePlex);
|
||||
googleMapController.update();
|
||||
print("addressOnCameraIdle${googleMapController.address}");
|
||||
// _onAddMarkerButtonPressed(_center!);
|
||||
},
|
||||
child: Icon(Icons.refresh, color: Colors.white)),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||
bottomNavigationBar: GetBuilder<DropGoogleMapsController>(
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
height: 120,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
controller.dropAddressController.text??'',
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
height: 50,
|
||||
margin: EdgeInsets.only(left: 15,right: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
createOrderController.dropCityController.text = controller.dropCityController.text;
|
||||
createOrderController.dropStateController.text = controller.dropStateController.text ;
|
||||
createOrderController.dropSuburbController.text = controller.dropSuburbController.text ;
|
||||
createOrderController.dropPostcodeController.text = controller.dropPostcodeController.text ;
|
||||
createOrderController.dropAddressController.text = controller.dropAddressController.text ;
|
||||
createOrderController.dropAddressController.text = controller.toAddress??'';
|
||||
createOrderController.toLatitude = controller.toLatitude;
|
||||
createOrderController.toLongitude = controller.toLongitude;
|
||||
print('dropAddressControllergooglemap ${controller.dropAddressController.text}');
|
||||
controller.update();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Continue',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onAddMarkerButtonPressed(latLong) {
|
||||
googleMapController.update();
|
||||
googleMapController.markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId(DropGoogleMapsController.center.toString()),
|
||||
position: DropGoogleMapsController.center!,
|
||||
draggable: true,
|
||||
onDragEnd: (latLong) async {
|
||||
print('latLongDrag$latLong');
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.address = googleMapController.getAddressFromLatLong(
|
||||
latLong.latitude, latLong.longitude);
|
||||
googleMapController.update();
|
||||
},
|
||||
onDrag: (latLong) {
|
||||
DropGoogleMapsController.center = latLong;
|
||||
googleMapController.update();
|
||||
},
|
||||
infoWindow: InfoWindow(
|
||||
title: 'My Location',
|
||||
// snippet: googleMapController.address,
|
||||
|
||||
),
|
||||
icon: BitmapDescriptor.defaultMarker,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
96
lib/View/Home/Homeview.dart
Normal file
96
lib/View/Home/Homeview.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Controller/Home/Homecontroller.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/toast.dart';
|
||||
import '../Customers/Customersview.dart';
|
||||
import '../Dashboard/Dashboardview.dart';
|
||||
import '../Dashboard/Tabs/Createdview.dart';
|
||||
import '../More/Moreview.dart';
|
||||
import '../Orders/Orderspage.dart';
|
||||
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
final int selectedIndex;
|
||||
|
||||
HomeView({super.key, required this.selectedIndex});
|
||||
|
||||
HomeController homeController = Get.put(HomeController());
|
||||
|
||||
DateTime? currentBackPressTime;
|
||||
|
||||
Future<bool> _willPopCallback() async {
|
||||
DateTime now = DateTime.now();
|
||||
if (currentBackPressTime == null ||
|
||||
now.difference(currentBackPressTime!) > Duration(seconds: 1)) {
|
||||
currentBackPressTime = now;
|
||||
Toast.showToast("Press one more time to exit");
|
||||
return Future.value(false);
|
||||
}else{
|
||||
Get.back();
|
||||
return Future.value(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> widgetOptionsNearle = _widgetOptionsNearle();
|
||||
|
||||
return GetBuilder<HomeController>(initState: (_) {
|
||||
homeController.selectedIndex = selectedIndex;
|
||||
}, builder: (controller) {
|
||||
return WillPopScope(
|
||||
onWillPop: _willPopCallback,
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
items: <BottomNavigationBarItem>[
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Home',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.shopping_cart),
|
||||
label: 'Orders',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.shopping_bag),
|
||||
label: 'Products',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.people),
|
||||
label: 'Customers',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: 'Accounts',
|
||||
),
|
||||
],
|
||||
currentIndex: homeController.selectedIndex,
|
||||
selectedItemColor: ColorConstants.primaryColor,
|
||||
unselectedItemColor: Colors.grey,
|
||||
onTap: homeController.onItemTapped,
|
||||
),
|
||||
body: widgetOptionsNearle[controller.selectedIndex],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<Widget> _widgetOptionsNearle() =>
|
||||
<Widget>[
|
||||
DashboardView(),
|
||||
OrderView(),
|
||||
ProductView(),
|
||||
CustomerView(),
|
||||
// ReassignRidersView(deliveryDetails: DeliveriesDetails()),
|
||||
MoreView()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
139
lib/View/Internet/Internetcheckview.dart
Normal file
139
lib/View/Internet/Internetcheckview.dart
Normal file
@@ -0,0 +1,139 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import '../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/toast.dart';
|
||||
|
||||
|
||||
class NoInternetScreen extends StatelessWidget {
|
||||
final connectivityResult;
|
||||
|
||||
NoInternetScreen({super.key, this.connectivityResult});
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
// InterNetConnectionController interNetConnectionController = Get.put(InterNetConnectionController());
|
||||
|
||||
Future<bool> actionFunction() {
|
||||
SystemNavigator.pop();
|
||||
return Future.value(true);
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: ()async{
|
||||
bool navigateStatus = false;
|
||||
if(connectivityResult.contains(ConnectivityResult.wifi) || connectivityResult.contains(ConnectivityResult.mobile) ||connectivityResult.contains(ConnectivityResult.ethernet) ||connectivityResult.contains(ConnectivityResult.vpn)){
|
||||
navigateStatus = true;
|
||||
}
|
||||
|
||||
return navigateStatus;
|
||||
},
|
||||
child: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
body: Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
color: ColorConstants.secondaryColor,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.25,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
AssetConstants.nearleAppbarTop,
|
||||
),
|
||||
fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(20, 20),
|
||||
bottomRight: Radius.elliptical(20, 20))),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 64, left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.7,
|
||||
child: Image.asset(AssetConstants.nearleAppbarDarkLogo),
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Get.height*0.09,
|
||||
width: Get.width*0.6,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 25),
|
||||
child: Image.asset(AssetConstants.nearleTextLogoWhite),
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 30,right: 30),
|
||||
child: Text(
|
||||
"Please Connect to the Network and Try Again",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,height: 1.4,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.50,
|
||||
width: Get.width*0.6,
|
||||
color:ColorConstants.secondaryColor,
|
||||
child: Lottie.asset('assets/images/nointernet.json',width: Get.width*0.8,fit: BoxFit.cover)),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
height: Get.height*0.1,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image:DecorationImage(image:AssetImage(AssetConstants.nearleAppbarBottom,),fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(3, 3),
|
||||
bottomRight: Radius.elliptical(3, 3))),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
53
lib/View/Introscreen/Introscreenview.dart
Normal file
53
lib/View/Introscreen/Introscreenview.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intro_slider/intro_slider.dart';
|
||||
import '../../Controller/Introscreen/Introscreencontroller.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
class IntroScreenView extends StatelessWidget {
|
||||
IntroScreenView({super.key});
|
||||
|
||||
final IntroScreenController introScreenController = Get.put(IntroScreenController());
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return GetBuilder<IntroScreenController>(
|
||||
initState: (_){
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: IntroSlider(
|
||||
isScrollable: true,
|
||||
autoScrollInterval: Duration(seconds: 10),
|
||||
isAutoScroll: true,
|
||||
key: UniqueKey(),
|
||||
doneButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStateProperty.all(ColorConstants.primaryColor),
|
||||
),
|
||||
nextButtonStyle : ButtonStyle(
|
||||
foregroundColor: WidgetStateProperty.all(ColorConstants.primaryColor),
|
||||
),
|
||||
skipButtonStyle: ButtonStyle(
|
||||
foregroundColor: WidgetStateProperty.all(ColorConstants.primaryColor),
|
||||
),
|
||||
indicatorConfig: IndicatorConfig(activeIndicatorWidget:CircleAvatar(
|
||||
radius: screenSize.height * 0.004,
|
||||
backgroundColor: ColorConstants.primaryColor
|
||||
),
|
||||
),
|
||||
listContentConfig: controller.listContentConfig,
|
||||
onDonePress: controller.onDonePress,
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
160
lib/View/Location/Locationpermissionview.dart
Normal file
160
lib/View/Location/Locationpermissionview.dart
Normal file
@@ -0,0 +1,160 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Controller/Location/Locationpermissioncontroller.dart';
|
||||
import '../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/custombutton.dart';
|
||||
|
||||
|
||||
class LocationPermission extends StatelessWidget {
|
||||
LocationPermission({Key? key}) : super(key: key);
|
||||
|
||||
LocationPermissionController locationPermissionController = Get.put(LocationPermissionController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: ListView(
|
||||
children: [
|
||||
Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
Image(
|
||||
image: AssetImage(
|
||||
'${AssetConstants.nearleDarkLogo}',
|
||||
),
|
||||
height: 40,
|
||||
width: 260,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[200],
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image(
|
||||
image: AssetImage(
|
||||
AssetConstants.nearleLogin,
|
||||
),
|
||||
height: 200,
|
||||
width: 200,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
),
|
||||
Text(
|
||||
"Nearle 'Your super hero'",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'To enjoy a never before experience, please',
|
||||
style: TextStyle(color: Colors.grey[500], fontSize: 17),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'allow us the following permission.',
|
||||
style: TextStyle(color: Colors.grey[500], fontSize: 17),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 30,
|
||||
),
|
||||
Container(
|
||||
width: Get.width*0.80,
|
||||
child: Text(
|
||||
'Location helps to join your neighbourhood and explore customers around you.',
|
||||
style: TextStyle(
|
||||
color: Colors.grey[500],
|
||||
fontSize: 15,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
height: Get.height*0.10,
|
||||
decoration: BoxDecoration(color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom:10,top: 10),
|
||||
child: GetBuilder<LocationPermissionController>(
|
||||
builder: (controller) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
controller.doSomething();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Allow permissions',
|
||||
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,
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
320
lib/View/More/Editprofile/Editprofileview.dart
Normal file
320
lib/View/More/Editprofile/Editprofileview.dart
Normal file
@@ -0,0 +1,320 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Controller/More/Editprofile/Editprofilecontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/custombutton.dart';
|
||||
import '../../../Helper/customederaction.dart';
|
||||
import '../../../Model/Response/User/Usermodelresponse.dart';
|
||||
|
||||
class EditProfile extends StatelessWidget {
|
||||
UserDetails? data;
|
||||
EditProfile({super.key,this.data});
|
||||
|
||||
EditProfileController editProfileController = Get.put(EditProfileController());
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: SingleChildScrollView(
|
||||
child: GetBuilder<EditProfileController>(
|
||||
initState: (_){
|
||||
editProfileController.userInfo = data;
|
||||
editProfileController.getDetails();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.30,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
AssetConstants.nearleAppbarTop,
|
||||
),
|
||||
fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(20, 20),
|
||||
bottomRight: Radius.elliptical(20, 20))),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 64, left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.7,
|
||||
child: Image.asset(AssetConstants.nearleAppbarDarkLogo),
|
||||
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 45,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"Edit Profile",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
fontSize: 24),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"+91 ${data?.contactno}",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
fontSize: 17),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 25.0,horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 10,),
|
||||
firstName(),
|
||||
const SizedBox(height: 10,),
|
||||
lastName(),
|
||||
const SizedBox(height: 10,),
|
||||
email(),
|
||||
const SizedBox(height: 10,),
|
||||
contactNo(),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
bottomNavigationBar:Container(
|
||||
height: Get.height*0.1,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image:DecorationImage(image:AssetImage(AssetConstants.nearleAppbarBottom,),fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(3, 3),
|
||||
bottomRight: Radius.elliptical(3, 3))),
|
||||
child: Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height*0.08,
|
||||
child: submit()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Widget firstName() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Firstname',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
|
||||
controller: editProfileController.firstNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget lastName() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Lastname',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
|
||||
controller: editProfileController.lastNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget email() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Email',
|
||||
prefixIcon: Icon(
|
||||
Icons.email_outlined,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
controller: editProfileController.emailController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactNo() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
|
||||
// enabled: false,
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
buildCounter: (BuildContext context,
|
||||
{int? currentLength, int? maxLength, bool? isFocused}) =>
|
||||
null,
|
||||
maxLength: 10,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Contact no',
|
||||
// prefixIcon: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: Get.width * 0.3,
|
||||
// height: Get.height * 0.04,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// const SizedBox(
|
||||
// width: 25,
|
||||
// ),
|
||||
// InkWell(
|
||||
// child: CountryPickerUtils.getDefaultFlagImage(
|
||||
// editProfileController.selectedDialogCountry),
|
||||
// // onTap: _openCountryPickerDialog,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 8,
|
||||
// ),
|
||||
// Text(
|
||||
// "+${editProfileController.selectedDialogCountry.phoneCode}"),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
prefixIcon: Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
controller: editProfileController.contactNoController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget submit(){
|
||||
return GetBuilder<EditProfileController>(
|
||||
builder: (controller) {
|
||||
return RoundedButton(
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
onPressed: () {
|
||||
controller.doSomething();
|
||||
},
|
||||
color: ColorConstants.primaryColor!,
|
||||
title: 'Update',
|
||||
controller: controller.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Inter",
|
||||
color: Colors.white,
|
||||
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)}";
|
||||
}
|
||||
60
lib/View/More/Faqview/Termsandconditionsview.dart
Normal file
60
lib/View/More/Faqview/Termsandconditionsview.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
class TermsAndConditionsView extends StatefulWidget {
|
||||
const TermsAndConditionsView({super.key});
|
||||
|
||||
@override
|
||||
TermsAndConditionsViewState createState() => TermsAndConditionsViewState();
|
||||
}
|
||||
|
||||
class TermsAndConditionsViewState extends State<TermsAndConditionsView> {
|
||||
final Color primaryColor = const Color.fromRGBO(0, 157, 204, 1);
|
||||
double webProgress = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Terms and Conditions',style: TextStyle(color: ColorConstants.secondaryColor,fontFamily: 'Lato')),
|
||||
leading: InkWell(child: const FaIcon(FontAwesomeIcons.angleLeft,color: Colors.white,size: 30),onTap: ()=>Navigator.pop(context)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
|
||||
body: Column(
|
||||
children: [
|
||||
webProgress < 1
|
||||
? SizedBox(
|
||||
height: 5,
|
||||
child: LinearProgressIndicator(
|
||||
value: webProgress,
|
||||
color: ColorConstants.primaryColor,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
// Expanded(
|
||||
// child: WebView(
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// initialUrl: 'https://nearle.in/terms.html',
|
||||
// javascriptMode: JavascriptMode.unrestricted,
|
||||
// onProgress: (progress) {
|
||||
// setState(() {
|
||||
// webProgress = progress / 100;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
65
lib/View/More/Faqview/customerfaqs.dart
Normal file
65
lib/View/More/Faqview/customerfaqs.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
class CustomerFaqs extends StatefulWidget {
|
||||
const CustomerFaqs({Key? key, this.title}) : super(key: key);
|
||||
|
||||
final String? title;
|
||||
|
||||
@override
|
||||
CustomerFaqsState createState() => CustomerFaqsState();
|
||||
}
|
||||
|
||||
class CustomerFaqsState extends State<CustomerFaqs> {
|
||||
|
||||
double webProgress = 0;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('FAQ\'s',style: TextStyle(color: ColorConstants.secondaryColor,fontFamily: 'Lato')),
|
||||
leading: InkWell(child: const FaIcon(FontAwesomeIcons.angleLeft,color: Colors.white,size: 30),onTap: ()=>Navigator.pop(context)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
webProgress < 1
|
||||
? SizedBox(
|
||||
height: 5,
|
||||
child: LinearProgressIndicator(
|
||||
value: webProgress,
|
||||
color: ColorConstants.primaryColor,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
// Expanded(
|
||||
// child: WebView(
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// initialUrl: ' https://nearle.in/faq.html',
|
||||
// javascriptMode: JavascriptMode.unrestricted,
|
||||
// onProgress: (progress) {
|
||||
// setState(() {
|
||||
// webProgress = progress / 100;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
150
lib/View/More/Faqview/faqtabs.dart
Normal file
150
lib/View/More/Faqview/faqtabs.dart
Normal file
@@ -0,0 +1,150 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import 'Termsandconditionsview.dart';
|
||||
import 'privacy.dart';
|
||||
import 'customerfaqs.dart';
|
||||
|
||||
class FaqTabs extends StatelessWidget {
|
||||
const FaqTabs({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Our Policies and FAQ\'s',style: TextStyle(color: ColorConstants.secondaryColor,fontFamily: 'Lato')),
|
||||
leading: InkWell(child: const Icon(Icons.arrow_back,color: Colors.white,size: 30),onTap: ()=>Navigator.pop(context)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20,left: 10,right: 10),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>const CustomerFaqs());
|
||||
},
|
||||
child: Card(
|
||||
shadowColor: ColorConstants.secondaryColor,
|
||||
child: Container(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.95,
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.grey[400]!),borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 10,),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline,color: Colors.black,size: 36,),
|
||||
SizedBox(width: 10,),
|
||||
Text("FAQ's",style: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold,fontFamily: 'Lato')),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.10,
|
||||
// decoration: const BoxDecoration(color: ColorConstants.primaryColor,borderRadius: BorderRadius.only(topRight: Radius.circular(10),bottomRight: Radius.circular(10))),
|
||||
child: const Center(
|
||||
child: Icon(Icons.arrow_forward_ios,color: Colors.black,size: 22),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6,left: 10,right: 10),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>const Privacy());
|
||||
},
|
||||
child: Card(
|
||||
shadowColor: ColorConstants.secondaryColor,
|
||||
child: Container(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.95,
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.grey[400]!),borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 10,),
|
||||
Row(
|
||||
children: [
|
||||
Image(
|
||||
height: 40,
|
||||
width: 40,
|
||||
image: AssetImage(AssetConstants.privacyPolicy,)),
|
||||
SizedBox(width: 10,),
|
||||
Text("Privacy Policy",style: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold,fontFamily: 'Lato')),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.10,
|
||||
// decoration: const BoxDecoration(color: ColorConstants.primaryColor,borderRadius: BorderRadius.only(topRight: Radius.circular(10),bottomRight: Radius.circular(10))),
|
||||
child: const Center(
|
||||
child: Icon(Icons.arrow_forward_ios,color: Colors.black,size: 22),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6,left: 10,right: 10),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
Get.to(()=>const TermsAndConditionsView());
|
||||
},
|
||||
child: Card(
|
||||
shadowColor: ColorConstants.secondaryColor,
|
||||
child: Container(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.95,
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.grey[400]!),borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 10,),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.assignment_outlined,color: Colors.black,size: 36,),
|
||||
SizedBox(width: 10,),
|
||||
Text("Term's and conditions",style: TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold,fontFamily: 'Lato')),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.10,
|
||||
// decoration: const BoxDecoration(color: ColorConstants.primaryColor,borderRadius: BorderRadius.only(topRight: Radius.circular(10),bottomRight: Radius.circular(10))),
|
||||
child: const Center(
|
||||
child: Icon(Icons.arrow_forward_ios,color: Colors.black,size: 22),
|
||||
),
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
59
lib/View/More/Faqview/privacy.dart
Normal file
59
lib/View/More/Faqview/privacy.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
|
||||
class Privacy extends StatefulWidget {
|
||||
const Privacy({super.key});
|
||||
|
||||
@override
|
||||
PrivacyState createState() => PrivacyState();
|
||||
}
|
||||
|
||||
class PrivacyState extends State<Privacy> {
|
||||
final Color primaryColor = const Color.fromRGBO(0, 157, 204, 1);
|
||||
double webProgress = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Privacy Policy',style: TextStyle(color: ColorConstants.secondaryColor,fontFamily: 'Lato')),
|
||||
leading: InkWell(child: const FaIcon(FontAwesomeIcons.angleLeft,color: Colors.white,size: 30),onTap: ()=>Navigator.pop(context)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
webProgress < 1
|
||||
? SizedBox(
|
||||
height: 5,
|
||||
child: LinearProgressIndicator(
|
||||
value: webProgress,
|
||||
color: ColorConstants.primaryColor,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
// Expanded(
|
||||
// child: WebView(
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// initialUrl: 'https://nearle.in/privacy.html',
|
||||
// javascriptMode: JavascriptMode.unrestricted,
|
||||
// onProgress: (progress) {
|
||||
// setState(() {
|
||||
// webProgress = progress / 100;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
1001
lib/View/More/Locations/Addlocation/Addlocationview.dart
Normal file
1001
lib/View/More/Locations/Addlocation/Addlocationview.dart
Normal file
File diff suppressed because it is too large
Load Diff
844
lib/View/More/Locations/Locationview.dart
Normal file
844
lib/View/More/Locations/Locationview.dart
Normal file
@@ -0,0 +1,844 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/More/Locations/Locationcontroller.dart';
|
||||
import '../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/utility.dart';
|
||||
import '../../Home/Homeview.dart';
|
||||
import 'Addlocation/Addlocationview.dart';
|
||||
import 'Staffs/Staffdetailsview.dart';
|
||||
|
||||
class LocationView extends StatelessWidget {
|
||||
LocationView({super.key});
|
||||
LocationController locationController = Get.put(LocationController());
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: ()async{
|
||||
Get.to(()=>HomeView(selectedIndex: 3));
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0.5,
|
||||
leading: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorConstants. primaryColor,
|
||||
// radius: 20,
|
||||
backgroundImage: AssetImage(AssetConstants.NearleAppbarIcon),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
titleSpacing: 1,
|
||||
title: Text('Locations'),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: GetBuilder<LocationController>(
|
||||
initState: (_){
|
||||
locationController.getLocation();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 5),
|
||||
child: controller.shimmer == true
|
||||
? shimmerLocation()
|
||||
: controller.locations.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 Locations at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 16),
|
||||
),
|
||||
],
|
||||
))
|
||||
: listLocationMobile(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
height: 60,
|
||||
// width: Get.width * 0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30), color: ColorConstants.primaryColor),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print('hello');
|
||||
Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(
|
||||
builder: (context) => HomeView(
|
||||
selectedIndex: 0,
|
||||
)));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Home',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(()=>AddLocationView(editMode: false,));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.add_location_alt_sharp,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Add Location',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(HomeView(selectedIndex: 3));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Back',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget listLocationMobile() {
|
||||
return GetBuilder<LocationController>(
|
||||
builder: (controller) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 70),
|
||||
itemCount: controller.locations.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Card(
|
||||
// color: Colors.grey[150],
|
||||
elevation: 0,
|
||||
child: Container(
|
||||
height: 120,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion.getLightColors(
|
||||
controller.locations[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,
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(()=> AddLocationView(editMode: true,
|
||||
locationInfo: controller.locations[index],
|
||||
),);
|
||||
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
shape: BoxShape.circle,
|
||||
// borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6, horizontal: 6),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
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.locations[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.locations[index].locationcontact == null
|
||||
? "Contact No"
|
||||
: '${ controller.locations[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.locations[index].locationsuburb}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: Colors.black87
|
||||
|
||||
// fontWeight: FontWeight.w600
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// ExpansionTile(
|
||||
// maintainState: true,
|
||||
//
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// tilePadding: EdgeInsets.only(left: 8, top: 2),
|
||||
// initiallyExpanded: true,
|
||||
//
|
||||
// childrenPadding: EdgeInsets.only(left: 2, right: 2, bottom: 0),
|
||||
// trailing: Padding(
|
||||
// padding: const EdgeInsets.only(top: 30.0, right: 10),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// // flex: 3,
|
||||
// child: Icon(
|
||||
// Icons.keyboard_arrow_down_sharp,
|
||||
// color: Colors.black87,
|
||||
// size: 24,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// title: Container(
|
||||
// height: 120,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: UtilityPromotion.getLightColors(
|
||||
// controller.locations[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,
|
||||
// )),
|
||||
// Positioned(
|
||||
// bottom: 0,
|
||||
// right: 0,
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.to(()=> AddLocationView(editMode: true,
|
||||
// locationInfo: controller.locations[index],
|
||||
// ),);
|
||||
//
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: ColorConstants.primaryColor,
|
||||
// shape: BoxShape.circle,
|
||||
// // borderRadius: BorderRadius.circular(12),
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// vertical: 6, horizontal: 6),
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// color: Colors.white,
|
||||
// size: 16,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
//
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// 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.locations[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.locations[index].locationcontact == null
|
||||
// ? "Contact No"
|
||||
// : '${ controller.locations[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.locations[index].locationsuburb}",
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: TextStyle(
|
||||
// fontSize: 15, color: Colors.black87
|
||||
//
|
||||
// // fontWeight: FontWeight.w600
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// children: [
|
||||
// Divider(
|
||||
// thickness: 1,
|
||||
// color: Colors.grey[300],
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 10, bottom: 0, right: 10),
|
||||
// height: 90,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 7,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// Get.to(()=> AddLocationView(editMode: true,
|
||||
// locationInfo: controller.locations[index],
|
||||
// ),);
|
||||
//
|
||||
// },
|
||||
// child: Column(children: [
|
||||
//
|
||||
// Container(
|
||||
// height: 45,
|
||||
// width: 45,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: ColorConstants.primaryColor)),
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.edit_location_alt,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// size: 30,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
// Text("Location",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14,
|
||||
// color: Colors.grey[800],
|
||||
// height: 0.8)),
|
||||
// ]),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
//
|
||||
// Get.to(()=>StaffsDetails(staffData: [], locationName:controller.locations[index].locationname??'',));
|
||||
//
|
||||
// },
|
||||
// child: Column(children: [
|
||||
//
|
||||
// Container(
|
||||
// height: 45,
|
||||
// width: 45,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: ColorConstants.primaryColor)),
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.person,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// size: 30,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
// Text("Staff's",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14,
|
||||
// color: Colors.grey[800],
|
||||
// height: 0.8)),
|
||||
// ]),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// Expanded(
|
||||
// child: Container(),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // controller.moduleId != 4?Divider(
|
||||
// // thickness: 2,
|
||||
// // color: Colors.grey[100],
|
||||
// // ):SizedBox(),
|
||||
// // controller. moduleId != 4?Expanded(
|
||||
// // flex: 8,
|
||||
// // child: Row(
|
||||
// // mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// // children: [
|
||||
// // Expanded(
|
||||
// // child: InkWell(
|
||||
// // onTap: () {
|
||||
// //
|
||||
// // },
|
||||
// // child: Column(children: [
|
||||
// // SizedBox(
|
||||
// // height: 15,
|
||||
// // ),
|
||||
// // Container(
|
||||
// // height: 45,
|
||||
// // width: 45,
|
||||
// // decoration: BoxDecoration(
|
||||
// // shape: BoxShape.circle,
|
||||
// // border: Border.all(
|
||||
// // color: primaryColor)),
|
||||
// // child: Center(
|
||||
// // child: Icon(
|
||||
// // Icons.person,
|
||||
// // color: primaryColor,
|
||||
// // size: 30,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 10,
|
||||
// // ),
|
||||
// // Text("Staff's",
|
||||
// // textAlign: TextAlign.center,
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 14,
|
||||
// // color: Colors.grey[800],
|
||||
// // height: 0.8)),
|
||||
// // ]),
|
||||
// // ),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // )
|
||||
// // ],
|
||||
// // )):SizedBox(),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
shimmerLocation(){
|
||||
return Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
|
||||
enabled: true,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (_, __) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 8.0,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorConstants.secondaryColor!,width: 3)),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(13.0),
|
||||
child: Container(
|
||||
height: 50,
|
||||
width: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Container(
|
||||
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:17,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:17,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
itemCount: 6,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
484
lib/View/More/Locations/Staffs/Staffdetailsview.dart
Normal file
484
lib/View/More/Locations/Staffs/Staffdetailsview.dart
Normal file
@@ -0,0 +1,484 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../../Controller/More/Locations/Staffs/Staffdetailscontroller.dart';
|
||||
import '../../../../Controller/More/Staffs/Staffscontroller.dart';
|
||||
import '../../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/utility.dart';
|
||||
import '../../../Home/Homeview.dart';
|
||||
|
||||
class StaffsDetails extends StatelessWidget {
|
||||
List staffData;
|
||||
String locationName;
|
||||
StaffDetailsController staffDetailsController = Get.put(StaffDetailsController());
|
||||
StaffsDetails({Key? key, required this.staffData, required this.locationName,}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Image(
|
||||
image: AssetImage(AssetConstants.NearleAppbarIcon),
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
title: Text('$locationName Staffs'),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: mobileUserList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
height: 60,
|
||||
// width: Get.width * 0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30), color: ColorConstants.primaryColor),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(()=>HomeView(selectedIndex: 0,));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Home',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: 0.5,
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Back',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
addUser() {
|
||||
|
||||
// Get.to(()=>AddUser(location: true, locationId:staffData[0]['Locationid']??[],));
|
||||
}
|
||||
|
||||
mobileUserList() {
|
||||
return GetBuilder<StaffsController>(
|
||||
builder: (context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10,
|
||||
),
|
||||
child:staffData.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 users at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600], fontSize: 14),
|
||||
),
|
||||
],
|
||||
))
|
||||
: staffDetailsController.shimmer == true
|
||||
? Shimmer.fromColors(
|
||||
enabled: true,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 60),
|
||||
itemCount: 4,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!, width: 2),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 90,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 55,
|
||||
height: 55,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.secondaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
"--------------",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight:
|
||||
FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
// flex: 5,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.store,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
// '',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 80),
|
||||
itemCount: staffData.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: [BoxShadow(color: Colors.grey)],
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 130,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion.getLightColors(
|
||||
'${ staffData[index]['Firstname']==null||staffData[index]['Firstname'].toString().isEmpty?'':staffData[index]['Firstname'].toString()[0]}'
|
||||
.toString())
|
||||
.withAlpha(100),
|
||||
// staffData[index]['Firstname'][0].toString()),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// width: 55,
|
||||
// height: 60,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
"${ staffData[index]['Firstname']==null||staffData[index]['Firstname'].toString().isEmpty?'':staffData[index]['Firstname'].toString()[0].toUpperCase()}",
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
locationName
|
||||
.toString()
|
||||
.length >
|
||||
9
|
||||
?locationName
|
||||
.toString()
|
||||
.substring(0, 9) +
|
||||
'...'
|
||||
: locationName
|
||||
.toString(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// '',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// SizedBox(
|
||||
// height: 4,
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${staffData[index]['Firstname'] == null ? "" : staffData[index]['Firstname']} ${staffData[index]['Lastname'] == null ? "" : staffData[index]['Lastname']}",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
staffData[index]['Roleid']==1?Icon(Icons.admin_panel_settings_outlined,color: ColorConstants.primaryColor,size:20,):staffData[index]['Roleid']==2?Icon(Icons.phone_android,color: ColorConstants.primaryColor,size:20,):
|
||||
Icon(Icons.laptop_windows,color: ColorConstants.primaryColor,size:20,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'91 ${staffData[index]['Contact']}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.mail,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${staffData[index]['Email']}',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
}),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
96
lib/View/More/Mobileprofileview.dart
Normal file
96
lib/View/More/Mobileprofileview.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
class ProfileMobile extends StatelessWidget {
|
||||
final String title;
|
||||
final Color colorValue;
|
||||
final IconData icon;
|
||||
final Function(bool) onTapNavigation;
|
||||
|
||||
ProfileMobile(
|
||||
{required this.title,
|
||||
required this.icon,
|
||||
required this.onTapNavigation,
|
||||
required this.colorValue});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
onTapNavigation(true);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
width: Get.width * 0.3,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: colorValue,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
shape: BoxShape.rectangle),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 24,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 2),
|
||||
child: Text(
|
||||
"${this.title}",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey[800],
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Colors.grey[700],
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
309
lib/View/More/Moreview.dart
Normal file
309
lib/View/More/Moreview.dart
Normal file
@@ -0,0 +1,309 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../Controller/Dashboard/Dashboardcontroller.dart';
|
||||
import '../../Controller/Home/Homecontroller.dart';
|
||||
import '../../Controller/More/Morecontroller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Globalwidgets/web_view.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import 'Notification/Notificationview.dart';
|
||||
|
||||
class MoreView extends StatelessWidget {
|
||||
MoreView({super.key});
|
||||
|
||||
final MoreController moreController = Get.put(MoreController());
|
||||
|
||||
final DashboardController dashboardController = Get.put(DashboardController());
|
||||
|
||||
final HomeController homeController = Get.put(HomeController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MoreController>(
|
||||
initState: (_){
|
||||
moreController.getToken();
|
||||
homeController.getTenantId();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
appBar: AppBar(
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.only(left: 14),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: '${dashboardController.tenantInfo?.firstname}',
|
||||
fontSize : 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
maxLines: 1,
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
TextWidget(
|
||||
text: '+91 ${dashboardController.tenantInfo?.primarycontact}',
|
||||
fontSize: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
leadingWidth: double.infinity,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: 65,
|
||||
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20,),
|
||||
MyAccountSegmentUI(moreController: moreController, homeController: homeController,),
|
||||
const SizedBox(height: 20,),
|
||||
// HelpAndSupport(moreController: moreController, homeController: homeController,),
|
||||
// const SizedBox(height: 20,),
|
||||
const PrivacyPolicySegment(),
|
||||
const SizedBox(height: 20,),
|
||||
TextWidget(
|
||||
text: 'App Version: ${controller.currentVersion}',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
),
|
||||
const SizedBox(height: 50,),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyAccountSegmentUI extends StatelessWidget {
|
||||
const MyAccountSegmentUI({
|
||||
super.key, required
|
||||
this.moreController,
|
||||
required this.homeController,
|
||||
|
||||
});
|
||||
|
||||
final MoreController moreController;
|
||||
|
||||
final HomeController homeController;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10,),
|
||||
const TextWidget(
|
||||
text: 'My Account',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 21,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.notifications_active,
|
||||
title: 'Notification',
|
||||
onTap: () {
|
||||
Get.to(() => NotificationView());
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.qr_code_scanner,
|
||||
title: 'Scanner',
|
||||
onTap: () {
|
||||
homeController.showQRBottomSheet();
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.logout,
|
||||
title: 'Logout',
|
||||
onTap: () {
|
||||
moreController.confirmLogout(context);
|
||||
},
|
||||
noNeedDivider: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class HelpAndSupport extends StatelessWidget {
|
||||
const HelpAndSupport({
|
||||
super.key, required
|
||||
this.moreController,
|
||||
required this.homeController,
|
||||
|
||||
});
|
||||
|
||||
final MoreController moreController;
|
||||
|
||||
final HomeController homeController;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10,),
|
||||
const TextWidget(
|
||||
text: 'Help And Support',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 21,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.headphones,
|
||||
title: 'Create Request',
|
||||
onTap: () {
|
||||
Get.to(() => NotificationView());
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.support_agent_outlined,
|
||||
title: 'Requested Support',
|
||||
noNeedDivider: true,
|
||||
onTap: () {
|
||||
homeController.showQRBottomSheet();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PrivacyPolicySegment extends StatelessWidget {
|
||||
const PrivacyPolicySegment({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10,),
|
||||
const TextWidget(
|
||||
text: 'Policy and FAQ',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 21,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.question_answer,
|
||||
title: "FAQ's",
|
||||
onTap: () {
|
||||
Get.to(() => const WebViewApp(
|
||||
url: 'https://nearle.in/faq',
|
||||
appBarText: "FAQ's",
|
||||
));
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.rule,
|
||||
title: "Term's and conditions",
|
||||
onTap: () {
|
||||
Get.to(() => const WebViewApp(
|
||||
url: 'https://nearle.in/terms',
|
||||
appBarText: 'Terms and conditions',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.privacy_tip,
|
||||
title: 'Privacy Policy',
|
||||
noNeedDivider: true,
|
||||
onTap: () {
|
||||
Get.to(() => const WebViewApp(
|
||||
url: 'https://nearle.in/privacy',
|
||||
appBarText: 'Privacy Policy',
|
||||
));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomListTile extends StatelessWidget {
|
||||
final IconData leadingIcon;
|
||||
final String title;
|
||||
final VoidCallback onTap;
|
||||
final bool? noNeedDivider;
|
||||
|
||||
const CustomListTile({
|
||||
super.key,
|
||||
required this.leadingIcon,
|
||||
required this.title,
|
||||
required this.onTap,
|
||||
this.noNeedDivider,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(horizontal: -4), // Decrease space
|
||||
leading: CircleAvatar(
|
||||
radius: 18,
|
||||
backgroundColor: ColorConstants.primaryColor.withOpacity(0.1),
|
||||
child: Icon(
|
||||
leadingIcon,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 17),
|
||||
title: TextWidget(
|
||||
text: title,
|
||||
fontSize: 16,
|
||||
// fontWeight: FontWeight.bold,
|
||||
),
|
||||
onTap: onTap, // Action when the ListTile is tapped
|
||||
),
|
||||
(noNeedDivider ?? false) ?
|
||||
const SizedBox() :
|
||||
Divider(
|
||||
thickness: 0.5,
|
||||
// color: ColorConstants.lightGrey,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
100
lib/View/More/Notification/Notificationview.dart
Normal file
100
lib/View/More/Notification/Notificationview.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Controller/More/Notification/Notificationcontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
class NotificationView extends StatelessWidget {
|
||||
NotificationView({super.key});
|
||||
|
||||
final NotificationController controller =
|
||||
Get.put(NotificationController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
leading: Row(
|
||||
children: [
|
||||
IconButton(onPressed: (){
|
||||
Navigator.pop(context);
|
||||
|
||||
}, icon: Icon(Icons.arrow_back,color: Colors.black,)),
|
||||
Text(
|
||||
"Notification",
|
||||
style: TextStyle(color: Colors.black,fontSize: 20),
|
||||
),
|
||||
],
|
||||
),
|
||||
leadingWidth: 400,
|
||||
elevation: 0,
|
||||
backgroundColor:ColorConstants.lightColor,
|
||||
automaticallyImplyLeading: true,
|
||||
),
|
||||
|
||||
body: Obx(() {
|
||||
// Loading state
|
||||
if (controller.isLoading.value) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
// Empty state
|
||||
if (controller.notifications.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"No notification at this moment",
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Notification List
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(12),
|
||||
itemCount: controller.notifications.length,
|
||||
itemBuilder: (context, index) {
|
||||
final NotificationModel item =
|
||||
controller.notifications[index];
|
||||
|
||||
return Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
item.title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
item.message,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailing: Text(
|
||||
item.notificationdate.split("T")[0], // YYYY-MM-DD
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
477
lib/View/More/Staffs/Addstaff/Addstaffview.dart
Normal file
477
lib/View/More/Staffs/Addstaff/Addstaffview.dart
Normal file
@@ -0,0 +1,477 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../Controller/More/Staffs/Addstaff/Addstaffcontroller.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/custombutton.dart';
|
||||
import '../../../../Helper/customederaction.dart';
|
||||
|
||||
class AddStaffView extends StatelessWidget {
|
||||
final bool location;
|
||||
|
||||
AddStaffView({super.key, required this.location});
|
||||
|
||||
AddStaffController addStaffController = Get.put(AddStaffController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0.5,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConstants.secondaryColor,
|
||||
size: 28,
|
||||
)),
|
||||
titleSpacing: 1,
|
||||
title: Text('Add Staff',style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: Container(
|
||||
child: ListView(
|
||||
children: [
|
||||
GetBuilder<AddStaffController>(
|
||||
initState: (_){
|
||||
addStaffController.getLocation();
|
||||
},
|
||||
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0, right: 10.0, top: 10, bottom: 70),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
firstName(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
lastName(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
||||
Container(
|
||||
child: contactNo(context),
|
||||
height: 55,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
email(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
height: 110,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(7),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Text(
|
||||
addStaffController.isLocation.isTrue ?'Selected Location :':"Selected Location :",
|
||||
style: TextStyle(fontSize: 18, color: Colors.grey[500]),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
addStaffController.isLocation.value == true
|
||||
? Container(
|
||||
height: 45,
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
color: Colors.white
|
||||
),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
// width: 150,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 45,
|
||||
|
||||
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.store,
|
||||
color: ColorConstants.secondaryColor,
|
||||
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Container(width: 1,color: Colors.white,),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(controller.locationName??'',
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.white,
|
||||
height: 0.9,
|
||||
fontWeight: FontWeight.bold
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
:
|
||||
Expanded(
|
||||
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.only(left: 0),
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: addStaffController.tenantLocation?.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 5.0, top: 10,bottom: 12,right: 10),
|
||||
child: GetX<AddStaffController>(
|
||||
|
||||
builder: (controller) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.locationId.value = controller.tenantLocation?[index].locationid??0;
|
||||
controller.locationAddress = controller.tenantLocation?[index].locationaddress??'';
|
||||
controller.locationSuburb = controller.tenantLocation?[index].locationsuburb??'';
|
||||
controller.locationCity = controller.tenantLocation?[index].locationcity??'';
|
||||
controller.locationState = controller.tenantLocation?[index].locationstate??'';
|
||||
controller.locationPostcode = controller.tenantLocation?[index].locationpostcode??'';
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
print('locationAddressonTap${controller.locationAddress}');
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: controller.locationId.value == controller.tenantLocation?[index].locationid
|
||||
? ColorConstants.primaryColor
|
||||
: Colors.white,
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
color: controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? Colors.white
|
||||
: Colors.grey[300]!),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.store,
|
||||
color: controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? ColorConstants.secondaryColor
|
||||
: Colors.grey[400],
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
|
||||
// height: 5,
|
||||
),
|
||||
SizedBox(
|
||||
width: 1,
|
||||
child: Container(color:
|
||||
controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid? Colors.white:Colors.grey[300],),
|
||||
// height: 5,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
|
||||
// height: 5,
|
||||
),
|
||||
Text( controller.tenantLocation?[index].locationname??'',
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color:controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid? Colors.white: Colors.grey[600],
|
||||
height: 0.9,
|
||||
fontWeight:
|
||||
controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? FontWeight.bold
|
||||
: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
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: () {
|
||||
addStaffController.describeValidation();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Create',
|
||||
controller: addStaffController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
String? validateEmail(String? value) {
|
||||
const pattern = r"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'"
|
||||
r'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-'
|
||||
r'\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*'
|
||||
r'[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4]'
|
||||
r'[0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9]'
|
||||
r'[0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\'
|
||||
r'x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])';
|
||||
final regex = RegExp(pattern);
|
||||
|
||||
return value!.isNotEmpty && !regex.hasMatch(value)
|
||||
? 'Enter a valid email address'
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
Widget firstName(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'First Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addStaffController.nameController,
|
||||
// focusNode: aadharNoNode,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget lastName(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Last Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addStaffController.lastNameController,
|
||||
// focusNode: aadharNoNode,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactNo(context) {
|
||||
return TextFormField(
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
maxLength: 10,
|
||||
controller: addStaffController.phoneNoController,
|
||||
buildCounter: (BuildContext context,
|
||||
{int? currentLength, int? maxLength, bool? isFocused}) =>
|
||||
null,
|
||||
onChanged: (contactNo){
|
||||
if(contactNo.length==10){
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Contact no',
|
||||
labelStyle: TextStyle(color: Colors.grey),
|
||||
prefixIcon:Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * 0.2,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(flex: 1,),
|
||||
Flexible(
|
||||
child: Icon(
|
||||
Icons.phone_android_outlined,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 1,),
|
||||
Flexible(flex: 3,child: Text("+91",style: TextStyle(color: ColorConstants.primaryColor,fontWeight: FontWeight.bold))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget email(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: Form(
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
child: TextFormField(
|
||||
validator: validateEmail,
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Email',
|
||||
prefixIcon: Icon(
|
||||
Icons.mail_outline,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addStaffController.emailController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)}";
|
||||
}
|
||||
|
||||
563
lib/View/More/Staffs/Staffview.dart
Normal file
563
lib/View/More/Staffs/Staffview.dart
Normal file
@@ -0,0 +1,563 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../Controller/More/Staffs/Staffscontroller.dart';
|
||||
import '../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/utility.dart';
|
||||
import '../../Home/Homeview.dart';
|
||||
import '../Locations/Addlocation/Addlocationview.dart';
|
||||
import 'Addstaff/Addstaffview.dart';
|
||||
import 'Updatestaff/Updatestaffview.dart';
|
||||
|
||||
class StaffsView extends StatelessWidget {
|
||||
StaffsView({super.key});
|
||||
StaffsController staffsController = Get.put(StaffsController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Get.to(()=>HomeView(selectedIndex: 3));
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Image(
|
||||
image: AssetImage(AssetConstants.NearleAppbarIcon),
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
title: Text('Staffs',
|
||||
style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: mobileUserList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
height: 60,
|
||||
// width: Get.width * 0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
color: ColorConstants.primaryColor),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(
|
||||
builder: (context) => HomeView(
|
||||
selectedIndex: 0,
|
||||
)));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Home',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(() => AddStaffView(
|
||||
location: false,
|
||||
));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person_add,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Add User',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(HomeView(selectedIndex: 3));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.more_horiz,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'More',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget mobileUserList() {
|
||||
return GetBuilder<StaffsController>(initState: (_) {
|
||||
staffsController.shimmer = true;
|
||||
staffsController.getStaffs();
|
||||
}, builder: (controller) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10,
|
||||
),
|
||||
child:
|
||||
!controller.shimmer && controller.getStaff.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 users at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600], fontSize: 14),
|
||||
),
|
||||
],
|
||||
))
|
||||
: controller.shimmer
|
||||
? staffShimmer()
|
||||
:
|
||||
ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 80),
|
||||
itemCount: controller.getStaff.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: [BoxShadow(color: Colors.grey)],
|
||||
borderRadius: BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 120,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width*0.22,
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
UtilityPromotion.getLightColors(
|
||||
'${controller.getStaff[index].firstname?[0]}'.toString())
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// width: 55,
|
||||
// height: 60,
|
||||
child: CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 30,
|
||||
child: Text(
|
||||
"${controller.getStaff[index].firstname?[0].toString().toUpperCase()}",
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 26,
|
||||
right: 12,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(UpdateStaff(staffData:controller.getStaff[index]));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
shape: BoxShape.circle,
|
||||
// borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 6,
|
||||
horizontal: 6),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// SizedBox(
|
||||
// height: 4,
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${controller.getStaff[index].firstname}",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight:
|
||||
FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
// users[index]['Roleid']==1?
|
||||
// Icon(
|
||||
// Icons
|
||||
// .admin_panel_settings_outlined,
|
||||
// color:
|
||||
// ColorConstants.primaryColor,
|
||||
// size: 20,
|
||||
// )
|
||||
// : users[index]['Roleid']==2?Icon(Icons.phone_android,color:ColorConstants.primaryColor,size:20,):
|
||||
// Icon(Icons.laptop_windows,color:ColorConstants.primaryColor,size:20,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'+91 ${controller.getStaff[index].contactno}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 30,
|
||||
padding: EdgeInsets.only(right: 10,),
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
border: Border.all(
|
||||
color: ColorConstants.primaryColor)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10),
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white),
|
||||
child: Icon(
|
||||
Icons.business,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'${controller.getStaff[index].locationname}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.white,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
staffShimmer() {
|
||||
return Shimmer.fromColors(
|
||||
enabled: true,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 60, top: 10),
|
||||
itemCount: 4,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey[400]!, width: 2),
|
||||
borderRadius: BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 90,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 55,
|
||||
height: 55,
|
||||
child: CircleAvatar(
|
||||
backgroundColor:
|
||||
ColorConstants.secondaryColor,
|
||||
child: Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.secondaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
"--------------",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
// flex: 5,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.store,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
// '',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
);
|
||||
}
|
||||
}
|
||||
478
lib/View/More/Staffs/Updatestaff/Updatestaffview.dart
Normal file
478
lib/View/More/Staffs/Updatestaff/Updatestaffview.dart
Normal file
@@ -0,0 +1,478 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../Controller/More/Staffs/Updatestaff/Updatestaffcontroller.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/custombutton.dart';
|
||||
import '../../../../Helper/customederaction.dart';
|
||||
import '../../../../Model/Response/Staffs/Getstaffsresponse.dart';
|
||||
import '../../../Home/Homeview.dart';
|
||||
|
||||
class UpdateStaff extends StatelessWidget {
|
||||
final StaffDetails staffData;
|
||||
UpdateStaff({super.key, required this.staffData});
|
||||
UpdateStaffController updateStaffController = Get.put(UpdateStaffController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0.5,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConstants.secondaryColor,
|
||||
size: 28,
|
||||
)),
|
||||
titleSpacing: 1,
|
||||
title: Text('Update Staff',style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: Container(
|
||||
child: ListView(
|
||||
children: [
|
||||
GetBuilder<UpdateStaffController>(
|
||||
initState: (_){
|
||||
updateStaffController.staffData = staffData;
|
||||
updateStaffController.setValues();
|
||||
updateStaffController.getLocation();
|
||||
},
|
||||
|
||||
builder: (controller) {
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0, right: 10.0, top: 10, bottom: 70),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
firstName(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
lastName(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
|
||||
Container(
|
||||
child: contactNo(context),
|
||||
height: 55,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
email(context),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
height: 110,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(7),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Text(
|
||||
updateStaffController.isLocation.isTrue ?'Selected Location :':"Selected Location :",
|
||||
style: TextStyle(fontSize: 18, color: Colors.grey[500]),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
updateStaffController.isLocation.value == true
|
||||
? Container(
|
||||
height: 45,
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
color: Colors.white
|
||||
),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
// width: 150,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 45,
|
||||
|
||||
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.store,
|
||||
color: ColorConstants.secondaryColor,
|
||||
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Container(width: 1,color: Colors.white,),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(controller.locationName??'',
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.white,
|
||||
height: 0.9,
|
||||
fontWeight: FontWeight.bold
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
:
|
||||
Expanded(
|
||||
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.only(left: 0),
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: updateStaffController.tenantLocation?.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 5.0, top: 10,bottom: 12,right: 10),
|
||||
child: GetX<UpdateStaffController>(
|
||||
|
||||
builder: (controller) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.locationId.value = controller.tenantLocation?[index].locationid??0;
|
||||
controller.locationAddress = controller.tenantLocation?[index].locationaddress??'';
|
||||
controller.locationSuburb = controller.tenantLocation?[index].locationsuburb??'';
|
||||
controller.locationCity = controller.tenantLocation?[index].locationcity??'';
|
||||
controller.locationState = controller.tenantLocation?[index].locationstate??'';
|
||||
controller.locationPostcode = controller.tenantLocation?[index].locationpostcode??'';
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
print('locationAddressonTap${controller.locationAddress}');
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: controller.locationId.value == controller.tenantLocation?[index].locationid
|
||||
? ColorConstants.primaryColor
|
||||
: Colors.white,
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
color: controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? Colors.white
|
||||
: Colors.grey[300]!),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.store,
|
||||
color: controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? ColorConstants.secondaryColor
|
||||
: Colors.grey[400],
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
|
||||
// height: 5,
|
||||
),
|
||||
SizedBox(
|
||||
width: 1,
|
||||
child: Container(color:
|
||||
controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid? Colors.white:Colors.grey[300],),
|
||||
// height: 5,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
|
||||
// height: 5,
|
||||
),
|
||||
Text( controller.tenantLocation?[index].locationname??'',
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color:controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid? Colors.white: Colors.grey[600],
|
||||
height: 0.9,
|
||||
fontWeight:
|
||||
controller.locationId.value ==
|
||||
controller.tenantLocation?[index].locationid
|
||||
? FontWeight.bold
|
||||
: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
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: () {
|
||||
updateStaffController.describeValidation();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Update',
|
||||
controller: updateStaffController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget firstName(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'First Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: updateStaffController.nameController,
|
||||
// focusNode: aadharNoNode,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget lastName(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Last Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: updateStaffController.lastNameController,
|
||||
// focusNode: aadharNoNode,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactNo(context) {
|
||||
return TextFormField(
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
maxLength: 10,
|
||||
controller: updateStaffController.phoneNoController,
|
||||
buildCounter: (BuildContext context,
|
||||
{int? currentLength, int? maxLength, bool? isFocused}) =>
|
||||
null,
|
||||
onChanged: (contactNo) {
|
||||
if (contactNo.length == 10) {
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Contact no',
|
||||
labelStyle: TextStyle(color: Colors.grey),
|
||||
prefixIcon:Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * 0.2,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(flex: 1,),
|
||||
Flexible(
|
||||
child: Icon(
|
||||
Icons.phone_android_outlined,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 1,),
|
||||
Flexible(flex: 3,child: Text("+91",style: TextStyle(color: ColorConstants.primaryColor,fontWeight: FontWeight.bold))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(220, 220, 220, 0.6),
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(7.0),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget email(context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: Form(
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
child: TextFormField(
|
||||
validator: validateEmail,
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Email',
|
||||
prefixIcon: Icon(
|
||||
Icons.mail_outline,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: updateStaffController.emailController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String? validateEmail(String? value) {
|
||||
const pattern = r"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'"
|
||||
r'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-'
|
||||
r'\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*'
|
||||
r'[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4]'
|
||||
r'[0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9]'
|
||||
r'[0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\'
|
||||
r'x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])';
|
||||
final regex = RegExp(pattern);
|
||||
|
||||
return value!.isNotEmpty && !regex.hasMatch(value)
|
||||
? 'Enter a valid email address'
|
||||
: null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)}";
|
||||
}
|
||||
951
lib/View/Orders/Deliverydetails/Deliverydetailsview.dart
Normal file
951
lib/View/Orders/Deliverydetails/Deliverydetailsview.dart
Normal file
@@ -0,0 +1,951 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../../Controller/map_controller.dart';
|
||||
import '../../../Globalwidgets/textwidget.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/utility.dart';
|
||||
import '../../../Model/Response/Summary/Getsummarysresponse.dart';
|
||||
|
||||
|
||||
|
||||
class MapWithBottomSheetPage extends StatelessWidget {
|
||||
|
||||
final DeliveriesDetails data;
|
||||
|
||||
MapWithBottomSheetPage({super.key, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
MapWithPolylines(
|
||||
endLatLng: LatLng(
|
||||
double.tryParse(data.deliverylat ?? '') ?? 0.0,
|
||||
double.tryParse(data.deliverylong ?? '') ?? 0.0,
|
||||
),
|
||||
startLatLng: LatLng(
|
||||
double.tryParse(data.pickuplat ?? '') ?? 0.0,
|
||||
double.tryParse(data.pickuplon ?? '') ?? 0.0,
|
||||
),
|
||||
),
|
||||
DraggableScrollableSheet(
|
||||
initialChildSize: 0.22,
|
||||
minChildSize: 0.12,
|
||||
maxChildSize: 0.65,
|
||||
builder: (context, scrollController) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(18)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
radius: 30,
|
||||
child: TextWidget(
|
||||
text: data.ridername?[0] ?? '',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
data.ridername ?? '',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
),
|
||||
Text("Order ID: ${data.orderid}"),
|
||||
Text("Status: ${data.orderstatus}", style: TextStyle(color: Colors.green)),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.phone, color: ColorConstants.primaryColor),
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Divider(),
|
||||
ListTile(
|
||||
title: Text("Pickup Location"),
|
||||
subtitle: Text(data.pickupaddress ?? ''),
|
||||
leading: Icon(Icons.location_on, color: Colors.red),
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
ListTile(
|
||||
title: Text("Drop-off Location"),
|
||||
subtitle: Text(data.deliveryaddress ?? ''),
|
||||
leading: Icon(Icons.flag, color: Colors.green),
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
TextWidget(
|
||||
text: 'Order Details',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
Row(
|
||||
children: [
|
||||
TextWidget(
|
||||
text: 'Delivery Charges',
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Spacer(),
|
||||
TextWidget(
|
||||
text: data.deliverycharges.toString(),
|
||||
fontWeight: FontWeight.w700,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
Row(
|
||||
children: [
|
||||
TextWidget(
|
||||
text: 'Total Amount',
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Spacer(),
|
||||
TextWidget(
|
||||
text: data.deliveryamt.toString(),
|
||||
fontWeight: FontWeight.w700,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
TextWidget(
|
||||
text: 'Payment Details',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
Row(
|
||||
children: [
|
||||
TextWidget(
|
||||
text: data.deliverycustomer ?? '',
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Spacer(),
|
||||
TextWidget(
|
||||
text: data.deliverycontactno.toString(),
|
||||
fontWeight: FontWeight.w700,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
TextWidget(
|
||||
text: 'Payment method',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
TextWidget(
|
||||
text: 'Cash on delivery',
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// class SummaryDetailsView extends StatelessWidget {
|
||||
// final DeliveriesDetails data;
|
||||
//
|
||||
// const SummaryDetailsView({super.key, required this.data});
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: _buildAppBar(),
|
||||
// backgroundColor: Colors.grey[100],
|
||||
// body: _buildBody(context),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// /// Builds the app bar with a back button and title.
|
||||
// AppBar _buildAppBar() {
|
||||
// return AppBar(
|
||||
// leading: InkWell(
|
||||
// onTap: Get.back,
|
||||
// child: Icon(
|
||||
// Icons.arrow_back,
|
||||
// color: ColorConstants.blackColor,
|
||||
// size: 28,
|
||||
// ),
|
||||
// ),
|
||||
// title: TextWidget(
|
||||
// text: 'Delivery Details',
|
||||
// fontSize: 20,
|
||||
// fontWeight: FontWeight.w700,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// /// Builds the scrollable body with delivery details and map.
|
||||
// Widget _buildBody(BuildContext context) {
|
||||
// return SingleChildScrollView(
|
||||
// padding: const EdgeInsets.all(0.0),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 0,right: 0),
|
||||
// child: SizedBox(
|
||||
// height: Get.height * 0.60,
|
||||
// child: MapWithPolylines(
|
||||
// endLatLng: LatLng(
|
||||
// double.tryParse(data.deliverylat ?? '') ?? 0.0,
|
||||
// double.tryParse(data.deliverylong ?? '') ?? 0.0,
|
||||
// ),
|
||||
// startLatLng: LatLng(
|
||||
// double.tryParse(data.pickuplat ?? '') ?? 0.0,
|
||||
// double.tryParse(data.pickuplon ?? '') ?? 0.0,
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 10),
|
||||
// DeliveryCard(data: data, isFromSummary: true,),
|
||||
// const SizedBox(height: 20,)
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
/// A reusable card widget displaying delivery header information (date, tenant, order).
|
||||
class DeliveryHeaderCard extends StatelessWidget {
|
||||
final DeliveriesDetails data;
|
||||
|
||||
const DeliveryHeaderCard({super.key, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: ColorConstants.secondaryColor,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 5),
|
||||
height: 95,
|
||||
child: Row(
|
||||
children: [
|
||||
_buildDateSection(),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
IconTextRow(
|
||||
icon: Icons.person,
|
||||
text: data.tenantname ?? '',
|
||||
textStyle: _textStyle(15, Colors.grey[500]),
|
||||
),
|
||||
IconTextRow(
|
||||
icon: Icons.receipt,
|
||||
text: data.orderid ?? '',
|
||||
textStyle: _textStyle(13, Colors.black54),
|
||||
),
|
||||
IconTextRow(
|
||||
icon: Icons.phone,
|
||||
text: data.tenantcontactno ?? '',
|
||||
textStyle: _textStyle(13, Colors.black54),
|
||||
onTap: () => _launchPhone(data.tenantcontactno),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds the date section with day, month, and time.
|
||||
Widget _buildDateSection() {
|
||||
final date = DateFormat("yyyy-MM-dd", "en_US").parse(data.deliverydate ?? DateTime.now().toString());
|
||||
return Container(
|
||||
width: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor1,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("dd").format(date),
|
||||
style: _textStyle(14, Colors.grey[700]),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
DateFormat("MMM").format(date),
|
||||
style: _textStyle(14, Colors.grey[700], height: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
DateFormat("hh.mm a").format(date),
|
||||
style: _textStyle(11, Colors.grey[700]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Helper method to create consistent text styles.
|
||||
TextStyle _textStyle(double fontSize, Color? color, {double? height}) {
|
||||
return TextStyle(
|
||||
fontSize: fontSize,
|
||||
color: color,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: height,
|
||||
);
|
||||
}
|
||||
|
||||
/// Launches phone dialer with the provided number.
|
||||
void _launchPhone(String? number) {
|
||||
if (number != null && number.isNotEmpty) {
|
||||
launch('tel://$number');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A reusable card widget for displaying pickup or delivery location details.
|
||||
class DeliveryLocationCard extends StatelessWidget {
|
||||
final String title;
|
||||
final String address;
|
||||
final String contact;
|
||||
final double lat;
|
||||
final double lon;
|
||||
final Color iconColor;
|
||||
final bool isPickup;
|
||||
|
||||
const DeliveryLocationCard({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.address,
|
||||
required this.contact,
|
||||
required this.lat,
|
||||
required this.lon,
|
||||
required this.iconColor,
|
||||
required this.isPickup,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: Colors.red[100]!.withAlpha(100),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(13)),
|
||||
child: SizedBox(
|
||||
height: 150,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
_buildMarkerIcon(),
|
||||
const Spacer(),
|
||||
_buildNavigationIcon(),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 14,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
IconTextRow(
|
||||
icon: isPickup ? Icons.business : Icons.person,
|
||||
text: title,
|
||||
textStyle: const TextStyle(color: Colors.black87, fontSize: 15),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
IconTextRow(
|
||||
icon: Icons.location_on_rounded,
|
||||
text: address,
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 13,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
IconTextRow(
|
||||
icon: Icons.phone,
|
||||
text: contact,
|
||||
textStyle: const TextStyle(color: Colors.black87, fontSize: 13),
|
||||
onTap: () => Utility.openPhoneCallApp(contact),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds the marker icon for the location.
|
||||
Widget _buildMarkerIcon() {
|
||||
return Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.mapMarkerAlt,
|
||||
size: 22,
|
||||
color: iconColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds the navigation icon with a tap action to open the map.
|
||||
Widget _buildNavigationIcon() {
|
||||
return InkWell(
|
||||
onTap: () => Utility.openMap(lat, lon),
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.assistant_direction_rounded,
|
||||
size: 30,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A reusable widget for displaying an icon and text with an optional tap action.
|
||||
class IconTextRow extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final TextStyle textStyle;
|
||||
final int? maxLines;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const IconTextRow({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.textStyle,
|
||||
this.maxLines,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 14, color: Colors.black38),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
text,
|
||||
style: textStyle,
|
||||
maxLines: maxLines,
|
||||
overflow: maxLines != null ? TextOverflow.ellipsis : null,
|
||||
),
|
||||
),
|
||||
if (maxLines != null) const SizedBox(width: 5),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Map with polyLines
|
||||
class MapWithPolylines extends StatelessWidget {
|
||||
final LatLng startLatLng;
|
||||
final LatLng endLatLng;
|
||||
|
||||
MapWithPolylines({
|
||||
required this.startLatLng,
|
||||
required this.endLatLng,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final mapController = Get.put(MapController());
|
||||
|
||||
Set<Polyline> _createPolylines() {
|
||||
return {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route1'),
|
||||
visible: true,
|
||||
points: [startLatLng, endLatLng],
|
||||
color: Colors.blue,
|
||||
width: 5,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() => GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: startLatLng,
|
||||
zoom: mapController.zoom.value,
|
||||
),
|
||||
polylines: _createPolylines(),
|
||||
markers: {
|
||||
Marker(markerId: const MarkerId("start"), position: startLatLng),
|
||||
Marker(markerId: const MarkerId("end"), position: endLatLng),
|
||||
},
|
||||
onMapCreated: (controller) {
|
||||
mapController.setController(controller);
|
||||
},
|
||||
)),
|
||||
Positioned(
|
||||
top: 20,
|
||||
right: 10,
|
||||
child: Column(
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
mini: true,
|
||||
backgroundColor: Colors.white,
|
||||
onPressed: mapController.zoomIn,
|
||||
child: const Icon(Icons.add, color: Colors.black),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
FloatingActionButton(
|
||||
mini: true,
|
||||
backgroundColor: Colors.white,
|
||||
onPressed: mapController.zoomOut,
|
||||
child: const Icon(Icons.remove, color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 20,
|
||||
left: 10,
|
||||
child: FloatingActionButton(
|
||||
mini: true,
|
||||
backgroundColor: Colors.white,
|
||||
child: Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DeliveryInfoCard extends StatelessWidget {
|
||||
final String deliveryDate;
|
||||
final String tenantName;
|
||||
final String orderId;
|
||||
final String contactNumber;
|
||||
final VoidCallback onPhoneTap;
|
||||
final Color primaryColor;
|
||||
|
||||
const DeliveryInfoCard({
|
||||
super.key,
|
||||
required this.deliveryDate,
|
||||
required this.tenantName,
|
||||
required this.orderId,
|
||||
required this.contactNumber,
|
||||
required this.onPhoneTap,
|
||||
required this.primaryColor,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final date = DateFormat("yyyy-MM-dd").parse(deliveryDate);
|
||||
final dateTime = DateFormat("yyyy-MM-ddTHH:mm:ss").parse(deliveryDate);
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
blurRadius: 6,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: Row(
|
||||
children: [
|
||||
/// LEFT SIDE: DATE
|
||||
Container(
|
||||
width: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
bottomLeft: Radius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
DateFormat("dd").format(date),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
DateFormat("MMM").format(date),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
DateFormat("hh:mm a").format(dateTime),
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 12),
|
||||
|
||||
/// RIGHT SIDE: DETAILS
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildIconText(Icons.person, tenantName, 15),
|
||||
_buildIconText(Icons.receipt, orderId, 13),
|
||||
InkWell(
|
||||
onTap: onPhoneTap,
|
||||
child: _buildIconText(Icons.phone, contactNumber, 13, isLink: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIconText(IconData icon, String text, double fontSize, {bool isLink = false}) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, color: Colors.black45, size: 18),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
color: isLink ? Colors.blue : Colors.black87,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: isLink ? TextDecoration.underline : TextDecoration.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DeliveryCard extends StatelessWidget {
|
||||
final dynamic data;
|
||||
final bool isFromSummary;
|
||||
|
||||
const DeliveryCard({super.key, required this.data, this.isFromSummary = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(12),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
elevation: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/// Timeline: Pickup icon, dotted line, Drop icon
|
||||
SizedBox(
|
||||
height: 190, // <-- match the combined height of your content
|
||||
child: Column(
|
||||
children: [
|
||||
_circleIcon(FontAwesomeIcons.mapMarkerAlt as IconData, isFromSummary ? Colors.red : Colors.green),
|
||||
Expanded(child: _verticalDottedLine()),
|
||||
_circleIcon((isFromSummary ? FontAwesomeIcons.checkCircle : FontAwesomeIcons.mapMarkerAlt) as IconData, isFromSummary ? Colors.green : Colors.red),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
/// Content Block
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoBlock(
|
||||
label: "Pickup",
|
||||
name: data?.pickupcustomer ?? '',
|
||||
address: data?.pickupaddress ?? '',
|
||||
contact: data?.pickupcontactno ?? '',
|
||||
lat: data?.pickuplat,
|
||||
lon: data?.pickuplon,
|
||||
isPickup: true,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildInfoBlock(
|
||||
label: isFromSummary ? "Delivered" : "Drop",
|
||||
name: data?.deliverycustomer ?? '',
|
||||
address: data?.deliveryaddress ?? '',
|
||||
contact: data?.deliverycontactno ?? '',
|
||||
lat: data?.droplat,
|
||||
lon: data?.droplon,
|
||||
isPickup: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _circleIcon(IconData icon, Color color) {
|
||||
return Container(
|
||||
height: 38,
|
||||
width: 38,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 3)],
|
||||
),
|
||||
child: FaIcon(icon as FaIconData?, color: color, size: 20),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _verticalDottedLine({double height = 60}) {
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: List.generate(
|
||||
(height ~/ 6),
|
||||
(index) => Container(
|
||||
width: 1,
|
||||
height: 4,
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoBlock({
|
||||
required String label,
|
||||
required String name,
|
||||
required String address,
|
||||
required String contact,
|
||||
required String? lat,
|
||||
required String? lon,
|
||||
required bool isPickup,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_infoRow(Icons.person, name),
|
||||
const SizedBox(height: 4),
|
||||
_infoRow(Icons.location_on, address, maxLines: 2),
|
||||
const SizedBox(height: 4),
|
||||
InkWell(
|
||||
onTap: () => Utility.openPhoneCallApp(contact),
|
||||
child: _infoRow(Icons.phone, contact),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Utility.openMap(
|
||||
double.tryParse(lat ?? '0') ?? 0,
|
||||
double.tryParse(lon ?? '0') ?? 0,
|
||||
);
|
||||
},
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.assistant_direction_rounded,
|
||||
color: ColorConstants.primaryColor, size: 20),
|
||||
SizedBox(width: 6),
|
||||
Text(
|
||||
"Navigate",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _infoRow(IconData icon, String text, {int maxLines = 1}) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(icon, size: 16, color: Colors.black45),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
maxLines: maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
431
lib/View/Orders/Deliverydetails/delivery_detail_view.dart
Normal file
431
lib/View/Orders/Deliverydetails/delivery_detail_view.dart
Normal file
@@ -0,0 +1,431 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../Globalwidgets/textwidget.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Model/Response/Summary/Getsummarysresponse.dart';
|
||||
import '../../../Model/Response/products/product_info.dart';
|
||||
import '../orderDetails.dart';
|
||||
|
||||
class OrderDetailsPage extends StatelessWidget {
|
||||
final DeliveriesDetails orderDetails;
|
||||
final List<ProductDetails> productDetails;
|
||||
|
||||
const OrderDetailsPage({
|
||||
super.key,
|
||||
required this.productDetails,
|
||||
required this.orderDetails,
|
||||
});
|
||||
|
||||
// to replace "null" with empty text
|
||||
String safe(String? v) {
|
||||
if (v == null || v == "null") return "";
|
||||
return v;
|
||||
}
|
||||
|
||||
// to avoid crash when parsing date
|
||||
DateTime safeParseDate(String? date) {
|
||||
if (date == null || date.isEmpty || date == "null") {
|
||||
return DateTime.now();
|
||||
}
|
||||
try {
|
||||
return DateTime.parse(date);
|
||||
} catch (e) {
|
||||
print("Invalid date received: $date");
|
||||
return DateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
bool isValidLatLng(double lat, double lng) {
|
||||
return lat != 0.0 && lng != 0.0;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double totalAmount = 0;
|
||||
double totalTax = 0;
|
||||
|
||||
for (var product in productDetails) {
|
||||
totalAmount += product.productsumprice ?? 0.0;
|
||||
totalTax += product.taxamount ?? 0.0;
|
||||
}
|
||||
|
||||
final totalWithTax = totalAmount + totalTax;
|
||||
|
||||
final DateTime dateTime = safeParseDate(orderDetails.deliverydate);
|
||||
final String formattedDate = DateFormat('dd-MM-yy').format(dateTime);
|
||||
final String formattedTime = DateFormat('hh:mm a').format(dateTime);
|
||||
|
||||
final pickupLat = double.tryParse(safe(orderDetails.pickuplat)) ?? 0.0;
|
||||
final pickupLng = double.tryParse(safe(orderDetails.pickuplon)) ?? 0.0;
|
||||
final deliveryLat = double.tryParse(safe(orderDetails.deliverylat)) ?? 0.0;
|
||||
final deliveryLng = double.tryParse(safe(orderDetails.deliverylong)) ?? 0.0;
|
||||
|
||||
final bool showMap = isValidLatLng(pickupLat, pickupLng) &&
|
||||
isValidLatLng(deliveryLat, deliveryLng);
|
||||
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: true,
|
||||
title: TextWidget(
|
||||
text: 'Order Details',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConstants.blackColor,
|
||||
)),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_sectionCard(
|
||||
icon: Icons.receipt_long,
|
||||
title: "Order Info",
|
||||
children: [
|
||||
_infoRow("Order ID", safe(orderDetails.orderid)),
|
||||
_infoRow("Date", formattedDate),
|
||||
_infoRow("Time", formattedTime),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_sectionCard(
|
||||
icon: Icons.shopping_cart,
|
||||
title: "Products",
|
||||
children: [
|
||||
...productDetails.map((product) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${safe(product.productname)} x${product.orderqty}")),
|
||||
Text(
|
||||
"₹${((product.price ?? 0) * (product.orderqty ?? 0)).toStringAsFixed(0)}",
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const Divider(height: 24),
|
||||
_infoRow("Amount", "₹${totalAmount.toStringAsFixed(2)}",
|
||||
isForProducts: true),
|
||||
_infoRow("Tax", "₹${totalTax.toStringAsFixed(2)}",
|
||||
isForProducts: true),
|
||||
_infoRow("Total", "₹${totalWithTax.toStringAsFixed(2)}",
|
||||
isForProducts: true),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_sectionCard(
|
||||
icon: Icons.person,
|
||||
title: "Customer",
|
||||
children: [
|
||||
_infoRow("Name", safe(orderDetails.deliverycustomer)),
|
||||
_infoRow("Address", safe(orderDetails.deliveryaddress)),
|
||||
_infoRow("Phone", safe(orderDetails.deliverycontactno)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Visibility(
|
||||
visible: safe(orderDetails.ridername).isNotEmpty,
|
||||
child: _sectionCard(
|
||||
icon: Icons.delivery_dining,
|
||||
title: "Rider",
|
||||
children: [
|
||||
_infoRow("Name", safe(orderDetails.ridername)),
|
||||
_infoRow("Phone", safe(orderDetails.ridercontact)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: OrderStatusTimeline(
|
||||
stages: [
|
||||
Stage(
|
||||
label: "Accepted",
|
||||
icon: Icons.check,
|
||||
completed: safe(orderDetails.starttime).isNotEmpty,
|
||||
time: convertTo12HourFormat(safe(orderDetails.starttime)),
|
||||
),
|
||||
Stage(
|
||||
label: "Arrived",
|
||||
icon: Icons.location_on,
|
||||
completed: safe(orderDetails.arrivaltime).isNotEmpty,
|
||||
time: convertTo12HourFormat(safe(orderDetails.arrivaltime)),
|
||||
),
|
||||
Stage(
|
||||
label: "Picked",
|
||||
icon: Icons.shopping_bag,
|
||||
completed: safe(orderDetails.pickuptime).isNotEmpty,
|
||||
time: convertTo12HourFormat(safe(orderDetails.pickuptime)),
|
||||
),
|
||||
Stage(
|
||||
label: "Delivered",
|
||||
icon: Icons.delivery_dining,
|
||||
completed: safe(orderDetails.deliverytime).isNotEmpty,
|
||||
time: convertTo12HourFormat(safe(orderDetails.deliverytime)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Only show map if lat/lng are valid (not 0.0)
|
||||
if (showMap)
|
||||
SizedBox(
|
||||
height: 300,
|
||||
child: MapWithPolyLines(
|
||||
startLatLng: LatLng(pickupLat, pickupLng),
|
||||
endLatLng: LatLng(deliveryLat, deliveryLng),
|
||||
),
|
||||
)
|
||||
else
|
||||
Container(
|
||||
height: 80,
|
||||
alignment: Alignment.center,
|
||||
child: Text("Map not available"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _sectionCard({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
String? Amount,
|
||||
String? TaxAmount,
|
||||
String? Total,
|
||||
required List<Widget> children,
|
||||
}) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: ColorConstants.primaryColor),
|
||||
const SizedBox(width: 8),
|
||||
Text(title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 16)),
|
||||
],
|
||||
),
|
||||
const Divider(),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _infoRow(String label, String value, {bool? isForProducts}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(color: Colors.black54),
|
||||
),
|
||||
),
|
||||
(isForProducts ?? false) ? Spacer() : const SizedBox(width: 8),
|
||||
(isForProducts ?? false)
|
||||
? Text(
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
: Expanded(
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showBottomSheet(BuildContext context, {required VoidCallback onAccept}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16.0)),
|
||||
),
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 5,
|
||||
margin: EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Text(
|
||||
'Confirm Order',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Text(
|
||||
'Accept this order and assign a rider?',
|
||||
style: TextStyle(fontSize: 16),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 24.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.black,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: TextWidget(text: 'Cancel'),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.0),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
onAccept();
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: TextWidget(
|
||||
text: 'Accept',
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────
|
||||
// MAP WITH POLYLINES — SAFE (NO CRASH)
|
||||
// ──────────────────────────────────────────────────────────
|
||||
|
||||
class MapWithPolyLines extends StatelessWidget {
|
||||
final LatLng startLatLng;
|
||||
final LatLng endLatLng;
|
||||
|
||||
const MapWithPolyLines({
|
||||
super.key,
|
||||
required this.startLatLng,
|
||||
required this.endLatLng,
|
||||
});
|
||||
|
||||
Set<Polyline> _createPolylines() {
|
||||
final polylineCoordinates = [
|
||||
startLatLng,
|
||||
endLatLng,
|
||||
];
|
||||
|
||||
return {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route1'),
|
||||
visible: true,
|
||||
points: polylineCoordinates,
|
||||
color: Colors.blue,
|
||||
width: 5,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: startLatLng,
|
||||
zoom: 13.0,
|
||||
),
|
||||
onMapCreated: (GoogleMapController controller) {},
|
||||
polylines: _createPolylines(),
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: const MarkerId("start"),
|
||||
position: startLatLng,
|
||||
),
|
||||
Marker(
|
||||
markerId: const MarkerId("end"),
|
||||
position: endLatLng,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
330
lib/View/Orders/Orderspage.dart
Normal file
330
lib/View/Orders/Orderspage.dart
Normal file
@@ -0,0 +1,330 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.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 '../../Model/Response/products/product_response.dart';
|
||||
import '../Dashboard/Dashboardview.dart';
|
||||
|
||||
class ProductView extends StatelessWidget {
|
||||
ProductView({super.key});
|
||||
|
||||
final ProductController controller = Get.put(ProductController());
|
||||
final FocusNode searchFocusNode = FocusNode();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<ProductController>(
|
||||
initState: (_) {
|
||||
controller.getProducts();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||
return SizeTransition(
|
||||
sizeFactor: animation,
|
||||
axis: Axis.horizontal,
|
||||
child: FadeTransition(opacity: animation, child: child),
|
||||
);
|
||||
},
|
||||
child: controller.isSearchModeEnable.value
|
||||
? TextField(
|
||||
key: const ValueKey('searchField'),
|
||||
focusNode: searchFocusNode,
|
||||
controller: controller.productSearchController,
|
||||
cursorColor: ColorConstants.primaryColor,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Search Products',
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.white, width: 2),
|
||||
),
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
|
||||
// 🔥 FIXED HERE — USE LOCAL SEARCH
|
||||
onChanged: (value) {
|
||||
controller.applySearch(value);
|
||||
},
|
||||
|
||||
autofocus: true,
|
||||
)
|
||||
: TextWidget(
|
||||
key: const ValueKey('titleText'),
|
||||
text: 'Products',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 12),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (controller.isSearchModeEnable.value) {
|
||||
controller.productSearchController.clear();
|
||||
searchFocusNode.unfocus();
|
||||
|
||||
// 🔥 FIXED HERE — RESTORE LIST
|
||||
controller.applySearch('');
|
||||
} else {
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
searchFocusNode.requestFocus();
|
||||
});
|
||||
}
|
||||
|
||||
controller.isSearchModeEnable.value =
|
||||
!controller.isSearchModeEnable.value;
|
||||
controller.update();
|
||||
},
|
||||
child: Icon(
|
||||
controller.isSearchModeEnable.value
|
||||
? Icons.cancel
|
||||
: Icons.search,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
body: Obx(() {
|
||||
if (controller.isProductLoading.value) {
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: ShimmerListView(height: 100),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (controller.product.isEmpty) {
|
||||
return emptyProductsWidget();
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
cacheExtent: 1000,
|
||||
itemCount: controller.product.length,
|
||||
itemBuilder: (context, index) {
|
||||
final product = controller.product[index];
|
||||
return ProductCard(
|
||||
key: ValueKey(product.productid),
|
||||
product: product,
|
||||
index: index,
|
||||
controller: controller,
|
||||
isLoading: controller.loadingIndices.contains(index),
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Product Card Widget
|
||||
class ProductCard extends StatelessWidget {
|
||||
final ProductData product;
|
||||
final int index;
|
||||
final ProductController controller;
|
||||
final bool isLoading;
|
||||
|
||||
const ProductCard({
|
||||
super.key,
|
||||
required this.product,
|
||||
required this.index,
|
||||
required this.controller,
|
||||
required this.isLoading,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isAvailable = product.status == 'Active';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
shadowColor: Colors.grey.shade100,
|
||||
color: Colors.white,
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 12, left: 10, right: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: product.productimage ?? '',
|
||||
width: 80,
|
||||
height: 80,
|
||||
fit: BoxFit.cover,
|
||||
memCacheHeight: 160,
|
||||
memCacheWidth: 160,
|
||||
maxHeightDiskCache: 160,
|
||||
maxWidthDiskCache: 160,
|
||||
placeholder: (context, url) => Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
color: Colors.grey.shade100,
|
||||
child: Icon(Icons.image,
|
||||
color: Colors.grey.shade400, size: 40),
|
||||
),
|
||||
errorWidget: (context, url, error) => Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
color: Colors.grey.shade100,
|
||||
child: Icon(Icons.broken_image_outlined,
|
||||
color: Colors.grey.shade400, size: 40),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: product.productname ?? 'Unknown',
|
||||
maxLines: 1,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: isAvailable
|
||||
? Colors.black87
|
||||
: Colors.grey.shade600,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.inventory_2_outlined,
|
||||
size: 16,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
"Qty: ${product.productstock ?? 0}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade700,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
product.productcost != null
|
||||
? '₹${product.productcost!.toStringAsFixed(2)}'
|
||||
: 'N/A',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade700,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: isAvailable
|
||||
? Colors.green.shade500
|
||||
: Colors.red.shade400,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
isAvailable ? "Active" : "Out of Stock",
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
AnimatedOpacity(
|
||||
opacity: isLoading ? 0.6 : 1.0,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Switch.adaptive(
|
||||
value: isAvailable,
|
||||
activeColor: Colors.green.shade500,
|
||||
inactiveThumbColor: Colors.grey.shade400,
|
||||
inactiveTrackColor: Colors.grey.shade200,
|
||||
onChanged: isLoading
|
||||
? null
|
||||
: (_) => controller.toggleAvailability(index),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget emptyProductsWidget() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Image.asset(
|
||||
AssetConstants.noProductsFound,
|
||||
height: 200,
|
||||
width: 200,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
TextWidget(
|
||||
text: 'No Products Found!',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextWidget(
|
||||
text: 'You haven’t added any products yet.',
|
||||
color: ColorConstants.blackColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
883
lib/View/Orders/Tabs/Month.dart
Normal file
883
lib/View/Orders/Tabs/Month.dart
Normal file
@@ -0,0 +1,883 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/Orders/Tabs/Monthcontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../Deliverydetails/Deliverydetailsview.dart';
|
||||
|
||||
class MonthOrderView extends StatelessWidget {
|
||||
MonthOrderView({super.key});
|
||||
MonthOrderController monthOrderController = Get.put(MonthOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MonthOrderController>(
|
||||
initState: (_){
|
||||
monthOrderController.shimmer.value = true;
|
||||
monthOrderController.getOrders();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, top: 5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5, right: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.94,
|
||||
child: TextField(
|
||||
// textAlign: TextAlign.center,
|
||||
controller: controller.searchController,
|
||||
// style: TextStyle(fontSize: 15),
|
||||
onChanged: (data) {
|
||||
controller.search(data);
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 10,
|
||||
right: 45,
|
||||
// left: 10
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
// suffixIcon: popUp(),
|
||||
hintText: 'Name'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child:monthOrderController.orderAllList.length == 0&& !monthOrderController.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 92,
|
||||
),
|
||||
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): ListView.builder(
|
||||
itemCount: controller.orderAllList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
// height: Get.height * 0.21,
|
||||
// width: Get.width * 0.9,
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
// Get.to(()=> DeliveryDetailsView(data: controller.orderAllList[index]));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
controller.orderAllList[index].deliverydate == "" ? Text(''):
|
||||
Text(
|
||||
'${DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
controller.orderAllList[index].deliverydate == "" ? Text(''):
|
||||
|
||||
Text(
|
||||
'${DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 7,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delivery_dining,
|
||||
size: 25,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
),
|
||||
controller.orderAllList[index].kms==null?Text(
|
||||
'0.0',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
):Text(
|
||||
'${controller.orderAllList[index].kms?.toString()}Km',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!)),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 10,),
|
||||
CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: ColorConstants.primaryColor1,
|
||||
child: controller.orderAllList[index].paymenttype==42?Icon(Icons.mobile_friendly,color: ColorConstants.primaryColor,size: 12,):controller.orderAllList[index].paymenttype==43?Icon(Icons.money,color: ColorConstants.primaryColor,size: 12,):Icon(Icons.wallet,color: ColorConstants.primaryColor,size: 12,)),
|
||||
SizedBox(width: 07,),
|
||||
Text(
|
||||
"₹ ${controller.orderAllList[index].deliverycharges}",
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 9,
|
||||
),
|
||||
controller.orderAllList[index].orderstatus =='cancelled'?Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:Colors.red,borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
Icon(Icons.cancel,
|
||||
color: ColorConstants.secondaryColor, size: 18),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus }',
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
):Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:controller.orderAllList[index].orderstatus =='completed'?Colors.green: Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
CircleAvatar(
|
||||
backgroundColor:controller.orderAllList[index].orderstatus =='completed'?
|
||||
ColorConstants.secondaryColor:
|
||||
ColorConstants.primaryColor1,
|
||||
radius: 10,
|
||||
child: Icon(Icons.check,
|
||||
color: Colors.grey, size: 15),
|
||||
),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus }',
|
||||
style: TextStyle(
|
||||
color:controller.orderAllList[index].orderstatus =='completed'?
|
||||
ColorConstants.secondaryColor: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Container(
|
||||
width: Get.width*0.35,
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].pickupcustomer}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.start,
|
||||
// crossAxisAlignment:
|
||||
// CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on,
|
||||
// color: Colors.grey[500],
|
||||
// size: 22,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 4,
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 2),
|
||||
// child: Container(
|
||||
// width: Get.width*0.35,
|
||||
// child: Text(
|
||||
// '${controller.orderAllList[index].delivceryaddress}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black87,
|
||||
// fontWeight:
|
||||
// FontWeight.normal,
|
||||
// fontSize: 14,
|
||||
//
|
||||
// ),
|
||||
// maxLines: 2,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].pickupcontactno}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].orderid}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business_rounded,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].tenantname}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 3.0, horizontal: 5),
|
||||
child: Text(
|
||||
'${DateFormat("hh.mm a").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
color: Colors.white)),
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: Get.height * 0.21,
|
||||
width: Get.width * 0.9,
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 7,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delivery_dining,
|
||||
size: 25,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!)),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
CircleAvatar(
|
||||
backgroundColor:Colors.grey[100],
|
||||
radius: 10,
|
||||
child: Icon(Icons.check,
|
||||
color: Colors.grey, size: 15),
|
||||
),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color:Colors.grey[100],
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.02,
|
||||
width: Get.width*0.1,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 3.0, horizontal: 5),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
color: Colors.white)),
|
||||
)),
|
||||
SizedBox(height: 80,),
|
||||
Icon(Icons.cancel,size: 30,color: Colors.grey[100],)
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
206
lib/View/Orders/Tabs/Summary.dart
Normal file
206
lib/View/Orders/Tabs/Summary.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Controller/Orders/Tabs/Summarycontroller.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
|
||||
class OrderSummary extends StatelessWidget {
|
||||
OrderSummary({super.key});
|
||||
OrderSummaryController orderSummaryController = Get.put(OrderSummaryController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor : Colors.grey[100],
|
||||
body: GetBuilder<OrderSummaryController>(
|
||||
initState: (_){
|
||||
orderSummaryController.shimmer.value = true;
|
||||
orderSummaryController.getOrdersSummary();
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.shimmer.value
|
||||
? Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor,))
|
||||
:ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10,left: 10,right: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.94,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(child: Icon(Icons.pending, size: 54, color:ColorConstants.primaryColor1)),
|
||||
const SizedBox(width: 5,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 2,),
|
||||
Text('Pending',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
|
||||
const SizedBox(height: 4,),
|
||||
Text('${controller.getOrderSummary.pending}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15,),
|
||||
Container(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.94,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(child: Icon(Icons.check_circle, size: 46, color:ColorConstants.primaryColor1)),
|
||||
const SizedBox(width: 10,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4,),
|
||||
Text('Completed',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
|
||||
const SizedBox(height: 4,),
|
||||
Row(
|
||||
children: [
|
||||
Text('${controller.getOrderSummary.delivered}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15,),
|
||||
Container(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.94,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(child: Icon(Icons.cancel, size: 48, color:ColorConstants.primaryColor1)),
|
||||
const SizedBox(width: 10,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4,),
|
||||
Text('Cancelled',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
|
||||
const SizedBox(height: 4,),
|
||||
Row(
|
||||
children: [
|
||||
Text('${controller.getOrderSummary.cancelled}',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 15,),
|
||||
Container(
|
||||
height: Get.height*0.10,
|
||||
width: Get.width*0.94,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(child: Icon(Icons.location_city, size: 46, color:ColorConstants.primaryColor1)),
|
||||
const SizedBox(width: 10,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4,),
|
||||
Text('Amount',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16,color: Colors.grey[600]),),
|
||||
const SizedBox(height: 4,),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.currency_rupee_sharp,color: Colors.grey[600],size: 20),
|
||||
Text('0.00',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20,color: Colors.grey[600]),),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
612
lib/View/Orders/Tabs/Today.dart
Normal file
612
lib/View/Orders/Tabs/Today.dart
Normal file
@@ -0,0 +1,612 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/Orders/Tabs/Todaycontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/toast.dart';
|
||||
|
||||
class TodayOrderView extends StatefulWidget {
|
||||
const TodayOrderView({super.key});
|
||||
|
||||
@override
|
||||
State<TodayOrderView> createState() => _TodayOrderViewState();
|
||||
}
|
||||
|
||||
class _TodayOrderViewState extends State<TodayOrderView> {
|
||||
late TodayOrderController todayOrderController;
|
||||
Timer? _refreshTimer;
|
||||
final TodayOrderController controller = Get.put(TodayOrderController());
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
todayOrderController.shimmer.value = true;
|
||||
|
||||
// Fetch once
|
||||
todayOrderController.getOrders();
|
||||
|
||||
// Then refresh every 3 seconds
|
||||
_refreshTimer = Timer.periodic(const Duration(seconds: 3), (timer) {
|
||||
print('hi');
|
||||
todayOrderController.getOrders();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshTimer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<TodayOrderController>(
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, top: 5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5, right: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.94,
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
onChanged: (data) {
|
||||
controller.search(data);
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 10,
|
||||
right: 45,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
hintText: 'Name',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: controller.orderAllList.isEmpty && !controller.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 92),
|
||||
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)
|
||||
: ListView.builder(
|
||||
itemCount: controller.orderAllList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
// Get.to(() => DeliveryDetailsView(data: controller.orderAllList[index]));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: ColorConstants.primaryColor),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
controller.orderAllList[index].deliverydate == ""
|
||||
? Text('')
|
||||
: Text(
|
||||
'${DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
controller.orderAllList[index].deliverydate == ""
|
||||
? Text('')
|
||||
: Text(
|
||||
'${DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 7),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: ColorConstants.primaryColor),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delivery_dining,
|
||||
size: 25,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
controller.orderAllList[index].kms == null
|
||||
? Text(
|
||||
'0.0',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'${controller.orderAllList[index].kms?.toString()}Km',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: Colors.grey[400]!),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 10),
|
||||
CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: ColorConstants.primaryColor1,
|
||||
child: controller.orderAllList[index].paymenttype == 42
|
||||
? Icon(Icons.mobile_friendly, color: ColorConstants.primaryColor, size: 12)
|
||||
: controller.orderAllList[index].paymenttype == 43
|
||||
? Icon(Icons.money, color: ColorConstants.primaryColor, size: 12)
|
||||
: Icon(Icons.wallet, color: ColorConstants.primaryColor, size: 12),
|
||||
),
|
||||
SizedBox(width: 7),
|
||||
Text(
|
||||
"₹ ${controller.orderAllList[index].deliverycharges}",
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 9),
|
||||
controller.orderAllList[index].orderstatus == 'cancelled'
|
||||
? Container(
|
||||
height: Get.height * 0.04,
|
||||
width: Get.width * 0.3,
|
||||
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
Icon(Icons.cancel, color: ColorConstants.secondaryColor, size: 18),
|
||||
SizedBox(width: 6),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
height: Get.height * 0.04,
|
||||
width: Get.width * 0.3,
|
||||
decoration: BoxDecoration(
|
||||
color: controller.orderAllList[index].orderstatus == 'completed' ? Colors.green : Colors.grey[100],
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
CircleAvatar(
|
||||
backgroundColor: controller.orderAllList[index].orderstatus == 'completed'
|
||||
? ColorConstants.secondaryColor
|
||||
: ColorConstants.primaryColor1,
|
||||
radius: 10,
|
||||
child: Icon(Icons.check, color: Colors.grey, size: 15),
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus}',
|
||||
style: TextStyle(
|
||||
color: controller.orderAllList[index].orderstatus == 'completed'
|
||||
? ColorConstants.secondaryColor
|
||||
: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Container(
|
||||
width: Get.width * 0.35,
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].pickupcustomer}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.phone, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'${controller.orderAllList[index].pickupcontactno}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.confirmation_num, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderid}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.business_rounded, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'${controller.orderAllList[index].tenantname}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3.0, horizontal: 5),
|
||||
child: Text(
|
||||
'${DateFormat("hh.mm a").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(fontSize: 10.5, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: Get.height * 0.21,
|
||||
width: Get.width * 0.9,
|
||||
margin: EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: ColorConstants.primaryColor!),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 7),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: ColorConstants.primaryColor!),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.delivery_dining, size: 25, color: ColorConstants.primaryColor),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: Colors.grey[400]!),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text("", style: TextStyle(color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
Container(
|
||||
height: Get.height * 0.04,
|
||||
width: Get.width * 0.3,
|
||||
decoration: BoxDecoration(color: Colors.grey[100], borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
CircleAvatar(backgroundColor: Colors.grey[100], radius: 10, child: Icon(Icons.check, color: Colors.grey, size: 15)),
|
||||
SizedBox(width: 6),
|
||||
Text('', style: TextStyle(color: Colors.grey[100], fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.phone, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.confirmation_num, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.business, color: Colors.grey[500], size: 22),
|
||||
SizedBox(width: 4),
|
||||
Text('', style: TextStyle(color: Colors.black87, fontWeight: FontWeight.normal, fontSize: 14)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.02,
|
||||
width: Get.width * 0.1,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3.0, horizontal: 5),
|
||||
child: Text('', style: TextStyle(fontSize: 10.5, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80),
|
||||
Icon(Icons.cancel, size: 30, color: Colors.grey[100]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
883
lib/View/Orders/Tabs/Week.dart
Normal file
883
lib/View/Orders/Tabs/Week.dart
Normal file
@@ -0,0 +1,883 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/Orders/Tabs/Weekcontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../Deliverydetails/Deliverydetailsview.dart';
|
||||
|
||||
class WeekOrderView extends StatelessWidget {
|
||||
WeekOrderView({super.key});
|
||||
WeekOrderController weekOrderController = Get.put(WeekOrderController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<WeekOrderController>(
|
||||
initState: (_){
|
||||
weekOrderController.shimmer.value = true;
|
||||
weekOrderController.getOrders();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, top: 5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5, right: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.94,
|
||||
child: TextField(
|
||||
// textAlign: TextAlign.center,
|
||||
controller: controller.searchController,
|
||||
// style: TextStyle(fontSize: 15),
|
||||
onChanged: (data) {
|
||||
controller.search(data);
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 10,
|
||||
right: 45,
|
||||
// left: 10
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30),
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
// suffixIcon: popUp(),
|
||||
hintText: 'Name'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child:weekOrderController.orderAllList.length == 0&& !weekOrderController.shimmer.value
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 92,
|
||||
),
|
||||
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): ListView.builder(
|
||||
itemCount: controller.orderAllList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
// height: Get.height * 0.21,
|
||||
// width: Get.width * 0.9,
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
// Get.to(()=> DeliveryDetailsView(data: controller.orderAllList[index]));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
controller.orderAllList[index].deliverydate == "" ? Text(''):
|
||||
Text(
|
||||
'${DateFormat("dd").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
controller.orderAllList[index].deliverydate == "" ? Text(''):
|
||||
|
||||
Text(
|
||||
'${DateFormat("MMM").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 7,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delivery_dining,
|
||||
size: 25,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
),
|
||||
controller.orderAllList[index].kms==null?Text(
|
||||
'0.0',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
):Text(
|
||||
'${controller.orderAllList[index].kms?.toString()}Km',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!)),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 10,),
|
||||
CircleAvatar(
|
||||
radius: 10,
|
||||
backgroundColor: ColorConstants.primaryColor1,
|
||||
child: controller.orderAllList[index].paymenttype==42?Icon(Icons.mobile_friendly,color: ColorConstants.primaryColor,size: 12,):controller.orderAllList[index].paymenttype==43?Icon(Icons.money,color: ColorConstants.primaryColor,size: 12,):Icon(Icons.wallet,color: ColorConstants.primaryColor,size: 12,)),
|
||||
SizedBox(width: 07,),
|
||||
Text(
|
||||
"₹ ${controller.orderAllList[index].deliverycharges}",
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 9,
|
||||
),
|
||||
controller.orderAllList[index].orderstatus =='cancelled'?Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:Colors.red,borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
Icon(Icons.cancel,
|
||||
color: ColorConstants.secondaryColor, size: 18),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus }',
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
):Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:controller.orderAllList[index].orderstatus =='completed'?Colors.green: Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
CircleAvatar(
|
||||
backgroundColor:controller.orderAllList[index].orderstatus =='completed'?
|
||||
ColorConstants.secondaryColor:
|
||||
ColorConstants.primaryColor1,
|
||||
radius: 10,
|
||||
child: Icon(Icons.check,
|
||||
color: Colors.grey, size: 15),
|
||||
),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'${controller.orderAllList[index].orderstatus }',
|
||||
style: TextStyle(
|
||||
color:controller.orderAllList[index].orderstatus =='completed'?
|
||||
ColorConstants.secondaryColor: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Container(
|
||||
width: Get.width*0.35,
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].pickupcustomer}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.start,
|
||||
// crossAxisAlignment:
|
||||
// CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on,
|
||||
// color: Colors.grey[500],
|
||||
// size: 22,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 4,
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 2),
|
||||
// child: Container(
|
||||
// width: Get.width*0.35,
|
||||
// child: Text(
|
||||
// '${controller.orderAllList[index].delivceryaddress}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black87,
|
||||
// fontWeight:
|
||||
// FontWeight.normal,
|
||||
// fontSize: 14,
|
||||
//
|
||||
// ),
|
||||
// maxLines: 2,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].pickupcontactno}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].orderid}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business_rounded,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'${controller.orderAllList[index].tenantname}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 3.0, horizontal: 5),
|
||||
child: Text(
|
||||
'${DateFormat("hh.mm a").format(DateFormat("yyyy-MM-dd'T'HH:mm:ss", "en_US").parse(controller.orderAllList[index].deliverydate!))}',
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
color: Colors.white)),
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
orderShimmerCard(BuildContext context) {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: Get.height * 0.21,
|
||||
width: Get.width * 0.9,
|
||||
margin:
|
||||
EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, right: 10, top: 10, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 7,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.06,
|
||||
width: Get.width * 0.13,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
5),
|
||||
border: Border.all(
|
||||
color: ColorConstants
|
||||
.primaryColor!)),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delivery_dining,
|
||||
size: 25,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.28,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!)),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 6,
|
||||
),
|
||||
Container(
|
||||
height: Get.height*0.04,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(color:Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 5,),
|
||||
CircleAvatar(
|
||||
backgroundColor:Colors.grey[100],
|
||||
radius: 10,
|
||||
child: Icon(Icons.check,
|
||||
color: Colors.grey, size: 15),
|
||||
),
|
||||
SizedBox(width: 6,),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color:Colors.grey[100],
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 7),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.confirmation_num,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.business,
|
||||
color: Colors.grey[500],
|
||||
size: 22,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 2),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.02,
|
||||
width: Get.width*0.1,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12.0)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 3.0, horizontal: 5),
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
color: Colors.white)),
|
||||
)),
|
||||
SizedBox(height: 80,),
|
||||
Icon(Icons.cancel,size: 30,color: Colors.grey[100],)
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
618
lib/View/Orders/orderDetails.dart
Normal file
618
lib/View/Orders/orderDetails.dart
Normal file
@@ -0,0 +1,618 @@
|
||||
import 'package:country_currency_pickers/currency_picker_cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:rounded_loading_button_plus/rounded_loading_button.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
import '../../Controller/Dashboard/Tabs/Ordercontroller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
import '../../Model/Response/Orders/Getorderresponse.dart';
|
||||
import '../../Model/Response/products/product_info.dart';
|
||||
import '../Rider/rider_assign.dart';
|
||||
|
||||
class OrderDetailsPage extends StatelessWidget {
|
||||
|
||||
final OrderDetails orderDetails;
|
||||
final List<ProductDetails> productDetails;
|
||||
final CurrentOrderController controller;
|
||||
|
||||
|
||||
const OrderDetailsPage({
|
||||
super.key,
|
||||
required this.productDetails,
|
||||
required this.orderDetails,
|
||||
required this.controller,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double totalAmount = 0;
|
||||
double totalTax = 0;
|
||||
|
||||
for (var product in productDetails) {
|
||||
totalAmount = product.productsumprice ?? 0.0;
|
||||
totalTax += product.taxamount ?? 0.0;
|
||||
}
|
||||
|
||||
final totalWithTax = totalAmount + totalTax;
|
||||
|
||||
final DateTime dateTime = DateTime.parse(orderDetails.orderdate ?? '');
|
||||
|
||||
final String formattedDate = DateFormat('dd-MM-yy').format(dateTime);
|
||||
final String formattedTime = DateFormat('hh:mm a').format(dateTime);
|
||||
|
||||
logger.i('Order Status : ${orderDetails.orderstatus}');
|
||||
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: true,
|
||||
title: TextWidget(
|
||||
text: 'Order Details',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConstants.blackColor,
|
||||
)
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_sectionCard(
|
||||
icon: Icons.receipt_long,
|
||||
title: "Order Info",
|
||||
children: [
|
||||
_infoRow("Order ID", orderDetails.orderid ?? ''),
|
||||
_infoRow("Date", "${formattedDate}"),
|
||||
_infoRow("Time", "${formattedTime}"),
|
||||
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_sectionCard(
|
||||
icon: Icons.shopping_cart,
|
||||
title: "Products",
|
||||
children: [
|
||||
// List of products
|
||||
...productDetails.map((product) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(child: Text("${product.productname} x${product.orderqty}")),
|
||||
Text(
|
||||
"₹${((product.price ?? 0.0) * (product.orderqty ?? 1)).toStringAsFixed(2)}",
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
|
||||
const Divider(height: 24),
|
||||
|
||||
// Additional totals
|
||||
_infoRow("Amount", "₹${totalAmount.toStringAsFixed(2)}", isForProducts: true),
|
||||
_infoRow("Tax", "₹${totalTax.toStringAsFixed(2)}", isForProducts: true),
|
||||
_infoRow(
|
||||
"Total",
|
||||
"₹${totalWithTax.toStringAsFixed(2)}",
|
||||
isForProducts: true
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_sectionCard(
|
||||
icon: Icons.person,
|
||||
title: "Customer",
|
||||
children: [
|
||||
_infoRow("Name", orderDetails.deliverycustomer ?? ''),
|
||||
_infoRow("Address", orderDetails.deliveryaddress ?? ''),
|
||||
_infoRow("Phone", orderDetails.deliverycontactno ?? ''),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
Visibility(
|
||||
visible: orderDetails.rider?.isNotEmpty ?? false,
|
||||
child: _sectionCard(
|
||||
icon: Icons.delivery_dining,
|
||||
title: "Rider",
|
||||
children: [
|
||||
_infoRow("Name", orderDetails.rider ?? ''),
|
||||
_infoRow("Phone", orderDetails.ridercontactno ?? ''),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: OrderStatusTimeline(
|
||||
stages: [
|
||||
Stage(
|
||||
label: "Accepted",
|
||||
icon: Icons.check,
|
||||
completed: orderDetails.starttime?.isNotEmpty ?? false,
|
||||
time: convertTo12HourFormat(orderDetails.starttime ?? '',
|
||||
),
|
||||
),
|
||||
Stage(
|
||||
label: "Arrived",
|
||||
icon: Icons.location_on,
|
||||
completed: orderDetails.arrivaltime?.isNotEmpty ?? false,
|
||||
time: convertTo12HourFormat(orderDetails.arrivaltime ?? '',
|
||||
),
|
||||
),
|
||||
Stage(
|
||||
label: "Picked",
|
||||
icon: Icons.shopping_bag,
|
||||
completed: orderDetails.pickuptime?.isNotEmpty ?? false,
|
||||
time: convertTo12HourFormat(orderDetails.pickuptime ?? '')
|
||||
),
|
||||
Stage(
|
||||
label: "Delivered",
|
||||
icon: Icons.delivery_dining,
|
||||
completed:orderDetails.deliverytime?.isNotEmpty ?? false,
|
||||
time: convertTo12HourFormat(orderDetails.deliverytime ?? '')
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: orderDetails.orderstatus == 'cancelled' || orderDetails.orderstatus == 'delivered' ?
|
||||
SizedBox() :
|
||||
SafeArea(
|
||||
child: SizedBox(
|
||||
height: 80,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 14,right: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: (orderDetails.orderstatus == 'pending' || orderDetails.orderstatus == 'created') ,
|
||||
child: Expanded(
|
||||
child: RoundedLoadingButton(
|
||||
controller: controller.cancelOrderButton,
|
||||
color: Colors.red,
|
||||
onPressed: () {
|
||||
showCancelOrderDialog(
|
||||
context,
|
||||
() {
|
||||
controller.declineOrder(
|
||||
orderDetails.orderheaderid,
|
||||
orderDetails.orderid,
|
||||
orderDetails.customertoken,
|
||||
orderDetails.ridertoken,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Cancel',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorConstants.secondaryColor,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Visibility(
|
||||
visible: orderDetails.orderstatus == 'created',
|
||||
child: Expanded(
|
||||
child: RoundedLoadingButton(
|
||||
controller: controller.acceptOrderButton,
|
||||
color: Colors.green,
|
||||
onPressed: () {
|
||||
Get.to(() => ReassignRidersView(deliveryDetails: orderDetails));
|
||||
controller.acceptOrderButton.reset();
|
||||
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Accept',
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Alert dialog for the Cancel Order
|
||||
void showCancelOrderDialog(BuildContext context, VoidCallback onConfirm) {
|
||||
controller.cancelOrderButton.reset();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: const TextWidget(
|
||||
text: 'Cancel Order',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 18,
|
||||
),
|
||||
content: const TextWidget(text: 'Would you like to cancel this order?', fontSize: 14,),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const TextWidget(text: 'No'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(Colors.red),
|
||||
foregroundColor: WidgetStateProperty.all(ColorConstants.secondaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
onConfirm();
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Yes, Cancel' ,
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _sectionCard({
|
||||
required IconData icon,
|
||||
required String title,
|
||||
String? Amount,
|
||||
String? TaxAmount,
|
||||
String? Total,
|
||||
required List<Widget> children,
|
||||
}) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 4)],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: ColorConstants.primaryColor),
|
||||
const SizedBox(width: 8),
|
||||
Text(title, style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 16)),
|
||||
],
|
||||
),
|
||||
const Divider(),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _infoRow(String label, String value, {bool? isForProducts}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 100, // fixed width for label
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(color: Colors.black54),
|
||||
),
|
||||
),
|
||||
(isForProducts ?? false) ?
|
||||
Spacer() :
|
||||
const SizedBox(width: 8),
|
||||
(isForProducts ?? false) ?
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
maxLines: 3, // Allow wrapping for address
|
||||
overflow: TextOverflow.ellipsis,
|
||||
) :
|
||||
Expanded(
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
maxLines: 3, // Allow wrapping for address
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showBottomSheet(BuildContext context, {required VoidCallback onAccept}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16.0)),
|
||||
),
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Optional: Add a handle or title
|
||||
Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 5,
|
||||
margin: EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Text(
|
||||
'Confirm Order',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Text(
|
||||
'Accept this order and assign a rider?',
|
||||
style: TextStyle(fontSize: 16),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 24.0),
|
||||
// Buttons
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Handle Cancel action
|
||||
Navigator.pop(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.black,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: TextWidget(
|
||||
text: 'Cancel'
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 16.0),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Handle Accept action
|
||||
onAccept();
|
||||
// Add your accept logic here
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: TextWidget(
|
||||
text: 'Accept',
|
||||
color: ColorConstants.secondaryColor,
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class OrderStatusTimeline extends StatelessWidget {
|
||||
final List<Stage> stages;
|
||||
|
||||
const OrderStatusTimeline({super.key, required this.stages});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 4)],
|
||||
),
|
||||
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Title
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 12, bottom: 8),
|
||||
child: Text(
|
||||
'Order Status',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
// Horizontal Timeline
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: Row(
|
||||
children: List.generate(stages.length, (index) {
|
||||
final isFirst = index == 0;
|
||||
final isLast = index == stages.length - 1;
|
||||
final stage = stages[index];
|
||||
|
||||
return TimelineTile(
|
||||
axis: TimelineAxis.horizontal,
|
||||
alignment: TimelineAlign.center,
|
||||
isFirst: isFirst,
|
||||
isLast: isLast,
|
||||
beforeLineStyle: LineStyle(
|
||||
color: stage.completed ? Colors.green : Colors.grey.shade400,
|
||||
thickness: 2,
|
||||
),
|
||||
afterLineStyle: LineStyle(
|
||||
color: stage.completed ? Colors.green : Colors.grey.shade400,
|
||||
thickness: 2,
|
||||
),
|
||||
indicatorStyle: IndicatorStyle(
|
||||
width: 30,
|
||||
height: 30,
|
||||
indicator: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: stage.completed ? Colors.green : Colors.grey.shade400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
stage.icon,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
endChild: Container(
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
stage.label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: stage.completed ? Colors.black : Colors.grey,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
if (stage.time != null)
|
||||
Expanded(
|
||||
child: Text(
|
||||
stage.time!,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.black54,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Stage {
|
||||
final String label;
|
||||
final IconData icon;
|
||||
final bool completed;
|
||||
final String? time;
|
||||
|
||||
Stage({
|
||||
required this.label,
|
||||
required this.icon,
|
||||
this.completed = false,
|
||||
this.time,
|
||||
});
|
||||
}
|
||||
|
||||
String convertTo12HourFormat(String dateTimeString) {
|
||||
logger.i('Convert This into 12 : ${dateTimeString}');
|
||||
|
||||
// Check if input is empty
|
||||
if (dateTimeString.isEmpty) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Parse the input string to DateTime
|
||||
DateTime dateTime = DateTime.parse(dateTimeString);
|
||||
|
||||
// Get hour and minute
|
||||
int hour = dateTime.hour;
|
||||
int minute = dateTime.minute;
|
||||
|
||||
// Determine AM/PM
|
||||
String period = hour >= 12 ? 'PM' : 'AM';
|
||||
|
||||
// Convert to 12-hour format
|
||||
hour = hour % 12;
|
||||
if (hour == 0) hour = 12;
|
||||
|
||||
// Format minute to always show two digits
|
||||
String minuteStr = minute.toString().padLeft(2, '0');
|
||||
|
||||
return '$hour:$minuteStr $period';
|
||||
}
|
||||
|
||||
210
lib/View/Rider/rider_assign.dart
Normal file
210
lib/View/Rider/rider_assign.dart
Normal file
@@ -0,0 +1,210 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
|
||||
import 'package:rounded_loading_button_plus/rounded_loading_button.dart';
|
||||
import '../../Controller/Rider_assign/rider_assign_controller.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
import '../../Helper/toast.dart';
|
||||
import '../../Helper/utility.dart';
|
||||
import '../../Model/Response/Orders/Getorderresponse.dart';
|
||||
|
||||
class ReassignRidersView extends StatelessWidget {
|
||||
final OrderDetails deliveryDetails;
|
||||
|
||||
ReassignRidersView({Key? key, required this.deliveryDetails}) : super(key: key);
|
||||
|
||||
final RiderAssignController reassignRidersController = Get.put(RiderAssignController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
appBar: AppBar(
|
||||
leading: BackButton(color: Colors.black),
|
||||
title: TextWidget(
|
||||
text: 'Assign Rider',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
elevation: 2,
|
||||
),
|
||||
body: GetBuilder<RiderAssignController>(
|
||||
initState: (_) {
|
||||
reassignRidersController.shimmer.value = true;
|
||||
reassignRidersController.getRiders(deliveryDetails.applocationid);
|
||||
logger.i('RiderDetails : ${deliveryDetails.pickupaddress}');
|
||||
logger.i('RiderDetails : ${deliveryDetails.pickupcustomer}');
|
||||
logger.i('RiderDetails : ${deliveryDetails.pickupaddress}');
|
||||
logger.i('RiderDetails : ${deliveryDetails.pickupcustomer}');
|
||||
},
|
||||
builder: (controller) {
|
||||
if (controller.shimmer.value) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (controller.riderDetails.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
AssetConstants.NoRecords,
|
||||
height: 160,
|
||||
width: 160,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"No riders at this moment",
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.separated(
|
||||
itemCount: controller.riderDetails.length,
|
||||
padding: const EdgeInsets.all(12),
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 8),
|
||||
itemBuilder: (context, index) {
|
||||
final rider = controller.riderDetails[index];
|
||||
final isSelected = controller.riderFcmToken.contains(rider.userfcmtoken);
|
||||
final status = rider.status ?? '';
|
||||
final isIdle = status.toLowerCase() == 'idle';
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (isSelected) {
|
||||
controller.riderFcmToken.remove(rider.userfcmtoken);
|
||||
controller.riderUserIdList = 0;
|
||||
} else if (rider.userfcmtoken == null || rider.userfcmtoken!.isEmpty) {
|
||||
Toast.showToast("Rider token not available");
|
||||
} else {
|
||||
controller
|
||||
..isIdle = false
|
||||
..isSelectAll = false
|
||||
..riderFcmToken.clear()
|
||||
..riderFcmToken.add(rider.userfcmtoken!)
|
||||
..riderUserIdList = rider.userid ?? 0
|
||||
..partnerId = rider.partnerid ?? 0
|
||||
..shiftId = rider.shiftid ?? 0
|
||||
..riderStatus = status;
|
||||
}
|
||||
|
||||
controller.update();
|
||||
},
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
elevation: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 26,
|
||||
backgroundColor: Utility.getLightColors(rider.firstname?[0] ?? '').withAlpha(160),
|
||||
child: TextWidget(
|
||||
text: rider.firstname?[0].toUpperCase() ?? '',
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
)
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${rider.firstname} ${rider.lastname}',
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'+91 ${rider.contactno}',
|
||||
style: TextStyle(color: Colors.grey[700], fontSize: 14),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Chip(
|
||||
label: Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
color: isIdle ? Colors.green : Colors.green,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
backgroundColor: isIdle
|
||||
? Colors.green[50]
|
||||
: Colors.green[50],
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: isSelected ? Colors.green : Colors.grey,
|
||||
size: 28,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.grey[600],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
),
|
||||
icon: const Icon(Icons.arrow_back, size: 18),
|
||||
label: const Text('Back'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: RoundedLoadingButton(
|
||||
color: Colors.green,
|
||||
controller: reassignRidersController.btnNotifyRiderController,
|
||||
onPressed: () {
|
||||
if (reassignRidersController.riderUserIdList != 0 &&
|
||||
reassignRidersController.riderFcmToken.isNotEmpty) {
|
||||
reassignRidersController.createDelivery([deliveryDetails]);
|
||||
} else {
|
||||
Toast.showToast("Please select a rider");
|
||||
reassignRidersController.btnNotifyRiderController.reset();
|
||||
}
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Notify',
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorConstants.secondaryColor,
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
66
lib/View/Success/Successview.dart
Normal file
66
lib/View/Success/Successview.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../Home/Homeview.dart';
|
||||
|
||||
class AccountCreatedScreen extends StatelessWidget {
|
||||
const AccountCreatedScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Lottie.asset(
|
||||
'assets/success.json',
|
||||
width: 200,
|
||||
height: 200,
|
||||
repeat: false,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
const TextWidget(
|
||||
text: "Account Created Successfully!",
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const TextWidget(
|
||||
text: "You can now start using the app.",
|
||||
fontSize: 16,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.off(() => HomeView(
|
||||
key: UniqueKey(),
|
||||
selectedIndex: 0,
|
||||
));
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 12),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
child: const Text(
|
||||
"Continue",
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
292
lib/View/Tenantlocation/Tenantlocationview.dart
Normal file
292
lib/View/Tenantlocation/Tenantlocationview.dart
Normal 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,
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
182
lib/View/Update/Updateview.dart
Normal file
182
lib/View/Update/Updateview.dart
Normal file
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'dart:io';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../Globalwidgets/textwidget.dart';
|
||||
import '../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../Helper/Logger.dart';
|
||||
|
||||
|
||||
class UpdateAppPage extends StatelessWidget {
|
||||
final bool mIsForceUpdate;
|
||||
final String mCurrentVersion;
|
||||
final String mUpdateVersion;
|
||||
|
||||
const UpdateAppPage(
|
||||
{super.key, this.mIsForceUpdate = true, required this.mCurrentVersion, required this.mUpdateVersion,});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
SystemNavigator.pop();
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
body: ListView(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Lottie.asset(''
|
||||
'assets/Update.json',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 50,),
|
||||
const Text(
|
||||
"It's Time to Update",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Lato',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
Text(
|
||||
'Version $mUpdateVersion',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Lato',
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold),),
|
||||
const SizedBox(height: 10,),
|
||||
SizedBox(
|
||||
width: Get.width * 0.80,
|
||||
child: const Text(
|
||||
'We added lots of new features and fix some bugs to make your experience as smooth as possible',
|
||||
style: TextStyle(
|
||||
fontFamily: "Lato",
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: SizedBox(
|
||||
height: Get.height * 0.10,
|
||||
child: btnDownload(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget nearleLogoImg() {
|
||||
return Hero(
|
||||
tag: 'hero',
|
||||
child: Image.asset(
|
||||
AssetConstants.nearleDarkLogo,
|
||||
height: 200,
|
||||
width: 250,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget textContents() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: 'You are using an older version of Nearle Deals Business Application.',
|
||||
fontSize: 20,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
Center(
|
||||
child:
|
||||
TextWidget(
|
||||
text: 'Available version',
|
||||
fontSize: 20,
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 9,),
|
||||
Center(
|
||||
child: TextWidget(
|
||||
text: mUpdateVersion,
|
||||
textAlign: TextAlign.center,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget btnDownload() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: Container(margin: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(
|
||||
ColorConstants.primaryColor),
|
||||
foregroundColor: WidgetStateProperty.all(Colors.white),
|
||||
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
5), // Adjust radius
|
||||
),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
downloadActions();
|
||||
},
|
||||
child: TextWidget(
|
||||
text: 'Update',
|
||||
fontSize: 16,
|
||||
color: ColorConstants.secondaryColor,
|
||||
)
|
||||
))
|
||||
],
|
||||
),),
|
||||
);
|
||||
}
|
||||
|
||||
skipAction() {
|
||||
Get.back();
|
||||
}
|
||||
|
||||
void downloadActions() async {
|
||||
String url;
|
||||
var s = Platform.isAndroid ? "Android" : "Ios";
|
||||
if (s == "Android") {
|
||||
// appInfo = await Utility.getApplicationInfo();
|
||||
|
||||
url = 'https://play.google.com/store/apps/details?id=com.nearle.bond';
|
||||
} else {
|
||||
url = 'https://apps.apple.com/us/app/gear/id1596895375ls=1';
|
||||
}
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
} else {
|
||||
throw 'Could not launch App';
|
||||
}
|
||||
}
|
||||
}
|
||||
26
lib/View/ex.dart
Normal file
26
lib/View/ex.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
// distance_service.dart
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
|
||||
|
||||
|
||||
class DistanceService {
|
||||
Future<double> getDistance(double pickupLat, double pickupLong, double dropLat, double dropLong) async {
|
||||
final apiKey = 'AIzaSyDQ2c_pOSOFYSjxGMwkFvCVWKjYOM9siow';
|
||||
final url =
|
||||
'https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=$pickupLat,$pickupLong&destinations=$dropLat,$dropLong&key=$apiKey';
|
||||
|
||||
final response = await http.get(Uri.parse(url));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
final distanceText = data['rows'][0]['elements'][0]['distance']['text'];
|
||||
final distanceValue = data['rows'][0]['elements'][0]['distance']['value'] / 1000; // Convert meters to kilometers
|
||||
print('Distance: $distanceText');
|
||||
return distanceValue;
|
||||
} else {
|
||||
throw Exception('Failed to load distance');
|
||||
}
|
||||
}
|
||||
}
|
||||
66
lib/View/ex1.dart
Normal file
66
lib/View/ex1.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
// distance_controller.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'ex.dart';
|
||||
|
||||
class DistanceController extends GetxController {
|
||||
final DistanceService _distanceService = DistanceService();
|
||||
RxDouble distance = 0.0.obs;
|
||||
|
||||
void calculateDistance(double pickupLat, double pickupLong, double dropLat, double dropLong) async {
|
||||
try {
|
||||
final distanceValue = await _distanceService.getDistance(pickupLat, pickupLong, dropLat, dropLong);
|
||||
distance(distanceValue);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyDistanceCalculate extends StatelessWidget {
|
||||
final DistanceController distanceController = Get.put(DistanceController());
|
||||
|
||||
final lat1 = 11.0043693;
|
||||
final lon1 = 77.00916169999999;
|
||||
|
||||
final lat2 = 11.0195965;
|
||||
final lon2 = 76.9727256;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Distance Calculator'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
final pickupLat = double.tryParse(lat1.toString());
|
||||
final pickupLong = double.tryParse(lon1.toString());
|
||||
final dropLat = double.tryParse(lat2.toString());
|
||||
final dropLong = double.tryParse(lon2.toString());
|
||||
if (pickupLat != null && pickupLong != null && dropLat != null && dropLong != null) {
|
||||
distanceController.calculateDistance(pickupLat, pickupLong, dropLat, dropLong);
|
||||
} else {
|
||||
// Handle invalid input
|
||||
print('Invalid input');
|
||||
}
|
||||
},
|
||||
child: Text('Calculate Distance'),
|
||||
),
|
||||
Obx(() => Text('Distance: ${distanceController.distance.toStringAsFixed(2)} kms')),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
0
lib/View/test.dart
Normal file
0
lib/View/test.dart
Normal file
Reference in New Issue
Block a user