second commit

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

View File

@@ -0,0 +1,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)}";
}

View 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;
// });
// },
// ),
// ),
],
),
);
}
}

View 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;
// });
// },
// ),
// ),
],
),
);
}
}

View 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),
),
)
],
),
),
),
),
),
],
),
);
}
}

View 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;
// });
// },
// ),
// ),
],
),
);
}
}

File diff suppressed because it is too large Load Diff

View 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,
),
);
}
}

View 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),
),
],
),
],
),
),
],
),
),
],
),
);
}),
);
}
);
}
}

View 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
View 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,
),
],
);
}
}

View 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),
),
),
);
},
);
}),
);
}
}

View 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)}";
}

View 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]!,
);
}
}

View 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)}";
}