CHANGE_ : GPA Changed to dynamic

This commit is contained in:
venbaittech 2024-08-05 11:59:57 +05:30
parent aca02073a4
commit 4e698ed887
3 changed files with 800 additions and 970 deletions

View File

@ -242,52 +242,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
} }
final response = await apiService.getGpaEmpPolicyDetailsToApi( final response = await apiService.getGpaEmpPolicyDetailsToApi(
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!); empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
if (response['status'] == 'success') {
if (response.containsKey('data')) {
gpaPolicies = response['data'];
print(gpaPolicies);
// Assuming data is a List
print(gpaPolicies);
if (gpaPolicies.isNotEmpty) {
setState(() {
// You can use gpaPolicies as needed
print('GPA Policies found: $gpaPolicies');
gpaPolicyName = gpaPolicies['Policy_Name'].toString();
print(gpaPolicyName);
gpaClintPolicyId = gpaPolicies['ClientPolicyId'].toString();
print(gpaClintPolicyId);
gpasumInsured = gpaPolicies['mapped_family_floaters']['data']
['basic_cover_si'];
print(gpasumInsured);
gpaMappedFamilyFloaters =
gpaPolicies['mapped_family_floaters']['data'];
print(gpaMappedFamilyFloaters);
gpaSelfName = gpaMappedFamilyFloaters['name'].toString() ?? '';
// gpaSelfMobileNo = gpaMappedFamilyFloaters['mobile'];
gpaSelfDob = gpaMappedFamilyFloaters['dob'].toString() ?? '';
gpaSelfRelationship =
gpaMappedFamilyFloaters['relationship'].toString() ?? '';
gpaSelfDetails = gpaSelfName +
' ~ ' +
gpaSelfRelationship +
' ~ ' +
' DOB : ' +
formatDate(gpaSelfDob);
gpaECardDownload = gpaPolicies['eCardDownload']; if (response['status'] == 'success') {
}); setState(() {
} else { gpaPolicies = response['data'];
setState(() { print('gpaPolicies');
gpaDataIsEmpty = 0; });
});
// ToastHelper.showWarningToast(context, 'Something went wrong');
print('No data found in the response');
}
} else {
// Handle other status messages if needed
// ToastHelper.showWarningToast(context, 'Something went wrong');
print('API request failed with status: ${response['status']}');
}
} else { } else {
setState(() { setState(() {
gpaDataIsEmpty = 0; gpaDataIsEmpty = 0;
@ -1796,197 +1756,12 @@ class _addOnsDetailsState extends State<addOnsDetails> {
), ),
SizedBox(height: 16), SizedBox(height: 16),
if (gpaPolicies != null && gpaPolicies.length > 0) if (gpaPolicies != null && gpaPolicies.length > 0)
Card( Column(
elevation: 0, crossAxisAlignment: CrossAxisAlignment.stretch,
color: Colors.white, children: [
child: Padding( ...generateGpaCards(gpaPolicies),
padding: Responsive.isDesktop(context) ],
? EdgeInsets.all(30) ),
: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(
0xFFFFF1DD), // Set background color for the container
borderRadius: BorderRadius.circular(
5), // Set border radius for the container
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 15,
bottom: 15,
left: 25,
right: 25)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 8,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
gpaPolicyName ?? '',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Row(
children: [
Text(
'Group Personal Accident Coverage',
textAlign:
TextAlign.left,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
if (gpaECardDownload !=
null)
GestureDetector(
onTap: () async {
// Convert the URL string to a Uri object
Uri uri = Uri.parse(
gpaECardDownload);
// Check if the URL is valid
if (await canLaunchUrl(
uri)) {
// Open the URL in the default browser
await launchUrl(
uri);
} else {
// Handle the case where the URL cannot be launched
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Icon(
Icons
.file_download,
color: Color(
0xFFE26728),
size: 25,
),
),
),
],
),
],
))),
Expanded(
flex: 4,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Text(
'${gpasumInsured != null ? gpasumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
],
))),
],
),
),
SizedBox(height: 15),
Container(
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 0,
bottom: 0,
left: 15,
right: 15)
: EdgeInsets.only(
top: 0, bottom: 0, left: 5, right: 5),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_right,
color: Color(
0xFFE26728)), // Arrow icon
SizedBox(
width: Responsive.isDesktop(
context)
? 10
: 5), // Space between icon and text
Expanded(
child: Text(
gpaSelfDetails ?? '',
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(
context)
? 18
: 16,
color: Color(0xFF232526),
),
),
),
],
),
],
),
),
],
),
)),
SizedBox(height: 16), SizedBox(height: 16),
if (gmcPolicies != null && gmcPolicies.length > 0) if (gmcPolicies != null && gmcPolicies.length > 0)
Column( Column(
@ -2098,12 +1873,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
fontSize: Responsive fontSize: Responsive
.isDesktop( .isDesktop(
context) context)
? 18 ? 20
: 14, : 16,
fontWeight:
FontWeight.w600,
), ),
), ),
Text( Text(
topUpTypeName ?? '', '',
textAlign: textAlign:
TextAlign.left, TextAlign.left,
style: GoogleFonts style: GoogleFonts
@ -2741,13 +2518,14 @@ class _addOnsDetailsState extends State<addOnsDetails> {
fontSize: Responsive fontSize: Responsive
.isDesktop( .isDesktop(
context) context)
? 18 ? 20
: 14, : 16,
fontWeight:
FontWeight.w600,
), ),
), ),
Text( Text(
topUpParentTypeName ?? '',
'',
textAlign: textAlign:
TextAlign.left, TextAlign.left,
style: GoogleFonts style: GoogleFonts
@ -2755,10 +2533,8 @@ class _addOnsDetailsState extends State<addOnsDetails> {
fontSize: Responsive fontSize: Responsive
.isDesktop( .isDesktop(
context) context)
? 20 ? 18
: 16, : 14,
fontWeight:
FontWeight.w600,
), ),
), ),
], ],
@ -4516,6 +4292,200 @@ class _addOnsDetailsState extends State<addOnsDetails> {
); );
} }
List<Widget> generateGpaCards(List<dynamic> data) {
List<Widget> cards = [];
for (var item in data) {
print('item');
print(item);
String? gpaPolicyName = item['Policy_Name'];
String? gpaECardDownload = item['eCardDownload'];
String? gpaSumInsured;
List<dynamic> gpaMappedFamilyFloaters = [];
if (item['mapped_family_floaters'] != null) {
gpaMappedFamilyFloaters = [item['mapped_family_floaters']];
}
dynamic getTrueObjects = gpaMappedFamilyFloaters
.where((element) => element['is_value_exist'] == true)
.toList();
if (getTrueObjects.length > 0) {
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
} else {
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
}
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
List<Widget> familyFloaterContainers = [];
for (var floater in gpaMappedFamilyFloaters) {
bool isValueExist = floater['is_value_exist'];
Map<String, dynamic> floaterData = floater['data'];
gpaSelfDetails = floaterData['name'] +
' ~ ' +
floaterData['relationship'] +
' ~ ' +
' DOB : ' +
formatDate(floaterData['dob']);
if (isValueExist) {
familyFloaterContainers.add(
Container(
padding: Responsive.isDesktop(context)
? EdgeInsets.only(top: 0, bottom: 0, left: 15, right: 15)
: EdgeInsets.only(top: 0, bottom: 0, left: 5, right: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_right,
color: Color(0xFFE26728)), // Arrow icon
SizedBox(
width: Responsive.isDesktop(context)
? 10
: 5), // Space between icon and text
Expanded(
child: Text(
gpaSelfDetails ?? '',
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) ? 18 : 16,
color: Color(0xFF232526),
),
),
),
],
),
],
),
),
);
}
familyFloaterContainers.add(SizedBox(height: 15));
}
Widget card = Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(0xFFFFF1DD),
borderRadius: BorderRadius.circular(5),
),
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 9,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 18 : 13,
),
),
Row(
children: [
Text(
gpaPolicyName ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
if (gpaECardDownload != null)
GestureDetector(
onTap: () async {
Uri uri = Uri.parse(gpaECardDownload);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: Icon(
Icons.file_download,
color: Color(0xFFE26728),
size: 25,
),
),
),
],
),
],
),
),
),
Expanded(
flex: 3,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 18 : 13,
),
),
Text(
'${gpaSumInsured != null ? gpaSumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
],
),
),
),
],
),
),
SizedBox(height: 10),
Column(
children: familyFloaterContainers,
),
],
),
),
);
cards.add(card);
}
return cards;
}
List<Widget> generateGmcCards(List<dynamic> data) { List<Widget> generateGmcCards(List<dynamic> data) {
List<Widget> cards = []; List<Widget> cards = [];
@ -4576,7 +4546,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 9,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
@ -4585,25 +4555,25 @@ class _addOnsDetailsState extends State<addOnsDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
gmcPolicyName ?? '', '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Row( Row(
children: [ children: [
Text( Text(
gmcTypeName ?? '', gmcPolicyName ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -4638,7 +4608,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
], ],
))), ))),
Expanded( Expanded(
flex: 4, flex: 3,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Column( child: Column(
@ -4652,7 +4622,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Text( Text(
@ -4662,7 +4632,7 @@ class _addOnsDetailsState extends State<addOnsDetails> {
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),

View File

@ -381,48 +381,14 @@ class _empDetailsState extends State<empDetails> {
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!); empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
if (response['status'] == 'success') { if (response['status'] == 'success') {
if (response.containsKey('data')) { setState(() {
gpaPolicies = response['data']; gpaPolicies = response['data'];
print('gpaPolicies'); print('gpaPolicies');
// Assuming data is a List });
print(gpaPolicies);
if (gpaPolicies.isNotEmpty) {
setState(() {
// You can use gpaPolicies as needed
print('GPA Policies found: $gpaPolicies');
gpaPolicyName = gpaPolicies['Policy_Name'].toString();
print(gpaPolicyName);
gpasumInsured = gpaPolicies['mapped_family_floaters']['data']
['basic_cover_si'];
print(gpasumInsured);
gpaMappedFamilyFloaters =
gpaPolicies['mapped_family_floaters']['data'];
print(gpaMappedFamilyFloaters);
gpaSelfName = gpaMappedFamilyFloaters['name'].toString();
// gpaSelfMobileNo = gpaMappedFamilyFloaters['mobile'];
gpaSelfDob = gpaMappedFamilyFloaters['dob'].toString();
gpaSelfRelationship =
gpaMappedFamilyFloaters['relationship'].toString();
gpaSelfDetails = gpaSelfRelationship + ' . ' + gpaSelfDob;
gpaOpenForEnrollment = gpaPolicies['OpenForEnrollment'];
gpaECardDownload = gpaPolicies['eCardDownload'];
});
} else {
setState(() {
gpaDataIsEmpty = 0;
});
// ToastHelper.showErrorToast(context, 'Something went wrong');
print('No data found in the response');
}
} else {
// Handle other status messages if needed
// ToastHelper.showErrorToast(context, 'Something went wrong');
print('API request failed with status: ${response['status']}');
}
} else { } else {
setState(() {
gpaDataIsEmpty = 0;
});
// Handle other status codes // Handle other status codes
ToastHelper.showWarningToast(context, 'Something went wrong'); ToastHelper.showWarningToast(context, 'Something went wrong');
print('Request failed with status: ${response['code']}'); print('Request failed with status: ${response['code']}');
@ -900,351 +866,12 @@ class _empDetailsState extends State<empDetails> {
), ),
SizedBox(height: 16), SizedBox(height: 16),
if (gpaPolicies != null && gpaPolicies.length > 0) if (gpaPolicies != null && gpaPolicies.length > 0)
Card( Column(
elevation: 0, crossAxisAlignment: CrossAxisAlignment.stretch,
color: Colors.white, children: [
child: Padding( ...generateGpaCards(gpaPolicies),
padding: Responsive.isDesktop(context) ],
? EdgeInsets.all(30) ),
: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(
0xFFFFF1DD), // Set background color for the container
borderRadius: BorderRadius.circular(
5), // Set border radius for the container
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 15,
bottom: 15,
left: 25,
right: 25)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 8,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
gpaPolicyName ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Row(
children: [
Text(
'Group Personal Accident Coverage ',
textAlign:
TextAlign.left,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
if (gpaECardDownload !=
null)
GestureDetector(
onTap: () async {
// Convert the URL string to a Uri object
Uri uri = Uri.parse(
gpaECardDownload);
// Check if the URL is valid
if (await canLaunchUrl(
uri)) {
// Open the URL in the default browser
await launchUrl(
uri);
} else {
// Handle the case where the URL cannot be launched
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Icon(
Icons
.file_download,
color: Color(
0xFFE26728),
size: 25,
),
),
),
],
),
],
))),
Expanded(
flex: 4,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Text(
'${gpasumInsured != null ? gpasumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
],
))),
],
),
),
SizedBox(height: 10),
// Container(
// padding: EdgeInsets.only(
// top: 0, bottom: 0, left: 10, right: 10),
// child: Text(
// 'This is a floater sum insured. A floater is a type ot sum insured that provides coverage to more than one member ot a tamily at the same time. Simply put, its a single insurance cover tor the entire family.',
// style: TextStyle(
// fontSize:
// Responsive.isDesktop(context) ? 14 : 11,
// color: Color(0xFF727272),
// )),
// ),
SizedBox(
height: Responsive.isDesktop(context)
? 15
: 15),
// Container(
// decoration: BoxDecoration(
// color: Color(
// 0xFFF9F9FB), // Set background color for the container
// borderRadius: BorderRadius.circular(
// 5), // Set border radius for the container
// ),
// padding: EdgeInsets.only(
// top: 15, bottom: 15, left: 25, right: 25),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Expanded(
// flex: 12,
// child: Container(
// alignment: Alignment.centerLeft,
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.start,
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// 'Please Note',
// textAlign: TextAlign.left,
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// ),
// ),
// Text(
// 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
// textAlign: TextAlign.left,
// style: TextStyle(
// fontSize: 18,
// ),
// ),
// ],
// ))),
// ],
// ),
// ),
Container(
decoration: BoxDecoration(
border: Border.all(
color:
Color(0xFF000000), // Set border color
width: 1, // Set border width
),
// Set background color for the container
borderRadius: BorderRadius.circular(
5), // Set border radius for the container
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 15,
bottom: 15,
left: 25,
right: 25)
: EdgeInsets.only(
top: 8,
bottom: 8,
left: 10,
right: 10),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: Responsive.isDesktop(context)
? 1
: 2,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
padding: Responsive
.isDesktop(context)
? EdgeInsets.all(10)
: EdgeInsets.all(
5), // Padding around the icon
decoration: BoxDecoration(
color: Color(
0xFF00989E), // Background color of the icon container
borderRadius:
BorderRadius.circular(
5), // Radius of the container
),
child: Icon(
Icons
.account_circle, // Icon data
color: Colors.white,
size:
32, // Color of the icon
),
),
],
))),
Expanded(
flex: Responsive.isDesktop(context)
? 9
: 8,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
gpaSelfName ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 16,
fontWeight:
FontWeight.w600,
),
),
Text(
gpaSelfDetails ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 16,
),
),
],
))),
Expanded(
flex: 2,
child: Container(
alignment: Alignment.topRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
MouseRegion(
cursor: SystemMouseCursors
.click,
child: GestureDetector(
onTap: () {
openSelfForm('View');
},
child: Text(
'View',
textAlign:
TextAlign.left,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 16
: 15,
color: Color(
0xFFE26728), // Add underline decoration
),
),
),
)
],
))),
],
),
),
],
),
)),
SizedBox(height: 16), SizedBox(height: 16),
if (gmcPolicies != null && gmcPolicies.length > 0) if (gmcPolicies != null && gmcPolicies.length > 0)
Column( Column(
@ -1995,6 +1622,262 @@ class _empDetailsState extends State<empDetails> {
); );
} }
List<Widget> generateGpaCards(List<dynamic> data) {
List<Widget> cards = [];
for (var item in data) {
print('item');
print(item);
String? gpaPolicyName = item['Policy_Name'];
String? gpaECardDownload = item['eCardDownload'];
String? gpaSumInsured;
List<dynamic> gpaMappedFamilyFloaters = [];
if (item['mapped_family_floaters'] != null) {
gpaMappedFamilyFloaters = [item['mapped_family_floaters']];
}
dynamic getTrueObjects = gpaMappedFamilyFloaters
.where((element) => element['is_value_exist'] == true)
.toList();
if (getTrueObjects.length > 0) {
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
} else {
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
}
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
List<Widget> familyFloaterContainers = [];
for (var floater in gpaMappedFamilyFloaters) {
bool isValueExist = floater['is_value_exist'];
Map<String, dynamic> floaterData = floater['data'];
if (isValueExist) {
familyFloaterContainers.add(Container(
decoration: BoxDecoration(
border: Border.all(
color: Color(0xFF000000),
width: 1,
),
borderRadius: BorderRadius.circular(5),
),
padding: Responsive.isDesktop(context)
? EdgeInsets.all(15)
: EdgeInsets.only(top: 8, bottom: 8, left: 10, right: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: Responsive.isDesktop(context) ? 1 : 2,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(10)
: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Color(0xFF00989E),
borderRadius: BorderRadius.circular(5),
),
child: Icon(
Icons.account_circle,
color: Colors.white,
size: 32,
),
),
],
),
),
),
Expanded(
flex: 8,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
floaterData['name'] ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) ? 18 : 16,
fontWeight: FontWeight.w600,
),
),
Text(
'${floaterData['relationship']} - ${floaterData['dob']}' ??
'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) ? 18 : 16,
),
),
],
),
),
),
Expanded(
flex: 2,
child: Container(
alignment: Alignment.topRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
openSelfForm('View');
},
child: Text(
'View',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 16 : 15,
color: Color(0xFFE26728),
),
),
),
)
],
),
),
),
],
),
));
}
familyFloaterContainers.add(SizedBox(height: 15));
}
Widget card = Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(0xFFFFF1DD),
borderRadius: BorderRadius.circular(5),
),
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 9,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 18 : 13,
),
),
Row(
children: [
Text(
gpaPolicyName ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
if (gpaECardDownload != null)
GestureDetector(
onTap: () async {
Uri uri = Uri.parse(gpaECardDownload);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: Icon(
Icons.file_download,
color: Color(0xFFE26728),
size: 25,
),
),
),
],
),
],
),
),
),
Expanded(
flex: 3,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 18 : 13,
),
),
Text(
'${gpaSumInsured != null ? gpaSumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
],
),
),
),
],
),
),
SizedBox(height: 10),
Column(
children: familyFloaterContainers,
),
],
),
),
);
cards.add(card);
}
return cards;
}
List<Widget> generateCards(List<dynamic> data) { List<Widget> generateCards(List<dynamic> data) {
List<Widget> cards = []; List<Widget> cards = [];
@ -2291,7 +2174,7 @@ class _empDetailsState extends State<empDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 9,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
@ -2299,24 +2182,24 @@ class _empDetailsState extends State<empDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
gmcPolicyName ?? 'NA', '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) fontSize: Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Row( Row(
children: [ children: [
Text( Text(
gmcTypeName ?? '', gmcPolicyName ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -2351,7 +2234,7 @@ class _empDetailsState extends State<empDetails> {
], ],
))), ))),
Expanded( Expanded(
flex: 4, flex: 3,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Column( child: Column(
@ -2364,7 +2247,7 @@ class _empDetailsState extends State<empDetails> {
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) fontSize: Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Text( Text(
@ -2373,7 +2256,7 @@ class _empDetailsState extends State<empDetails> {
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) fontSize: Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),

View File

@ -298,63 +298,18 @@ class _empReviewDetailsState extends State<empReviewDetails> {
} }
final response = await apiService.getGpaEmpPolicyDetailsToApi( final response = await apiService.getGpaEmpPolicyDetailsToApi(
empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!); empPrimaryId, empCodeString!, client_id!, 'GPA', empClientBranchId!);
if (response['status'] == 'success') { if (response['status'] == 'success') {
if (response.containsKey('data')) { setState(() {
gpaPolicies = response['data']; gpaPolicies = response['data'];
print(gpaPolicies); print('gpaPolicies');
// Assuming data is a List });
print(gpaPolicies);
if (gpaPolicies.isNotEmpty) {
setState(() {
// You can use gpaPolicies as needed
print('GPA Policies found: $gpaPolicies');
gpaPolicyName = gpaPolicies['Policy_Name'];
print(gpaPolicyName);
gpasumInsured = gpaPolicies['mapped_family_floaters']['data']
['basic_cover_si'];
print(gpasumInsured);
gpaMappedFamilyFloaters =
gpaPolicies['mapped_family_floaters']['data'];
print(gpaMappedFamilyFloaters);
gpaSelfName = gpaMappedFamilyFloaters['name'];
// gpaSelfMobileNo = gpaMappedFamilyFloaters['mobile'];
gpaSelfDob = gpaMappedFamilyFloaters['dob'];
gpaSelfRelationship = gpaMappedFamilyFloaters['relationship'];
gpaSelfDetails = gpaSelfName +
' ~ ' +
gpaSelfRelationship +
' ~ ' +
' DOB : ' +
formatDate(gpaSelfDob);
// gpaGridMaster = await gpaPolicies[0]['GridMaster'];
// gpaSlabRates = await gpaPolicies[0]['SlabRates'];
gpaClintPolicyId = gpaPolicies['ClientPolicyId'];
gpaECardDownload = gpaPolicies['eCardDownload'];
// gpaSelectedSI =
// gpaMappedFamilyFloaters['basic_cover_si'].toString();
});
} else {
setState(() {
gpaDataIsEmpty = 0;
});
// ToastHelper.showWarningToast(context, 'No data found');
print('No data found in the response');
}
} else {
// Handle other status messages if needed
// ToastHelper.showWarningToast(context, 'Something went wrong');
print('API request failed with status: ${response['status']}');
}
} else { } else {
setState(() { setState(() {
gpaDataIsEmpty = 0; gpaDataIsEmpty = 0;
}); });
// Handle other status codes // Handle other status codes
// ToastHelper.showErrorToast(context, 'Something went wrong'); ToastHelper.showWarningToast(context, 'Something went wrong');
print('Request failed with status: ${response['code']}'); print('Request failed with status: ${response['code']}');
} }
} catch (e) { } catch (e) {
@ -1010,196 +965,12 @@ class _empReviewDetailsState extends State<empReviewDetails> {
), ),
SizedBox(height: 16), SizedBox(height: 16),
if (gpaPolicies != null && gpaPolicies.length > 0) if (gpaPolicies != null && gpaPolicies.length > 0)
Card( Column(
elevation: 0, crossAxisAlignment: CrossAxisAlignment.stretch,
child: Padding( children: [
padding: Responsive.isDesktop(context) ...generateGpaCards(gpaPolicies),
? EdgeInsets.all(30) ],
: EdgeInsets.all(10), ),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(
0xFFFFF1DD), // Set background color for the container
borderRadius: BorderRadius.circular(
5), // Set border radius for the container
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 15,
bottom: 15,
left: 25,
right: 25)
: EdgeInsets.only(
top: 10,
bottom: 10,
left: 10,
right: 10),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 8,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
gpaPolicyName ?? '',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Row(
children: [
Text(
'Group Personal Accident Coverage',
textAlign:
TextAlign.left,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
if (gpaECardDownload !=
null)
GestureDetector(
onTap: () async {
// Convert the URL string to a Uri object
Uri uri = Uri.parse(
gpaECardDownload);
// Check if the URL is valid
if (await canLaunchUrl(
uri)) {
// Open the URL in the default browser
await launchUrl(
uri);
} else {
// Handle the case where the URL cannot be launched
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Icon(
Icons
.file_download,
color: Color(
0xFFE26728),
size: 25,
),
),
),
],
),
],
))),
Expanded(
flex: 4,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 14,
),
),
Text(
'${gpasumInsured != null ? gpasumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
),
),
],
))),
],
),
),
SizedBox(height: 15),
Container(
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 0,
bottom: 0,
left: 15,
right: 15)
: EdgeInsets.only(
top: 0, bottom: 0, left: 5, right: 5),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_right,
color: Color(
0xFFE26728)), // Arrow icon
SizedBox(
width: Responsive.isDesktop(
context)
? 10
: 5), // Space between icon and text
Expanded(
child: Text(
gpaSelfDetails ?? '',
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(
context)
? 18
: 16,
color: Color(0xFF232526),
),
),
),
],
),
],
),
),
],
),
)),
SizedBox(height: 16), SizedBox(height: 16),
if (gmcPolicies != null && gmcPolicies.length > 0) if (gmcPolicies != null && gmcPolicies.length > 0)
Column( Column(
@ -1277,7 +1048,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 9,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
@ -1287,20 +1058,20 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
topUpPolicyName ?? '', '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Row( Row(
children: [ children: [
Text( Text(
'Group Medical Coverage - Top Up', topUpPolicyName ?? '',
textAlign: textAlign:
TextAlign.left, TextAlign.left,
style: style:
@ -1309,7 +1080,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
.isDesktop( .isDesktop(
context) context)
? 20 ? 20
: 16, : 14,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ),
@ -1352,7 +1123,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
], ],
))), ))),
Expanded( Expanded(
flex: 4, flex: 3,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Column( child: Column(
@ -1370,7 +1141,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Text( Text(
@ -1381,7 +1152,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 20 ? 20
: 16, : 14,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ),
@ -1512,7 +1283,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 9,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
@ -1522,73 +1293,83 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
topUpParentPolicyName ?? '', '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Row( Container(
children: [ // padding: EdgeInsets.all(8.0),
Text( child: Row(
topUpParentTypeName ?? children: [
'', Flexible(
textAlign: child: Text(
TextAlign.left, topUpParentPolicyName ??
style: '',
GoogleFonts.poppins( textAlign:
fontSize: Responsive TextAlign.left,
.isDesktop( style: GoogleFonts
context) .poppins(
? 20 fontSize: Responsive
: 16, .isDesktop(
fontWeight: context)
FontWeight.w600, ? 20
), : 14,
), fontWeight:
if (topUpParentECardDownload != FontWeight
null) .w600,
GestureDetector(
onTap: () async {
// Convert the URL string to a Uri object
Uri uri = Uri.parse(
topUpParentECardDownload);
// Check if the URL is valid
if (await canLaunchUrl(
uri)) {
// Open the URL in the default browser
await launchUrl(
uri);
} else {
// Handle the case where the URL cannot be launched
print(
'Could not launch $topUpParentECardDownload');
}
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Icon(
Icons
.file_download,
color: Color(
0xFFE26728),
size: 25,
), ),
softWrap: true,
overflow:
TextOverflow
.visible,
), ),
), ),
], if (topUpParentECardDownload !=
), null)
GestureDetector(
onTap: () async {
// Convert the URL string to a Uri object
Uri uri = Uri.parse(
topUpParentECardDownload);
// Check if the URL is valid
if (await canLaunchUrl(
uri)) {
// Open the URL in the default browser
await launchUrl(
uri);
} else {
// Handle the case where the URL cannot be launched
print(
'Could not launch $topUpParentECardDownload');
}
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Icon(
Icons
.file_download,
color: Color(
0xFFE26728),
size: 25,
),
),
),
],
),
)
], ],
))), ))),
Expanded( Expanded(
flex: 4, flex: 3,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Column( child: Column(
@ -1606,7 +1387,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Text( Text(
@ -1617,7 +1398,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 20 ? 20
: 16, : 14,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ),
@ -1760,8 +1541,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
addOnsDependentPolicyName ?? '',
'',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
@ -1774,7 +1554,8 @@ class _empReviewDetailsState extends State<empReviewDetails> {
Row( Row(
children: [ children: [
Text( Text(
'Group Medical Coverage - Dependent AddOns', addOnsDependentPolicyName ??
'',
textAlign: textAlign:
TextAlign.left, TextAlign.left,
style: style:
@ -2072,10 +1853,11 @@ class _empReviewDetailsState extends State<empReviewDetails> {
padding: padding:
EdgeInsets.all(8.0), EdgeInsets.all(8.0),
child: Text( child: Text(
Responsive.isDesktop( (Responsive.isDesktop(
context) context)
? topUpTypeName ? (topUpPolicyName ??
: 'GMC - Top Up', 'Default Top Up Name')
: 'GMC - Top Up'),
textAlign: textAlign:
TextAlign.start, TextAlign.start,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
@ -2157,10 +1939,11 @@ class _empReviewDetailsState extends State<empReviewDetails> {
padding: padding:
EdgeInsets.all(8.0), EdgeInsets.all(8.0),
child: Text( child: Text(
Responsive.isDesktop( (Responsive.isDesktop(
context) context)
? topUpParentTypeName ? (topUpParentPolicyName ??
: 'GMC - Parents Top Up', 'Default Parent Top Up Name')
: 'GMC - Parents Top Up'),
textAlign: textAlign:
TextAlign.start, TextAlign.start,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
@ -2244,8 +2027,9 @@ class _empReviewDetailsState extends State<empReviewDetails> {
child: Text( child: Text(
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 'Group Medical Coverage - Add Dependent' ? (addOnsDependentPolicyName ??
: 'GMC - Dependent ', 'Default Add Dependent Up Name')
: 'GMC - Dependent',
textAlign: textAlign:
TextAlign.start, TextAlign.start,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
@ -2540,6 +2324,199 @@ class _empReviewDetailsState extends State<empReviewDetails> {
} }
} }
List<Widget> generateGpaCards(List<dynamic> data) {
List<Widget> cards = [];
for (var item in data) {
print('item');
print(item);
String? gpaPolicyName = item['Policy_Name'];
String? gpaECardDownload = item['eCardDownload'];
String? gpaSumInsured;
List<dynamic> gpaMappedFamilyFloaters = [];
if (item['mapped_family_floaters'] != null) {
gpaMappedFamilyFloaters = [item['mapped_family_floaters']];
}
dynamic getTrueObjects = gpaMappedFamilyFloaters
.where((element) => element['is_value_exist'] == true)
.toList();
if (getTrueObjects.length > 0) {
gpaSumInsured = getTrueObjects[0]["data"]["basic_cover_si"];
} else {
gpaSumInsured = item['Policy_Terms']['sumInsured2'];
}
int gpaOpenForEnrollment = int.parse(item['OpenForEnrollment']);
List<Widget> familyFloaterContainers = [];
for (var floater in gpaMappedFamilyFloaters) {
bool isValueExist = floater['is_value_exist'];
Map<String, dynamic> floaterData = floater['data'];
gpaSelfDetails = floaterData['name'] +
' ~ ' +
floaterData['relationship'] +
' ~ ' +
' DOB : ' +
formatDate(floaterData['dob']);
if (isValueExist) {
familyFloaterContainers.add(
Container(
padding: Responsive.isDesktop(context)
? EdgeInsets.only(top: 0, bottom: 0, left: 15, right: 15)
: EdgeInsets.only(top: 0, bottom: 0, left: 5, right: 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.arrow_right,
color: Color(0xFFE26728)), // Arrow icon
SizedBox(
width: Responsive.isDesktop(context)
? 10
: 5), // Space between icon and text
Expanded(
child: Text(
gpaSelfDetails ?? '',
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) ? 18 : 16,
color: Color(0xFF232526),
),
),
),
],
),
],
),
),
);
}
familyFloaterContainers.add(SizedBox(height: 15));
}
Widget card = Card(
elevation: 0,
color: Colors.white,
child: Padding(
padding: Responsive.isDesktop(context)
? EdgeInsets.all(30)
: EdgeInsets.all(10),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Color(0xFFFFF1DD),
borderRadius: BorderRadius.circular(5),
),
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 9,
child: Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize: 13,
),
),
Row(
children: [
Text(
gpaPolicyName ?? 'NA',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
if (gpaECardDownload != null)
GestureDetector(
onTap: () async {
Uri uri = Uri.parse(gpaECardDownload);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
print(
'Could not launch $gpaECardDownload');
}
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: Icon(
Icons.file_download,
color: Color(0xFFE26728),
size: 25,
),
),
),
],
),
],
),
),
),
Expanded(
flex: 3,
child: Container(
alignment: Alignment.centerRight,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Sum Insured',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 18 : 13,
),
),
Text(
'${gpaSumInsured != null ? gpaSumInsured : 'NA'}',
textAlign: TextAlign.right,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context) ? 20 : 14,
fontWeight: FontWeight.w600,
),
),
],
),
),
),
],
),
),
SizedBox(height: 10),
Column(
children: familyFloaterContainers,
),
],
),
),
);
cards.add(card);
}
return cards;
}
List<Widget> generateGmcCards(List<dynamic> data) { List<Widget> generateGmcCards(List<dynamic> data) {
List<Widget> cards = []; List<Widget> cards = [];
@ -2600,7 +2577,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 8, flex: 9,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
@ -2609,25 +2586,25 @@ class _empReviewDetailsState extends State<empReviewDetails> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
gmcPolicyName ?? '', '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Row( Row(
children: [ children: [
Text( Text(
gmcTypeName ?? '', gmcPolicyName ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -2663,7 +2640,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
], ],
))), ))),
Expanded( Expanded(
flex: 4, flex: 3,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Column( child: Column(
@ -2677,7 +2654,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 18 ? 18
: 14, : 13,
), ),
), ),
Text( Text(
@ -2687,7 +2664,7 @@ class _empReviewDetailsState extends State<empReviewDetails> {
fontSize: fontSize:
Responsive.isDesktop(context) Responsive.isDesktop(context)
? 20 ? 20
: 16, : 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),