Merge branch 'development_sikander' into 'master'

Development sikander

See merge request mirza.shafique/mohem_flutter_app!74
merge-requests/1/merge
Sikander Saleem 3 years ago
commit 8a0f18b741

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="30.776" height="24.337" viewBox="0 0 30.776 24.337">
<g id="folder" transform="translate(0 -42.679)">
<g id="Group_8637" data-name="Group 8637" transform="translate(0 45.895)">
<g id="Group_8636" data-name="Group 8636" transform="translate(0 0)">
<path id="Path_5021" data-name="Path 5021" d="M25.043,88.08H13.94l-2.209-2.625a.377.377,0,0,0-.3-.136H2.471A2.489,2.489,0,0,0,0,87.808v16.145a2.489,2.489,0,0,0,2.486,2.486H25.043a2.489,2.489,0,0,0,2.486-2.486V90.566A2.489,2.489,0,0,0,25.043,88.08Z" transform="translate(0 -85.319)" fill="#2bb8a6"/>
</g>
</g>
<g id="Group_8639" data-name="Group 8639" transform="translate(3.274 42.679)">
<g id="Group_8638" data-name="Group 8638" transform="translate(0 0)">
<path id="Path_5022" data-name="Path 5022" d="M68.431,45.44H57.324l-2.209-2.625a.377.377,0,0,0-.3-.136H45.859A2.486,2.486,0,0,0,43.4,44.827h8.168a1.445,1.445,0,0,1,1.11.516l1.886,2.242H65.169a3.56,3.56,0,0,1,3.554,3.554V63.775A2.486,2.486,0,0,0,70.9,61.31V47.923A2.489,2.489,0,0,0,68.431,45.44Z" transform="translate(-43.4 -42.679)" fill="#2bb8a6"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="30.996" height="28.414" viewBox="0 0 30.996 28.414">
<g id="image-gallery" transform="translate(-0.001 -2)">
<g id="Group_8635" data-name="Group 8635" transform="translate(0.001 5.875)">
<g id="Group_8634" data-name="Group 8634" transform="translate(0 5.078)">
<path id="Path_5018" data-name="Path 5018" d="M8.072,22.581A4.836,4.836,0,0,1,3.5,19.286l-.045-.149a4.711,4.711,0,0,1-.223-1.4V8.932L.1,19.391a2.933,2.933,0,0,0,2.056,3.558L22.123,28.3a2.962,2.962,0,0,0,.744.1,2.88,2.88,0,0,0,2.791-2.112l1.164-3.7Z" transform="translate(-0.001 -8.932)" fill="#2bb8a6"/>
</g>
<path id="Path_5019" data-name="Path 5019" d="M9.583,10.166A2.583,2.583,0,1,0,7,7.583,2.586,2.586,0,0,0,9.583,10.166Z" transform="translate(2.04 -5)" fill="#2bb8a6"/>
</g>
<path id="Path_5020" data-name="Path 5020" d="M26.6,2H7.229A3.233,3.233,0,0,0,4,5.229V19.436a3.233,3.233,0,0,0,3.229,3.229H26.6a3.233,3.233,0,0,0,3.229-3.229V5.229A3.233,3.233,0,0,0,26.6,2ZM7.229,4.583H26.6a.646.646,0,0,1,.646.646V14.4l-4.08-4.761a2.313,2.313,0,0,0-1.732-.794,2.258,2.258,0,0,0-1.726.815l-4.8,5.758-1.563-1.559a2.267,2.267,0,0,0-3.2,0L6.583,17.42V5.229a.646.646,0,0,1,.646-.646Z" transform="translate(1.166)" fill="#2bb8a6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="31.908" height="29.134" viewBox="0 0 31.908 29.134">
<g id="Group_8579" data-name="Group 8579" transform="translate(0 -100)">
<path id="Path_4556" data-name="Path 4556" d="M88.972,88.108h-4.4l-2.539-2.775H72.324v4.162H68.162v4.162H64V107.53a2.783,2.783,0,0,0,2.775,2.775h22.2a2.783,2.783,0,0,0,2.775-2.775V90.882A2.783,2.783,0,0,0,88.972,88.108Zm-11.1,18.035a6.937,6.937,0,1,1,6.937-6.937A6.939,6.939,0,0,1,77.873,106.143Z" transform="translate(-59.838 18.829)" fill="#2bb8a6"/>
<path id="Path_4557" data-name="Path 4557" d="M4.162,32.432H6.937V28.27H11.1V25.495H6.937V21.333H4.162v4.162H0V28.27H4.162Z" transform="translate(0 78.667)" fill="#2bb8a6"/>
<path id="Path_4558" data-name="Path 4558" d="M213.505,230.4a4.435,4.435,0,0,0-4.439,4.439h0a4.439,4.439,0,1,0,4.439-4.439Z" transform="translate(-195.47 -116.804)" fill="#2bb8a6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 910 B

