Merge branch 'master' into Fatima
# Conflicts: # lib/config/routes.dart # lib/models/generic_response_model.dart # lib/models/profile_menu.model.dartmerge-requests/1/merge
commit
dc880df35a
@ -0,0 +1,18 @@
|
||||
class CreateVacationRuleList {
|
||||
String? pRETURNMSG;
|
||||
String? pRETURNSTATUS;
|
||||
|
||||
CreateVacationRuleList({this.pRETURNMSG, this.pRETURNSTATUS});
|
||||
|
||||
CreateVacationRuleList.fromJson(Map<String, dynamic> json) {
|
||||
pRETURNMSG = json['P_RETURN_MSG'];
|
||||
pRETURNSTATUS = json['P_RETURN_STATUS'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['P_RETURN_MSG'] = this.pRETURNMSG;
|
||||
data['P_RETURN_STATUS'] = this.pRETURNSTATUS;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
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/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
|
||||
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
|
||||
class MyAttendanceScreen extends StatelessWidget {
|
||||
List<GetMenuEntriesList> list;
|
||||
|
||||
MyAttendanceScreen({Key? key, this.list = const <GetMenuEntriesList>[]}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
list = ModalRoute.of(context)!.settings.arguments as List<GetMenuEntriesList>;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.myAttendance.tr(),
|
||||
),
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: list.isEmpty
|
||||
? Utils.getNoDataWidget(context)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.all(21),
|
||||
itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", list[index].prompt!).onPress(() {
|
||||
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(list[index].prompt!, list[index].functionName!));
|
||||
}),
|
||||
separatorBuilder: (cxt, index) => 12.height,
|
||||
itemCount: list.length),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemView(String icon, String title) {
|
||||
return Row(
|
||||
children: [
|
||||
(title).toText16().expanded,
|
||||
12.width,
|
||||
SvgPicture.asset(
|
||||
"assets/images/arrow_next.svg",
|
||||
color: MyColors.darkIconColor,
|
||||
)
|
||||
],
|
||||
).objectContainerView();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
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/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
|
||||
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
|
||||
class ServicesMenuListScreenParams {
|
||||
final String title;
|
||||
final List<GetMenuEntriesList> list;
|
||||
|
||||
ServicesMenuListScreenParams(this.title, this.list);
|
||||
}
|
||||
|
||||
class ServicesMenuListScreen extends StatelessWidget {
|
||||
late ServicesMenuListScreenParams servicesMenuData;
|
||||
|
||||
ServicesMenuListScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
servicesMenuData = ModalRoute.of(context)!.settings.arguments as ServicesMenuListScreenParams;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: servicesMenuData.title,
|
||||
),
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: servicesMenuData.list.isEmpty
|
||||
? Utils.getNoDataWidget(context)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.all(21),
|
||||
itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", servicesMenuData.list[index].prompt!).onPress(() {
|
||||
if (servicesMenuData.list[index].parentMenuName == "MBL_PERINFO_SS") {
|
||||
if (servicesMenuData.list[index].requestType == "BASIC_DETAILS") {
|
||||
Navigator.pushNamed(context, AppRoutes.basicDetails);
|
||||
} else if (servicesMenuData.list[index].requestType == "PHONE_NUMBERS") {
|
||||
Navigator.pushNamed(context, AppRoutes.personalInfo);
|
||||
} else if (servicesMenuData.list[index].requestType == "ADDRESS") {
|
||||
Navigator.pushNamed(context, AppRoutes.contactDetails);
|
||||
} else if (servicesMenuData.list[index].requestType == "CONTACT") {
|
||||
Navigator.pushNamed(context, AppRoutes.familyMembers);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!));
|
||||
}),
|
||||
separatorBuilder: (cxt, index) => 12.height,
|
||||
itemCount: servicesMenuData.list.length),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemView(String icon, String title) {
|
||||
return Row(
|
||||
children: [
|
||||
(title).toText16().expanded,
|
||||
12.width,
|
||||
SvgPicture.asset(
|
||||
"assets/images/arrow_next.svg",
|
||||
color: MyColors.darkIconColor,
|
||||
)
|
||||
],
|
||||
).objectContainerView();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
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/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/profile_menu.model.dart';
|
||||
|
||||
class ProfileInFo extends StatelessWidget {
|
||||
MemberInformationListModel memberInfo;
|
||||
|
||||
ProfileInFo(this.memberInfo, {Key? key}) : super(key: key);
|
||||
|
||||
List<ProfileMenu> menu = [
|
||||
ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo),
|
||||
ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails),
|
||||
ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails),
|
||||
ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
16.height,
|
||||
memberInfo.eMPLOYEENAME!.toText22(),
|
||||
("${memberInfo.eMPLOYEENUMBER!} | ${memberInfo.jOBNAME!}").toText13(color: MyColors.grey80Color),
|
||||
memberInfo.eMPLOYEEEMAILADDRESS!.toText13(),
|
||||
12.height,
|
||||
const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor),
|
||||
12.height,
|
||||
LocaleKeys.completingYear.tr().toText11(),
|
||||
Row(children: [
|
||||
appreciationTime(LocaleKeys.year.tr(), memberInfo.sERVICEYEARS.toString()),
|
||||
appreciationTime(LocaleKeys.month.tr(), memberInfo.sERVICEMONTHS.toString()),
|
||||
appreciationTime(LocaleKeys.day.tr(), memberInfo.sERVICEDAYS.toString()),
|
||||
]).paddingOnly(bottom: 12, top: 12),
|
||||
const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor),
|
||||
Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
(LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(),
|
||||
8.height,
|
||||
Row(
|
||||
children: [
|
||||
for (var i = 0; i < 4; i++)
|
||||
if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef)))
|
||||
],
|
||||
),
|
||||
14.height,
|
||||
LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true),
|
||||
],
|
||||
).paddingOnly(left: 21, right: 21, bottom: 18, top: 12),
|
||||
const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor),
|
||||
ListView.separated(
|
||||
padding: EdgeInsets.zero,
|
||||
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);
|
||||
}).paddingOnly(left: 21, right: 21, top: 21),
|
||||
separatorBuilder: (cxt, index) => 12.height,
|
||||
itemCount: menu.length),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget drawSlider(color) {
|
||||
return Row(children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
height: 6,
|
||||
width: 20,
|
||||
color: color,
|
||||
),
|
||||
)),
|
||||
Container(height: 6, width: 3, color: Colors.white),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget appreciationTime(String title, String value) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
title.toText13(color: MyColors.grey80Color),
|
||||
value.padLeft(2, '0').toText20(color: MyColors.textMixColor),
|
||||
],
|
||||
).expanded;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
|
||||
import 'package:mohem_flutter_app/ui/profile/widgets/profile_info.dart';
|
||||
|
||||
class ProfilePanel extends StatelessWidget {
|
||||
ProfilePanel(this.memberInformationList);
|
||||
|
||||
late MemberInformationListModel memberInformationList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 32),
|
||||
padding: const EdgeInsets.only(top: 37),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
// border: Border.all(color: MyColors.lightGreyEFColor, width: 1),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(25),
|
||||
topRight: Radius.circular(25),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xff000000).withOpacity(.1),
|
||||
blurRadius: 26,
|
||||
offset: const Offset(0, -3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ProfileInFo(memberInformationList),
|
||||
),
|
||||
Container(height: 68, alignment: Alignment.center, child: profileImage())
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget profileImage() => CircleAvatar(
|
||||
radius: 68,
|
||||
backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
}
|
||||
@ -1,160 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mohem_flutter_app/config/routes.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
|
||||
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:mohem_flutter_app/models/profile_menu.model.dart';
|
||||
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
||||
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart';
|
||||
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
// todo '@sultan' kindly follow structure of code written. use extension methods for widgets, also format code
|
||||
|
||||
class ProfileInFo extends StatefulWidget {
|
||||
ProfileInFo(this.memberInfo);
|
||||
|
||||
MemberInformationListModel memberInfo;
|
||||
|
||||
@override
|
||||
State<ProfileInFo> createState() => _ProfileInFoState();
|
||||
}
|
||||
|
||||
class _ProfileInFoState extends State<ProfileInFo> {
|
||||
static List<GetMenuEntriesList> menuData = [];
|
||||
String data = '.';
|
||||
double sliderValue = 75;
|
||||
List<ProfileMenu> menu = [
|
||||
ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo, dynamicUrl: '', menuEntries: getMenuEntries('')),
|
||||
ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails, menuEntries: getMenuEntries('BASIC_DETAILS')),
|
||||
ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails, dynamicUrl: '', menuEntries: getMenuEntries('ADDRESS')),
|
||||
ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers, dynamicUrl: '', menuEntries: getMenuEntries('CONTACT')),
|
||||
];
|
||||
|
||||
@override
|
||||
void setState(VoidCallback fn) {
|
||||
super.setState(fn);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
/// card header
|
||||
customLabel(widget.memberInfo.eMPLOYEENAME.toString(), 22, Colors.black, true),
|
||||
|
||||
customLabel(widget.memberInfo.eMPLOYEENUMBER.toString() + ' | ' + widget.memberInfo.jOBNAME.toString(), 14, Colors.grey, false),
|
||||
|
||||
customLabel(widget.memberInfo.eMPLOYEEEMAILADDRESS.toString(), 13, Colors.black, true),
|
||||
|
||||
Divider(height: 40, thickness: 8, color: const Color(0xffefefef)),
|
||||
|
||||
customLabel(LocaleKeys.completingYear.tr(), 10, Colors.black, true),
|
||||
|
||||
SizedBox(height: 10),
|
||||
Container(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Column(
|
||||
children: [customLabel(LocaleKeys.year.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEYEARS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)],
|
||||
),
|
||||
Column(
|
||||
children: [customLabel(LocaleKeys.month.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEMONTHS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)],
|
||||
),
|
||||
Column(
|
||||
children: [customLabel(LocaleKeys.day.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEDAYS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)],
|
||||
)
|
||||
])),
|
||||
|
||||
Divider(height: 40, thickness: 8, color: const Color(0xffefefef)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
customLabel(LocaleKeys.profile_profileCompletionPer.tr() + ' 75%', 18, Colors.black, true),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
for (var i = 0; i < 4; i++)
|
||||
if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef)))
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
LocaleKeys.profile_completeProfile.tr(),
|
||||
style: TextStyle(color: Color(0xff2BB8A6), fontWeight: FontWeight.bold, decoration: TextDecoration.underline),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
/// description
|
||||
Divider(height: 50, thickness: 8, color: const Color(0xffefefef)),
|
||||
|
||||
Column(
|
||||
children: menu.map((i) => rowItem(i, context)).toList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget drawSlider(color) {
|
||||
return Row(children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
height: 6,
|
||||
width: 20,
|
||||
color: color,
|
||||
),
|
||||
)),
|
||||
Container(height: 6, width: 3, color: Colors.white),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget rowItem(obj, context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
//if (obj.dynamicUrl == '') {
|
||||
Navigator.pushNamed(context, obj.route);
|
||||
// } else {
|
||||
// Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, arguments: DynamicListViewParams(obj.name, obj.functionName, uRL: obj.dynamicUrl, requestID: obj.requestID));
|
||||
//}
|
||||
},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset('assets/images/' + obj.icon),
|
||||
title: Text(obj.name),
|
||||
trailing: Icon(Icons.arrow_forward),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget customLabel(String label, double size, Color color, bool isBold, {double padding = 0.0}) => Container(
|
||||
padding: EdgeInsets.all(padding),
|
||||
// height: 50,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [Text(label, style: TextStyle(color: color, fontSize: size, fontWeight: isBold ? FontWeight.bold : FontWeight.normal))]));
|
||||
}
|
||||
|
||||
GetMenuEntriesList getMenuEntries(String type) {
|
||||
List<GetMenuEntriesList> data = _ProfileInFoState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList();
|
||||
if (data.isNotEmpty) {
|
||||
return data[0];
|
||||
} else {
|
||||
return GetMenuEntriesList();
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
|
||||
import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_info.dart';
|
||||
|
||||
class ProfilePanle extends StatelessWidget {
|
||||
ProfilePanle(this.memberInformationList);
|
||||
|
||||
late MemberInformationListModel memberInformationList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double _width = MediaQuery.of(context).size.width;
|
||||
return Container(
|
||||
margin: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
width: _width,
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
padding: EdgeInsets.only(top: 50),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
|
||||
boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)],
|
||||
),
|
||||
child: ProfileInFo(memberInformationList),
|
||||
),
|
||||
Container(height: 100, alignment: Alignment.center, child: ProfileImage())
|
||||
]));
|
||||
}
|
||||
|
||||
Widget ProfileImage() => CircleAvatar(
|
||||
radius: 70,
|
||||
backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,224 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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/utils.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/get_action_history_list_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/widgets/button/default_button.dart';
|
||||
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
|
||||
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
|
||||
|
||||
class SearchEmployeeBottomSheet extends StatefulWidget {
|
||||
int? notificationID;
|
||||
String title, apiMode;
|
||||
List<GetActionHistoryList>? actionHistoryList;
|
||||
Function(ReplacementList) onSelectEmployee;
|
||||
|
||||
SearchEmployeeBottomSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, required this.onSelectEmployee});
|
||||
|
||||
@override
|
||||
State<SearchEmployeeBottomSheet> createState() => _SearchEmployeeBottomSheetState();
|
||||
}
|
||||
|
||||
class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
|
||||
TextEditingController username = TextEditingController();
|
||||
String searchText = "";
|
||||
|
||||
List<String>? optionsList = [
|
||||
LocaleKeys.fullName.tr(),
|
||||
LocaleKeys.username.tr(),
|
||||
LocaleKeys.endDate.tr(),
|
||||
];
|
||||
List<GetFavoriteReplacements>? favUsersList;
|
||||
|
||||
List<ReplacementList>? replacementList;
|
||||
List<ReplacementList>? favouriteUserList;
|
||||
List<ReplacementList>? nonFavouriteUserList;
|
||||
|
||||
int _selectedSearchIndex = 0;
|
||||
|
||||
void fetchUserByInput({bool isNeedLoading = true}) async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
replacementList = await WorkListApiClient().searchUserByInput(
|
||||
userName: _selectedSearchIndex == 0 ? searchText : "",
|
||||
userId: _selectedSearchIndex == 1 ? searchText : "",
|
||||
email: _selectedSearchIndex == 2 ? searchText : "",
|
||||
);
|
||||
favouriteUserList = replacementList?.where((element) => element.isFavorite ?? false).toList();
|
||||
nonFavouriteUserList = replacementList?.where((element) => !(element.isFavorite ?? false)).toList();
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(e, context, null);
|
||||
}
|
||||
|
||||
if (isNeedLoading) Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height - 100,
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
widget.title.toText24(isBold: true),
|
||||
21.height,
|
||||
"Search".toText16(),
|
||||
11.height,
|
||||
Row(
|
||||
children: [
|
||||
radioOption("Name", 0, _selectedSearchIndex),
|
||||
radioOption("User Name", 1, _selectedSearchIndex),
|
||||
radioOption("Email", 2, _selectedSearchIndex),
|
||||
],
|
||||
),
|
||||
14.height,
|
||||
Row(
|
||||
children: [
|
||||
DynamicTextFieldWidget(
|
||||
"Search",
|
||||
"Search By Username",
|
||||
inputAction: TextInputAction.done,
|
||||
suffixIconData: Icons.search,
|
||||
onChange: (text) {
|
||||
searchText = text;
|
||||
setState(() {});
|
||||
},
|
||||
).expanded,
|
||||
IconButton(
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () async {
|
||||
await SystemChannels.textInput.invokeMethod('TextInput.hide');
|
||||
fetchUserByInput();
|
||||
},
|
||||
icon: Icon(Icons.search))
|
||||
],
|
||||
),
|
||||
if (replacementList != null)
|
||||
replacementList!.isEmpty
|
||||
? Utils.getNoDataWidget(context).expanded
|
||||
: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 21, bottom: 8),
|
||||
children: [
|
||||
if (favouriteUserList?.isNotEmpty ?? false) ...[
|
||||
"Favorites".toText16(),
|
||||
12.height,
|
||||
ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]),
|
||||
separatorBuilder: (cxt, index) => Container(
|
||||
height: 1,
|
||||
color: MyColors.borderE3Color,
|
||||
),
|
||||
itemCount: favouriteUserList?.length ?? 0),
|
||||
12.height,
|
||||
],
|
||||
if (nonFavouriteUserList?.isNotEmpty ?? false) ...[
|
||||
"Related".toText16(),
|
||||
12.height,
|
||||
ListView.separated(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]),
|
||||
separatorBuilder: (cxt, index) => Container(
|
||||
height: 1,
|
||||
color: MyColors.borderE3Color,
|
||||
),
|
||||
itemCount: nonFavouriteUserList?.length ?? 0),
|
||||
]
|
||||
],
|
||||
).expanded
|
||||
],
|
||||
).paddingOnly(left: 21, right: 21, bottom: 0, top: 21).expanded,
|
||||
Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
|
||||
DefaultButton(
|
||||
LocaleKeys.cancel.tr(),
|
||||
() {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
textColor: MyColors.grey3AColor,
|
||||
colors: const [
|
||||
Color(0xffE6E6E6),
|
||||
Color(0xffE6E6E6),
|
||||
],
|
||||
).insideContainer
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget employeeItemView(ReplacementList replacement) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
widget.onSelectEmployee(replacement);
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
child: Row(
|
||||
children: [
|
||||
CircularAvatar(
|
||||
url: replacement.employeeImage ?? "",
|
||||
height: 30,
|
||||
width: 30,
|
||||
isImageBase64: true,
|
||||
),
|
||||
16.width,
|
||||
Expanded(
|
||||
child: (replacement.employeeDisplayName ?? "").toText12(),
|
||||
),
|
||||
Icon(Icons.star, size: 16, color: replacement.isFavorite! ? MyColors.yellowFavColor : MyColors.borderCEColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget radioOption(String title, int value, int groupValue) {
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(color: MyColors.borderColor, width: 1),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||
),
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: value == groupValue ? MyColors.grey3AColor : Colors.transparent,
|
||||
borderRadius: BorderRadius.all(const Radius.circular(100)),
|
||||
),
|
||||
),
|
||||
),
|
||||
9.width,
|
||||
title.toText12(color: MyColors.grey57Color)
|
||||
],
|
||||
).onPress(() {
|
||||
_selectedSearchIndex = value;
|
||||
setState(() {});
|
||||
}).expanded;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue