UI_BUGFIX

This commit is contained in:
venbaittech 2025-11-07 10:17:58 +05:30
parent cb82278834
commit 705731d2ab
15 changed files with 7126 additions and 6534 deletions

View File

@ -32,7 +32,6 @@ import 'package:nhance_app_pwa/pages/session/SetPinBiometric.dart';
import 'package:nhance_app_pwa/pages/session/changePin.dart'; import 'package:nhance_app_pwa/pages/session/changePin.dart';
import 'package:nhance_app_pwa/pages/session/settingUpPinAndBiometric.dart'; import 'package:nhance_app_pwa/pages/session/settingUpPinAndBiometric.dart';
import 'package:nhance_app_pwa/pages/verify.dart'; import 'package:nhance_app_pwa/pages/verify.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'models/environment.dart'; import 'models/environment.dart';
@ -61,12 +60,10 @@ class _SplashScreenState extends State<SplashScreen> {
final isMpinSkipped = prefs.getString('is_mpin_skipped'); final isMpinSkipped = prefs.getString('is_mpin_skipped');
if (isMpinSkipped == '0') { if (isMpinSkipped == '0') {
if (mounted) context.go('/pinPage'); if (mounted) context.go('/pinPage');
} else { } else {
if (mounted) context.go('/login'); if (mounted) context.go('/login');
} }
} }
@override @override
@ -82,7 +79,6 @@ class _SplashScreenState extends State<SplashScreen> {
} }
} }
/// Middleware logic for tokens + mpin /// Middleware logic for tokens + mpin
Future<String?> tokenRedirectLogic( Future<String?> tokenRedirectLogic(
BuildContext context, GoRouterState state) async { BuildContext context, GoRouterState state) async {
@ -110,7 +106,8 @@ Future<String?> tokenRedirectLogic(
await SessionManager().clear(); await SessionManager().clear();
// Show toast once // Show toast once
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
ToastHelper.showErrorToast(context, 'Session expired. Please login again.'); ToastHelper.showErrorToast(
context, 'Session expired. Please login again.');
}); });
return '/login'; return '/login';
} }
@ -192,7 +189,8 @@ Future<void> main() async {
final router = GoRouter( final router = GoRouter(
initialLocation: initialLocation, initialLocation: initialLocation,
routes: [ routes: [
GoRoute(path: '/splash', builder: (context, state) => const SplashScreen()), GoRoute(
path: '/splash', builder: (context, state) => const SplashScreen()),
GoRoute(path: '/login', builder: (context, state) => login()), GoRoute(path: '/login', builder: (context, state) => login()),
// GoRoute( // GoRoute(
// path: '/verify', // path: '/verify',
@ -241,7 +239,9 @@ Future<void> main() async {
// ), // ),
// GoRoute(path: '/mailVerify', builder: (context, state) => MyEmailVerify(email: '')), // GoRoute(path: '/mailVerify', builder: (context, state) => MyEmailVerify(email: '')),
GoRoute(path: '/pinPage', builder: (context, state) => pinPage()), GoRoute(path: '/pinPage', builder: (context, state) => pinPage()),
GoRoute(path: '/pinSettingPage', builder: (context, state) => pinSettingPage()), GoRoute(
path: '/pinSettingPage',
builder: (context, state) => pinSettingPage()),
GoRoute( GoRoute(
path: '/changePin', path: '/changePin',
builder: (context, state) => changePin(), builder: (context, state) => changePin(),
@ -249,24 +249,31 @@ Future<void> main() async {
GoRoute(path: '/home', builder: (context, state) => Home()), GoRoute(path: '/home', builder: (context, state) => Home()),
GoRoute(path: '/profile', builder: (context, state) => profile()), GoRoute(path: '/profile', builder: (context, state) => profile()),
GoRoute(path: '/help', builder: (context, state) => help()), GoRoute(path: '/help', builder: (context, state) => help()),
GoRoute(path: '/claimprocess', builder: (context, state) => claimprocess()), GoRoute(
path: '/claimprocess', builder: (context, state) => claimprocess()),
GoRoute(path: '/wellness', builder: (context, state) => wellness()), GoRoute(path: '/wellness', builder: (context, state) => wellness()),
GoRoute(path: '/privacypolicy', builder: (context, state) => privacypolicy()), GoRoute(
path: '/privacypolicy', builder: (context, state) => privacypolicy()),
GoRoute(path: '/termsofuse', builder: (context, state) => termsofuse()), GoRoute(path: '/termsofuse', builder: (context, state) => termsofuse()),
GoRoute(path: '/generalExclusionsDeductibles', builder: (context, state) => generalExclusionsDeductibles()), GoRoute(
GoRoute(path: '/raisedTicketHistory', builder: (context, state) => raisedTicketHistory()), path: '/generalExclusionsDeductibles',
builder: (context, state) => generalExclusionsDeductibles()),
GoRoute(
path: '/raisedTicketHistory',
builder: (context, state) => raisedTicketHistory()),
GoRoute(path: '/tickets', builder: (context, state) => tickets()), GoRoute(path: '/tickets', builder: (context, state) => tickets()),
GoRoute( GoRoute(
path: '/policies', path: '/policies',
builder: (context, state) { builder: (context, state) {
final arguments = state.extra as Map<String, dynamic>?; // 👈 receive here final arguments =
state.extra as Map<String, dynamic>?; // 👈 receive here
return policies(arguments: arguments); return policies(arguments: arguments);
}, },
), ),
GoRoute( GoRoute(
path: '/claims', path: '/claims',
builder: (context, state) { builder: (context, state) {
final int tabIndex = state.extra as int? ?? 1 ; // default to 0 final int tabIndex = state.extra as int? ?? 0; // default to 0
return claims(initialTab: tabIndex); return claims(initialTab: tabIndex);
}, },
), ),
@ -284,14 +291,20 @@ Future<void> main() async {
return tickettracklist(ticketID: ticketID); return tickettracklist(ticketID: ticketID);
}, },
), ),
GoRoute(path: '/empDetails',builder:(context,state) => empDetails(),), GoRoute(
GoRoute(path: '/addOnsDetails', builder: (context, state) => addOnsDetails()), path: '/empDetails',
GoRoute(path: '/empReviewDetails', builder: (context, state) => empReviewDetails()), builder: (context, state) => empDetails(),
),
GoRoute(
path: '/addOnsDetails', builder: (context, state) => addOnsDetails()),
GoRoute(
path: '/empReviewDetails',
builder: (context, state) => empReviewDetails()),
], ],
// Middleware hook // Middleware hook
redirect: (context, state) async => redirect: (context, state) async =>
await tokenRedirectLogic(context, state), await tokenRedirectLogic(context, state),
); );
// Load API data once at startup // Load API data once at startup
// runApp( // runApp(
@ -323,11 +336,10 @@ class _MyAppState extends State<MyApp> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
final apiService = ApiService(context); final apiService = ApiService(context);
DataManager().init(apiService); DataManager().init(apiService);
DataManager().loadAdvertisementImages(); DataManager().loadAdvertisementImages();
}); });
} }
@override @override

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -674,7 +674,20 @@ class _loginState extends State<login> {
SizedBox(width: 10), SizedBox(width: 10),
SizedBox( SizedBox(
width: 40, width: 40,
child: TextField( // child: TextField(
// controller:
// countryController,
// keyboardType:
// TextInputType
// .number,
// decoration:
// InputDecoration(
// border:
// InputBorder
// .none,
// ),
// ),
child: TextFormField(
controller: controller:
countryController, countryController,
keyboardType: keyboardType:
@ -686,6 +699,23 @@ class _loginState extends State<login> {
InputBorder InputBorder
.none, .none,
), ),
validator: (value) {
if (value ==
null ||
value
.isEmpty) {
return 'Required';
}
return null;
},
inputFormatters: [
FilteringTextInputFormatter
.allow(RegExp(
r'[0-9+]')),
LengthLimitingTextInputFormatter(
3),
],
), ),
), ),
Text( Text(

File diff suppressed because it is too large Load Diff

View File

@ -93,7 +93,7 @@ class _claimsState extends State<claims> {
trackClaimsActive = 0; trackClaimsActive = 0;
yourPlanActive = 1; yourPlanActive = 1;
isActive = false; isActive = false;
} else if(arguments == 2){ } else if (arguments == 2) {
print(arguments); print(arguments);
trackClaimsActive = 0; trackClaimsActive = 0;
yourPlanActive = 1; yourPlanActive = 1;
@ -250,378 +250,413 @@ class _claimsState extends State<claims> {
canPop: false, canPop: false,
onPopInvokedWithResult: (didPop, result) { onPopInvokedWithResult: (didPop, result) {
if (didPop) return; if (didPop) return;
if(widget.initialTab == 2){ if (widget.initialTab == 2) {
context.go('/home'); context.go('/home');
} else { } else {
context.pop(); context.pop();
} }
}, },
child: Scaffold( child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: CustomAppBar(), appBar: CustomAppBar(),
body: Stack(children: [ body: Stack(children: [
SingleChildScrollView( SingleChildScrollView(
child: Container( child: Container(
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.symmetric( ? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width * horizontal: MediaQuery.of(context).size.width *
0.2, // 30% of screen width as horizontal padding 0.2, // 30% of screen width as horizontal padding
vertical: MediaQuery.of(context).size.height * vertical: MediaQuery.of(context).size.height *
0.03, // 5% of screen height as vertical padding 0.03, // 5% of screen height as vertical padding
) )
: EdgeInsets.all(10), : EdgeInsets.all(10),
color: Colors.white, color: Colors.white,
child: Column(children: [ child: Column(children: [
Container( Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 12,
child: InkWell(
onTap: () {
if(widget.initialTab == 2){
context.go('/home');
} else {
context.pop();
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(
Icons
.chevron_left, // Replace with your desired icon
color: Color(0xFF000000),
size: 30,
),
SizedBox(
width:
5), // Adjust space between icon and text
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Claims assistance',
textAlign: TextAlign.start,
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF000000),
),
),
Text(
'Manage your claims',
textAlign: TextAlign.start,
style: GoogleFonts.poppins(
fontSize:
12, // Adjust the font size as needed
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
),
),
],
),
],
),
),
),
],
),
// Add more rows as needed
],
),
),
SizedBox(height: 15),
MouseRegion(
cursor: SystemMouseCursors.click,
child: InkWell(
onTap: () {
context.push('/help');
},
child: Card(
elevation: 0,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Color(0xFFD9D9D9), // Set the border color here
width: 1.0, // Set the border width here
),
borderRadius: BorderRadius.circular(
8.0), // Set the border radius here
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Row(
decoration: BoxDecoration( mainAxisAlignment: MainAxisAlignment.start,
color: Colors children: [
.white, // Set background color for the container Expanded(
), flex: 12,
padding: Responsive.isDesktop(context) child: InkWell(
? EdgeInsets.only( onTap: () {
top: 15, bottom: 15, left: 10, right: 10) print("CACLAIMS - ${widget.initialTab}");
: EdgeInsets.only( if (widget.initialTab == 2) {
top: 15, bottom: 15, left: 10, right: 10), context.go('/home');
child: Row( }
crossAxisAlignment: CrossAxisAlignment.center, if (widget.initialTab == 0) {
children: [ context.go('/home');
Expanded( } else {
flex: 11, context.pop();
}
},
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SvgPicture.string( Icon(
SvgService.getSvg('contactUs'), Icons
width: 25, .chevron_left, // Replace with your desired icon
height: 25, color: Color(0xFF000000),
size: 30,
), ),
SizedBox( SizedBox(
width: width:
7), // Adjust space between icon and text 5), // Adjust space between icon and text
Text( Column(
'Contact Us', mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, crossAxisAlignment:
style: GoogleFonts.poppins( CrossAxisAlignment.start,
fontSize: Responsive.isDesktop(context) children: [
? 18 Text(
: 12, 'Claims Assistance',
fontWeight: FontWeight.w500, textAlign: TextAlign.start,
color: Color(0xFF000000), style: GoogleFonts.poppins(
), fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF000000),
),
),
Text(
'Manage your claims',
textAlign: TextAlign.start,
style: GoogleFonts.poppins(
fontSize:
12, // Adjust the font size as needed
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
),
),
],
), ),
], ],
), ),
), ),
Expanded( ),
flex: 1, ],
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons
.chevron_right, // Replace with your desired icon
color: Color(0xFFE26728),
size: 20,
),
],
),
),
],
),
), ),
// Add more rows as needed
], ],
), ),
), ),
), SizedBox(height: 15),
), MouseRegion(
SizedBox(height: 15), cursor: SystemMouseCursors.click,
MouseRegion( child: InkWell(
cursor: SystemMouseCursors.click, onTap: () {
child: InkWell( context.push('/help');
onTap: () { },
context.go('/claimprocess'); child: Card(
}, elevation: 0,
child: Card( shape: RoundedRectangleBorder(
elevation: 0, side: BorderSide(
shape: RoundedRectangleBorder( color: Color(0xFFD9D9D9), // Set the border color here
side: BorderSide( width: 1.0, // Set the border width here
color: Color(0xFFD9D9D9), // Set the border color here ),
width: 1.0, // Set the border width here borderRadius: BorderRadius.circular(
8.0), // Set the border radius here
),
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors
.white, // Set background color for the container
),
padding: Responsive.isDesktop(context)
? EdgeInsets.only(
top: 15, bottom: 15, left: 10, right: 10)
: EdgeInsets.only(
top: 15, bottom: 15, left: 10, right: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 11,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.string(
SvgService.getSvg('contactUs'),
width: 25,
height: 25,
),
SizedBox(
width:
7), // Adjust space between icon and text
Text(
'Contact Us',
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context)
? 18
: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
),
),
],
),
),
Expanded(
flex: 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons
.chevron_right, // Replace with your desired icon
color: Color(0xFFE26728),
size: 20,
),
],
),
),
],
),
),
],
), ),
borderRadius: BorderRadius.circular(
8.0), // Set the border radius here
), ),
child: Column(children: [ ),
Container( ),
decoration: BoxDecoration( SizedBox(height: 15),
color: Colors MouseRegion(
.white, // Set background color for the container cursor: SystemMouseCursors.click,
child: InkWell(
onTap: () {
context.go('/claimprocess');
},
child: Card(
elevation: 0,
shape: RoundedRectangleBorder(
side: BorderSide(
color:
Color(0xFFD9D9D9), // Set the border color here
width: 1.0, // Set the border width here
),
borderRadius: BorderRadius.circular(
8.0), // Set the border radius here
), ),
padding: Responsive.isDesktop(context) child: Column(children: [
? EdgeInsets.only( Container(
top: 15, bottom: 15, left: 10, right: 10) decoration: BoxDecoration(
: EdgeInsets.only( color: Colors
top: 15, bottom: 15, left: 10, right: 10), .white, // Set background color for the container
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 11,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.string(
SvgService.getSvg('fileClaims'),
width: 25,
height: 25,
),
SizedBox(
width:
7), // Adjust space between icon and text
Text(
'Know how to file a claim',
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context)
? 18
: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
),
),
],
),
), ),
Expanded( padding: Responsive.isDesktop(context)
flex: 1, ? EdgeInsets.only(
child: Row( top: 15, bottom: 15, left: 10, right: 10)
mainAxisAlignment: MainAxisAlignment.end, : EdgeInsets.only(
children: [ top: 15, bottom: 15, left: 10, right: 10),
Icon( child: Row(
Icons crossAxisAlignment: CrossAxisAlignment.center,
.chevron_right, // Replace with your desired icon children: [
color: Color(0xFFE26728), Expanded(
size: 20, flex: 11,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.string(
SvgService.getSvg('fileClaims'),
width: 25,
height: 25,
),
SizedBox(
width:
7), // Adjust space between icon and text
Text(
'Know how to file a claim',
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context)
? 18
: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
),
),
],
), ),
], ),
), Expanded(
flex: 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(
Icons
.chevron_right, // Replace with your desired icon
color: Color(0xFFE26728),
size: 20,
),
],
),
),
],
), ),
], ),
), ])),
), ),
])), ),
), SizedBox(height: 15),
), Container(
SizedBox(height: 15), decoration: BoxDecoration(
Container( color: Color(
decoration: BoxDecoration( 0xFFF6FAFF), // Set background color for the container
color: borderRadius: BorderRadius.circular(
Color(0xFFF6FAFF), // Set background color for the container 5), // Set border radius for the container
borderRadius: BorderRadius.circular( ),
5), // Set border radius for the container padding: Responsive.isDesktop(context)
), ? EdgeInsets.only(
padding: Responsive.isDesktop(context) top: 10, bottom: 10, left: 25, right: 25)
? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25) : EdgeInsets.only(
: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), top: 10, bottom: 10, left: 10, right: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
flex: 12, flex: 12,
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Row(
flex: 6, mainAxisAlignment: MainAxisAlignment.center,
child: Container( children: [
alignment: Alignment.center, Expanded(
child: GestureDetector( flex: 6,
onTap: () { child: Container(
setState(() { alignment: Alignment.center,
isActive = true; child: GestureDetector(
// policyList.clear(); onTap: () {
yourPlanActive = 0; setState(() {
trackClaimsActive = 1; isActive = true;
}); // policyList.clear();
getActiveAndInactivePolicyDetails(); yourPlanActive = 0;
}, trackClaimsActive = 1;
child: isActive });
? Material( getActiveAndInactivePolicyDetails();
elevation: 5, },
borderRadius: child: isActive
BorderRadius.circular(10), ? Material(
color: Colors.white, elevation: 5,
child: TextButton( borderRadius:
onPressed: () {}, BorderRadius.circular(
style: TextButton.styleFrom( 10),
padding: EdgeInsets.symmetric( color: Colors.white,
horizontal: Responsive child: TextButton(
.isDesktop( onPressed: () {},
context) style: TextButton
? 140 .styleFrom(
: 50, padding: EdgeInsets.symmetric(
vertical: Responsive horizontal: Responsive
.isDesktop( .isDesktop(
context) context)
? 15 ? 140
: 5), : 50,
// primary: Color(0xFF000000), vertical: Responsive
), .isDesktop(
child: Text( context)
? 15
: 5),
// primary: Color(0xFF000000),
),
child: Text(
'Your Plan',
style: GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF000000)),
),
),
)
: Text(
'Your Plan', 'Your Plan',
style: GoogleFonts.poppins( style:
fontSize: Responsive GoogleFonts.poppins(
.isDesktop( fontSize: Responsive
context) .isDesktop(
? 18 context)
: 13,
fontWeight:
FontWeight.w500,
color: Color(
0xFF000000)),
),
),
)
: Text(
'Your Plan',
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18 ? 18
: 13, : 13,
fontWeight: FontWeight.w400, fontWeight:
color: Color(0xFF636363), FontWeight.w400,
), color:
), Color(0xFF636363),
), ),
)),
Expanded(
flex: 6,
child: Container(
alignment: Alignment.center,
child: GestureDetector(
onTap: () {
setState(() {
isActive = false;
// trackClaimsList.clear();
yourPlanActive = 1;
trackClaimsActive = 0;
});
getTrackClaimsList();
},
child: !isActive
? Material(
elevation: 5,
borderRadius:
BorderRadius.circular(10),
color: Colors.white,
child: TextButton(
onPressed: () {},
style: TextButton.styleFrom(
padding: EdgeInsets.symmetric(
horizontal: Responsive
.isDesktop(
context)
? 130
: 30,
vertical: Responsive
.isDesktop(
context)
? 15
: 5),
// primary: Color(0xFF000000),
), ),
child: Text( ),
)),
Expanded(
flex: 6,
child: Container(
alignment: Alignment.center,
child: GestureDetector(
onTap: () {
setState(() {
isActive = false;
// trackClaimsList.clear();
yourPlanActive = 1;
trackClaimsActive = 0;
});
getTrackClaimsList();
},
child: !isActive
? Material(
elevation: 5,
borderRadius:
BorderRadius.circular(
10),
color: Colors.white,
child: TextButton(
onPressed: () {},
style: TextButton
.styleFrom(
padding: EdgeInsets.symmetric(
horizontal: Responsive
.isDesktop(
context)
? 130
: 30,
vertical: Responsive
.isDesktop(
context)
? 15
: 5),
// primary: Color(0xFF000000),
),
child: Text(
'Track claims',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
color: Color(
0xFF000000),
fontWeight:
FontWeight.w500,
),
),
),
)
: Text(
'Track claims', 'Track claims',
style: style:
GoogleFonts.poppins( GoogleFonts.poppins(
@ -630,127 +665,112 @@ class _claimsState extends State<claims> {
context) context)
? 18 ? 18
: 13, : 13,
color:
Color(0xFF000000),
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w400,
color:
Color(0xFF636363),
), ),
), ),
), ),
) ))
: Text( ],
'Track claims', )
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 13,
fontWeight: FontWeight.w400,
color: Color(0xFF636363),
),
),
),
))
], ],
) ))),
], ],
))),
],
),
),
SizedBox(height: 15),
if (policyList != null && policyList.length > 0)
if (yourPlanActive == 0)
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
...generateYourPlanList(policyList),
],
),
if (trackClaimsList != null && trackClaimsList.length > 0)
if (trackClaimsActive == 0)
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: generateTrackList(trackClaimsList),
), ),
), ),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 70), SizedBox(height: 15),
if (policyList != null && policyList.length > 0)
if (yourPlanActive == 0)
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
...generateYourPlanList(policyList),
],
),
if (trackClaimsList != null && trackClaimsList.length > 0)
if (trackClaimsActive == 0)
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: generateTrackList(trackClaimsList),
),
),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 70),
]),
)),
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)
if (isLoading) // ? null
Container( // : FloatingActionButton(
color: Color(0x98FFFCE5), // Semi-transparent background // onPressed: () {
child: Center( // Navigator.pushNamed(context, 'chatbot');
child: // Your GIF loader widget // },
Image.asset( // child: Icon(Icons.chat),
height: 60, // ),
width: 60, floatingActionButtonLocation: Responsive.isDesktop(context)
'assets/nhance-loader.gif'), // Adjust path to your GIF loader ? null
), : FloatingActionButtonLocation.miniEndFloat,
), bottomNavigationBar: Responsive.isDesktop(context)
if (Responsive.isDesktop(context)) ? null
Align( : CustomBottomNavigationBar(
alignment: Alignment.bottomCenter, onTabChanged: (index) {
child: Container( // Add your navigation logic here
width: double.infinity, // Make the footer full width // For example:
child: CustomFooter(), if (index == 0) {
), context.push('/home');
), } else if (index == 1) {
]), context.push('/claims');
// floatingActionButton: Responsive.isDesktop(context) } else if (index == 2) {
// ? null context.push('/profile');
// : FloatingActionButton( } else if (index == 3) {
// onPressed: () { context.push('/help');
// Navigator.pushNamed(context, 'chatbot'); } else if (index == 4) {
// }, // Wellness tab clicked show popup
// child: Icon(Icons.chat), PopupHelper.showRedirectPopup(
// ), context: context,
floatingActionButtonLocation: Responsive.isDesktop(context) apiService: apiService,
? null empPrimaryId: session.empPrimaryId,
: FloatingActionButtonLocation.miniEndFloat, );
bottomNavigationBar: Responsive.isDesktop(context) }
? null },
: CustomBottomNavigationBar( icons: [
onTabChanged: (index) { Icons.home_outlined,
// Add your navigation logic here Icons.sticky_note_2_outlined,
// For example: Icons.person_outline_outlined,
if (index == 0) { Icons.headset_mic_outlined,
context.push('/home'); Icons.health_and_safety_outlined,
} else if (index == 1) { ],
context.push('/claims'); labels: [
} else if (index == 2) { "Home",
context.push('/profile'); "Claims",
} else if (index == 3) { "Profile",
context.push('/help'); "Help",
} else if (index == 4) { "Wellness",
// Wellness tab clicked show popup ],
PopupHelper.showRedirectPopup( initialIndex: 1, // Initial index of the bottom navigation bar
context: context, ),
apiService: apiService, ));
empPrimaryId: session.empPrimaryId,
);
}
},
icons: [
Icons.home_outlined,
Icons.sticky_note_2_outlined,
Icons.person_outline_outlined,
Icons.headset_mic_outlined,
Icons.health_and_safety_outlined,
],
labels: [
"Home",
"Claims",
"Profile",
"Help",
"Wellness",
],
initialIndex: 1, // Initial index of the bottom navigation bar
),
)
);
} }
List<Widget> generateYourPlanList(List<dynamic> data) { List<Widget> generateYourPlanList(List<dynamic> data) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'dart:html' as html;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -30,10 +31,10 @@ import 'chatbot.dart';
// import 'dart:html' as html; // import 'dart:html' as html;
import '/pages/helpers/botman_stub.dart' import '/pages/helpers/botman_stub.dart'
if (dart.library.html) '/pages/helpers/botman_web.dart'; if (dart.library.html) '/pages/helpers/botman_web.dart';
import '/../pages/helpers/mobile_helpers.dart' import '/../pages/helpers/mobile_helpers.dart'
if (dart.library.html) '/../pages/helpers/web_helpers.dart'; if (dart.library.html) '/../pages/helpers/web_helpers.dart';
import 'package:webview_flutter_android/webview_flutter_android.dart'; import 'package:webview_flutter_android/webview_flutter_android.dart';
class Home extends StatefulWidget { class Home extends StatefulWidget {
@ -45,6 +46,7 @@ class Home extends StatefulWidget {
class _HomeState extends State<Home> { class _HomeState extends State<Home> {
bool _dialogShown = false; bool _dialogShown = false;
late StreamSubscription<html.PopStateEvent> _popStateListener;
bool isLoadingGif = false; bool isLoadingGif = false;
late ApiService apiService; late ApiService apiService;
int _currentIndex = 0; int _currentIndex = 0;
@ -60,7 +62,7 @@ class _HomeState extends State<Home> {
dynamic policyHeading; dynamic policyHeading;
dynamic policyName; dynamic policyName;
dynamic EmployeePolicy; dynamic EmployeePolicy;
dynamic emp_name; dynamic emp_name = '';
dynamic pre_policy_count; dynamic pre_policy_count;
dynamic client_branch_id; dynamic client_branch_id;
dynamic mobileNo; dynamic mobileNo;
@ -86,42 +88,37 @@ class _HomeState extends State<Home> {
_loadToken(); _loadToken();
checkEnrollToken(); checkEnrollToken();
// 🔹 Load ads // 🔹 Load ads
// dataManager.loadAdvertisementImages(); // dataManager.loadAdvertisementImages();
if(kIsWeb){ if (kIsWeb) {
getAdvertisementSliderImage(); getAdvertisementSliderImage();
} else { } else {
advertisementImages = DataManager().advertisementImages; advertisementImages = DataManager().advertisementImages;
} }
print('starts'); print('starts');
print(advertisementImages); print(advertisementImages);
print('Ends'); print('Ends');
// // 🔹 Load policies (Active ones)
activePoliciesDetails = dataManager.loadPolicies(
clientId: session.client_id,
empCode: session.empCodeString,
status: "Active",
clientBranchId: session.empClientBranchId,
mobileNo: session.mobileNo,
);
print('activePoliciesDetails');
print(activePoliciesDetails);
// 🔹 Load self employee profile
dataManager.loadSelfEmployeeProfile(
clientId: session.client_id!,
empCode: session.empCodeString!,
clientBranchId: session.empClientBranchId!,
);
print('loadSelfEmployeeProfile');
// // 🔹 Load policies (Active ones)
activePoliciesDetails = dataManager.loadPolicies(
clientId: session.client_id,
empCode: session.empCodeString,
status: "Active",
clientBranchId: session.empClientBranchId,
mobileNo: session.mobileNo,
);
print('activePoliciesDetails');
print(activePoliciesDetails);
// 🔹 Load self employee profile
dataManager.loadSelfEmployeeProfile(
clientId: session.client_id!,
empCode: session.empCodeString!,
clientBranchId: session.empClientBranchId!,
);
print('loadSelfEmployeeProfile');
// if (kIsWeb) { // if (kIsWeb) {
// openBotmanChat(); // openBotmanChat();
@ -189,6 +186,9 @@ class _HomeState extends State<Home> {
final preToken = TokenService.getPreToken(); final preToken = TokenService.getPreToken();
print('preToken'); print('preToken');
print(preToken); print(preToken);
WidgetsBinding.instance.addPostFrameCallback((_) {
checkbackbutton();
});
setState(() { setState(() {
isTokenAvailable = preToken != null; isTokenAvailable = preToken != null;
}); });
@ -314,7 +314,7 @@ class _HomeState extends State<Home> {
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
final random = Random.secure(); final random = Random.secure();
return List.generate( return List.generate(
length, (index) => characters[random.nextInt(characters.length)]) length, (index) => characters[random.nextInt(characters.length)])
.join(); .join();
} }
@ -352,11 +352,11 @@ class _HomeState extends State<Home> {
actions: [ actions: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceEvenly, // Space buttons evenly MainAxisAlignment.spaceEvenly, // Space buttons evenly
children: [ children: [
SizedBox( SizedBox(
width: width:
MediaQuery.of(context).size.width * 0.3, // Set button width MediaQuery.of(context).size.width * 0.3, // Set button width
child: TextButton( child: TextButton(
onPressed: () => Navigator.pop(dialogContext), onPressed: () => Navigator.pop(dialogContext),
style: TextButton.styleFrom( style: TextButton.styleFrom(
@ -379,7 +379,7 @@ class _HomeState extends State<Home> {
), ),
SizedBox( SizedBox(
width: width:
MediaQuery.of(context).size.width * 0.3, // Set button width MediaQuery.of(context).size.width * 0.3, // Set button width
child: TextButton( child: TextButton(
onPressed: () => TokenService().logout(context), onPressed: () => TokenService().logout(context),
style: TextButton.styleFrom( style: TextButton.styleFrom(
@ -411,9 +411,22 @@ class _HomeState extends State<Home> {
); );
} }
void checkbackbutton() async {
// Push a dummy state so back button triggers popstate instead of navigating
html.window.history.pushState(null, 'home', html.window.location.href);
_popStateListener = html.window.onPopState.listen((event) {
if (!_dialogShown && mounted) {
_showBackConfirmationDialog();
}
// Re-push to prevent leaving
html.window.history.pushState(null, 'home', html.window.location.href);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!Responsive.isDesktop(context)) if (!Responsive.isDesktop(context))
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Color(0xFFFFFBDE), // Status bar color statusBarColor: Color(0xFFFFFBDE), // Status bar color
@ -421,23 +434,27 @@ class _HomeState extends State<Home> {
)); ));
return PopScope( return PopScope(
canPop: false, canPop: false,
onPopInvokedWithResult: (didPop, result) { onPopInvoked: (didPop) {
if (didPop) return; if (didPop) return;
_showExitConfirmation(context); _showExitConfirmation(context);
}, },
// onPopInvokedWithResult: (didPop, result) {
// if (didPop) return;
// _showExitConfirmation(context);
// },
child: Scaffold( child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: CustomAppBar(), appBar: CustomAppBar(),
body: Stack(children: [ body: Stack(children: [
SingleChildScrollView( SingleChildScrollView(
child: Container( child: Container(
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.symmetric( ? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width * horizontal: MediaQuery.of(context).size.width *
0.2, // 30% of screen width as horizontal padding 0.2, // 30% of screen width as horizontal padding
vertical: MediaQuery.of(context).size.height * vertical: MediaQuery.of(context).size.height *
0.03, // 5% of screen height as vertical padding 0.03, // 5% of screen height as vertical padding
) )
: EdgeInsets.all(15), : EdgeInsets.all(15),
color: Colors.white, color: Colors.white,
child: Column(children: [ child: Column(children: [
@ -459,9 +476,10 @@ class _HomeState extends State<Home> {
'Hello, $emp_name!', 'Hello, $emp_name!',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) fontSize:
? 20 Responsive.isDesktop(context)
: 20, ? 20
: 20,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
), ),
@ -489,7 +507,7 @@ class _HomeState extends State<Home> {
color: Color(0xFFDDF3FF), color: Color(0xFFDDF3FF),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(10), // Set the border radius here BorderRadius.circular(10), // Set the border radius here
), ),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
@ -505,9 +523,9 @@ class _HomeState extends State<Home> {
), ),
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.only( ? EdgeInsets.only(
top: 10, bottom: 10, left: 10, right: 10) top: 10, bottom: 10, left: 10, right: 10)
: EdgeInsets.only( : EdgeInsets.only(
top: 10, bottom: 10, left: 10, right: 10), top: 10, bottom: 10, left: 10, right: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -520,8 +538,9 @@ class _HomeState extends State<Home> {
'Policies for enrollment : $pre_policy_count', 'Policies for enrollment : $pre_policy_count',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize: Responsive.isDesktop(context)
Responsive.isDesktop(context) ? 18 : 12, ? 18
: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF404040), color: Color(0xFF404040),
), ),
@ -537,8 +556,8 @@ class _HomeState extends State<Home> {
ElevatedButton( ElevatedButton(
onPressed: isTokenAvailable onPressed: isTokenAvailable
? () { ? () {
context.go('/empDetails'); context.go('/empDetails');
} }
: null, : null,
child: Text('View Details'), child: Text('View Details'),
), ),
@ -565,84 +584,84 @@ class _HomeState extends State<Home> {
child: advertisementImages.isEmpty child: advertisementImages.isEmpty
? Center(child: Text("No images available")) ? Center(child: Text("No images available"))
: Container( : Container(
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 12, flex: 12,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Container( Container(
child: ImageSlideshow( child: ImageSlideshow(
/// Width of the [ImageSlideshow]. /// Width of the [ImageSlideshow].
width: double.infinity, width: double.infinity,
/// Height of the [ImageSlideshow]. /// Height of the [ImageSlideshow].
height: height:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 200 ? 200
: 150, : 150,
/// The page to show when first creating the [ImageSlideshow]. /// The page to show when first creating the [ImageSlideshow].
initialPage: 0, initialPage: 0,
/// The color to paint the indicator. /// The color to paint the indicator.
indicatorColor: indicatorColor:
Color(0xFFE26728), Color(0xFFE26728),
/// The color to paint behind the indicator. /// The color to paint behind the indicator.
indicatorBackgroundColor: indicatorBackgroundColor:
Colors.grey, Colors.grey,
/// The widgets to display in the [ImageSlideshow]. /// The widgets to display in the [ImageSlideshow].
children: children:
advertisementImages advertisementImages
.map( .map(
(imageUrl) => (imageUrl) =>
ClipRRect( ClipRRect(
borderRadius: borderRadius:
BorderRadius BorderRadius
.circular( .circular(
8), 8),
child: Image child: Image
.network( .network(
imageUrl, imageUrl,
fit: BoxFit fit: BoxFit
.cover, .cover,
), ),
), ),
) )
.toList(), .toList(),
/// Called whenever the page in the center of the viewport changes. /// Called whenever the page in the center of the viewport changes.
onPageChanged: (value) { onPageChanged: (value) {
print( print(
'Page changed: $value'); 'Page changed: $value');
}, },
/// Auto scroll interval. /// Auto scroll interval.
/// Do not auto scroll with null or 0. /// Do not auto scroll with null or 0.
autoPlayInterval: 3000, autoPlayInterval: 3000,
/// Loops back to the first slide. /// Loops back to the first slide.
isLoop: true, isLoop: true,
),
),
],
), ),
), ),
], ),
), ],
), ),
), ),
],
),
),
), ),
), ),
], ],
@ -667,9 +686,10 @@ class _HomeState extends State<Home> {
'Your Policies', 'Your Policies',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context) fontSize:
? 18 Responsive.isDesktop(context)
: 18, ? 18
: 18,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
), ),
@ -694,14 +714,16 @@ class _HomeState extends State<Home> {
SizedBox(height: 15), SizedBox(height: 15),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Color(
Color(0xFFEEF5FF), // Set background color for the container 0xFFEEF5FF), // Set background color for the container
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
5), // Set border radius for the container 5), // Set border radius for the container
), ),
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25) ? EdgeInsets.only(
: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), top: 10, bottom: 10, left: 25, right: 25)
: EdgeInsets.only(
top: 10, bottom: 10, left: 10, right: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -731,58 +753,64 @@ class _HomeState extends State<Home> {
}, },
child: isActive child: isActive
? Material( ? Material(
elevation: 5, elevation: 5,
borderRadius: borderRadius:
BorderRadius.circular(10), BorderRadius.circular(
color: Colors.white, 10),
child: SizedBox( color: Colors.white,
width: Responsive.isDesktop( child: SizedBox(
context) width: Responsive
? 400 .isDesktop(
: 150, // Set the width here context)
child: TextButton( ? 400
onPressed: () {}, : 150, // Set the width here
style: child: TextButton(
TextButton.styleFrom( onPressed: () {},
padding: EdgeInsets style: TextButton
.symmetric( .styleFrom(
vertical: Responsive padding: EdgeInsets
.isDesktop( .symmetric(
context) vertical: Responsive
? 12 .isDesktop(
: 5, context)
? 12
: 5,
),
),
child: Text(
'Active',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
), ),
), )
child: Text( : Text(
'Active', 'Active',
style: style:
GoogleFonts.poppins( GoogleFonts.poppins(
fontSize: Responsive fontSize: Responsive
.isDesktop( .isDesktop(
context) context)
? 18 ? 18
: 13, : 13,
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w400,
color: color:
Color(0xFF593AFF), Color(0xFF636363),
), ),
), ),
),
),
)
: Text(
'Active',
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 13,
fontWeight: FontWeight.w400,
color: Color(0xFF636363),
),
),
), ),
)), )),
Expanded( Expanded(
@ -800,58 +828,64 @@ class _HomeState extends State<Home> {
}, },
child: !isActive child: !isActive
? Material( ? Material(
elevation: 5, elevation: 5,
borderRadius: borderRadius:
BorderRadius.circular(10), BorderRadius.circular(
color: Colors.white, 10),
child: SizedBox( color: Colors.white,
width: Responsive.isDesktop( child: SizedBox(
context) width: Responsive
? 400 .isDesktop(
: 150, // Set the width here context)
child: TextButton( ? 400
onPressed: () {}, : 150, // Set the width here
style: child: TextButton(
TextButton.styleFrom( onPressed: () {},
padding: EdgeInsets style: TextButton
.symmetric( .styleFrom(
vertical: Responsive padding: EdgeInsets
.isDesktop( .symmetric(
context) vertical: Responsive
? 12 .isDesktop(
: 5, context)
? 12
: 5,
),
),
child: Text(
'Inactive',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
), ),
), )
child: Text( : Text(
'Inactive', 'Inactive',
style: style:
GoogleFonts.poppins( GoogleFonts.poppins(
fontSize: Responsive fontSize: Responsive
.isDesktop( .isDesktop(
context) context)
? 18 ? 18
: 13, : 13,
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w400,
color: color:
Color(0xFF593AFF), Color(0xFF636363),
), ),
), ),
),
),
)
: Text(
'Inactive',
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 13,
fontWeight: FontWeight.w400,
color: Color(0xFF636363),
),
),
), ),
)) ))
], ],
@ -1070,7 +1104,7 @@ class _HomeState extends State<Home> {
onTap: () { onTap: () {
context.go( context.go(
'/policies', '/policies',
extra: item, // 👈 pass arguments here extra: item, // 👈 pass arguments here
); );
}, },
child: MouseRegion( child: MouseRegion(
@ -1079,7 +1113,7 @@ class _HomeState extends State<Home> {
elevation: 5, elevation: 5,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(15.0), // Set border radius here BorderRadius.circular(15.0), // Set border radius here
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1089,12 +1123,12 @@ class _HomeState extends State<Home> {
), ),
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.only( ? EdgeInsets.only(
top: 15, bottom: 15, left: 15, right: 15) top: 15, bottom: 15, left: 15, right: 15)
: EdgeInsets.only( : EdgeInsets.only(
top: 10, top: 10,
bottom: 10, bottom: 10,
left: 10, left: 10,
right: 10), // Add padding to the container right: 10), // Add padding to the container
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -1104,7 +1138,7 @@ class _HomeState extends State<Home> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
@ -1112,17 +1146,17 @@ class _HomeState extends State<Home> {
flex: 7, flex: 7,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
policyHeading ?? '', policyHeading ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 10 ? 10
: 10, : 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Color(0xFF785EFF), color: Color(0xFF785EFF),
), ),
@ -1134,17 +1168,17 @@ class _HomeState extends State<Home> {
flex: 5, flex: 5,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.end, CrossAxisAlignment.end,
children: [ children: [
Text( Text(
'Expires on $formattedDate', 'Expires on $formattedDate',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 10 ? 10
: 10, : 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Color(0xFF747474), color: Color(0xFF747474),
), ),
@ -1161,17 +1195,17 @@ class _HomeState extends State<Home> {
flex: 6, flex: 6,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
policyName ?? '', policyName ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 14 ? 14
: 13, : 13,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
), ),
@ -1183,7 +1217,7 @@ class _HomeState extends State<Home> {
flex: 5, flex: 5,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.end, CrossAxisAlignment.end,
children: [ children: [
Text( Text(
formatToCroresLakhsAndThousands( formatToCroresLakhsAndThousands(
@ -1191,10 +1225,10 @@ class _HomeState extends State<Home> {
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize:
Responsive.isDesktop( Responsive.isDesktop(
context) context)
? 14 ? 14
: 13, : 13,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF000000), color: Color(0xFF000000),
), ),
@ -1206,13 +1240,13 @@ class _HomeState extends State<Home> {
flex: 1, flex: 1,
child: Container( child: Container(
alignment: alignment:
Alignment.centerRight, Alignment.centerRight,
child: Icon( child: Icon(
Icons.chevron_right, Icons.chevron_right,
color: Color( color: Color(
0xFFE26728), // Replace with your desired icon 0xFFE26728), // Replace with your desired icon
size: Responsive.isDesktop( size: Responsive.isDesktop(
context) context)
? 30 ? 30
: 26, : 26,
), ),
@ -1222,28 +1256,67 @@ class _HomeState extends State<Home> {
SizedBox(height: 7), SizedBox(height: 7),
Row( Row(
children: [ children: [
Expanded( Flexible(
flex: 12, child: Container(
child: Column( // color: Colors.red,
crossAxisAlignment: child: Column(
CrossAxisAlignment.start, crossAxisAlignment:
children: [ CrossAxisAlignment.start,
Text( children: [
memberNames ?? '', Tooltip(
textAlign: TextAlign.left, message: '$memberNames',
style: GoogleFonts.poppins( child: Text(
fontSize: memberNames ?? '',
Responsive.isDesktop( textAlign: TextAlign.left,
context) maxLines: 1,
? 14 overflow:
: 13, TextOverflow.ellipsis,
fontWeight: FontWeight.w400, softWrap: false,
color: Color(0xFF000000), style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 14
: 13,
fontWeight:
FontWeight.w400,
color: const Color(
0xFF000000),
),
),
), ),
), ],
], ),
), ),
), ),
// Expanded(
// flex: 1,
// child: Container(
// color: Colors.red,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// memberNames ?? '',
// textAlign: TextAlign.left,
// style: GoogleFonts.poppins(
// fontSize:
// Responsive.isDesktop(
// context)
// ? 14
// : 13,
// fontWeight:
// FontWeight.w400,
// color: Color(0xFF000000),
// ),
// ),
// ],
// ),
// ),
// ),
], ],
), ),
SizedBox(height: 7), SizedBox(height: 7),
@ -1267,4 +1340,4 @@ class _HomeState extends State<Home> {
), ),
); );
} }
} }

View File

@ -1503,4 +1503,4 @@ SizedBox(height: 15),
}, },
); );
} }
} }