@ -387,6 +387,10 @@
"itemPrice": "سعر السلعة", "itemPrice": "سعر السلعة",
"itemPhotos": "صور البند", "itemPhotos": "صور البند",
"itemInfo": "معلومات العنصر", "itemInfo": "معلومات العنصر",
"uploadAttachment": "تحميل المرفق",
"selectFromGalleryOrOpenCamera": "اختر من المعرض أو فتح الكاميرا",
"openCamera": "فتح\nآلة تصوير",
"uploadFromGallery": "تحميل من\nصالة عرض",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -387,6 +387,10 @@
"itemPrice": "Item Price", "itemPrice": "Item Price",
"itemPhotos": "Item Photos", "itemPhotos": "Item Photos",
"itemInfo": "Item Info", "itemInfo": "Item Info",
"uploadAttachment": "Upload Attachment",
"selectFromGalleryOrOpenCamera": "Select from gallery or open camera",
"openCamera": "Open\nCamera",
"uploadFromGallery": "Upload from\nGallery",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -12,6 +12,7 @@ class MyColors {
static const Color grey57Color = Color(0xff575757); static const Color grey57Color = Color(0xff575757);
static const Color grey67Color = Color(0xff676767); static const Color grey67Color = Color(0xff676767);
static const Color grey77Color = Color(0xff777777); static const Color grey77Color = Color(0xff777777);
static const Color greyF7Color = Color(0xffF7F7F7);
static const Color grey80Color = Color(0xff808080); static const Color grey80Color = Color(0xff808080);
static const Color grey70Color = Color(0xff707070); static const Color grey70Color = Color(0xff707070);
static const Color greyACColor = Color(0xffACACAC); static const Color greyACColor = Color(0xffACACAC);
@ -22,6 +23,7 @@ class MyColors {
static const Color lightGreyE3Color = Color(0xffE3E3E3); static const Color lightGreyE3Color = Color(0xffE3E3E3);
static const Color lightGreyE6Color = Color(0xffE6E6E6); static const Color lightGreyE6Color = Color(0xffE6E6E6);
static const Color lightGreyEAColor = Color(0xffEAEAEA); static const Color lightGreyEAColor = Color(0xffEAEAEA);
static const Color lightGreyE5Color = Color(0xffE5E5E5);
static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color darkWhiteColor = Color(0xffE0E0E0);
static const Color redColor = Color(0xffD02127); static const Color redColor = Color(0xffD02127);
static const Color yellowColor = Color(0xffF4E31C); static const Color yellowColor = Color(0xffF4E31C);

@ -21,11 +21,11 @@ extension EmailValidator on String {
style: TextStyle(fontSize: 10, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), style: TextStyle(fontSize: 10, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4),
); );
Widget toText11({Color? color, bool isUnderLine = false, bool isBold = false}) => Text( Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isBold = false}) => Text(
this, this,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
fontWeight: isBold ? FontWeight.bold : FontWeight.w600, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600),
color: color ?? MyColors.darkTextColor, color: color ?? MyColors.darkTextColor,
letterSpacing: -0.33, letterSpacing: -0.33,
decoration: isUnderLine ? TextDecoration.underline : null, decoration: isUnderLine ? TextDecoration.underline : null,

