action colors added. contact details improvement

merge-requests/11/head
Sikander Saleem 2 years ago
parent f36606f603
commit bf7a18b91c

@ -84,24 +84,8 @@ class _ContactDetailsState extends State<ContactDetails> {
if (getEmployeePhonesList.isNotEmpty) if (getEmployeePhonesList.isNotEmpty)
Stack( Stack(
children: [ children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
menuEntriesPhone.updateButton == 'Y'
? IconButton(
icon: Icon(
Icons.edit_location_alt_outlined,
size: 20,
),
onPressed: () {
updatePhone();
},
)
: Container()
],
),
ListView.separated( ListView.separated(
physics: NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (cxt, index) => Column( itemBuilder: (cxt, index) => Column(
@ -113,38 +97,20 @@ class _ContactDetailsState extends State<ContactDetails> {
), ),
separatorBuilder: (cxt, index) => 12.height, separatorBuilder: (cxt, index) => 12.height,
itemCount: getEmployeePhonesList.length), itemCount: getEmployeePhonesList.length),
// Column( if (menuEntriesPhone.updateButton == 'Y')
// crossAxisAlignment: CrossAxisAlignment.start, Positioned(
// children: getEmployeePhonesList top: 1,
// .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ right: 1,
// "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), child: const Icon(Icons.edit_location_alt_outlined, size: 20).onPress(updatePhone),
// "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), ),
// ]))
// .toList())
], ],
).objectContainerView(), ).objectContainerView(),
12.height, 12.height,
if (getEmployeeAddressList.isNotEmpty) if (getEmployeeAddressList.isNotEmpty)
Stack( Stack(
children: [ children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
menuEntriesAddress.updateButton == 'Y'
? IconButton(
icon: Icon(
Icons.edit_location_alt_outlined,
size: 20,
),
onPressed: () {
addUpdateAddress();
},
)
: Container()
],
),
ListView.separated( ListView.separated(
physics: NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (cxt, index) => Column( itemBuilder: (cxt, index) => Column(
@ -156,14 +122,12 @@ class _ContactDetailsState extends State<ContactDetails> {
), ),
separatorBuilder: (cxt, index) => 12.height, separatorBuilder: (cxt, index) => 12.height,
itemCount: getEmployeeAddressList.length), itemCount: getEmployeeAddressList.length),
// Column( if (menuEntriesAddress.updateButton == 'Y')
// crossAxisAlignment: CrossAxisAlignment.start, Positioned(
// children: getEmployeeAddressList top: 1,
// .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ right: 1,
// "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), child: const Icon(Icons.edit_location_alt_outlined, size: 20).onPress(addUpdateAddress),
// "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), ),
// ]))
// .toList())
], ],
).objectContainerView() ).objectContainerView()
], ],

