|
|
|
@ -29,10 +29,13 @@ class _MyTeamState extends State<MyTeam> {
|
|
|
|
|
TextEditingController? _textEditingController = TextEditingController();
|
|
|
|
|
List<GetEmployeeSubordinatesList> getEmployeeSListOnSearch = [];
|
|
|
|
|
|
|
|
|
|
String dropdownValue = 'Name';
|
|
|
|
|
String dropdownValue = '';
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
dropdownValue = list[index];
|
|
|
|
|
getEmployeeSubordinates();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -52,155 +55,153 @@ class _MyTeamState extends State<MyTeam> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBarWidget(
|
|
|
|
|
context,
|
|
|
|
|
title: LocaleKeys.myTeamMembers.tr(),
|
|
|
|
|
showMemberButton: true,
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: MyColors.backgroundColor,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
appBar: AppBarWidget(
|
|
|
|
|
context,
|
|
|
|
|
title: LocaleKeys.myTeamMembers.tr(),
|
|
|
|
|
showMemberButton: true,
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: MyColors.backgroundColor,
|
|
|
|
|
body: ListView(
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 21, right: 21, top: 20, bottom: 6),
|
|
|
|
|
padding: EdgeInsets.only(left: 14, right: 14, top: 21, bottom: 21),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
color: Color(0xffFFFFFF),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Color(0xffefefef),
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TextField(
|
|
|
|
|
onChanged: dropdownValue == "Name"
|
|
|
|
|
? (String value) {
|
|
|
|
|
getEmployeeSListOnSearch =
|
|
|
|
|
getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList();
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
: (String value) {
|
|
|
|
|
getEmployeeSListOnSearch =
|
|
|
|
|
getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
controller: _textEditingController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
filled: true,
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
// contentPadding: EdgeInsets.fromLTRB(10, 15, 10, 15),
|
|
|
|
|
hintText: LocaleKeys.searchBy.tr() + " $dropdownValue",
|
|
|
|
|
hintStyle: TextStyle(fontSize: 14.0, color: MyColors.grey3AColor),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
height: 36,
|
|
|
|
|
width: 1,
|
|
|
|
|
color: Color(0xffC4C4C4),
|
|
|
|
|
),
|
|
|
|
|
10.width,
|
|
|
|
|
dropDown(),
|
|
|
|
|
],
|
|
|
|
|
TextField(
|
|
|
|
|
onChanged: dropdownValue == "Name"
|
|
|
|
|
? (String value) {
|
|
|
|
|
getEmployeeSListOnSearch =
|
|
|
|
|
getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList();
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
: (String value) {
|
|
|
|
|
getEmployeeSListOnSearch =
|
|
|
|
|
getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
color: MyColors.grey3AColor,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
_textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
separatorBuilder: (cxt, index) => 12.height,
|
|
|
|
|
itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}');
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSListOnSearch[index]);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
getEmployeeSListOnSearch[index].eMPLOYEEIMAGE == null
|
|
|
|
|
? SvgPicture.asset("assets/images/user.svg",height: 34, width: 34, ).paddingOnly(top: 4)
|
|
|
|
|
: Container(
|
|
|
|
|
height: 34,
|
|
|
|
|
width: 34,
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
radius: 25,
|
|
|
|
|
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE)),
|
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
|
).paddingOnly(top: 4),
|
|
|
|
|
),
|
|
|
|
|
9.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// "Present".toText13(color: MyColors.greenColor),
|
|
|
|
|
"${getEmployeeSListOnSearch[index].eMPLOYEENAME}".toText16(color: MyColors.grey3AColor),
|
|
|
|
|
"${getEmployeeSListOnSearch[index].pOSITIONNAME}".toText10(color: MyColors.grey57Color),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER == ""
|
|
|
|
|
? SvgPicture.asset("assets/images/call-disable.svg", width: 22, height: 22).paddingOnly(bottom: 23)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
launchUrl(phoneNumber);
|
|
|
|
|
},
|
|
|
|
|
child: SvgPicture.asset("assets/images/call.svg", width: 22, height: 22).paddingOnly(bottom: 23),
|
|
|
|
|
),
|
|
|
|
|
// 21.height,
|
|
|
|
|
Icon(Icons.arrow_forward_outlined, color: MyColors.grey3AColor),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView(),
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
controller: _textEditingController,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
filled: true,
|
|
|
|
|
isDense: true,
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
//contentPadding: EdgeInsets.fromLTRB(14, 15, 10, 15),
|
|
|
|
|
hintText: LocaleKeys.searchBy.tr() + " $dropdownValue",
|
|
|
|
|
hintStyle: const TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
color: MyColors.grey3AColor,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
).paddingOnly(top: 21, bottom: 21).expanded,
|
|
|
|
|
Container(height: 15, width: 1, color: const Color(0xffC4C4C4)),
|
|
|
|
|
10.width,
|
|
|
|
|
dropDown(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
).paddingOnly(left: 14, right: 14).objectContainerBorderView(disablePadding: true, color: Colors.white, radius: 10),
|
|
|
|
|
_textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context).paddingOnly(top: 120)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
//scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
padding: const EdgeInsets.only(top: 12),
|
|
|
|
|
separatorBuilder: (cxt, index) => 12.height,
|
|
|
|
|
itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}');
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSListOnSearch[index]);
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
getEmployeeSListOnSearch[index].eMPLOYEEIMAGE == null
|
|
|
|
|
? SvgPicture.asset(
|
|
|
|
|
"assets/images/user.svg",
|
|
|
|
|
height: 34,
|
|
|
|
|
width: 34,
|
|
|
|
|
).paddingOnly(top: 4)
|
|
|
|
|
: Container(
|
|
|
|
|
height: 34,
|
|
|
|
|
width: 34,
|
|
|
|
|
child: CircleAvatar(
|
|
|
|
|
radius: 25,
|
|
|
|
|
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE)),
|
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
|
).paddingOnly(top: 4),
|
|
|
|
|
),
|
|
|
|
|
9.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// "Present".toText13(color: MyColors.greenColor),
|
|
|
|
|
"${getEmployeeSListOnSearch[index].eMPLOYEENAME}".toText16(color: MyColors.grey3AColor),
|
|
|
|
|
"${getEmployeeSListOnSearch[index].pOSITIONNAME}".toText10(color: MyColors.grey57Color),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER == ""
|
|
|
|
|
? SvgPicture.asset("assets/images/call-disable.svg", width: 22, height: 22)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
launchUrl(phoneNumber);
|
|
|
|
|
},
|
|
|
|
|
child: SvgPicture.asset("assets/images/call.svg", width: 22, height: 22)),
|
|
|
|
|
8.height,
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.arrow_forward_outlined,
|
|
|
|
|
color: MyColors.grey3AColor,
|
|
|
|
|
size: 18,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(top: 13, bottom: 13, right: 12, left: 14).objectContainerView(radius: 10, disablePadding: true),
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// todo @fatima add translation for below list
|
|
|
|
|
List<String> list = ["Name", "Email"];
|
|
|
|
|
|
|
|
|
|
Widget dropDown() {
|
|
|
|
|
return
|
|
|
|
|
DropdownButton<String>(
|
|
|
|
|
value: dropdownValue,
|
|
|
|
|
icon: const Icon(Icons.keyboard_arrow_down,
|
|
|
|
|
color: MyColors.grey35Color).paddingOnly(left: 4),
|
|
|
|
|
elevation: 16,
|
|
|
|
|
onChanged: (String? newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
dropdownValue = newValue!;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
items: <String>['Name', 'Email'].map<DropdownMenuItem<String>>((String value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value,
|
|
|
|
|
child: Text(value),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
style: TextStyle(fontSize: 14.0, color: MyColors.grey57Color),
|
|
|
|
|
);
|
|
|
|
|
return PopupMenuButton(
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < list.length; i++) PopupMenuItem<int>(value: i, child: Text(list[i])),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
index = popupIndex;
|
|
|
|
|
dropdownValue = list[popupIndex];
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
dropdownValue.toText14(),
|
|
|
|
|
10.width,
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.keyboard_arrow_down_rounded,
|
|
|
|
|
color: Color(0xff535353),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|