@ -42,7 +42,7 @@ extension WidgetExtensions on Widget {
child: this, child: this,
); );
Widget objectContainerView({String title = "", String note = "", bool disablePadding = false,double radius =15}) { Widget objectContainerView({String title = "", String note = "", bool disablePadding = false, double radius = 15}) {
return Container( return Container(
padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -69,14 +69,14 @@ extension WidgetExtensions on Widget {
); );
} }
Widget objectContainerBorderView({String title = "", String note = ""}) { Widget objectContainerBorderView({String title = "", String note = "", bool disablePadding = false, double radius = 15, Color? color, Color borderColor = MyColors.lightGreyEFColor}) {
return Container( return Container(
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(radius),
color: color,
border: Border.all( border: Border.all(
color: MyColors.lightGreyEFColor, color: borderColor,
width: 1, width: 1,
), ),
), ),

@ -1,11 +1,9 @@
import 'dart:collection';
import 'dart:ui'; import 'dart:ui';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/html_parser.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart'; import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart';
import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
@ -19,7 +17,6 @@ import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.
import 'package:mohem_flutter_app/models/profile_menu.model.dart'; import 'package:mohem_flutter_app/models/profile_menu.model.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -28,13 +25,12 @@ class EmployeeDetails extends StatefulWidget {
@override @override
_EmployeeDetailsState createState() => _EmployeeDetailsState(); _EmployeeDetailsState createState() => _EmployeeDetailsState();
} }
class _EmployeeDetailsState extends State<EmployeeDetails> { class _EmployeeDetailsState extends State<EmployeeDetails> {
GetEmployeeSubordinatesList? getEmployeeSubordinates; GetEmployeeSubordinatesList? getEmployeeSubordinates;
static List<GetMenuEntriesList> menuData = []; static List<GetMenuEntriesList> menuData = [];
List<ProfileMenu> menu =[]; List<ProfileMenu> menu = [];
String? selectedFavLetter; String? selectedFavLetter;
List<String>? favLetters; List<String>? favLetters;
List<GetFavoriteReplacements>? favUsersList; List<GetFavoriteReplacements>? favUsersList;
@ -62,15 +58,13 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
setState(() {}); setState(() {});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(getEmployeeSubordinates == null) { if (getEmployeeSubordinates == null) {
getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
setMenu(); setMenu();
} }
return Scaffold( return Scaffold(
extendBody: true, extendBody: true,
backgroundColor: MyColors.lightGreyEFColor, backgroundColor: MyColors.lightGreyEFColor,
@ -118,108 +112,107 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
Widget myTeamInfo() { Widget myTeamInfo() {
Uri phoneNumber = Uri.parse('tel:${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}'); Uri phoneNumber = Uri.parse('tel:${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}');
double _width = MediaQuery double _width = MediaQuery.of(context).size.width;
.of(context)
.size
.width;
return Column( return Column(
children: [ children: [
Stack(children: [ Stack(children: [
Container( Container(
margin: EdgeInsets.fromLTRB(21, 40, 21, 0), margin: EdgeInsets.fromLTRB(21, 40, 21, 0),
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
IconButton( IconButton(
onPressed: (){ padding: EdgeInsets.zero,
if(getEmployeeSubordinates!.isFavorite != true){ constraints: const BoxConstraints(),
onPressed: () {
if (getEmployeeSubordinates!.isFavorite != true) {
showFavoriteAlertDialog(context); showFavoriteAlertDialog(context);
setState(() {}); setState(() {});
}else{ } else {
fetchChangeFav( fetchChangeFav(
email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "", email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "",
employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "", employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "",
image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "", image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",
userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "", userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "",
isFav: false,); isFav: false,
);
setState(() {}); setState(() {});
} }, }
icon: getEmployeeSubordinates!.isFavorite != true },
? Icon( icon: Icon(
Icons.star_outline, getEmployeeSubordinates!.isFavorite != true ? Icons.star_outline : Icons.star_outlined,
size: 35,
color: MyColors.green9CColor,
)
: Icon(
Icons.star_outlined,
size: 35, size: 35,
color: MyColors.green9CColor, color: MyColors.green9CColor,
), ),
), ),
getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER == "" getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER == ""
? SvgPicture.asset("assets/images/call-disable.svg", height: 25, width: 25,).paddingOnly(left:6, right: 17) ? SvgPicture.asset(
: InkWell( "assets/images/call-disable.svg",
onTap:() { height: 25,
launchUrl(phoneNumber); width: 25,
}, )
child: SvgPicture.asset("assets/images/call.svg", height: 25, width: 25,).paddingOnly(left:6, right: 17), : InkWell(
), onTap: () {
launchUrl(phoneNumber);
},
child: SvgPicture.asset(
"assets/images/call.svg",
height: 25,
width: 25,
),
),
], ],
), ),
getEmployeeSubordinates!.eMPLOYEENAME!.toText21(maxlines: 2), getEmployeeSubordinates!.eMPLOYEENAME!.toText21(maxlines: 2),
("${getEmployeeSubordinates!.eMPLOYEENUMBER!} | ${getEmployeeSubordinates!.jOBNAME!}").toText13(color: MyColors.grey80Color), ("${getEmployeeSubordinates!.eMPLOYEENUMBER!} | ${getEmployeeSubordinates!.jOBNAME!}").toText13(color: MyColors.grey80Color),
getEmployeeSubordinates!.eMPLOYEEEMAILADDRESS!.toText13(), getEmployeeSubordinates!.eMPLOYEEEMAILADDRESS!.toText13(),
], ],
).objectContainerView(), ).paddingOnly(top: 16, bottom: 12, right: 14, left: 14).objectContainerView(radius: 10, disablePadding: true),
),
Container(
height: 68, alignment: Alignment.center, child: ProfileImage()).paddingOnly(top: 10),
]),
12.height,
Container(
margin: EdgeInsets.fromLTRB(21, 0, 21, 0),
child: Column(
children: menu.map((ProfileMenu i) => rowItem(i, context)).toList(),
).objectContainerView(),
), ),
// ), Container(height: 68, alignment: Alignment.center, child: ProfileImage()).paddingOnly(top: 10),
]),
12.height,
ListView.separated(
padding: EdgeInsets.only(bottom: 21),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Row(
children: [
SvgPicture.asset('assets/images/' + menu[index].icon, width: 20, height: 20),
16.width,
menu[index].name.toText16().expanded,
16.width,
const Icon(Icons.arrow_forward, color: MyColors.darkIconColor)
],
).onPress(() {
Navigator.pushNamed(context, menu[index].route, arguments: menu[index].arguments);
}).paddingOnly(left: 21, right: 21, top: 21),
separatorBuilder: (cxt, index) => 12.height,
itemCount: menu.length)
.objectContainerView(disablePadding: true, radius: 10)
.paddingOnly(left: 21, right: 21),
], ],
); );
} }
Widget ProfileImage() => Widget ProfileImage() => getEmployeeSubordinates?.eMPLOYEEIMAGE == null
getEmployeeSubordinates?.eMPLOYEEIMAGE == null ? SvgPicture.asset(
? SvgPicture.asset("assets/images/user.svg",height: 68, width: 68, ) "assets/images/user.svg",
height: 68,
width: 68,
)
: CircleAvatar( : CircleAvatar(
radius: 70, radius: 68,
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)), backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
); );
Widget rowItem(obj, context) {
return InkWell(
onTap: () {
Navigator.pushNamed(context, obj.route, arguments:obj.arguments);
}, void setMenu() {
child: ListTile(
leading: SvgPicture.asset('assets/images/' + obj.icon),
title: Text(obj.name,
style: TextStyle(color: MyColors.grey3AColor,
fontSize: 16)),
trailing: Icon(Icons.arrow_forward,
color: MyColors.grey3AColor,),
),
);
}
void setMenu(){
menu = [ menu = [
ProfileMenu(name: LocaleKeys.profileDetails.tr(), icon: "profile_details.svg", route: AppRoutes.profileDetails, arguments:getEmployeeSubordinates), ProfileMenu(name: LocaleKeys.profileDetails.tr(), icon: "profile_details.svg", route: AppRoutes.profileDetails, arguments: getEmployeeSubordinates),
ProfileMenu(name: LocaleKeys.createRequest.tr(), icon: "create_request.svg", route: AppRoutes.createRequest,arguments: getEmployeeSubordinates), ProfileMenu(name: LocaleKeys.createRequest.tr(), icon: "create_request.svg", route: AppRoutes.createRequest, arguments: getEmployeeSubordinates),
ProfileMenu(name: LocaleKeys.viewAttendance.tr(), icon: "view_attendance.svg", route: AppRoutes.viewAttendance, arguments: getEmployeeSubordinates), ProfileMenu(name: LocaleKeys.viewAttendance.tr(), icon: "view_attendance.svg", route: AppRoutes.viewAttendance, arguments: getEmployeeSubordinates),
ProfileMenu(name: LocaleKeys.teamMembers.tr(), icon: "team.svg", route: AppRoutes.teamMembers, arguments: getEmployeeSubordinates), ProfileMenu(name: LocaleKeys.teamMembers.tr(), icon: "team.svg", route: AppRoutes.teamMembers, arguments: getEmployeeSubordinates),
]; ];
@ -239,15 +232,15 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
LocaleKeys.ok.tr(), LocaleKeys.ok.tr(),
), ),
onPressed: () { onPressed: () {
fetchChangeFav( fetchChangeFav(
email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "", email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "",
employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "", employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "",
image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "", image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",
userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "", userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "",
isFav: true, isFav: true,
); );
setState(() {}); setState(() {});
Navigator.pop(context); Navigator.pop(context);
}, },
); );
AlertDialog alert = AlertDialog( AlertDialog alert = AlertDialog(
@ -265,7 +258,7 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
width: 50, width: 50,
isImageBase64: true, isImageBase64: true,
).paddingOnly(top: 21), ).paddingOnly(top: 21),
// 16.width, // 16.width,
], ],
), ),
), ),
@ -283,15 +276,11 @@ class _EmployeeDetailsState extends State<EmployeeDetails> {
} }
} }
GetMenuEntriesList getMenuEntries(String type) { GetMenuEntriesList getMenuEntries(String type) {
List<GetMenuEntriesList> data = _EmployeeDetailsState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList(); List<GetMenuEntriesList> data = _EmployeeDetailsState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList();
if (data.isNotEmpty) { if (data.isNotEmpty) {
return data[0]; return data[0];
} else { } else {
return GetMenuEntriesList(); return GetMenuEntriesList();
} }
} }

