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.
155 lines
5.9 KiB
Dart
155 lines
5.9 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/generated/locale_keys.g.dart';
|
|
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
|
|
import 'package:mohem_flutter_app/ui/profile/profile.dart';
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
|
|
class BasicDetails extends StatefulWidget {
|
|
const BasicDetails({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_BasicDetailsState createState() => _BasicDetailsState();
|
|
}
|
|
|
|
class _BasicDetailsState extends State<BasicDetails> {
|
|
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: AppBarWidget(
|
|
context,
|
|
title: LocaleKeys.profile_basicDetails.tr(),
|
|
),
|
|
// appBar: AppBar(
|
|
// backgroundColor: MyColors.white,
|
|
// leading: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// IconButton(
|
|
// icon: const Icon(
|
|
// Icons.arrow_back_ios,
|
|
// color: MyColors.backgroundBlackColor,
|
|
// ),
|
|
// onPressed: () => Navigator.pop(context),
|
|
// ),
|
|
// "Basic Details".toText24(isBold: true, color: MyColors.blackColor),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
backgroundColor: MyColors.backgroundColor,
|
|
bottomSheet: footer(),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(top: 20, left: 21, right: 21,bottom: 20),
|
|
padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 5),
|
|
height: 280,
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 5,
|
|
blurRadius: 26,
|
|
offset: Offset(0, 3),
|
|
),
|
|
],
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
LocaleKeys.fullName.tr().toText13(color: MyColors.lightGrayColor),
|
|
"${fullName}".toText16(isBold: true, color: MyColors.blackColor),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
LocaleKeys.maritalStatus.tr().toText13(color: MyColors.lightGrayColor),
|
|
"${maritalStatus}".toText16(isBold: true, color: MyColors.blackColor),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
LocaleKeys.dateOfBirth.tr().toText13(color: MyColors.lightGrayColor),
|
|
"${birthDate}".toText16(isBold: true, color: MyColors.blackColor),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
LocaleKeys.civilIdentityNumber.tr().toText13(color: MyColors.lightGrayColor),
|
|
"${civilIdentityNumber}".toText16(isBold: true, color: MyColors.blackColor),
|
|
]),
|
|
),
|
|
],
|
|
));
|
|
}
|
|
|
|
footer() {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(10),
|
|
color: MyColors.white,
|
|
boxShadow: [
|
|
BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3),
|
|
],
|
|
),
|
|
child: DefaultButton(LocaleKeys.update.tr(), () async {
|
|
// context.setLocale(const Locale("en", "US")); // to change Loacle
|
|
Profile();
|
|
}).insideContainer,
|
|
);
|
|
}
|
|
}
|