You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
289 lines
10 KiB
Dart
289 lines
10 KiB
Dart
import 'package:easy_localization/src/public_ext.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/api/profile_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/models/get_employee_basic_details.model.dart';
|
|
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
|
|
|
|
class Profile extends StatefulWidget {
|
|
const Profile({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_ProfileState createState() => _ProfileState();
|
|
}
|
|
|
|
class _ProfileState extends State<Profile> {
|
|
String? fullName = "";
|
|
String? maritalStatus = "";
|
|
String? birthDate = "";
|
|
String? civilIdentityNumber = "";
|
|
String? emailAddress = "";
|
|
String? employeeNo = "";
|
|
|
|
List<GetEmployeeBasicDetailsList> getEmployeeBasicDetailsList = [];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
getEmployeeBasicDetails();
|
|
basicDetails();
|
|
}
|
|
|
|
void getEmployeeBasicDetails() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
getEmployeeBasicDetailsList = await ProfileApiClient().getEmployeeBasicDetails();
|
|
Utils.hideLoading(context);
|
|
basicDetails();
|
|
print("getEmployeeBasicDetailsList.length");
|
|
print(getEmployeeBasicDetailsList.length);
|
|
setState(() {});
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
|
|
basicDetails() {
|
|
for (int i = 0; i < getEmployeeBasicDetailsList.length; i++) {
|
|
if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'FULL_NAME') {
|
|
fullName = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'MARITAL_STATUS') {
|
|
maritalStatus = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'DATE_OF_BIRTH') {
|
|
birthDate = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'NATIONAL_IDENTIFIER') {
|
|
civilIdentityNumber = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMAIL_ADDRESS') {
|
|
emailAddress = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMPLOYEE_NUMBER') {
|
|
employeeNo = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
|
|
}
|
|
}
|
|
}
|
|
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: MyColors.lightGreenColor,
|
|
leading: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
IconButton(
|
|
icon: const Icon(
|
|
Icons.arrow_back_ios,
|
|
color: MyColors.backgroundBlackColor,
|
|
),
|
|
onPressed: () => Navigator.pop(context),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
backgroundColor: MyColors.lightGreenColor,
|
|
body: Stack(children: [
|
|
Align(
|
|
alignment: Alignment.topRight,
|
|
child: Container(
|
|
height: 30,
|
|
width: 80,
|
|
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5, bottom: 5),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: MyColors.gradiantEndColor,
|
|
style: BorderStyle.solid,
|
|
),
|
|
color: MyColors.gradiantEndColor,
|
|
borderRadius: BorderRadius.circular(100.0)),
|
|
child: InkWell(
|
|
onTap: () {},
|
|
child: RichText(
|
|
text: TextSpan(
|
|
children: [
|
|
WidgetSpan(
|
|
child: Icon(
|
|
Icons.image,
|
|
size: 20,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: " Edit",
|
|
),
|
|
],
|
|
),
|
|
),
|
|
)),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(top: 48),
|
|
height: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0)),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
"${fullName}".toText20(isBold: true, color: MyColors.blackColor),
|
|
"${employeeNo}".toText12(isBold: false, color: MyColors.lightGrayColor),
|
|
"${emailAddress}".toText12(isBold: false, color: MyColors.black),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Divider(
|
|
color: MyColors.lightGreyE6Color,
|
|
height: 20,
|
|
thickness: 8,
|
|
indent: 0,
|
|
endIndent: 0,
|
|
),
|
|
|
|
Container(
|
|
padding: EdgeInsets.only(left: 10.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
InkWell(
|
|
onTap: () {
|
|
|
|
},
|
|
child: Row(
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
width: 15,
|
|
),
|
|
"Personal Information".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
|
|
},
|
|
child: Row(
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
width: 15,
|
|
),
|
|
"Basic Details".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
|
|
},
|
|
child: Row(
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
"Contact Details".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
|
|
},
|
|
child: Row(
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
"Family Members".toText16(isBold: true, color: MyColors.grey3AColor),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
).paddingOnly( top: 35, bottom: 36),
|
|
),
|
|
Align(
|
|
alignment: Alignment.topCenter,
|
|
child: SizedBox(
|
|
child: CircleAvatar(
|
|
radius: 40.0,
|
|
backgroundColor: Colors.white,
|
|
child: CircleAvatar(
|
|
child: Align(
|
|
alignment: Alignment.bottomRight,
|
|
// child: CircleAvatar(
|
|
// backgroundColor: Colors.white,
|
|
// radius: 12.0,
|
|
// child: Icon(
|
|
// Icons.camera_alt,
|
|
// size: 15.0,
|
|
// color: Color(0xFF404040),
|
|
// ),
|
|
// ),
|
|
),
|
|
radius: 38.0,
|
|
// url:"",
|
|
),
|
|
),
|
|
)),
|
|
])
|
|
// Container(
|
|
// margin: const EdgeInsets.only(top:50),
|
|
// decoration: const BoxDecoration(
|
|
// color: Colors.white,
|
|
// borderRadius: BorderRadius.only(
|
|
// topLeft: Radius.circular(30.0),
|
|
// topRight: Radius.circular(30.0))
|
|
// ),
|
|
// // color: MyColors.white,
|
|
// child: Stack(
|
|
// children: [
|
|
// Container(
|
|
// height: 30,
|
|
// color: MyColors.lightGreenColor,
|
|
// margin: const EdgeInsets.only(bottom: 20,),
|
|
// child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
// children: [
|
|
// CircleAvatar(
|
|
// backgroundColor: Colors.grey.shade800,
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ListView(
|
|
// scrollDirection: Axis.vertical,
|
|
// children: [
|
|
// Column(
|
|
// children: [
|
|
// // 20.height,
|
|
// ],
|
|
// )
|
|
// ],
|
|
// ),
|
|
// ]
|
|
// ),
|
|
// ),
|
|
);
|
|
}
|
|
}
|