@ -29,10 +29,13 @@ class _MyTeamState extends State<MyTeam> {
TextEditingController? _textEditingController = TextEditingController(); TextEditingController? _textEditingController = TextEditingController();
List<GetEmployeeSubordinatesList> getEmployeeSListOnSearch = []; List<GetEmployeeSubordinatesList> getEmployeeSListOnSearch = [];
String dropdownValue = 'Name'; String dropdownValue = '';
int index = 0;
void initState() { void initState() {
super.initState(); super.initState();
dropdownValue = list[index];
getEmployeeSubordinates(); getEmployeeSubordinates();
} }
@ -52,155 +55,153 @@ class _MyTeamState extends State<MyTeam> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBarWidget( appBar: AppBarWidget(
context, context,
title: LocaleKeys.myTeamMembers.tr(), title: LocaleKeys.myTeamMembers.tr(),
showMemberButton: true, showMemberButton: true,
), ),
backgroundColor: MyColors.backgroundColor, backgroundColor: MyColors.backgroundColor,
body: SingleChildScrollView( body: ListView(
child: Column( padding: const EdgeInsets.all(21),
children: [
Row(
children: [ children: [
Container( TextField(
margin: EdgeInsets.only(left: 21, right: 21, top: 20, bottom: 6), onChanged: dropdownValue == "Name"
padding: EdgeInsets.only(left: 14, right: 14, top: 21, bottom: 21), ? (String value) {
decoration: BoxDecoration( getEmployeeSListOnSearch =
borderRadius: BorderRadius.circular(15), getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList();
color: Color(0xffFFFFFF), setState(() {});
border: Border.all( }
color: Color(0xffefefef), : (String value) {
width: 1, getEmployeeSListOnSearch =
), getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList();
), setState(() {});
child: Row( },
children: [ style: const TextStyle(
Expanded( fontSize: 14.0,
child: TextField( color: MyColors.grey3AColor,
onChanged: dropdownValue == "Name" fontWeight: FontWeight.w600,
? (String value) { letterSpacing: -0.56,
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(),
],
), ),
), controller: _textEditingController,
Container( decoration: InputDecoration(
margin: EdgeInsets.only(left: 21, right: 21), filled: true,
width: MediaQuery.of(context).size.width, isDense: true,
child: SingleChildScrollView( fillColor: Colors.white,
scrollDirection: Axis.vertical, border: InputBorder.none,
child: Column( enabledBorder: InputBorder.none,
children: <Widget>[ focusedBorder: InputBorder.none,
_textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty contentPadding: EdgeInsets.zero,
? Utils.getNoDataWidget(context) //contentPadding: EdgeInsets.fromLTRB(14, 15, 10, 15),
: ListView.separated( hintText: LocaleKeys.searchBy.tr() + " $dropdownValue",
scrollDirection: Axis.vertical, hintStyle: const TextStyle(
shrinkWrap: true, fontSize: 14.0,
physics: ScrollPhysics(), color: MyColors.grey3AColor,
separatorBuilder: (cxt, index) => 12.height, fontWeight: FontWeight.w600,
itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length, letterSpacing: -0.56,
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(),
);
})
],
), ),
), ),
) ).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() { Widget dropDown() {
return return PopupMenuButton(
DropdownButton<String>( itemBuilder: (_) => <PopupMenuItem<int>>[
value: dropdownValue, for (int i = 0; i < list.length; i++) PopupMenuItem<int>(value: i, child: Text(list[i])),
icon: const Icon(Icons.keyboard_arrow_down, ],
color: MyColors.grey35Color).paddingOnly(left: 4), onSelected: (int popupIndex) {
elevation: 16, index = popupIndex;
onChanged: (String? newValue) { dropdownValue = list[popupIndex];
setState(() { setState(() {});
dropdownValue = newValue!; },
}); child: Row(
}, children: [
items: <String>['Name', 'Email'].map<DropdownMenuItem<String>>((String value) { dropdownValue.toText14(),
return DropdownMenuItem<String>( 10.width,
value: value, const Icon(
child: Text(value), Icons.keyboard_arrow_down_rounded,
); color: Color(0xff535353),
}).toList(), )
style: TextStyle(fontSize: 14.0, color: MyColors.grey57Color), ],
); ),
);
} }
} }

@ -59,134 +59,105 @@ class _FamilyMembersState extends State<FamilyMembers> {
backgroundColor: MyColors.backgroundColor, backgroundColor: MyColors.backgroundColor,
body: Column( body: Column(
children: [ children: [
20.height,
Expanded( Expanded(
child: getEmployeeContactsList.length != 0 child: getEmployeeContactsList.length != 0
? SingleChildScrollView( ? ListView.separated(
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
scrollDirection: Axis.vertical, separatorBuilder: (cxt, index) => 12.height,
child: ListView.separated( itemCount: getEmployeeContactsList.length,
scrollDirection: Axis.vertical, itemBuilder: (context, index) {
shrinkWrap: true, return Column(
physics: ScrollPhysics(), crossAxisAlignment: CrossAxisAlignment.start,
separatorBuilder: (cxt, index) => 12.height, children: [
itemCount: getEmployeeContactsList.length, Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
itemBuilder: (context, index) { "${getEmployeeContactsList[index].cONTACTNAME}".toText16(color: MyColors.grey3AColor),
return Column( "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(color: MyColors.textMixColor),
crossAxisAlignment: CrossAxisAlignment.start, ]).paddingOnly(top: 15, left: 13, right: 13, bottom: 12),
children: [ 1.divider,
Column( Row(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: <Widget>[
"${getEmployeeContactsList[index].cONTACTNAME}".toText16(isBold: true, color: MyColors.grey3AColor), // todo @faitma clean below logic and write clean code.
"${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), menuEntries.updateButton == 'Y'
]), ? InkWell(
const Divider( onTap: () async {
color: Color(0xffEFEFEF), relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt();
thickness: 1, showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr());
indent: 0, },
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
menuEntries.updateButton == 'Y'
? InkWell(
onTap: () async{
relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt();
showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr());
},
child: RichText( child: RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(
Icons.edit,
size: 15,
color: MyColors.grey67Color,
),
),
TextSpan(
text: LocaleKeys.update.tr(),
style: TextStyle(
color: MyColors.grey67Color,
fontSize: 12,
),
),
],
),
),
)
: RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
WidgetSpan( const WidgetSpan(
child: Icon( child: Icon(
Icons.edit, Icons.edit,
size: 15, size: 15,
color: MyColors.lightGreyColor, color: MyColors.grey67Color,
), ),
), ),
TextSpan( TextSpan(
text: LocaleKeys.update.tr(), text: LocaleKeys.update.tr(),
style: TextStyle( style: const TextStyle(color: MyColors.grey67Color, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600),
color: MyColors.lightGreyColor,
fontSize: 12,
),
), ),
], ],
), ),
), ),
Container( )
height: 35, : RichText(
width: 1,
color: Color(0xffEFEFEF),
),
InkWell(
onTap: () {
relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt();
showRemoveAlertDialog(context, relationId!.toInt());
},
child: RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
WidgetSpan( const WidgetSpan(
child: Icon( child: Icon(
Icons.delete, Icons.edit,
size: 15, size: 15,
color: MyColors.redColor, color: MyColors.lightGreyColor,
), ),
), ),
TextSpan( TextSpan(
text: LocaleKeys.remove.tr(), text: LocaleKeys.update.tr(),
style: TextStyle( style: const TextStyle(color: MyColors.lightGreyColor, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600),
color: MyColors.redColor,
fontSize: 12,
),
), ),
], ],
), ),
),
Container(height: 35, width: 1, color: const Color(0xffEFEFEF)),
InkWell(
onTap: () {
relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt();
showRemoveAlertDialog(context, relationId!.toInt());
},
child: RichText(
text: TextSpan(
children: [
const WidgetSpan(
child: Icon(
Icons.delete,
size: 15,
color: MyColors.redColor,
), ),
), ),
TextSpan(
text: LocaleKeys.remove.tr(),
style: const TextStyle(color: MyColors.redColor, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600),
),
], ],
), ),
], ),
).objectContainerView(); ),
}), ],
) ),
],
).objectContainerView(disablePadding: true);
})
: Container(), : Container(),
), ),
DefaultButton( DefaultButton(LocaleKeys.addNewFamilyMember.tr(), () async {
LocaleKeys.addNewFamilyMember.tr(), () async {
Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"}); Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"});
ProfileScreen(); ProfileScreen();
} }).insideContainer,
).insideContainer,
], ],
)); ));
} }
void showUpdateAlertDialog(BuildContext context, int relationId, int flag, String actionType) { void showUpdateAlertDialog(BuildContext context, int relationId, int flag, String actionType) {
Widget cancelButton = TextButton( Widget cancelButton = TextButton(
child: Text( child: Text(
@ -261,6 +232,4 @@ class _FamilyMembersState extends State<FamilyMembers> {
}, },
); );
} }
} }

