From f7edbd6a99fbf659418b6a39699e257e97c5dd28 Mon Sep 17 00:00:00 2001 From: Venba Date: Wed, 17 Jul 2024 15:43:12 +0530 Subject: [PATCH] CHANGE_ --- lib/pages/enrollment/addons.dart | 3722 +++++++++++++------------- lib/pages/enrollment/empDetails.dart | 1005 +++---- lib/pages/enrollment/empReview.dart | 3137 +++++++++++----------- lib/pages/postEnrollment/home.dart | 74 +- 4 files changed, 4166 insertions(+), 3772 deletions(-) diff --git a/lib/pages/enrollment/addons.dart b/lib/pages/enrollment/addons.dart index 3d51517..c158496 100644 --- a/lib/pages/enrollment/addons.dart +++ b/lib/pages/enrollment/addons.dart @@ -3,8 +3,10 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:nhance_app_pwa/pages/enrollment/service/api_service.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../../customAppBar/customFooter.dart'; import '../../customAppBar/enrollmentAppBar.dart'; import '../../customAppBar/responsive.dart'; +import '../../customAppBar/tabs.dart'; import '../../customAppBar/toastHelper.dart'; import 'package:jwt_decode/jwt_decode.dart'; import 'package:http/http.dart' as http; @@ -14,6 +16,8 @@ import 'dart:convert'; import 'package:intl/intl.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../postEnrollment/chatbot.dart'; + class addOnsDetails extends StatefulWidget { const addOnsDetails({Key? key}) : super(key: key); @@ -23,6 +27,7 @@ class addOnsDetails extends StatefulWidget { class _addOnsDetailsState extends State { late ApiService apiService; + bool isLoading = true; bool isChecked = false; bool _addOnsDependentSwitcher = false; // Declare the _isSwitched variable here @@ -128,6 +133,11 @@ class _addOnsDetailsState extends State { _memberNameController = TextEditingController(); _relationShipController = TextEditingController(); _loadToken(); + Future.delayed(Duration(seconds: 3), () { + setState(() { + isLoading = false; + }); + }); } @override @@ -1317,6 +1327,9 @@ class _addOnsDetailsState extends State { } Future sendAddOnAPI() async { + setState(() { + isLoading = true; + }); print('sendAddOnAPI'); if (gpaDataIsEmpty != 0) { iAgreeForAddOn.add(int.parse(gpaClintPolicyId)); @@ -1348,14 +1361,24 @@ class _addOnsDetailsState extends State { final response = await apiService.sendAddOnToAPI(apiParams); if (response['status'] == 'success') { + setState(() { + isLoading = false; + isChecked = false; + }); print('response.statusCode == 200'); ToastHelper.showSuccessToast(context, 'Saved Successfully...'); } else { + setState(() { + isLoading = false; + }); // Handle other status codes ToastHelper.showErrorToast(context, 'failed to save'); print('Request failed with status: ${response['code']}'); } } catch (e) { + setState(() { + isLoading = false; + }); // Handle exceptions print('Exception occurred: $e'); } @@ -1685,337 +1708,241 @@ class _addOnsDetailsState extends State { return Scaffold( appBar: CustomAppBar(), - body: SingleChildScrollView( - child: Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * - 0.2, // 30% of screen width as horizontal padding - vertical: MediaQuery.of(context).size.height * - 0.03, // 5% of screen height as vertical padding - ) - : EdgeInsets.all(10), - color: Color(0xFFEFF3F6), - child: Column( - children: [ - Card( - elevation: 0, - color: Colors.white, - child: Container( - width: double.infinity, - height: 75, - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 20, bottom: 20, left: 30, right: 30) - : EdgeInsets.only( - top: 12, - bottom: 12, - left: 10, - right: 10), // Add padding to the container - child: Row( - children: [ - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerLeft, - child: Image.network( - clientLogo ?? '', - width: 80, // Set the width here - height: 80, // Set the height here - loadingBuilder: (BuildContext context, - Widget child, - ImageChunkEvent? loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: CircularProgressIndicator( - value: loadingProgress.expectedTotalBytes != - null - ? loadingProgress - .cumulativeBytesLoaded / - loadingProgress.expectedTotalBytes! - : null, - ), - ); - }, - errorBuilder: (BuildContext context, Object error, - StackTrace? stackTrace) { - return Image.asset( - 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path - width: 80, - height: 80, - fit: BoxFit.cover, - ); - }, + body: Stack(children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * + 0.2, // 30% of screen width as horizontal padding + vertical: MediaQuery.of(context).size.height * + 0.03, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(10), + color: Color(0xFFEFF3F6), + child: Column( + children: [ + Card( + elevation: 0, + color: Colors.white, + child: Container( + width: double.infinity, + height: 75, + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 20, bottom: 20, left: 30, right: 30) + : EdgeInsets.only( + top: 12, + bottom: 12, + left: 10, + right: 10), // Add padding to the container + child: Row( + children: [ + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerLeft, + child: Image.network( + clientLogo ?? '', + width: 80, // Set the width here + height: 80, // Set the height here + loadingBuilder: (BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: CircularProgressIndicator( + value: + loadingProgress.expectedTotalBytes != + null + ? loadingProgress + .cumulativeBytesLoaded / + loadingProgress + .expectedTotalBytes! + : null, + ), + ); + }, + errorBuilder: (BuildContext context, + Object error, StackTrace? stackTrace) { + return Image.asset( + 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path + width: 80, + height: 80, + fit: BoxFit.cover, + ); + }, + ), ), ), - ), - Expanded( - flex: 9, - child: Text( - clientName ?? '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 20 : 18, - fontWeight: FontWeight.w600, + Expanded( + flex: 9, + child: Text( + clientName ?? '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 20 : 18, + fontWeight: FontWeight.w600, + ), ), - ), - ) - ], + ) + ], + ), ), ), - ), - SizedBox(height: 16), - if (gpaPolicies != null && gpaPolicies.length > 0) - 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), // 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, - ), + SizedBox(height: 16), + if (gpaPolicies != null && gpaPolicies.length > 0) + 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), // 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, ), - 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, - ), + ), + Row( + children: [ + Text( + 'Group Personal Accident Coverage', + textAlign: TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, ), ), - ], - ), - ], - ))), - 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, + 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, + ), + ), + ), + ], ), - ), - Text( - '₹ ${gpasumInsured != null ? gpasumInsured : 'NA'}', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 20 - : 16, - fontWeight: FontWeight.w600, + ], + ))), + 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, + ), ), - ), - ], - ))), - ], - ), - ), - 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), - if (gmcPolicies != null && gmcPolicies.length > 0) - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ...generateGmcCards(gmcPolicies), - ], - ), - SizedBox(height: 16), - if (addOnsDependentMappedFamilyFloatersDependent != null || - topUpMappedFamilyFloatersSi != null) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Add Ons', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( + Text( + '₹ ${gpasumInsured != null ? gpasumInsured : 'NA'}', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( fontSize: Responsive.isDesktop( context) ? 20 - : 18, + : 16, fontWeight: FontWeight.w600, - color: Color(0xFF181818)), - ), - Text( - 'Increase your medical cover for your family or add parents or parent in laws by paying additional premium', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 15, - color: Color(0xFF181818), + ), ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - if (topUpMappedFamilyFloatersSi != null) - Container( - decoration: BoxDecoration( - color: Color( - 0xFFDDF3FF), // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container + ], + ))), + ], ), + ), + SizedBox(height: 15), + Container( padding: Responsive.isDesktop(context) - ? EdgeInsets.all(25) - : EdgeInsets.all(10), + ? 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: [ @@ -2023,1232 +1950,100 @@ class _addOnsDetailsState extends State { 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( - flex: Responsive.isDesktop(context) - ? 6 - : 8, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - topUpPolicyName ?? '', - textAlign: TextAlign.left, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - topUpTypeName ?? '', - textAlign: TextAlign.left, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - ], - ))), - if (Responsive.isDesktop(context) && - _topUpSiSwitcher == true) - Expanded( - flex: 3, - child: Container( - width: 50, - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - IgnorePointer( - ignoring: (topUpOpenForEnrollment == - 0 || - (topUpOpenForEnrollment != - 0 && - topUpECardDownload != - null)), - child: - DropdownButtonFormField< - String>( - onChanged: (value) { - setState(() { - topUpSiSelectedSI = - value; - }); - topUpSiCalculation( - value); - // calculationForTopUpSiSumValue( - // 'Edit'); - }, - decoration: - InputDecoration( - border: - OutlineInputBorder(), - hintText: - 'Sum Insured', - labelText: - 'Sum Insured', - contentPadding: - EdgeInsets - .symmetric( - vertical: - 5, - horizontal: - 5), - ), - value: - topUpSiSelectedSI, - items: (topUpSlabRates ?? - []) - .map< - DropdownMenuItem< - String>>( - (addOn) { - return DropdownMenuItem< - String>( - value: addOn['si'] - .toString(), - child: Text( - '₹ ${addOn['si']}'), - ); - }).toList(), - ), - ) - ], - ))), - Expanded( - flex: 3, - child: Container( - alignment: - Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Switch( - value: _topUpSiSwitcher, - onChanged: (topUpOpenForEnrollment == - 0 || - (topUpOpenForEnrollment != - 0 && - topUpECardDownload != - null)) - ? null - : (value) { - setState(() { - _topUpSiSwitcher = - value; - // Add your logic here based on the toggle state - }); - }, - activeColor: Color( - 0xFFE26728), // Color when the switch is ON - inactiveTrackColor: Colors - .grey, // Color of the switch track when OFF - ), - ], - ))), + child: Text( + gpaSelfDetails ?? '', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + color: Color(0xFF232526), + ), + ), + ), ], ), - if (_topUpSiSwitcher == true) - SizedBox(height: 10), - if (!Responsive.isDesktop(context) && - _topUpSiSwitcher == true) - Row( - children: [ - Expanded( - flex: 12, - child: Container( - width: 50, - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - IgnorePointer( - ignoring: (topUpOpenForEnrollment == - 0 || - (topUpOpenForEnrollment != - 0 && - topUpECardDownload != - null)), - child: - DropdownButtonFormField< - String>( - onChanged: (value) { - setState(() { - topUpSiSelectedSI = - value; - }); - topUpSiCalculation( - value); - // calculationForTopUpSiSumValue( - // 'Edit'); - }, - decoration: - InputDecoration( - border: - OutlineInputBorder(), - hintText: - 'Sum Insured', - labelText: - 'Sum Insured', - contentPadding: - EdgeInsets - .symmetric( - vertical: - 5, - horizontal: - 5), - ), - value: - topUpSiSelectedSI, - items: (topUpSlabRates ?? - []) - .map< - DropdownMenuItem< - String>>( - (addOn) { - return DropdownMenuItem< - String>( - value: addOn['si'] - .toString(), - child: Text( - '₹ ${addOn['si']}'), - ); - }).toList(), - ), - ) - ], - ))), - ], - ), - if (_topUpSiSwitcher == true) - SizedBox(height: 10), - if (_topUpSiSwitcher == - true) // Add space between rows - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: - topUpMappedFamilyFloatersSi - .where((item) => - item[ - 'is_value_exist'] == - true) - .map((item) { - Map data = - item['data']; - String formattedDate = - formatDate(data['dob']); - return 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( - '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 16, - color: - Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ) - ], - ), - if (_topUpSiSwitcher == true) - SizedBox(height: 20), - if (Responsive.isDesktop(context) && - _topUpSiSwitcher == true) - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 5, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Additional Premium', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpSiPremiumValue != - null - ? '₹ $topUpSiPremiumValue/Year' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - Expanded( - flex: 2, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'GST', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpSiPremiumGst != - null - ? '₹ $topUpSiPremiumGst/-' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - Expanded( - flex: 5, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Total Payable', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpSiTotalAmt != null - ? '₹ $topUpSiTotalAmt/-' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - ], - ), - if (!Responsive.isDesktop(context) && - _topUpSiSwitcher == true) - Container( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Additional Premium', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpSiPremiumValue != - null - ? '₹ $topUpSiPremiumValue/Year' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'GST', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpSiPremiumGst != - null - ? '₹ $topUpSiPremiumGst/-' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Total Payable', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 5, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpSiTotalAmt != - null - ? '₹ $topUpSiTotalAmt/-' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), - ], - ), - ])) ], ), ), - SizedBox(height: 15), - if (topUpParentMappedFamilyFloatersSi != null) + ], + ), + )), + SizedBox(height: 16), + if (gmcPolicies != null && gmcPolicies.length > 0) + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...generateGmcCards(gmcPolicies), + ], + ), + SizedBox(height: 16), + if (addOnsDependentMappedFamilyFloatersDependent != null || + topUpMappedFamilyFloatersSi != null) + 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( - 0xFFDDF3FF), // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(25) - : EdgeInsets.all(10), - child: Column( + child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: Responsive.isDesktop(context) - ? 6 - : 8, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - topUpParentPolicyName ?? - '', - textAlign: TextAlign.left, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - topUpParentTypeName ?? '', - textAlign: TextAlign.left, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - ], - ))), - if (Responsive.isDesktop(context) && - _topUpParentSiSwitcher == true) - Expanded( - flex: 3, - child: Container( - width: 50, - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - IgnorePointer( - ignoring: (topUpParentOpenForEnrollment == - 0 || - (topUpParentOpenForEnrollment != - 0 && - topUpParentECardDownload != - null)), - child: - DropdownButtonFormField< - String>( - onChanged: (value) { - setState(() { - topUpParentSiSelectedSI = - value; - }); - topUpParentSiCalculation( - value); - // calculationForTopUpSiSumValue( - // 'Edit'); - }, - decoration: - InputDecoration( - border: - OutlineInputBorder(), - hintText: - 'Sum Insured', - labelText: - 'Sum Insured', - contentPadding: - EdgeInsets - .symmetric( - vertical: - 5, - horizontal: - 5), - ), - value: - topUpParentSiSelectedSI, - items: (topUpParentSlabRates ?? - []) - .map< - DropdownMenuItem< - String>>( - (addOn) { - return DropdownMenuItem< - String>( - value: addOn['si'] - .toString(), - child: Text( - '₹ ${addOn['si']}'), - ); - }).toList(), - ), - ) - ], - ))), - Expanded( - flex: 3, - child: Container( - alignment: - Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Switch( - value: - _topUpParentSiSwitcher, - onChanged: (topUpParentOpenForEnrollment == - 0 || - (topUpParentOpenForEnrollment != - 0 && - topUpParentECardDownload != - null)) - ? null - : (value) { - setState(() { - _topUpParentSiSwitcher = - value; - // Add your logic here based on the toggle state - }); - }, - activeColor: Color( - 0xFFE26728), // Color when the switch is ON - inactiveTrackColor: Colors - .grey, // Color of the switch track when OFF - ), - ], - ))), - ], - ), - if (_topUpParentSiSwitcher == true) - SizedBox(height: 10), - if (!Responsive.isDesktop(context) && - _topUpParentSiSwitcher == true) - Row( - children: [ - Expanded( - flex: 12, - child: Container( - width: 50, - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - IgnorePointer( - ignoring: (topUpParentOpenForEnrollment == - 0 || - (topUpParentOpenForEnrollment != - 0 && - topUpParentECardDownload != - null)), - child: - DropdownButtonFormField< - String>( - onChanged: (value) { - setState(() { - topUpParentSiSelectedSI = - value; - }); - topUpParentSiCalculation( - value); - // calculationForTopUpSiSumValue( - // 'Edit'); - }, - decoration: - InputDecoration( - border: - OutlineInputBorder(), - hintText: - 'Sum Insured', - labelText: - 'Sum Insured', - contentPadding: - EdgeInsets - .symmetric( - vertical: - 5, - horizontal: - 5), - ), - value: - topUpParentSiSelectedSI, - items: (topUpParentSlabRates ?? - []) - .map< - DropdownMenuItem< - String>>( - (addOn) { - return DropdownMenuItem< - String>( - value: addOn['si'] - .toString(), - child: Text( - '₹ ${addOn['si']}'), - ); - }).toList(), - ), - ) - ], - ))), - ], - ), - if (_topUpParentSiSwitcher == true) - SizedBox(height: 10), - if (_topUpParentSiSwitcher == - true) // Add space between rows - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: - topUpParentMappedFamilyFloatersSi - .where((item) => - item[ - 'is_value_exist'] == - true) - .map((item) { - Map data = - item['data']; - String formattedDate = - formatDate(data['dob']); - return 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( - '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 16, - color: - Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ) - ], - ), - if (_topUpParentSiSwitcher == true) - SizedBox(height: 20), - if (Responsive.isDesktop(context) && - _topUpParentSiSwitcher == true) - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 5, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Additional Premium', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpParentSiPremiumValue != - null - ? '₹ $topUpParentSiPremiumValue/Year' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - Expanded( - flex: 2, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'GST', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpParentSiPremiumGst != - null - ? '₹ $topUpParentSiPremiumGst/-' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - Expanded( - flex: 5, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Total Payable', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 20, - fontWeight: - FontWeight.w500, - ), - ), - Text( - topUpParentSiTotalAmt != - null - ? '₹ $topUpParentSiTotalAmt/-' - : 'N/A', - textAlign: - TextAlign.start, - style: - GoogleFonts.poppins( - fontSize: 18, - ), - ), - ], - ))), - ], - ), - if (!Responsive.isDesktop(context) && - _topUpParentSiSwitcher == true) - Container( - child: Column( + mainAxisAlignment: + MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Additional Premium', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpParentSiPremiumValue != - null - ? '₹ $topUpParentSiPremiumValue/Year' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), + Text( + 'Add Ons', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 20 + : 18, + fontWeight: + FontWeight.w600, + color: Color(0xFF181818)), + ), + Text( + 'Increase your medical cover for your family or add parents or parent in laws by paying additional premium', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 15, + color: Color(0xFF181818), + ), + ), ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'GST', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpParentSiPremiumGst != - null - ? '₹ $topUpParentSiPremiumGst/-' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment - .centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - 'Total Payable', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 18, - fontWeight: - FontWeight - .w500, - ), - ), - ], - ))), - Expanded( - flex: 5, - child: Container( - alignment: Alignment - .centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, - crossAxisAlignment: - CrossAxisAlignment - .center, - children: [ - Text( - topUpParentSiTotalAmt != - null - ? '₹ $topUpParentSiTotalAmt/-' - : 'N/A', - textAlign: - TextAlign - .start, - style: GoogleFonts - .poppins( - fontSize: 16, - ), - ), - ], - ))), - ], - ), - ])) + ))), ], ), ), - SizedBox(height: 15), - if (addOnsDependentMappedFamilyFloatersDependent != - null) - Container( + SizedBox(height: 15), + if (topUpMappedFamilyFloatersSi != null) + Container( decoration: BoxDecoration( color: Color( 0xFFDDF3FF), // Set background color for the container @@ -3259,6 +2054,8 @@ class _addOnsDetailsState extends State { ? EdgeInsets.all(25) : EdgeInsets.all(10), child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: @@ -3280,8 +2077,7 @@ class _addOnsDetailsState extends State { .start, children: [ Text( - addOnsDependentPolicyName ?? - '', + topUpPolicyName ?? '', textAlign: TextAlign.left, style: @@ -3294,7 +2090,7 @@ class _addOnsDetailsState extends State { ), ), Text( - 'Group Medical Coverage - Dependent AddOns', + topUpTypeName ?? '', textAlign: TextAlign.left, style: @@ -3311,7 +2107,7 @@ class _addOnsDetailsState extends State { ], ))), if (Responsive.isDesktop(context) && - _addOnsDependentSwitcher) + _topUpSiSwitcher == true) Expanded( flex: 3, child: Container( @@ -3326,23 +2122,23 @@ class _addOnsDetailsState extends State { .center, children: [ IgnorePointer( - ignoring: (addOnsDependentOpenForEnrollment == + ignoring: (topUpOpenForEnrollment == 0 || - (addOnsDependentOpenForEnrollment != + (topUpOpenForEnrollment != 0 && - addOnsDependentECardDownload != + topUpECardDownload != null)), child: DropdownButtonFormField< String>( onChanged: (value) { setState(() { - addOnsSelectedDependent = + topUpSiSelectedSI = value; }); - addOnsDependentCalculation( + topUpSiCalculation( value); - // calculationForDependentSumValue( + // calculationForTopUpSiSumValue( // 'Edit'); }, decoration: @@ -3361,8 +2157,8 @@ class _addOnsDetailsState extends State { 5), ), value: - addOnsSelectedDependent, - items: (addOnsDependentSlabRates ?? + topUpSiSelectedSI, + items: (topUpSlabRates ?? []) .map< DropdownMenuItem< @@ -3393,18 +2189,17 @@ class _addOnsDetailsState extends State { CrossAxisAlignment.end, children: [ Switch( - value: - _addOnsDependentSwitcher, - onChanged: (addOnsDependentOpenForEnrollment == + value: _topUpSiSwitcher, + onChanged: (topUpOpenForEnrollment == 0 || - (addOnsDependentOpenForEnrollment != + (topUpOpenForEnrollment != 0 && - addOnsDependentECardDownload != + topUpECardDownload != null)) ? null : (value) { setState(() { - _addOnsDependentSwitcher = + _topUpSiSwitcher = value; // Add your logic here based on the toggle state }); @@ -3418,14 +2213,14 @@ class _addOnsDetailsState extends State { ))), ], ), - if (_addOnsDependentSwitcher == true) + if (_topUpSiSwitcher == true) SizedBox(height: 10), if (!Responsive.isDesktop(context) && - _addOnsDependentSwitcher == true) + _topUpSiSwitcher == true) Row( children: [ Expanded( - flex: 3, + flex: 12, child: Container( width: 50, alignment: Alignment.center, @@ -3438,23 +2233,23 @@ class _addOnsDetailsState extends State { .center, children: [ IgnorePointer( - ignoring: (addOnsDependentOpenForEnrollment == + ignoring: (topUpOpenForEnrollment == 0 || - (addOnsDependentOpenForEnrollment != + (topUpOpenForEnrollment != 0 && - addOnsDependentECardDownload != + topUpECardDownload != null)), child: DropdownButtonFormField< String>( onChanged: (value) { setState(() { - addOnsSelectedDependent = + topUpSiSelectedSI = value; }); - addOnsDependentCalculation( + topUpSiCalculation( value); - // calculationForDependentSumValue( + // calculationForTopUpSiSumValue( // 'Edit'); }, decoration: @@ -3473,8 +2268,8 @@ class _addOnsDetailsState extends State { 5), ), value: - addOnsSelectedDependent, - items: (addOnsDependentSlabRates ?? + topUpSiSelectedSI, + items: (topUpSlabRates ?? []) .map< DropdownMenuItem< @@ -3495,15 +2290,70 @@ class _addOnsDetailsState extends State { ))), ], ), - SizedBox(height: 20), - if (_addOnsDependentSwitcher == true) - Column( - children: familyFloaterContainers, + if (_topUpSiSwitcher == true) + SizedBox(height: 10), + if (_topUpSiSwitcher == + true) // Add space between rows + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: + topUpMappedFamilyFloatersSi + .where((item) => + item[ + 'is_value_exist'] == + true) + .map((item) { + Map data = + item['data']; + String formattedDate = + formatDate(data['dob']); + return 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( + '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', + style: GoogleFonts + .poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 16, + color: Color( + 0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ) + ], ), - if (_addOnsDependentSwitcher) + if (_topUpSiSwitcher == true) SizedBox(height: 20), if (Responsive.isDesktop(context) && - _addOnsDependentSwitcher) + _topUpSiSwitcher == true) Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -3532,9 +2382,9 @@ class _addOnsDetailsState extends State { ), ), Text( - addOnDependentPremiumValue != + topUpSiPremiumValue != null - ? '₹ $addOnDependentPremiumValue/Year' + ? '₹ $topUpSiPremiumValue/Year' : 'N/A', textAlign: TextAlign.start, @@ -3569,9 +2419,9 @@ class _addOnsDetailsState extends State { ), ), Text( - addOnsDependentPremiumGst != + topUpSiPremiumGst != null - ? '₹ $addOnsDependentPremiumGst/-' + ? '₹ $topUpSiPremiumGst/-' : 'N/A', textAlign: TextAlign.start, @@ -3606,9 +2456,9 @@ class _addOnsDetailsState extends State { ), ), Text( - addOnsDependentTotalAmt != + topUpSiTotalAmt != null - ? '₹ $addOnsDependentTotalAmt/-' + ? '₹ $topUpSiTotalAmt/-' : 'N/A', textAlign: TextAlign.start, @@ -3622,7 +2472,7 @@ class _addOnsDetailsState extends State { ], ), if (!Responsive.isDesktop(context) && - _addOnsDependentSwitcher == true) + _topUpSiSwitcher == true) Container( child: Column( crossAxisAlignment: @@ -3675,9 +2525,9 @@ class _addOnsDetailsState extends State { .center, children: [ Text( - addOnDependentPremiumValue != + topUpSiPremiumValue != null - ? '₹ $addOnDependentPremiumValue/Year' + ? '₹ $topUpSiPremiumValue/Year' : 'N/A', textAlign: TextAlign @@ -3739,9 +2589,9 @@ class _addOnsDetailsState extends State { .center, children: [ Text( - addOnsDependentPremiumGst != + topUpSiPremiumGst != null - ? '₹ $addOnsDependentPremiumGst/-' + ? '₹ $topUpSiPremiumGst/-' : 'N/A', textAlign: TextAlign @@ -3803,9 +2653,9 @@ class _addOnsDetailsState extends State { .center, children: [ Text( - addOnsDependentTotalAmt != + topUpSiTotalAmt != null - ? '₹ $addOnsDependentTotalAmt/-' + ? '₹ $topUpSiTotalAmt/-' : 'N/A', textAlign: TextAlign @@ -3822,246 +2672,1536 @@ class _addOnsDetailsState extends State { ), ])) ], - )), - ], - ), - )), - SizedBox(height: 16), - if (addOnsDependentMappedFamilyFloatersDependent == null && - topUpMappedFamilyFloatersSi == null && - topUpParentMappedFamilyFloatersSi == null) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, + ), + ), + SizedBox(height: 15), + if (topUpParentMappedFamilyFloatersSi != null) + Container( + decoration: BoxDecoration( + color: Color( + 0xFFDDF3FF), // Set background color for the container + borderRadius: BorderRadius.circular( + 5), // Set border radius for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(25) + : EdgeInsets.all(10), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: + Responsive.isDesktop(context) + ? 6 + : 8, + child: Container( + alignment: + Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + topUpParentPolicyName ?? + '', + textAlign: + TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + topUpParentTypeName ?? + '', + textAlign: + TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + ], + ))), + if (Responsive.isDesktop(context) && + _topUpParentSiSwitcher == true) + Expanded( + flex: 3, + child: Container( + width: 50, + alignment: Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + IgnorePointer( + ignoring: (topUpParentOpenForEnrollment == + 0 || + (topUpParentOpenForEnrollment != + 0 && + topUpParentECardDownload != + null)), + child: + DropdownButtonFormField< + String>( + onChanged: (value) { + setState(() { + topUpParentSiSelectedSI = + value; + }); + topUpParentSiCalculation( + value); + // calculationForTopUpSiSumValue( + // 'Edit'); + }, + decoration: + InputDecoration( + border: + OutlineInputBorder(), + hintText: + 'Sum Insured', + labelText: + 'Sum Insured', + contentPadding: + EdgeInsets.symmetric( + vertical: + 5, + horizontal: + 5), + ), + value: + topUpParentSiSelectedSI, + items: (topUpParentSlabRates ?? + []) + .map< + DropdownMenuItem< + String>>( + (addOn) { + return DropdownMenuItem< + String>( + value: addOn[ + 'si'] + .toString(), + child: Text( + '₹ ${addOn['si']}'), + ); + }).toList(), + ), + ) + ], + ))), + Expanded( + flex: 3, + child: Container( + alignment: + Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Switch( + value: + _topUpParentSiSwitcher, + onChanged: (topUpParentOpenForEnrollment == + 0 || + (topUpParentOpenForEnrollment != + 0 && + topUpParentECardDownload != + null)) + ? null + : (value) { + setState(() { + _topUpParentSiSwitcher = + value; + // Add your logic here based on the toggle state + }); + }, + activeColor: Color( + 0xFFE26728), // Color when the switch is ON + inactiveTrackColor: Colors + .grey, // Color of the switch track when OFF + ), + ], + ))), + ], + ), + if (_topUpParentSiSwitcher == true) + SizedBox(height: 10), + if (!Responsive.isDesktop(context) && + _topUpParentSiSwitcher == true) + Row( + children: [ + Expanded( + flex: 12, + child: Container( + width: 50, + alignment: Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + IgnorePointer( + ignoring: (topUpParentOpenForEnrollment == + 0 || + (topUpParentOpenForEnrollment != + 0 && + topUpParentECardDownload != + null)), + child: + DropdownButtonFormField< + String>( + onChanged: (value) { + setState(() { + topUpParentSiSelectedSI = + value; + }); + topUpParentSiCalculation( + value); + // calculationForTopUpSiSumValue( + // 'Edit'); + }, + decoration: + InputDecoration( + border: + OutlineInputBorder(), + hintText: + 'Sum Insured', + labelText: + 'Sum Insured', + contentPadding: + EdgeInsets.symmetric( + vertical: + 5, + horizontal: + 5), + ), + value: + topUpParentSiSelectedSI, + items: (topUpParentSlabRates ?? + []) + .map< + DropdownMenuItem< + String>>( + (addOn) { + return DropdownMenuItem< + String>( + value: addOn[ + 'si'] + .toString(), + child: Text( + '₹ ${addOn['si']}'), + ); + }).toList(), + ), + ) + ], + ))), + ], + ), + if (_topUpParentSiSwitcher == true) + SizedBox(height: 10), + if (_topUpParentSiSwitcher == + true) // Add space between rows + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: + topUpParentMappedFamilyFloatersSi + .where((item) => + item[ + 'is_value_exist'] == + true) + .map((item) { + Map data = + item['data']; + String formattedDate = + formatDate(data['dob']); + return 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( + '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', + style: GoogleFonts + .poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 16, + color: Color( + 0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ) + ], + ), + if (_topUpParentSiSwitcher == true) + SizedBox(height: 20), + if (Responsive.isDesktop(context) && + _topUpParentSiSwitcher == true) + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 5, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Additional Premium', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight.w500, + ), + ), + Text( + topUpParentSiPremiumValue != + null + ? '₹ $topUpParentSiPremiumValue/Year' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), + Expanded( + flex: 2, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'GST', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight.w500, + ), + ), + Text( + topUpParentSiPremiumGst != + null + ? '₹ $topUpParentSiPremiumGst/-' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), + Expanded( + flex: 5, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Total Payable', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight.w500, + ), + ), + Text( + topUpParentSiTotalAmt != + null + ? '₹ $topUpParentSiTotalAmt/-' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), + ], + ), + if (!Responsive.isDesktop(context) && + _topUpParentSiSwitcher == true) + Container( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Additional Premium', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + topUpParentSiPremiumValue != + null + ? '₹ $topUpParentSiPremiumValue/Year' + : 'N/A', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 16, + ), + ), + ], + ))), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'GST', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + topUpParentSiPremiumGst != + null + ? '₹ $topUpParentSiPremiumGst/-' + : 'N/A', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 16, + ), + ), + ], + ))), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Total Payable', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 5, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + topUpParentSiTotalAmt != + null + ? '₹ $topUpParentSiTotalAmt/-' + : 'N/A', + textAlign: + TextAlign + .start, + style: + GoogleFonts + .poppins( + fontSize: 16, + ), + ), + ], + ))), + ], + ), + ])) + ], + ), + ), + SizedBox(height: 15), + if (addOnsDependentMappedFamilyFloatersDependent != + null) + Container( + decoration: BoxDecoration( + color: Color( + 0xFFDDF3FF), // Set background color for the container + borderRadius: BorderRadius.circular( + 5), // Set border radius for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(25) + : EdgeInsets.all(10), + child: Column( + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: Responsive.isDesktop( + context) + ? 6 + : 8, + child: Container( + alignment: + Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .start, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + addOnsDependentPolicyName ?? + '', + textAlign: + TextAlign.left, + style: GoogleFonts + .poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + 'Group Medical Coverage - Dependent AddOns', + textAlign: + TextAlign.left, + style: GoogleFonts + .poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + ], + ))), + if (Responsive.isDesktop(context) && + _addOnsDependentSwitcher) + Expanded( + flex: 3, + child: Container( + width: 50, + alignment: + Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + IgnorePointer( + ignoring: (addOnsDependentOpenForEnrollment == + 0 || + (addOnsDependentOpenForEnrollment != + 0 && + addOnsDependentECardDownload != + null)), + child: + DropdownButtonFormField< + String>( + onChanged: + (value) { + setState(() { + addOnsSelectedDependent = + value; + }); + addOnsDependentCalculation( + value); + // calculationForDependentSumValue( + // 'Edit'); + }, + decoration: + InputDecoration( + border: + OutlineInputBorder(), + hintText: + 'Sum Insured', + labelText: + 'Sum Insured', + contentPadding: + EdgeInsets.symmetric( + vertical: + 5, + horizontal: + 5), + ), + value: + addOnsSelectedDependent, + items: (addOnsDependentSlabRates ?? + []) + .map>( + (addOn) { + return DropdownMenuItem< + String>( + value: addOn[ + 'si'] + .toString(), + child: Text( + '₹ ${addOn['si']}'), + ); + }).toList(), + ), + ) + ], + ))), + Expanded( + flex: 3, + child: Container( + alignment: + Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment + .end, + children: [ + Switch( + value: + _addOnsDependentSwitcher, + onChanged: (addOnsDependentOpenForEnrollment == + 0 || + (addOnsDependentOpenForEnrollment != + 0 && + addOnsDependentECardDownload != + null)) + ? null + : (value) { + setState(() { + _addOnsDependentSwitcher = + value; + // Add your logic here based on the toggle state + }); + }, + activeColor: Color( + 0xFFE26728), // Color when the switch is ON + inactiveTrackColor: Colors + .grey, // Color of the switch track when OFF + ), + ], + ))), + ], + ), + if (_addOnsDependentSwitcher == true) + SizedBox(height: 10), + if (!Responsive.isDesktop(context) && + _addOnsDependentSwitcher == true) + Row( + children: [ + Expanded( + flex: 3, + child: Container( + width: 50, + alignment: + Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + IgnorePointer( + ignoring: (addOnsDependentOpenForEnrollment == + 0 || + (addOnsDependentOpenForEnrollment != + 0 && + addOnsDependentECardDownload != + null)), + child: + DropdownButtonFormField< + String>( + onChanged: + (value) { + setState(() { + addOnsSelectedDependent = + value; + }); + addOnsDependentCalculation( + value); + // calculationForDependentSumValue( + // 'Edit'); + }, + decoration: + InputDecoration( + border: + OutlineInputBorder(), + hintText: + 'Sum Insured', + labelText: + 'Sum Insured', + contentPadding: + EdgeInsets.symmetric( + vertical: + 5, + horizontal: + 5), + ), + value: + addOnsSelectedDependent, + items: (addOnsDependentSlabRates ?? + []) + .map>( + (addOn) { + return DropdownMenuItem< + String>( + value: addOn[ + 'si'] + .toString(), + child: Text( + '₹ ${addOn['si']}'), + ); + }).toList(), + ), + ) + ], + ))), + ], + ), + SizedBox(height: 20), + if (_addOnsDependentSwitcher == true) + Column( + children: familyFloaterContainers, + ), + if (_addOnsDependentSwitcher) + SizedBox(height: 20), + if (Responsive.isDesktop(context) && + _addOnsDependentSwitcher) + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Checkbox( - value: isChecked, - onChanged: (bool? value) { - setState(() { - isChecked = value!; - }); - }, - activeColor: Color(0xFFE26728), - ), + Expanded( + flex: 5, + child: Container( + alignment: + Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Additional Premium', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight + .w500, + ), + ), + Text( + addOnDependentPremiumValue != + null + ? '₹ $addOnDependentPremiumValue/Year' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), + Expanded( + flex: 2, + child: Container( + alignment: + Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'GST', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight + .w500, + ), + ), + Text( + addOnsDependentPremiumGst != + null + ? '₹ $addOnsDependentPremiumGst/-' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), + Expanded( + flex: 5, + child: Container( + alignment: + Alignment.center, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Total Payable', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 20, + fontWeight: + FontWeight + .w500, + ), + ), + Text( + addOnsDependentTotalAmt != + null + ? '₹ $addOnsDependentTotalAmt/-' + : 'N/A', + textAlign: + TextAlign.start, + style: GoogleFonts + .poppins( + fontSize: 18, + ), + ), + ], + ))), ], - ))), - Expanded( - flex: 11, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - 'I declare that the information I have provided is true and accurate to the best of my knowledge', - textAlign: Responsive.isDesktop( - context) - ? TextAlign.left - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: + ), + if (!Responsive.isDesktop(context) && + _addOnsDependentSwitcher == true) + Container( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Additional Premium', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + addOnDependentPremiumValue != + null + ? '₹ $addOnDependentPremiumValue/Year' + : 'N/A', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 16, + ), + ), + ], + ))), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'GST', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + addOnsDependentPremiumGst != + null + ? '₹ $addOnsDependentPremiumGst/-' + : 'N/A', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 16, + ), + ), + ], + ))), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment + .centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + 'Total Payable', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 18, + fontWeight: + FontWeight + .w500, + ), + ), + ], + ))), + Expanded( + flex: 5, + child: Container( + alignment: Alignment + .centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: + CrossAxisAlignment + .center, + children: [ + Text( + addOnsDependentTotalAmt != + null + ? '₹ $addOnsDependentTotalAmt/-' + : 'N/A', + textAlign: + TextAlign + .start, + style: GoogleFonts + .poppins( + fontSize: + 16, + ), + ), + ], + ))), + ], + ), + ])) + ], + )), + ], + ), + )), + SizedBox(height: 16), + if (addOnsDependentMappedFamilyFloatersDependent == null && + topUpMappedFamilyFloatersSi == null && + topUpParentMappedFamilyFloatersSi == null) + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Checkbox( + value: isChecked, + onChanged: (bool? value) { + setState(() { + isChecked = value!; + }); + }, + activeColor: + Color(0xFFE26728), + ), + ], + ))), + Expanded( + flex: 11, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + 'I declare that the information I have provided is true and accurate to the best of my knowledge', + textAlign: Responsive.isDesktop( context) - ? 18 - : 15, - color: Color(0xFF292929), + ? TextAlign.left + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 15, + color: Color(0xFF292929), + ), ), - ), - ], - ))), - ], + ], + ))), + ], + ), ), - ), - SizedBox( - height: Responsive.isDesktop(context) ? 15 : 0), - Container( - child: Row( - children: [ - Expanded( - flex: 6, - child: Container( - width: 150, - height: Responsive.isDesktop(context) - ? 150 - : 100, - alignment: Alignment.centerLeft, - child: ElevatedButton( - onPressed: () { - Navigator.pushNamed( - context, 'empDetails'); - }, - child: Text( - 'Back', - style: GoogleFonts.poppins( - color: Color(0xFFE26728)), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - side: BorderSide( + SizedBox( + height: + Responsive.isDesktop(context) ? 15 : 0), + Container( + child: Row( + children: [ + Expanded( + flex: 6, + child: Container( + width: 150, + height: Responsive.isDesktop(context) + ? 150 + : 100, + alignment: Alignment.centerLeft, + child: ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, 'empDetails'); + }, + child: Text( + 'Back', + style: GoogleFonts.poppins( color: Color(0xFFE26728)), ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: - isChecked ? sendAddOnAPI : null, - child: Text( - 'Submit', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(5), + side: BorderSide( + color: Color(0xFFE26728)), + ), ), ), - ), - )), - ], + )), + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerRight, + child: ElevatedButton( + onPressed: + isChecked ? sendAddOnAPI : null, + child: Text( + 'Submit', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: + Color(0xFFE26728), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(5), + ), + ), + ), + )), + ], + ), ), - ), + ], + ), + )) + else + Card( + elevation: 0, + color: Colors.white, + child: Container( + width: double.infinity, + height: 75, + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 20, bottom: 20, left: 30, right: 30) + : EdgeInsets.only( + top: 10, + bottom: 10, + left: 10, + right: 10), // Add padding to the container + child: Row( + children: [ + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerLeft, + child: ElevatedButton( + onPressed: () { + backFunction(); + }, + child: Text( + 'Back', + style: GoogleFonts.poppins( + color: Color(0xFFE26728)), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + side: BorderSide( + color: Color(0xFFE26728)), + ), + ), + ), + )), + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerRight, + child: ElevatedButton( + onPressed: + addOnsDependentMappedFamilyFloatersDependent != + null || + topUpMappedFamilyFloatersSi != + null || + topUpParentMappedFamilyFloatersSi != + null + ? () { + if (_topUpSiSwitcher == false) { + removeAddonsGmcSiToAPI(); + } else { + print('checkSiTopUp'); + checkSiTopUp(); + } + + if (_topUpParentSiSwitcher == + false) { + removeAddonsGmcParentSiToAPI(); + } else { + print('checkSiParentTopUp'); + checkSiParentTopUp(); + } + + if (_addOnsDependentSwitcher == + false) { + removeAddonsGmcDependentToAPI(); + } else { + print('checkDependentTopUp'); + checkDependentTopUp(); + sendAddonsGmcDependentToAPI(); + } + Navigator.pushNamed(context, + 'empReviewDetails'); + } + : null, + child: Text( + 'Continue ', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFFE26728), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + ), + ), + ), + )), ], ), - )) - else - Card( - elevation: 0, - color: Colors.white, - child: Container( - width: double.infinity, - height: 75, - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 20, bottom: 20, left: 30, right: 30) - : EdgeInsets.only( - top: 10, - bottom: 10, - left: 10, - right: 10), // Add padding to the container - child: Row( - children: [ - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerLeft, - child: ElevatedButton( - onPressed: () { - backFunction(); - }, - child: Text( - 'Back', - style: GoogleFonts.poppins( - color: Color(0xFFE26728)), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - side: - BorderSide(color: Color(0xFFE26728)), - ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: - addOnsDependentMappedFamilyFloatersDependent != - null || - topUpMappedFamilyFloatersSi != - null || - topUpParentMappedFamilyFloatersSi != - null - ? () { - if (_topUpSiSwitcher == false) { - removeAddonsGmcSiToAPI(); - } else { - print('checkSiTopUp'); - checkSiTopUp(); - } - - if (_topUpParentSiSwitcher == - false) { - removeAddonsGmcParentSiToAPI(); - } else { - print('checkSiParentTopUp'); - checkSiParentTopUp(); - } - - if (_addOnsDependentSwitcher == - false) { - removeAddonsGmcDependentToAPI(); - } else { - print('checkDependentTopUp'); - checkDependentTopUp(); - sendAddonsGmcDependentToAPI(); - } - Navigator.pushNamed( - context, 'empReviewDetails'); - } - : null, - child: Text( - 'Continue ', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - ), - ), - ), - )), - ], ), ), - ), - ], + SizedBox(height: 30) + ], + ), ), ), - ), + if (isLoading) + Container( + color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader + ), + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), + floatingActionButton: Responsive.isDesktop(context) + ? null + : FloatingActionButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => chatbot()), + ), + child: Icon(Icons.chat), + ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.miniEndFloat, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // For example: + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], + initialIndex: 0, // Initial index of the bottom navigation bar + ), ); } } diff --git a/lib/pages/enrollment/empDetails.dart b/lib/pages/enrollment/empDetails.dart index ae43108..6f17f44 100644 --- a/lib/pages/enrollment/empDetails.dart +++ b/lib/pages/enrollment/empDetails.dart @@ -4,7 +4,9 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:nhance_app_pwa/customAppBar/enrollmentAppBar.dart'; import 'package:nhance_app_pwa/pages/enrollment/service/api_service.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../../customAppBar/customFooter.dart'; import '../../customAppBar/responsive.dart'; +import '../../customAppBar/tabs.dart'; import '../../customAppBar/toastHelper.dart'; import '../../models/environment.dart'; import 'package:jwt_decode/jwt_decode.dart'; @@ -16,6 +18,7 @@ import 'package:intl/intl.dart'; import 'dart:io'; import 'dart:async'; import 'package:url_launcher/url_launcher.dart'; +import '../postEnrollment/chatbot.dart'; class empDetails extends StatefulWidget { const empDetails({Key? key}) : super(key: key); @@ -660,21 +663,438 @@ class _empDetailsState extends State { )); } else { return Scaffold( - appBar: CustomAppBar(), - body: Stack(children: [ - SingleChildScrollView( - child: Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * - 0.2, // 30% of screen width as horizontal padding - vertical: MediaQuery.of(context).size.height * - 0.03, // 5% of screen height as vertical padding - ) - : EdgeInsets.all(10), - color: Color(0xFFEFF3F6), - child: Column( - children: [ + appBar: CustomAppBar(), + body: Stack(children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * + 0.2, // 30% of screen width as horizontal padding + vertical: MediaQuery.of(context).size.height * + 0.03, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(10), + color: Color(0xFFEFF3F6), + child: Column( + children: [ + Card( + elevation: 0, + color: Colors.white, + child: Container( + width: double.infinity, + height: 75, + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 20, bottom: 20, left: 30, right: 30) + : EdgeInsets.only( + top: 12, + bottom: 12, + left: 10, + right: 10), // Add padding to the container + child: Row( + children: [ + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerLeft, + child: Image.network( + clientLogo ?? '', + width: 80, // Set the width here + height: 80, // Set the height here + loadingBuilder: (BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: CircularProgressIndicator( + value: + loadingProgress.expectedTotalBytes != + null + ? loadingProgress + .cumulativeBytesLoaded / + loadingProgress + .expectedTotalBytes! + : null, + ), + ); + }, + errorBuilder: (BuildContext context, + Object error, StackTrace? stackTrace) { + return Image.asset( + 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path + width: 80, + height: 80, + fit: BoxFit.cover, + ); + }, + ), + ), + ), + Expanded( + flex: 9, + child: Text( + clientName ?? '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 20 : 18, + fontWeight: FontWeight.w600, + ), + ), + ) + ], + ), + ), + ), + SizedBox(height: 16), + if (gpaPolicies != null && gpaPolicies.length > 0) + 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), // 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), + if (gmcPolicies != null && gmcPolicies.length > 0) + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...generateCards(gmcPolicies), + ], + ), + SizedBox(height: 16), + if (gmcPolicies != null && gmcPolicies.length > 0) Card( elevation: 0, color: Colors.white, @@ -685,485 +1105,108 @@ class _empDetailsState extends State { ? EdgeInsets.only( top: 20, bottom: 20, left: 30, right: 30) : EdgeInsets.only( - top: 12, - bottom: 12, + top: 10, + bottom: 10, left: 10, right: 10), // Add padding to the container child: Row( children: [ Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerLeft, - child: Image.network( - clientLogo ?? '', - width: 80, // Set the width here - height: 80, // Set the height here - loadingBuilder: (BuildContext context, - Widget child, - ImageChunkEvent? loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: CircularProgressIndicator( - value: loadingProgress - .expectedTotalBytes != - null - ? loadingProgress - .cumulativeBytesLoaded / - loadingProgress - .expectedTotalBytes! - : null, + flex: 12, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerRight, + child: ElevatedButton( + onPressed: () { + Navigator.pushNamed( + context, 'addOnsDetails'); + }, + child: Text( + 'Continue', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFFE26728), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), ), - ); - }, - errorBuilder: (BuildContext context, - Object error, StackTrace? stackTrace) { - return Image.asset( - 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path - width: 80, - height: 80, - fit: BoxFit.cover, - ); - }, - ), - ), - ), - Expanded( - flex: 9, - child: Text( - clientName ?? '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) ? 20 : 18, - fontWeight: FontWeight.w600, - ), - ), - ) + ), + ), + )), ], ), ), ), - SizedBox(height: 16), - if (gpaPolicies != null && gpaPolicies.length > 0) - 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), // 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), - if (gmcPolicies != null && gmcPolicies.length > 0) - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ...generateCards(gmcPolicies), - ], - ), - SizedBox(height: 16), - if (gmcPolicies != null && gmcPolicies.length > 0) - Card( - elevation: 0, - color: Colors.white, - child: Container( - width: double.infinity, - height: 75, - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 20, bottom: 20, left: 30, right: 30) - : EdgeInsets.only( - top: 10, - bottom: 10, - left: 10, - right: 10), // Add padding to the container - child: Row( - children: [ - Expanded( - flex: 12, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: () { - Navigator.pushNamed( - context, 'addOnsDetails'); - }, - child: Text( - 'Continue', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - ), - ), - ), - )), - ], - ), - ), - ), - ], - ), + SizedBox(height: 40), + ], ), ), - if (isLoading) - Container( - color: Color(0xFFFFFCE5), // Semi-transparent background - child: Center( - child: // Your GIF loader widget - Image.asset( - height: 60, - width: 60, - 'assets/nhance-loader.gif'), // Adjust path to your GIF loader - ), + ), + if (isLoading) + Container( + color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader ), - ])); + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), + floatingActionButton: Responsive.isDesktop(context) + ? null + : FloatingActionButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => chatbot()), + ), + child: Icon(Icons.chat), + ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.miniEndFloat, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // For example: + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], + initialIndex: 0, // Initial index of the bottom navigation bar + ), + ); } } diff --git a/lib/pages/enrollment/empReview.dart b/lib/pages/enrollment/empReview.dart index c808533..8521d38 100644 --- a/lib/pages/enrollment/empReview.dart +++ b/lib/pages/enrollment/empReview.dart @@ -12,8 +12,11 @@ import 'package:flutter/services.dart'; import 'dart:convert'; import 'package:url_launcher/url_launcher.dart'; +import '../../customAppBar/customFooter.dart'; import '../../customAppBar/responsive.dart'; +import '../../customAppBar/tabs.dart'; import '../../customAppBar/toastHelper.dart'; +import '../postEnrollment/chatbot.dart'; class empReviewDetails extends StatefulWidget { const empReviewDetails({Key? key}) : super(key: key); @@ -24,6 +27,7 @@ class empReviewDetails extends StatefulWidget { class _empReviewDetailsState extends State { late ApiService apiService; + bool isLoading = true; bool isChecked = false; // Declare the _isSwitched variable here dynamic _token; dynamic empCodeString; @@ -123,6 +127,11 @@ class _empReviewDetailsState extends State { super.initState(); apiService = ApiService(context); // Initialize ApiService here _loadToken(); + Future.delayed(Duration(seconds: 3), () { + setState(() { + isLoading = false; + }); + }); } @override @@ -332,7 +341,7 @@ class _empReviewDetailsState extends State { setState(() { gpaDataIsEmpty = 0; }); - ToastHelper.showWarningToast(context, 'No data found'); + // ToastHelper.showWarningToast(context, 'No data found'); print('No data found in the response'); } } else { @@ -617,6 +626,9 @@ class _empReviewDetailsState extends State { } Future sendAddOnAPI() async { + setState(() { + isLoading = true; + }); if (addOnsDependentMappedFamilyFloatersArray != null) { dynamic getDependentTrueObjects = addOnsDependentMappedFamilyFloatersArray .where((element) => element['is_value_exist'] == true) @@ -688,14 +700,24 @@ class _empReviewDetailsState extends State { final response = await apiService.sendAddOnToAPI(apiParams); if (response['status'] == 'success') { + setState(() { + isLoading = false; + isChecked = false; + }); print('response.statusCode == 200'); ToastHelper.showSuccessToast(context, 'Saved Successfully...'); } else { + setState(() { + isLoading = false; + }); // Handle other status codes ToastHelper.showErrorToast(context, 'Failed to Save'); print('Request failed with status: ${response['code']}'); } } catch (e) { + setState(() { + isLoading = false; + }); // Handle exceptions print('Exception occurred: $e'); } @@ -726,1142 +748,1112 @@ class _empReviewDetailsState extends State { } else { return Scaffold( appBar: CustomAppBar(), - body: SingleChildScrollView( - child: Container( - padding: Responsive.isDesktop(context) - ? EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * - 0.2, // 30% of screen width as horizontal padding - vertical: MediaQuery.of(context).size.height * - 0.03, // 5% of screen height as vertical padding - ) - : EdgeInsets.all(10), - color: Color(0xFFEFF3F6), - child: Column( - children: [ - Card( - elevation: 0, - color: Colors.white, - child: Container( - width: double.infinity, - height: 75, - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 20, bottom: 20, left: 30, right: 30) - : EdgeInsets.only( - top: 12, - bottom: 12, - left: 10, - right: 10), // Add padding to the container - child: Row( - children: [ - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerLeft, - child: Image.network( - clientLogo ?? '', - width: 80, // Set the width here - height: 80, // Set the height here - loadingBuilder: (BuildContext context, - Widget child, - ImageChunkEvent? loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: CircularProgressIndicator( - value: loadingProgress.expectedTotalBytes != - null - ? loadingProgress - .cumulativeBytesLoaded / - loadingProgress.expectedTotalBytes! - : null, - ), - ); - }, - errorBuilder: (BuildContext context, Object error, - StackTrace? stackTrace) { - return Image.asset( - 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path - width: 80, - height: 80, - fit: BoxFit.cover, - ); - }, - ), - ), - ), - Expanded( - flex: 9, - child: Text( - clientName ?? '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) ? 20 : 18, - fontWeight: FontWeight.w600, - ), - ), - ) - ], - ), - ), - ), - SizedBox(height: 16), - Card( - elevation: 0, - color: Colors.white, - child: Container( - width: double.infinity, - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), // Add padding to the container - child: Column(children: [ - Row( - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Review', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 20 - : 18, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - Row( - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Total Payable', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - color: Color(0xFF181818), - ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '₹$totalPayableAmt/Year ', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 22 - : 18, - color: Color(0xFFE26728), - fontWeight: FontWeight.w500, - ), - ), - ], - ))), - ], - ), - ])), - ), - SizedBox(height: 16), - if (gpaPolicies != null && gpaPolicies.length > 0) + body: Stack(children: [ + SingleChildScrollView( + child: Container( + padding: Responsive.isDesktop(context) + ? EdgeInsets.symmetric( + horizontal: MediaQuery.of(context).size.width * + 0.2, // 30% of screen width as horizontal padding + vertical: MediaQuery.of(context).size.height * + 0.03, // 5% of screen height as vertical padding + ) + : EdgeInsets.all(10), + color: Color(0xFFEFF3F6), + child: Column( + children: [ 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), // 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), - if (gmcPolicies != null && gmcPolicies.length > 0) - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ...generateGmcCards(gmcPolicies), - ], - ), - SizedBox(height: 16), - if (showHideTopUpCard == 1) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Add Ons', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - 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( - topUpPolicyName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Row( - children: [ - Text( - 'Group Medical Coverage - Top Up', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - if (topUpECardDownload != - null) - GestureDetector( - onTap: () async { - // Convert the URL string to a Uri object - Uri uri = Uri.parse( - topUpECardDownload); - - // 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 $topUpECardDownload'); - } - }, - 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( - topUpFloaterTextHeading ?? '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - '₹ ${topUpSumInsured != null ? topUpSumInsured : '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: topUpMappedFamilyFloatersSiArray - .where((item) => - item['is_value_exist'] == true) - .map((item) { - Map data = item['data']; - String formattedDate = - formatDate(data['dob']); - return 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( - '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - color: Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ), - ], - ), - )), - SizedBox(height: showHideTopUpCard == 1 ? 16 : 0), - if (showHideTopUpParentCard == 1) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Add Ons', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - 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( - topUpParentPolicyName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Row( - children: [ - Text( - topUpParentTypeName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - 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( - flex: 4, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - topUpParentFloterTextHeading ?? - '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - '₹ ${topUpParentSiValue != null ? topUpParentSiValue : '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: topUpParentMappedFamilyFloatersSi - .where((item) => - item['is_value_exist'] == true) - .map((item) { - Map data = item['data']; - String formattedDate = - formatDate(data['dob']); - return 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( - '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - color: Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ), - ], - ), - )), - SizedBox(height: showHideTopUpCard == 1 ? 16 : 0), - if (showHideAddOnsCard == 1) - Card( - elevation: 0, - color: Colors.white, - child: Padding( - padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( - children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Add Ons', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - 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: - Responsive.isDesktop(context) ? 9 : 8, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - addOnsDependentPolicyName ?? '', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Row( - children: [ - Text( - 'Group Medical Coverage - Dependent AddOns', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 20 - : 16, - fontWeight: - FontWeight.w600, - ), - ), - if (addOnsDependentECardDownload != - null) - GestureDetector( - onTap: () async { - // Convert the URL string to a Uri object - Uri uri = Uri.parse( - addOnsDependentECardDownload); - - // 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 $addOnsDependentECardDownload'); - } - }, - child: MouseRegion( - cursor: - SystemMouseCursors - .click, - child: Icon( - Icons.file_download, - color: - Color(0xFFE26728), - size: 25, - ), - ), - ), - ], - ), - ], - ))), - Expanded( - flex: - Responsive.isDesktop(context) ? 3 : 4, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - addOnsFloaterTextHeading ?? '', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop( - context) - ? 18 - : 14, - ), - ), - Text( - '₹ ${addOnsDependentSumInsured != null ? addOnsDependentSumInsured : '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: - addOnsDependentMappedFamilyFloatersArray - .where((item) => - item['is_value_exist'] == true) - .map((item) { - Map data = item['data']; - return 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( - '${data['name']} - ${data['relationship']} - ${data['dob']}', - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 16, - color: Color(0xFF232526), - ), - ), - ), - ], - ); - }).toList(), - ), - ), - ], - ), - )), - SizedBox(height: showHideAddOnsCard == 1 ? 16 : 0), - Card( elevation: 0, color: Colors.white, - child: Padding( + child: Container( + width: double.infinity, + height: 75, padding: Responsive.isDesktop(context) - ? EdgeInsets.all(30) - : EdgeInsets.all(10), - child: Column( + ? EdgeInsets.only( + top: 20, bottom: 20, left: 30, right: 30) + : EdgeInsets.only( + top: 12, + bottom: 12, + left: 10, + right: 10), // Add padding to the container + child: Row( children: [ - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Premium Summary', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, - ), - ), - ], - ))), - ], + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerLeft, + child: Image.network( + clientLogo ?? '', + width: 80, // Set the width here + height: 80, // Set the height here + loadingBuilder: (BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: CircularProgressIndicator( + value: + loadingProgress.expectedTotalBytes != + null + ? loadingProgress + .cumulativeBytesLoaded / + loadingProgress + .expectedTotalBytes! + : null, + ), + ); + }, + errorBuilder: (BuildContext context, + Object error, StackTrace? stackTrace) { + return Image.asset( + 'assets/Solid_gray.png', // Replace 'default_image.png' with your default image asset path + width: 80, + height: 80, + fit: BoxFit.cover, + ); + }, + ), ), ), - SizedBox(height: 15), - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment - .centerLeft, // Adjust padding as needed - child: Table( - columnWidths: { - 0: FlexColumnWidth( - 2), // Adjust column width as needed - 1: FlexColumnWidth(2), - 2: FlexColumnWidth( - 2), // Adjust column width as needed - 3: FlexColumnWidth(2), - }, + Expanded( + flex: 9, + child: Text( + clientName ?? '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 20 : 18, + fontWeight: FontWeight.w600, + ), + ), + ) + ], + ), + ), + ), + SizedBox(height: 16), + Card( + elevation: 0, + color: Colors.white, + child: Container( + width: double.infinity, + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all( + 10), // Add padding to the container + child: Column(children: [ + Row( + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - TableRow( + Text( + 'Review', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 20 + : 18, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + Row( + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Total Payable', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + color: Color(0xFF181818), + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '₹$totalPayableAmt/Year ', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 22 + : 18, + color: Color(0xFFE26728), + fontWeight: FontWeight.w500, + ), + ), + ], + ))), + ], + ), + ])), + ), + SizedBox(height: 16), + if (gpaPolicies != null && gpaPolicies.length > 0) + 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), // 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), + if (gmcPolicies != null && gmcPolicies.length > 0) + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...generateGmcCards(gmcPolicies), + ], + ), + SizedBox(height: 16), + if (showHideTopUpCard == 1) + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Add Ons', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + ), + SizedBox(height: 15), + 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( + topUpPolicyName ?? '', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Row( + children: [ + Text( + 'Group Medical Coverage - Top Up', + textAlign: TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + if (topUpECardDownload != + null) + GestureDetector( + onTap: () async { + // Convert the URL string to a Uri object + Uri uri = Uri.parse( + topUpECardDownload); + + // 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 $topUpECardDownload'); + } + }, + 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( + topUpFloaterTextHeading ?? '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + '₹ ${topUpSumInsured != null ? topUpSumInsured : '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: topUpMappedFamilyFloatersSiArray + .where((item) => + item['is_value_exist'] == true) + .map((item) { + Map data = item['data']; + String formattedDate = + formatDate(data['dob']); + return 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( + '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + color: Color(0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ), + ], + ), + )), + SizedBox(height: showHideTopUpCard == 1 ? 16 : 0), + if (showHideTopUpParentCard == 1) + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Add Ons', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + ), + SizedBox(height: 15), + 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( + topUpParentPolicyName ?? '', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Row( + children: [ + Text( + topUpParentTypeName ?? '', + textAlign: TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + 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( + flex: 4, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + topUpParentFloterTextHeading ?? + '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + '₹ ${topUpParentSiValue != null ? topUpParentSiValue : '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: topUpParentMappedFamilyFloatersSi + .where((item) => + item['is_value_exist'] == true) + .map((item) { + Map data = item['data']; + String formattedDate = + formatDate(data['dob']); + return 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( + '${data['name']} ~ ${data['relationship']} ~ DOB : $formattedDate', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + color: Color(0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ), + ], + ), + )), + SizedBox(height: showHideTopUpCard == 1 ? 16 : 0), + if (showHideAddOnsCard == 1) + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Add Ons', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + ], + ), + ), + SizedBox(height: 15), + 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: Responsive.isDesktop(context) + ? 9 + : 8, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + addOnsDependentPolicyName ?? + '', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Row( + children: [ + Text( + 'Group Medical Coverage - Dependent AddOns', + textAlign: TextAlign.left, + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 20 + : 16, + fontWeight: + FontWeight.w600, + ), + ), + if (addOnsDependentECardDownload != + null) + GestureDetector( + onTap: () async { + // Convert the URL string to a Uri object + Uri uri = Uri.parse( + addOnsDependentECardDownload); + + // 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 $addOnsDependentECardDownload'); + } + }, + child: MouseRegion( + cursor: + SystemMouseCursors + .click, + child: Icon( + Icons.file_download, + color: Color( + 0xFFE26728), + size: 25, + ), + ), + ), + ], + ), + ], + ))), + Expanded( + flex: Responsive.isDesktop(context) + ? 3 + : 4, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + addOnsFloaterTextHeading ?? + '', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 14, + ), + ), + Text( + '₹ ${addOnsDependentSumInsured != null ? addOnsDependentSumInsured : '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: + addOnsDependentMappedFamilyFloatersArray + .where((item) => + item['is_value_exist'] == true) + .map((item) { + Map data = item['data']; + return 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( + '${data['name']} - ${data['relationship']} - ${data['dob']}', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) + ? 18 + : 16, + color: Color(0xFF232526), + ), + ), + ), + ], + ); + }).toList(), + ), + ), + ], + ), + )), + SizedBox(height: showHideAddOnsCard == 1 ? 16 : 0), + Card( + elevation: 0, + color: Colors.white, + child: Padding( + padding: Responsive.isDesktop(context) + ? EdgeInsets.all(30) + : EdgeInsets.all(10), + child: Column( + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - TableCell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Text( - 'Policy ', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 16 - : 14, - fontWeight: - FontWeight.bold), - ), - ), - ), - TableCell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Text( - 'Additional Premium', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 16 - : 14, - fontWeight: - FontWeight.bold), - ), - ), - ), - TableCell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Text( - 'GST', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 16 - : 14, - fontWeight: - FontWeight.bold), - ), - ), - ), - TableCell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Text( - 'Total', - textAlign: TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 16 - : 14, - fontWeight: - FontWeight.bold), - ), + Text( + 'Premium Summary', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, ), ), ], - ), - if (activeSiData == 1) + ))), + ], + ), + ), + SizedBox(height: 15), + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment + .centerLeft, // Adjust padding as needed + child: Table( + columnWidths: { + 0: FlexColumnWidth( + 2), // Adjust column width as needed + 1: FlexColumnWidth(2), + 2: FlexColumnWidth( + 2), // Adjust column width as needed + 3: FlexColumnWidth(2), + }, + children: [ TableRow( children: [ TableCell( @@ -1869,18 +1861,17 @@ class _empReviewDetailsState extends State { padding: EdgeInsets.all(8.0), child: Text( - Responsive.isDesktop( - context) - ? topUpTypeName - : 'GMC - Top Up', + 'Policy ', textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: Responsive .isDesktop( context) - ? 14 - : 12), + ? 16 + : 14, + fontWeight: + FontWeight.bold), ), ), ), @@ -1889,83 +1880,17 @@ class _empReviewDetailsState extends State { padding: EdgeInsets.all(8.0), child: Text( - '₹$topUpSiPremiumValue/Year', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$topUpSiPremiumGst/-', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$topUpSiTotalAmt/Year', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - ], - ), - if (activeSiParentData == 1) - TableRow( - children: [ - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - Responsive.isDesktop( - context) - ? topUpParentTypeName - : 'GMC - Parents Top Up', + 'Additional Premium', textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: Responsive .isDesktop( context) - ? 14 - : 12), + ? 16 + : 14, + fontWeight: + FontWeight.bold), ), ), ), @@ -1974,83 +1899,17 @@ class _empReviewDetailsState extends State { padding: EdgeInsets.all(8.0), child: Text( - '₹$topUpParentSiPremiumValue/Year', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$topUpParentSiPremiumGst/-', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$topUpParentSiTotalAmt/Year', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - ], - ), - if (activeDependentData == 1) - TableRow( - children: [ - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - Responsive.isDesktop( - context) - ? 'Group Medical Coverage - Add Dependent' - : 'GMC - Dependent ', + 'GST', textAlign: TextAlign.start, style: GoogleFonts.poppins( fontSize: Responsive .isDesktop( context) - ? 14 - : 12), + ? 16 + : 14, + fontWeight: + FontWeight.bold), ), ), ), @@ -2059,254 +1918,534 @@ class _empReviewDetailsState extends State { padding: EdgeInsets.all(8.0), child: Text( - '₹$addOnDependentPremiumValue/Year', + 'Total', textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, + TextAlign.start, style: GoogleFonts.poppins( fontSize: Responsive .isDesktop( context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$addOnsDependentPremiumGst/-', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), - ), - ), - ), - TableCell( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Text( - '₹$addOnsDependentTotalAmt/Year', - textAlign: - Responsive.isDesktop( - context) - ? TextAlign.start - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 12), + ? 16 + : 14, + fontWeight: + FontWeight.bold), ), ), ), ], ), - ], - ), - )) - ], - ), - ), - SizedBox(height: 10), - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - 'Total Payable', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop( - context) - ? 20 - : 16, - color: Color(0xFF181818), - fontWeight: FontWeight.w600, + if (activeSiData == 1) + TableRow( + children: [ + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + Responsive.isDesktop( + context) + ? topUpTypeName + : 'GMC - Top Up', + textAlign: + TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpSiPremiumValue/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpSiPremiumGst/-', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpSiTotalAmt/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + ], ), - ), - ], - ))), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - '₹$totalPayableAmt/Year', - textAlign: TextAlign.right, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop( - context) - ? 18 - : 16, - color: Color(0xFFE26728), - fontWeight: FontWeight.w500, + if (activeSiParentData == 1) + TableRow( + children: [ + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + Responsive.isDesktop( + context) + ? topUpParentTypeName + : 'GMC - Parents Top Up', + textAlign: + TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpParentSiPremiumValue/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpParentSiPremiumGst/-', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$topUpParentSiTotalAmt/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + ], ), - ), - ], - ))) - ], - ), - ), - SizedBox(height: 15), - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Checkbox( - value: isChecked, - onChanged: (bool? value) { - setState(() { - isChecked = value!; - }); - }, - activeColor: Color(0xFFE26728), - ), - ], - ))), - Expanded( - flex: 11, - child: Container( - alignment: Alignment.centerRight, - child: Column( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.end, - children: [ - Text( - 'I declare that the information I have provided is true and accurate to the best of my knowledge', - textAlign: - Responsive.isDesktop(context) - ? TextAlign.left - : TextAlign.start, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop( - context) - ? 18 - : 15, - color: Color(0xFF292929), + if (activeDependentData == 1) + TableRow( + children: [ + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + Responsive.isDesktop( + context) + ? 'Group Medical Coverage - Add Dependent' + : 'GMC - Dependent ', + textAlign: + TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$addOnDependentPremiumValue/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$addOnsDependentPremiumGst/-', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + TableCell( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: Text( + '₹$addOnsDependentTotalAmt/Year', + textAlign: Responsive + .isDesktop( + context) + ? TextAlign.start + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 14 + : 12), + ), + ), + ), + ], ), - ), ], - ))), - ], - ), - ), - SizedBox( - height: Responsive.isDesktop(context) ? 15 : 0), - Container( - child: Row( - children: [ - Expanded( - flex: 6, - child: Container( - width: 150, - height: Responsive.isDesktop(context) - ? 150 - : 100, - alignment: Alignment.centerLeft, - child: ElevatedButton( - onPressed: () async { - // Remove siData, siParentData, and dependentData from local storage - final SharedPreferences prefs = - await SharedPreferences - .getInstance(); - prefs.remove('siData'); - prefs.remove('siParentData'); - prefs.remove('dependentData'); - Navigator.pushNamed( - context, 'addOnsDetails'); - }, - child: Text( - 'Back', - style: GoogleFonts.poppins( - color: Color(0xFFE26728)), ), - style: ElevatedButton.styleFrom( - backgroundColor: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), - side: BorderSide( + )) + ], + ), + ), + SizedBox(height: 10), + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + 'Total Payable', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 20 + : 16, + color: Color(0xFF181818), + fontWeight: FontWeight.w600, + ), + ), + ], + ))), + Expanded( + flex: 6, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + '₹$totalPayableAmt/Year', + textAlign: TextAlign.right, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 16, + color: Color(0xFFE26728), + fontWeight: FontWeight.w500, + ), + ), + ], + ))) + ], + ), + ), + SizedBox(height: 15), + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Checkbox( + value: isChecked, + onChanged: (bool? value) { + setState(() { + isChecked = value!; + }); + }, + activeColor: Color(0xFFE26728), + ), + ], + ))), + Expanded( + flex: 11, + child: Container( + alignment: Alignment.centerRight, + child: Column( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, + children: [ + Text( + 'I declare that the information I have provided is true and accurate to the best of my knowledge', + textAlign: Responsive.isDesktop( + context) + ? TextAlign.left + : TextAlign.start, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 15, + color: Color(0xFF292929), + ), + ), + ], + ))), + ], + ), + ), + SizedBox( + height: Responsive.isDesktop(context) ? 15 : 0), + Container( + child: Row( + children: [ + Expanded( + flex: 6, + child: Container( + width: 150, + height: Responsive.isDesktop(context) + ? 150 + : 100, + alignment: Alignment.centerLeft, + child: ElevatedButton( + onPressed: () async { + // Remove siData, siParentData, and dependentData from local storage + final SharedPreferences prefs = + await SharedPreferences + .getInstance(); + prefs.remove('siData'); + prefs.remove('siParentData'); + prefs.remove('dependentData'); + Navigator.pushNamed( + context, 'addOnsDetails'); + }, + child: Text( + 'Back', + style: GoogleFonts.poppins( color: Color(0xFFE26728)), ), - ), - ), - )), - Expanded( - flex: 6, - child: Container( - width: 150, - height: 150, - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: - isChecked ? sendAddOnAPI : null, - child: Text( - 'Submit', - style: GoogleFonts.poppins( - color: Colors.white), - ), - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFFE26728), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(5), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(5), + side: BorderSide( + color: Color(0xFFE26728)), + ), ), ), - ), - )), - ], + )), + Expanded( + flex: 6, + child: Container( + width: 150, + height: 150, + alignment: Alignment.centerRight, + child: ElevatedButton( + onPressed: + isChecked ? sendAddOnAPI : null, + child: Text( + 'Submit', + style: GoogleFonts.poppins( + color: Colors.white), + ), + style: ElevatedButton.styleFrom( + backgroundColor: Color(0xFFE26728), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(5), + ), + ), + ), + )), + ], + ), ), - ), - ], - ), - )), - ], + ], + ), + )), + SizedBox(height: 30) + ], + ), ), ), - ), + if (isLoading) + Container( + color: Color(0x98FFFCE5), // Semi-transparent background + child: Center( + child: // Your GIF loader widget + Image.asset( + height: 60, + width: 60, + 'assets/nhance-loader.gif'), // Adjust path to your GIF loader + ), + ), + if (Responsive.isDesktop(context)) + Align( + alignment: Alignment.bottomCenter, + child: Container( + width: double.infinity, // Make the footer full width + child: CustomFooter(), + ), + ), + ]), + floatingActionButton: Responsive.isDesktop(context) + ? null + : FloatingActionButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => chatbot()), + ), + child: Icon(Icons.chat), + ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.miniEndFloat, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // For example: + if (index == 0) { + Navigator.pushNamed(context, 'home'); + } else if (index == 1) { + Navigator.pushNamed(context, 'claims'); + } else if (index == 2) { + Navigator.pushNamed(context, 'profile'); + } else if (index == 3) { + Navigator.pushNamed(context, 'help'); + } + }, + icons: [ + Icons.home_outlined, + Icons.sticky_note_2_outlined, + Icons.person_outline_outlined, + Icons.headset_mic_outlined, + ], + labels: [ + "Home", + "Claim", + "Profile", + "Help", + ], + initialIndex: 0, // Initial index of the bottom navigation bar + ), ); } } diff --git a/lib/pages/postEnrollment/home.dart b/lib/pages/postEnrollment/home.dart index 81e709d..5066076 100644 --- a/lib/pages/postEnrollment/home.dart +++ b/lib/pages/postEnrollment/home.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_image_slideshow/flutter_image_slideshow.dart'; @@ -39,6 +38,7 @@ class _MyAppState extends State { dynamic client_branch_id; List advertisementImages = []; bool isLoading = true; + dynamic policyCount; void _onTabChanged(int index) { setState(() { @@ -98,7 +98,12 @@ class _MyAppState extends State { if (response['status'] == 'success') { setState(() { policyList = response['data']; + print('policyList $policyList'); emp_name = response['emp_name']; + if (status == 'Active') { + policyCount = policyList.length; + print('policyCount : $policyCount'); + } }); print(policyList); } else { @@ -217,6 +222,73 @@ class _MyAppState extends State { ), ), SizedBox(height: 15), + Card( + elevation: 2, + color: Color(0xFFDDF3FF), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10), // Set the border radius here + ), + child: ClipRRect( + borderRadius: BorderRadius.circular( + 10), // Apply border radius to the container + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Color( + 0xFFDDF3FF), // Set background color for the container + borderRadius: BorderRadius.circular( + 10), // Set border radius for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10) + : EdgeInsets.only( + top: 10, bottom: 10, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 7, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + 'Policies for enrollment : $policyCount', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 14, + fontWeight: FontWeight.w500, + color: Color(0xFF404040), + ), + ), + ], + ), + ), + Expanded( + flex: 5, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton( + onPressed: () { + Navigator.pushNamed(context, 'empDetails'); + }, + child: Text('View Details'), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ), + SizedBox(height: 15), if (advertisementImages != null) Container( child: Row(