View File

@ -1214,4 +1214,4 @@ class _policiesState extends State<policies> {
), ),
); );
} }
} }

View File

@ -779,44 +779,17 @@ class _profileState extends State<profile> {
), ),
SizedBox(height: 10), SizedBox(height: 10),
Container( Container(
// color: Colors.amberAccent,
width: MediaQuery.of(context).size.width,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Responsive.isDesktop(context)
flex: 12, ? _buildLogoutButton(context)
child: Container( : Expanded(
width: 150, flex: 12, child: _buildLogoutButton(context)),
// height: Responsive.isDesktop(context) ? 150 : 100,
alignment: Alignment.center,
child: ElevatedButton(
onPressed: () {
logout(context);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.logout,
color: Color(0xFFE26728),
),
SizedBox(
width:
8), // Adjust space between icon and text
Text(
'Logout',
style: GoogleFonts.poppins(
color: Color(0xFFE26728)),
),
],
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: BorderSide(color: Color(0xFFE26728)),
),
),
),
)),
], ],
), ),
), ),
@ -935,4 +908,31 @@ class _profileState extends State<profile> {
), ),
)); ));
} }
Widget _buildLogoutButton(BuildContext context) {
return Container(
alignment: Alignment.center,
child: ElevatedButton(
onPressed: () => logout(context),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: const BorderSide(color: Color(0xFFE26728)),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.logout, color: Color(0xFFE26728)),
const SizedBox(width: 8),
Text(
'Logout',
style: GoogleFonts.poppins(color: const Color(0xFFE26728)),
),
],
),
),
);
}
} }

View File

@ -109,7 +109,6 @@ class _ticketsState extends State<tickets> {
} }
} }
Future<void> getActiveAndInactivePolicyDetails() async { Future<void> getActiveAndInactivePolicyDetails() async {
if (client_id == null || empCodeString == null) { if (client_id == null || empCodeString == null) {
return; return;
@ -213,8 +212,7 @@ class _ticketsState extends State<tickets> {
print('Check One'); print('Check One');
Map<String, dynamic> formData = { Map<String, dynamic> formData = {
'email': decodedToken?['email_corporate'], 'email': decodedToken?['email_corporate'],
'empcode': 'empcode': decodedToken?['emp_code'],
decodedToken?['emp_code'],
'message': messageController.text, 'message': messageController.text,
'mobile': decodedToken?['mobile'], 'mobile': decodedToken?['mobile'],
'name': decodedToken?['name'], 'name': decodedToken?['name'],
@ -268,365 +266,377 @@ class _ticketsState extends State<tickets> {
context.go('/help'); context.go('/help');
}, },
child: Scaffold( child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: CustomAppBar(), appBar: CustomAppBar(),
body: Stack(children: [ body: Stack(children: [
SingleChildScrollView( SingleChildScrollView(
child: Container( child: Container(
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.symmetric( ? EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width * horizontal: MediaQuery.of(context).size.width *
0.2, // 30% of screen width as horizontal padding 0.2, // 30% of screen width as horizontal padding
vertical: MediaQuery.of(context).size.height * vertical: MediaQuery.of(context).size.height *
0.05, // 5% of screen height as vertical padding 0.05, // 5% of screen height as vertical padding
) )
: EdgeInsets.all(10), : EdgeInsets.all(10),
color: Colors.white, color: Colors.white,
child: Column(children: [ child: Column(children: [
Card( Card(
elevation: 5, elevation: 5,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(15.0), // Set border radius here BorderRadius.circular(15.0), // Set border radius here
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, // Set background color to white color: Colors.white, // Set background color to white
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
15.0), // Set border radius for Container 15.0), // Set border radius for Container
), ),
padding: Responsive.isDesktop(context) padding: Responsive.isDesktop(context)
? EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15) ? EdgeInsets.only(
: EdgeInsets.only( top: 15, bottom: 15, left: 15, right: 15)
top: 10, : EdgeInsets.only(
bottom: 10, top: 10,
left: 10, bottom: 10,
right: 10), // Add padding to the container left: 10,
child: Row( right: 10), // Add padding to the container
children: [ child: Row(
Expanded( children: [
flex: 12, Expanded(
child: Container( flex: 12,
alignment: Alignment.centerLeft, child: Container(
child: Column( alignment: Alignment.centerLeft,
mainAxisAlignment: MainAxisAlignment.start, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
decoration: BoxDecoration( Container(
color: Color( decoration: BoxDecoration(
0xFFFFFCE5), // Set background color for the container color: Color(
borderRadius: BorderRadius.circular( 0xFFFFFCE5), // Set background color for the container
10), // Set border radius for the container borderRadius: BorderRadius.circular(
), 10), // Set border radius for the container
padding: Responsive.isDesktop(context) ),
? EdgeInsets.only( padding: Responsive.isDesktop(context)
top: 20, ? EdgeInsets.only(
bottom: 20, top: 20,
left: 0, bottom: 20,
right: 0) left: 0,
: EdgeInsets.only( right: 0)
top: 10, : EdgeInsets.only(
bottom: 10, top: 10,
left: 10, bottom: 10,
right: 10), left: 10,
child: Column( right: 10),
crossAxisAlignment: child: Column(
CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: InkWell(
onTap: () {
context.go('/help');
},
child: Icon(
Icons
.chevron_left, // Replace with your desired icon
color: Color(0xFF000000),
size: 30,
),
),
),
Expanded(
flex: 11,
child: Row(
mainAxisAlignment:
Responsive.isDesktop(context)
? MainAxisAlignment.center
: MainAxisAlignment.start,
children: [
Text(
'Raise a Query',
textAlign: TextAlign.start,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 20
: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF000000),
),
)
],
),
)
],
), // Space between rows
// Add more rows as needed
],
),
),
SizedBox(height: 15),
Container(
child: Column(
children: [
Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Container( Row(
width: double.infinity, mainAxisAlignment:
alignment: Alignment.centerLeft, MainAxisAlignment.start,
child: Column( children: [
mainAxisAlignment: Expanded(
MainAxisAlignment.start, // flex: 1,
crossAxisAlignment: child: InkWell(
CrossAxisAlignment.start, onTap: () {
children: [ context.go('/help');
Form( },
key: formKey, child: Icon(
child: Column( Icons
children: [ .chevron_left, // Replace with your desired icon
Column( color: Color(0xFF000000),
crossAxisAlignment: size: 30,
CrossAxisAlignment
.start,
children: [
buildDropdownField<
int>(
'Type',
(value) {
setState(() {
serviceId =
value;
selectedServiceName =
serviceList
.firstWhere(
(serList) =>
serList[
'id'] ==
value,
orElse: () =>
{
'name': ''
},
)['name'];
isServiceValid =
true;
});
},
false,
serviceList,
'name',
serviceId,
valueKey: 'id',
),
if (!isServiceValid)
Text(
'Please select a Service',
style: TextStyle(
color: Colors
.red)),
],
),
SizedBox(height: 15),
if (selectedServiceName !=
"Sales")
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
buildDropdownField<
String>(
'Policy Number',
(value) {
setState(() {
policyNumberId =
value;
isPolicyValid =
true;
});
},
false,
policyList,
'policy_no',
policyNumberId,
valueKey:
'policy_no',
),
if (!isPolicyValid)
Text(
'Please select a policy',
style: TextStyle(
color: Colors
.red)),
],
),
SizedBox(height: 15),
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
buildTextField(
'Subject',
subjectController),
if (!isSubjectValid)
Text(
'Please enter the Subject',
style: TextStyle(
color: Colors
.red)),
SizedBox(
height: 15),
buildTextAreaField(
'Message',
messageController),
if (!isMessageValid)
Text(
'Please enter the Message',
style: TextStyle(
color: Colors
.red)),
]),
],
),
),
],
),
),
],
),
SizedBox(height: 15),
Row(
children: [
Expanded(
flex: 12,
child: Container(
alignment: Alignment.centerRight,
child: ElevatedButton(
onPressed: () {
sendFormDataToApi();
},
child: Text(
'Send',
style: GoogleFonts.poppins(
color: Colors.white),
),
style: ElevatedButton.styleFrom(
backgroundColor:
Color(0xFFE26728),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(
5),
), ),
), ),
), ),
), Expanded(
flex: 11,
child: Row(
mainAxisAlignment: Responsive
.isDesktop(context)
? MainAxisAlignment.start
: MainAxisAlignment.start,
children: [
Text(
'Raise a Query',
textAlign:
TextAlign.start,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context)
? 20
: 16,
fontWeight:
FontWeight.w600,
color:
Color(0xFF000000),
),
)
],
),
)
],
), // Space between rows
// Add more rows as needed
],
),
),
SizedBox(height: 15),
Container(
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Form(
key: formKey,
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
buildDropdownField<
int>(
'Type',
(value) {
setState(() {
serviceId =
value;
selectedServiceName =
serviceList
.firstWhere(
(serList) =>
serList[
'id'] ==
value,
orElse:
() =>
{
'name':
''
},
)['name'];
isServiceValid =
true;
});
},
false,
serviceList,
'name',
serviceId,
valueKey: 'id',
),
if (!isServiceValid)
Text(
'Please select a Service',
style: TextStyle(
color: Colors
.red)),
],
),
SizedBox(height: 15),
if (selectedServiceName !=
"Sales")
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
buildDropdownField<
String>(
'Policy Number',
(value) {
setState(
() {
policyNumberId =
value;
isPolicyValid =
true;
});
},
false,
policyList,
'policy_no',
policyNumberId,
valueKey:
'policy_no',
),
if (!isPolicyValid)
Text(
'Please select a policy',
style: TextStyle(
color:
Colors.red)),
],
),
SizedBox(height: 15),
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
buildTextField(
'Subject',
subjectController),
if (!isSubjectValid)
Text(
'Please enter the Subject',
style: TextStyle(
color:
Colors.red)),
SizedBox(
height: 15),
buildTextAreaField(
'Message',
messageController),
if (!isMessageValid)
Text(
'Please enter the Message',
style: TextStyle(
color:
Colors.red)),
]),
],
),
),
],
),
),
],
),
SizedBox(height: 15),
Row(
children: [
Expanded(
flex: 12,
child: Container(
alignment:
Alignment.centerRight,
child: ElevatedButton(
onPressed: () {
sendFormDataToApi();
},
child: Text(
'Send',
style:
GoogleFonts.poppins(
color:
Colors.white),
),
style: ElevatedButton
.styleFrom(
backgroundColor:
Color(0xFFE26728),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(5),
),
),
),
),
),
],
), ),
], ],
), ),
], ),
), ],
), ))),
], ],
))), ),
], ),
),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 60),
]),
)),
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(),
), ),
), ),
),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 60),
]), ]),
)), // floatingActionButton: Responsive.isDesktop(context)
if (isLoading) // ? null
Container( // : FloatingActionButton(
color: Color(0x98FFFCE5), // Semi-transparent background // onPressed: () {
child: Center( // Navigator.pushNamed(context, 'chatbot');
child: // Your GIF loader widget // },
Image.asset( // child: Icon(Icons.chat),
height: 60, // ),
width: 60, floatingActionButtonLocation: Responsive.isDesktop(context)
'assets/nhance-loader.gif'), // Adjust path to your GIF loader ? null
), : FloatingActionButtonLocation.miniEndFloat,
), bottomNavigationBar: Responsive.isDesktop(context)
if (Responsive.isDesktop(context)) ? null
Align( : CustomBottomNavigationBar(
alignment: Alignment.bottomCenter, onTabChanged: (index) {
child: Container( // repositionBotman();
width: double.infinity, // Make the footer full width if (index == 0) {
child: CustomFooter(), context.go('/home');
), } else if (index == 1) {
), context.go('/claims');
]), } else if (index == 2) {
// floatingActionButton: Responsive.isDesktop(context) context.go('/profile');
// ? null } else if (index == 3) {
// : FloatingActionButton( context.go('/help');
// onPressed: () { } else if (index == 4) {
// Navigator.pushNamed(context, 'chatbot'); // Wellness tab clicked show popup
// }, PopupHelper.showRedirectPopup(
// child: Icon(Icons.chat), context: context,
// ), apiService: apiService,
floatingActionButtonLocation: Responsive.isDesktop(context) empPrimaryId: session.empPrimaryId,
? null );
: FloatingActionButtonLocation.miniEndFloat, }
bottomNavigationBar: Responsive.isDesktop(context) },
? null icons: [
: CustomBottomNavigationBar( Icons.home_outlined,
onTabChanged: (index) { Icons.sticky_note_2_outlined,
// repositionBotman(); Icons.person_outline_outlined,
if (index == 0) { Icons.headset_mic_outlined,
context.go('/home'); Icons.health_and_safety_outlined,
} else if (index == 1) { ],
context.go('/claims'); labels: [
} else if (index == 2) { "Home",
context.go('/profile'); "Claims",
} else if (index == 3) { "Profile",
context.go('/help'); "Help",
} else if (index == 4) { "Wellness",
// Wellness tab clicked show popup ],
PopupHelper.showRedirectPopup( initialIndex: 3, // Initial index of the bottom navigation bar
context: context, ),
apiService: apiService, ));
empPrimaryId: session.empPrimaryId,
);
}
},
icons: [
Icons.home_outlined,
Icons.sticky_note_2_outlined,
Icons.person_outline_outlined,
Icons.headset_mic_outlined,
Icons.health_and_safety_outlined,
],
labels: [
"Home",
"Claims",
"Profile",
"Help",
"Wellness",
],
initialIndex: 3, // Initial index of the bottom navigation bar
),
)
);
} }
Widget buildTextField(String label, TextEditingController controller, Widget buildTextField(String label, TextEditingController controller,

View File

@ -1282,4 +1282,4 @@
// print('Title: ${message.notification?.title}'); // print('Title: ${message.notification?.title}');
// print('Body: ${message.notification?.body}'); // print('Body: ${message.notification?.body}');
// print('Data: ${message.data}'); // print('Data: ${message.data}');
// } // }