@ -4,6 +4,8 @@ import 'package:mohem_flutter_app/api/profile_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';
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/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
@ -26,6 +28,7 @@ class PhoneNumbers extends StatefulWidget {
class _PhoneNumbersState extends State<PhoneNumbers> { class _PhoneNumbersState extends State<PhoneNumbers> {
List<GetPhoneNumberTypesModel> getPhoneNumberTypesList = []; List<GetPhoneNumberTypesModel> getPhoneNumberTypesList = [];
SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList(); SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -46,129 +49,66 @@ class _PhoneNumbersState extends State<PhoneNumbers> {
title: LocaleKeys.profile_contactDetails.tr(), title: LocaleKeys.profile_contactDetails.tr(),
), ),
backgroundColor: MyColors.backgroundColor, backgroundColor: MyColors.backgroundColor,
bottomSheet: footer(), body: Column(
body: SingleChildScrollView( children: [
child: Column( ListView(
children: [ physics: const BouncingScrollPhysics(),
Container( padding: const EdgeInsets.all(21),
width: double.infinity, children: [
margin: EdgeInsets.only(left: 25, right: 25, top: 25), DefaultButton("+ ${LocaleKeys.addRow.tr()}", () {
padding: EdgeInsets.all(20), widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW'));
// height: 400, setState(() {});
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.0), border: Border.all(color: Color.fromARGB(255, 209, 207, 207))), }),
child: InkWell( 12.height,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ ListView.separated(
Icon( shrinkWrap: true,
Icons.add, physics: const NeverScrollableScrollPhysics(),
color: Color(0xff259CB8), itemBuilder: (cxt, index) {
), var element = widget.getEmployeePhonesList[index];
Text( return element.aCTION != 'DELETE_ROW'
LocaleKeys.addRow.tr(), ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
style: TextStyle(color: Color(0xff259CB8), fontWeight: FontWeight.bold), PopupMenuButton(
) child: DynamicTextFieldWidget(
]), LocaleKeys.selectTypeT.tr(),
onTap: () { element.pHONETYPEMEANING ?? LocaleKeys.pleaseSelect.tr(),
addNewRow(); isEnable: false,
}, isPopup: true,
), ).paddingOnly(bottom: 12),
), itemBuilder: (_) => <PopupMenuItem<int>>[
Column( for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem<int>(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i),
crossAxisAlignment: CrossAxisAlignment.start, ],
children: widget.getEmployeePhonesList onSelected: (int index) {
.map((e) => e.aCTION != 'DELETE_ROW' element.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING;
? Container( element.pHONETYPE = getPhoneNumberTypesList[index].cODE;
width: double.infinity, setState(() {});
margin: EdgeInsets.only( }),
top: 20, DynamicTextFieldWidget(
left: 26, "Value",
right: 26, element.pHONENUMBER ?? "",
), isReadOnly: false,
padding: EdgeInsets.only(left: 14, right: 14, top: 15, bottom: 15), onChange: (text) {
// height: 400, element.pHONENUMBER = text;
decoration: BoxDecoration( },
boxShadow: [ ).paddingOnly(bottom: 12),
BoxShadow( Row(mainAxisAlignment: MainAxisAlignment.end, children: [
color: Colors.grey.withOpacity(0.5), Icon(Icons.delete, color: MyColors.redColor, size: 18),
spreadRadius: 5, LocaleKeys.delete.tr().toText14(color: MyColors.redColor),
blurRadius: 26, ]).onPress(() {
offset: Offset(0, 3), element.aCTION = 'DELETE_ROW';
), setState(() {});
], }),
color: Colors.white, ]).objectContainerView().paddingOnly(bottom: 12)
borderRadius: BorderRadius.circular(10.0), : Container();
), },
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ separatorBuilder: (cxt, index) => 0.height,
PopupMenuButton( itemCount: widget.getEmployeePhonesList.length)
child: DynamicTextFieldWidget( ],
LocaleKeys.pleaseSelect.tr(), ).expanded,
e.pHONETYPEMEANING ?? "", DefaultButton(LocaleKeys.update.tr(), () async {
isEnable: false, updatePhone();
isPopup: true, }).insideContainer
).paddingOnly(bottom: 12),
itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem<int>(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i),
],
onSelected: (int index) {
e.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING;
e.pHONETYPE = getPhoneNumberTypesList[index].cODE;
setState(() {});
}),
DynamicTextFieldWidget(
"",
e.pHONENUMBER ?? "",
isReadOnly: false,
onChange: (text) {
e.pHONENUMBER = text;
},
).paddingOnly(bottom: 12),
InkWell(
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
Icon(
Icons.delete,
color: Colors.red,
size: 18,
),
Text(
LocaleKeys.delete.tr(),
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
)
]),
onTap: () {
// widget.getEmployeePhonesList.removeWhere((item) => item.pHONEID == e.pHONEID);
setState(() {
deleteRow(e);
});
},
),
SizedBox(
height: 10,
),
]))
: Container())
.toList()),
SizedBox(
height: 80,
)
],
),
),
);
}
Widget 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 {
updatePhone();
// context.setLocale(const Locale("en", "US")); // to change Loacle
// Profile();
}).insideContainer,
); );
} }
@ -176,7 +116,6 @@ class _PhoneNumbersState extends State<PhoneNumbers> {
Utils.showLoading(context); Utils.showLoading(context);
setUpdateStatus(); setUpdateStatus();
submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList); submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList);
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
arguments: RequestSubmitScreenParams(LocaleKeys.profile_contactDetails.tr(), submitPhoneNumbers.pTRANSACTIONID!, submitPhoneNumbers.pITEMKEY!, 'phone_numbers')); arguments: RequestSubmitScreenParams(LocaleKeys.profile_contactDetails.tr(), submitPhoneNumbers.pTRANSACTIONID!, submitPhoneNumbers.pITEMKEY!, 'phone_numbers'));
@ -191,14 +130,4 @@ class _PhoneNumbersState extends State<PhoneNumbers> {
} }
}); });
} }
void addNewRow() {
setState(() {
widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW'));
});
}
void deleteRow(GetEmployeePhonesList row) {
row.aCTION = 'DELETE_ROW';
}
} }

@ -115,9 +115,15 @@ class ActionsFragment extends StatelessWidget {
if (code == "SUBMIT") { if (code == "SUBMIT") {
return const Color(0xff2E303A); return const Color(0xff2E303A);
} else if (code == "REJECTED") { } else if (code == "REJECTED") {
return const Color(0xffD02127); return MyColors.redColor;
} else if (code == "REJECT") {
return MyColors.redColor;
} else if (code == "PENDING") {
return MyColors.orange;
} else if (code == "APPROVED") { } else if (code == "APPROVED") {
return const Color(0xff1FA269); return const Color(0xff1FA269);
} else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") {
return const Color(0xff1FA269);
} else if (code == "REQUEST_INFO") { } else if (code == "REQUEST_INFO") {
return const Color(0xff2E303A); return const Color(0xff2E303A);
} else { } else {

Loading…
Cancel
Save