@ -28,7 +28,7 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
List<GetSaleCategoriesList> getSaleCategoriesList = []; List<GetSaleCategoriesList> getSaleCategoriesList = [];
late PageController _controller; late PageController _controller;
ItemReviewModel? itemReviewModel; ItemReviewModel? itemReviewModel;
int pageIndex = 0; int? pageIndex;
@override @override
void initState() { void initState() {
@ -43,7 +43,7 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getRequestID(); pageIndex ??= (ModalRoute.of(context)?.settings.arguments as int?) ?? 0;
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true), appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true),
@ -147,11 +147,6 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
); );
} }
void getRequestID() async {
int args = (ModalRoute.of(context)?.settings.arguments ?? <String, dynamic>{}) as int;
pageIndex = args;
}
void getItemForSaleCategory() async { void getItemForSaleCategory() async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);

@ -188,11 +188,11 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
children: [ children: [
title.toText16().expanded, title.toText16().expanded,
6.width, 6.width,
SimpleButton(LocaleKeys.add.tr(), () async { SimpleButton(LocaleKeys.add.tr(), () {
ImageOptions.showImageOptions(context, (String image, File file) { ImageOptions.showImageOptionsNew(context, (String image, File file) {
setState(() { // setState(() {
images.add(image); // images.add(image);
}); // });
}); });
}, fontSize: 14), }, fontSize: 14),
], ],

@ -47,11 +47,7 @@ class SearchOptionsSheet extends StatelessWidget {
}); });
}, },
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return Container( return 1.divider;
width: double.infinity,
height: 1,
color: Color(0xffE3E3E3),
);
}, },
itemCount: searchOptions.length, itemCount: searchOptions.length,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
class AttachmentOptions extends StatelessWidget {
VoidCallback onCameraTap;
VoidCallback onGalleryTap;
VoidCallback onFilesTap;
AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Upload Attachment".toSectionHeading(),
"Select from gallery or open camera".toText11(weight: FontWeight.w500),
GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 9, mainAxisSpacing: 9),
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(top: 21, bottom: 14),
shrinkWrap: true,
children: [
itemView("open_camera.svg", "Open\nCamera"),
itemView("gallery.svg", "Upload from\nGallery"),
itemView("files.svg", "Upload from\nFiles"),
],
)
],
).paddingOnly(left: 21, right: 21, bottom: 21),
);
}
Widget itemView(String icon, String title) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SvgPicture.asset("assets/images/$icon"),
title.toText11(isBold: true),
],
).paddingOnly(left: 13, right: 13, top: 16, bottom: 12).expanded.objectContainerBorderView(
disablePadding: true,
radius: 10,
color: MyColors.greyF7Color.withOpacity(.48),
borderColor: MyColors.lightGreyE5Color.withOpacity(.48),
);
}
}

@ -1,16 +1,31 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/attachment_options.dart';
class ImageOptions { class ImageOptions {
static void showImageOptions( static void showImageOptionsNew(BuildContext context, Function(String, File) image) {
BuildContext context, showMyBottomSheet(
Function(String, File) image, context,
) { child: AttachmentOptions(
onCameraTap: () async {
PickedFile? path = await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20);
},
onGalleryTap: () {},
onFilesTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
},
),
);
}
static void showImageOptions(BuildContext context, Function(String, File) image) {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
context: context, context: context,

Loading…
Cancel
Save