From 9a5ddf2b0a08f4f71c1dc562552032531a5df53e Mon Sep 17 00:00:00 2001 From: SurendarSuri30 Date: Mon, 10 Nov 2025 16:49:08 +0530 Subject: [PATCH] update mobile added --- android/app/build.gradle | 4 +- lib/pages/postEnrollment/home.dart | 1357 ++++++++--------- lib/pages/postEnrollment/planclaimsform.dart | 12 + lib/pages/postEnrollment/profile.dart | 64 +- .../service/common_update_mobile_dialog.dart | 34 +- pubspec.yaml | 4 +- 6 files changed, 721 insertions(+), 754 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0926571..ea3f6df 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -19,12 +19,12 @@ if (project.hasProperty('google-services.json')) { def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { - flutterVersionCode = '41' + flutterVersionCode = '42' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { - flutterVersionName = '2.0.3' + flutterVersionName = '2.0.4' } def keystoreProperties = new Properties() diff --git a/lib/pages/postEnrollment/home.dart b/lib/pages/postEnrollment/home.dart index a16f248..c4b6421 100755 --- a/lib/pages/postEnrollment/home.dart +++ b/lib/pages/postEnrollment/home.dart @@ -1,8 +1,7 @@ -import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:math'; -import 'dart:html' as html; + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -31,10 +30,10 @@ import 'chatbot.dart'; // import 'dart:html' as html; 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' - 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'; class Home extends StatefulWidget { @@ -46,7 +45,6 @@ class Home extends StatefulWidget { class _HomeState extends State { bool _dialogShown = false; - late StreamSubscription _popStateListener; bool isLoadingGif = false; late ApiService apiService; int _currentIndex = 0; @@ -62,7 +60,7 @@ class _HomeState extends State { dynamic policyHeading; dynamic policyName; dynamic EmployeePolicy; - dynamic emp_name = ''; + dynamic emp_name; dynamic pre_policy_count; dynamic client_branch_id; dynamic mobileNo; @@ -90,7 +88,7 @@ class _HomeState extends State { // 🔹 Load ads // dataManager.loadAdvertisementImages(); - if (kIsWeb) { + if(kIsWeb){ getAdvertisementSliderImage(); } else { advertisementImages = DataManager().advertisementImages; @@ -120,6 +118,11 @@ class _HomeState extends State { ); print('loadSelfEmployeeProfile'); + + + + + // if (kIsWeb) { // openBotmanChat(); // } @@ -186,9 +189,6 @@ class _HomeState extends State { final preToken = TokenService.getPreToken(); print('preToken'); print(preToken); - WidgetsBinding.instance.addPostFrameCallback((_) { - checkbackbutton(); - }); setState(() { isTokenAvailable = preToken != null; }); @@ -314,7 +314,7 @@ class _HomeState extends State { 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; final random = Random.secure(); return List.generate( - length, (index) => characters[random.nextInt(characters.length)]) + length, (index) => characters[random.nextInt(characters.length)]) .join(); } @@ -352,11 +352,11 @@ class _HomeState extends State { actions: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, // Space buttons evenly + MainAxisAlignment.spaceEvenly, // Space buttons evenly children: [ SizedBox( width: - MediaQuery.of(context).size.width * 0.3, // Set button width + MediaQuery.of(context).size.width * 0.3, // Set button width child: TextButton( onPressed: () => Navigator.pop(dialogContext), style: TextButton.styleFrom( @@ -379,7 +379,7 @@ class _HomeState extends State { ), SizedBox( width: - MediaQuery.of(context).size.width * 0.3, // Set button width + MediaQuery.of(context).size.width * 0.3, // Set button width child: TextButton( onPressed: () => TokenService().logout(context), style: TextButton.styleFrom( @@ -411,22 +411,9 @@ class _HomeState extends State { ); } - 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 Widget build(BuildContext context) { + if (!Responsive.isDesktop(context)) SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Color(0xFFFFFBDE), // Status bar color @@ -434,634 +421,613 @@ class _HomeState extends State { )); return PopScope( canPop: false, - onPopInvoked: (didPop) { + onPopInvokedWithResult: (didPop, result) { if (didPop) return; _showExitConfirmation(context); }, - // onPopInvokedWithResult: (didPop, result) { - // if (didPop) return; - // _showExitConfirmation(context); - // }, child: Scaffold( backgroundColor: Colors.white, 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(15), - color: Colors.white, - 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: [ - Row( + 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(15), + color: Colors.white, + 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( - 'Hello, $emp_name!', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) + Row( + children: [ + Text( + 'Hello, $emp_name!', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) ? 20 : 20, - fontWeight: FontWeight.w500, - color: Color(0xFF000000), - ), - ), - ], - ), - // Text( - // 'Lorem ipsum dolor sit amet', - // textAlign: TextAlign.left, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) ? 12 : 14, - // fontWeight: FontWeight.w400, - // color: Color(0xFF7A7A7A), - // ), - // ), - ], - ))), - ], - ), - ), - 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 : $pre_policy_count', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: Responsive.isDesktop(context) - ? 18 - : 12, - fontWeight: FontWeight.w500, - color: Color(0xFF404040), - ), - ), - ], - ), - ), - Expanded( - flex: 5, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ElevatedButton( - onPressed: isTokenAvailable - ? () { - context.go('/empDetails'); - } - : null, - child: Text('View Details'), - ), - ], - ), - ), - ], - ), - ), - ], - ), - ), - ), - SizedBox(height: 15), - if (advertisementImages != null) - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: advertisementImages.isEmpty - ? Center(child: Text("No images available")) - : Container( - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: ImageSlideshow( - /// Width of the [ImageSlideshow]. - width: double.infinity, - - /// Height of the [ImageSlideshow]. - height: - Responsive.isDesktop( - context) - ? 200 - : 150, - - /// The page to show when first creating the [ImageSlideshow]. - initialPage: 0, - - /// The color to paint the indicator. - indicatorColor: - Color(0xFFE26728), - - /// The color to paint behind the indicator. - indicatorBackgroundColor: - Colors.grey, - - /// The widgets to display in the [ImageSlideshow]. - children: - advertisementImages - .map( - (imageUrl) => - ClipRRect( - borderRadius: - BorderRadius - .circular( - 8), - child: Image - .network( - imageUrl, - fit: BoxFit - .cover, - ), - ), - ) - .toList(), - - /// Called whenever the page in the center of the viewport changes. - onPageChanged: (value) { - print( - 'Page changed: $value'); - }, - - /// Auto scroll interval. - /// Do not auto scroll with null or 0. - autoPlayInterval: 3000, - - /// Loops back to the first slide. - isLoop: true, - ), - ), - ], + fontWeight: FontWeight.w500, + color: Color(0xFF000000), ), ), + ], + ), + // Text( + // 'Lorem ipsum dolor sit amet', + // textAlign: TextAlign.left, + // style: GoogleFonts.poppins( + // fontSize: + // Responsive.isDesktop(context) ? 12 : 14, + // fontWeight: FontWeight.w400, + // color: Color(0xFF7A7A7A), + // ), + // ), + ], + ))), + ], + ), + ), + 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 : $pre_policy_count', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop(context) ? 18 : 12, + fontWeight: FontWeight.w500, + color: Color(0xFF404040), + ), ), ], ), ), - ), + Expanded( + flex: 5, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton( + onPressed: isTokenAvailable + ? () { + context.go('/empDetails'); + } + : null, + child: Text('View Details'), + ), + ], + ), + ), + ], + ), + ), + ], ), - ], + ), ), - ), - SizedBox(height: 15), - Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + SizedBox(height: 15), + if (advertisementImages != null) + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: advertisementImages.isEmpty + ? Center(child: Text("No images available")) + : Container( + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Text( - 'Your Policies', - textAlign: TextAlign.left, - style: GoogleFonts.poppins( - fontSize: - Responsive.isDesktop(context) - ? 18 - : 18, - fontWeight: FontWeight.w500, - color: Color(0xFF000000), + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: ImageSlideshow( + /// Width of the [ImageSlideshow]. + width: double.infinity, + + /// Height of the [ImageSlideshow]. + height: + Responsive.isDesktop( + context) + ? 200 + : 150, + + /// The page to show when first creating the [ImageSlideshow]. + initialPage: 0, + + /// The color to paint the indicator. + indicatorColor: + Color(0xFFE26728), + + /// The color to paint behind the indicator. + indicatorBackgroundColor: + Colors.grey, + + /// The widgets to display in the [ImageSlideshow]. + children: + advertisementImages + .map( + (imageUrl) => + ClipRRect( + borderRadius: + BorderRadius + .circular( + 8), + child: Image + .network( + imageUrl, + fit: BoxFit + .cover, + ), + ), + ) + .toList(), + + /// Called whenever the page in the center of the viewport changes. + onPageChanged: (value) { + print( + 'Page changed: $value'); + }, + + /// Auto scroll interval. + /// Do not auto scroll with null or 0. + autoPlayInterval: 3000, + + /// Loops back to the first slide. + isLoop: true, + ), + ), + ], + ), ), ), ], ), - // Text( - // 'Lorem ipsum dolor sit amet', - // textAlign: TextAlign.left, - // style: GoogleFonts.poppins( - // fontSize: - // Responsive.isDesktop(context) ? 12 : 14, - // fontWeight: FontWeight.w400, - // color: Color(0xFF7A7A7A), - // ), - // ), - ], - ))), - ], - ), - ), - SizedBox(height: 15), - Container( - decoration: BoxDecoration( - color: Color( - 0xFFEEF5FF), // Set background color for the container - borderRadius: BorderRadius.circular( - 5), // Set border radius for the container - ), - padding: Responsive.isDesktop(context) - ? EdgeInsets.only( - top: 10, bottom: 10, left: 25, right: 25) - : EdgeInsets.only( - top: 10, bottom: 10, left: 10, right: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 12, - child: Container( - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, + ), + ), + ), + ], + ), + ), + SizedBox(height: 15), + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 6, - child: Container( - alignment: Alignment.center, - child: GestureDetector( - onTap: () { - setState(() { - isActive = true; - policyList.clear(); - }); - getActiveAndInactivePolicyDetails( - 'Active'); - }, - child: isActive - ? Material( - elevation: 5, - borderRadius: - BorderRadius.circular( - 10), - color: Colors.white, - child: SizedBox( - width: Responsive - .isDesktop( - context) - ? 400 - : 150, // Set the width here - child: TextButton( - onPressed: () {}, - style: TextButton - .styleFrom( - padding: EdgeInsets - .symmetric( - vertical: Responsive - .isDesktop( - context) - ? 12 - : 5, - ), - ), - child: Text( - 'Active', - style: GoogleFonts - .poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 13, - fontWeight: - FontWeight - .w500, - color: Color( - 0xFF593AFF), - ), - ), - ), - ), - ) - : Text( - 'Active', - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 13, - fontWeight: - FontWeight.w400, - color: - Color(0xFF636363), - ), - ), + Row( + children: [ + Text( + 'Your Policies', + textAlign: TextAlign.left, + style: GoogleFonts.poppins( + fontSize: Responsive.isDesktop(context) + ? 18 + : 18, + fontWeight: FontWeight.w500, + color: Color(0xFF000000), ), - )), - Expanded( - flex: 6, - child: Container( - alignment: Alignment.center, - child: GestureDetector( - onTap: () { - setState(() { - isActive = false; - policyList.clear(); - }); - getActiveAndInactivePolicyDetails( - 'Inactive'); - }, - child: !isActive - ? Material( - elevation: 5, - borderRadius: - BorderRadius.circular( - 10), - color: Colors.white, - child: SizedBox( - width: Responsive - .isDesktop( - context) - ? 400 - : 150, // Set the width here - child: TextButton( - onPressed: () {}, - style: TextButton - .styleFrom( - padding: EdgeInsets - .symmetric( - vertical: Responsive - .isDesktop( - context) - ? 12 - : 5, - ), - ), - child: Text( - 'Inactive', - style: GoogleFonts - .poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 13, - fontWeight: - FontWeight - .w500, - color: Color( - 0xFF593AFF), - ), - ), - ), - ), - ) - : Text( - 'Inactive', - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 18 - : 13, - fontWeight: - FontWeight.w400, - color: - Color(0xFF636363), - ), - ), - ), - )) + ), + ], + ), + // Text( + // 'Lorem ipsum dolor sit amet', + // textAlign: TextAlign.left, + // style: GoogleFonts.poppins( + // fontSize: + // Responsive.isDesktop(context) ? 12 : 14, + // fontWeight: FontWeight.w400, + // color: Color(0xFF7A7A7A), + // ), + // ), ], - ) - ], - ))), - ], - ), + ))), + ], + ), + ), + SizedBox(height: 15), + Container( + decoration: BoxDecoration( + color: + Color(0xFFEEF5FF), // Set background color for the container + borderRadius: BorderRadius.circular( + 5), // Set border radius for the container + ), + padding: Responsive.isDesktop(context) + ? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25) + : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 12, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + flex: 6, + child: Container( + alignment: Alignment.center, + child: GestureDetector( + onTap: () { + setState(() { + isActive = true; + policyList.clear(); + }); + getActiveAndInactivePolicyDetails( + 'Active'); + }, + child: isActive + ? Material( + elevation: 5, + borderRadius: + BorderRadius.circular(10), + color: Colors.white, + child: SizedBox( + width: Responsive.isDesktop( + context) + ? 400 + : 150, // Set the width here + child: TextButton( + onPressed: () {}, + style: + TextButton.styleFrom( + padding: EdgeInsets + .symmetric( + vertical: Responsive + .isDesktop( + context) + ? 12 + : 5, + ), + ), + child: Text( + 'Active', + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 13, + fontWeight: + FontWeight.w500, + color: + Color(0xFF593AFF), + ), + ), + ), + ), + ) + : Text( + 'Active', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 13, + fontWeight: FontWeight.w400, + color: Color(0xFF636363), + ), + ), + ), + )), + Expanded( + flex: 6, + child: Container( + alignment: Alignment.center, + child: GestureDetector( + onTap: () { + setState(() { + isActive = false; + policyList.clear(); + }); + getActiveAndInactivePolicyDetails( + 'Inactive'); + }, + child: !isActive + ? Material( + elevation: 5, + borderRadius: + BorderRadius.circular(10), + color: Colors.white, + child: SizedBox( + width: Responsive.isDesktop( + context) + ? 400 + : 150, // Set the width here + child: TextButton( + onPressed: () {}, + style: + TextButton.styleFrom( + padding: EdgeInsets + .symmetric( + vertical: Responsive + .isDesktop( + context) + ? 12 + : 5, + ), + ), + child: Text( + 'Inactive', + style: + GoogleFonts.poppins( + fontSize: Responsive + .isDesktop( + context) + ? 18 + : 13, + fontWeight: + FontWeight.w500, + color: + Color(0xFF593AFF), + ), + ), + ), + ), + ) + : Text( + 'Inactive', + style: GoogleFonts.poppins( + fontSize: + Responsive.isDesktop( + context) + ? 18 + : 13, + fontWeight: FontWeight.w400, + color: Color(0xFF636363), + ), + ), + ), + )) + ], + ) + ], + ))), + ], + ), + ), + SizedBox(height: 15), + if (policyList != null && policyList.length > 0) + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ...generateCards(policyList), + ], + ), + SizedBox(height: Responsive.isDesktop(context) ? 40 : 70), + ]), + )), + // Positioned( + // bottom: 25, + // right: 15, + // child: GestureDetector( + // onTap: () async { + // // Navigator.of(context).push( + // // MaterialPageRoute(builder: (context) => const ChatPage()), + // // ); + // final sessionId = generateSessionId(); + // final SharedPreferences prefs = await SharedPreferences.getInstance(); + // final empClientBranchId = prefs.getString('empClientBranchId') ?? ''; + // final empCodeString = prefs.getString('empCode') ?? ''; + // final empPrimaryId = prefs.getString('empPrimaryId') ?? ''; + // final client_id = prefs.getString('client_id') ?? ''; + // final gpaEmpName = prefs.getString('gpaEmpName') ?? ''; + // + // print('param check from home'); + // print(gpaEmpName); + // print(empCodeString); + // print(empClientBranchId); + // print(client_id); + // print(empPrimaryId); + // + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (context) => BotmanChatScreen( + // // builder: (context) => ChatPage( + // sessionId: sessionId, + // employeeId: empPrimaryId, + // empCode: empCodeString, + // clientId: client_id, + // clientBranchId: empClientBranchId, + // empName: gpaEmpName, + // ), + // ), + // ); + // + // }, + // child: Container( + // width: 60, + // height: 60, + // decoration: BoxDecoration( + // color: Colors.blue, + // borderRadius: BorderRadius.circular(30), + // boxShadow: [ + // BoxShadow( + // color: Colors.black26, + // blurRadius: 5, + // offset: Offset(2, 2), + // ), + // ], + // ), + // alignment: Alignment.center, + // child: const Icon( + // Icons.chat, // you can change this to any icon you like + // color: Colors.white, + // size: 20, + // ), + // ), + // ), + // ), + if (isLoadingGif) + 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 ), - SizedBox(height: 15), - if (policyList != null && policyList.length > 0) - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ...generateCards(policyList), - ], - ), - SizedBox(height: Responsive.isDesktop(context) ? 40 : 70), - ]), - )), - // Positioned( - // bottom: 25, - // right: 15, - // child: GestureDetector( - // onTap: () async { - // // Navigator.of(context).push( - // // MaterialPageRoute(builder: (context) => const ChatPage()), - // // ); - // final sessionId = generateSessionId(); - // final SharedPreferences prefs = await SharedPreferences.getInstance(); - // final empClientBranchId = prefs.getString('empClientBranchId') ?? ''; - // final empCodeString = prefs.getString('empCode') ?? ''; - // final empPrimaryId = prefs.getString('empPrimaryId') ?? ''; - // final client_id = prefs.getString('client_id') ?? ''; - // final gpaEmpName = prefs.getString('gpaEmpName') ?? ''; - // - // print('param check from home'); - // print(gpaEmpName); - // print(empCodeString); - // print(empClientBranchId); - // print(client_id); - // print(empPrimaryId); - // - // Navigator.of(context).push( - // MaterialPageRoute( - // builder: (context) => BotmanChatScreen( - // // builder: (context) => ChatPage( - // sessionId: sessionId, - // employeeId: empPrimaryId, - // empCode: empCodeString, - // clientId: client_id, - // clientBranchId: empClientBranchId, - // empName: gpaEmpName, - // ), - // ), - // ); - // - // }, - // child: Container( - // width: 60, - // height: 60, - // decoration: BoxDecoration( - // color: Colors.blue, - // borderRadius: BorderRadius.circular(30), - // boxShadow: [ - // BoxShadow( - // color: Colors.black26, - // blurRadius: 5, - // offset: Offset(2, 2), - // ), - // ], - // ), - // alignment: Alignment.center, - // child: const Icon( - // Icons.chat, // you can change this to any icon you like - // color: Colors.white, - // size: 20, - // ), - // ), - // ), - // ), - if (isLoadingGif) - 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: () => push(chatbot()), + // onPressed: () => { + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => MyWebViewPage( + // // url: 'https://venbait.in/nhance/dev/chatbot?employee_id=${empPrimaryId}&emp_code=${empCodeString}&origin=mob&name=${empName}&client_id=${client_id}&client_branch_id=${client_branch_id}', + // // ), + // // ), + // // ) + // // context.go( + // // '/chatbot', + // // extra: { + // // 'client_branch_id': client_branch_id, + // // 'empCodeString': empCodeString, + // // 'empName': empName, + // // 'empPrimaryId': empPrimaryId, + // // 'client_id': client_id, + // // }, + // // ) + // Navigator.push( + // context, + // // MaterialPageRoute(builder: (context) => const BotmanChatPage()), + // MaterialPageRoute( + // builder: (context) => ChatbotWebViewPage( + // client_branch_id: client_branch_id, + // empCodeString: empCodeString, + // empName: empName, + // empPrimaryId: empPrimaryId, + // client_id: client_id, + // )), + // ) + // }, + // child: Icon(Icons.chat), + // ), + floatingActionButtonLocation: Responsive.isDesktop(context) + ? null + : FloatingActionButtonLocation.miniEndFloat, + bottomNavigationBar: Responsive.isDesktop(context) + ? null + : CustomBottomNavigationBar( + onTabChanged: (index) { + // Add your navigation logic here + // repositionBotman(); + if (index == 0) { + context.push('/home'); + } else if (index == 1) { + context.push('/claims'); + } else if (index == 2) { + context.push('/profile'); + } else if (index == 3) { + context.push('/help'); + } else if (index == 4) { + // Wellness tab clicked → show popup + PopupHelper.showRedirectPopup( + 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: 0, // Initial index of the bottom navigation bar ), - 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: () => push(chatbot()), - // onPressed: () => { - // // Navigator.push( - // // context, - // // MaterialPageRoute( - // // builder: (context) => MyWebViewPage( - // // url: 'https://venbait.in/nhance/dev/chatbot?employee_id=${empPrimaryId}&emp_code=${empCodeString}&origin=mob&name=${empName}&client_id=${client_id}&client_branch_id=${client_branch_id}', - // // ), - // // ), - // // ) - // // context.go( - // // '/chatbot', - // // extra: { - // // 'client_branch_id': client_branch_id, - // // 'empCodeString': empCodeString, - // // 'empName': empName, - // // 'empPrimaryId': empPrimaryId, - // // 'client_id': client_id, - // // }, - // // ) - // Navigator.push( - // context, - // // MaterialPageRoute(builder: (context) => const BotmanChatPage()), - // MaterialPageRoute( - // builder: (context) => ChatbotWebViewPage( - // client_branch_id: client_branch_id, - // empCodeString: empCodeString, - // empName: empName, - // empPrimaryId: empPrimaryId, - // client_id: client_id, - // )), - // ) - // }, - // child: Icon(Icons.chat), - // ), - floatingActionButtonLocation: Responsive.isDesktop(context) - ? null - : FloatingActionButtonLocation.miniEndFloat, - bottomNavigationBar: Responsive.isDesktop(context) - ? null - : CustomBottomNavigationBar( - onTabChanged: (index) { - // Add your navigation logic here - // repositionBotman(); - if (index == 0) { - context.push('/home'); - } else if (index == 1) { - context.push('/claims'); - } else if (index == 2) { - context.push('/profile'); - } else if (index == 3) { - context.push('/help'); - } else if (index == 4) { - // Wellness tab clicked → show popup - PopupHelper.showRedirectPopup( - 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: 0, // Initial index of the bottom navigation bar - ), - ) + ) ); } @@ -1104,7 +1070,7 @@ class _HomeState extends State { onTap: () { context.go( '/policies', - extra: item, // 👈 pass arguments here + extra: item, // 👈 pass arguments here ); }, child: MouseRegion( @@ -1113,7 +1079,7 @@ class _HomeState extends State { elevation: 5, shape: RoundedRectangleBorder( borderRadius: - BorderRadius.circular(15.0), // Set border radius here + BorderRadius.circular(15.0), // Set border radius here ), child: Container( decoration: BoxDecoration( @@ -1123,12 +1089,12 @@ class _HomeState extends State { ), padding: Responsive.isDesktop(context) ? EdgeInsets.only( - top: 15, bottom: 15, left: 15, right: 15) + top: 15, bottom: 15, left: 15, right: 15) : EdgeInsets.only( - top: 10, - bottom: 10, - left: 10, - right: 10), // Add padding to the container + top: 10, + bottom: 10, + left: 10, + right: 10), // Add padding to the container child: Row( children: [ Expanded( @@ -1138,7 +1104,7 @@ class _HomeState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Row( children: [ @@ -1146,17 +1112,17 @@ class _HomeState extends State { flex: 7, child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Text( policyHeading ?? '', textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop( - context) - ? 10 - : 10, + Responsive.isDesktop( + context) + ? 10 + : 10, fontWeight: FontWeight.w400, color: Color(0xFF785EFF), ), @@ -1168,17 +1134,17 @@ class _HomeState extends State { flex: 5, child: Column( crossAxisAlignment: - CrossAxisAlignment.end, + CrossAxisAlignment.end, children: [ Text( 'Expires on $formattedDate', textAlign: TextAlign.right, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop( - context) - ? 10 - : 10, + Responsive.isDesktop( + context) + ? 10 + : 10, fontWeight: FontWeight.w400, color: Color(0xFF747474), ), @@ -1195,17 +1161,17 @@ class _HomeState extends State { flex: 6, child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Text( policyName ?? '', textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop( - context) - ? 14 - : 13, + Responsive.isDesktop( + context) + ? 14 + : 13, fontWeight: FontWeight.w500, color: Color(0xFF000000), ), @@ -1217,7 +1183,7 @@ class _HomeState extends State { flex: 5, child: Column( crossAxisAlignment: - CrossAxisAlignment.end, + CrossAxisAlignment.end, children: [ Text( formatToCroresLakhsAndThousands( @@ -1225,10 +1191,10 @@ class _HomeState extends State { textAlign: TextAlign.left, style: GoogleFonts.poppins( fontSize: - Responsive.isDesktop( - context) - ? 14 - : 13, + Responsive.isDesktop( + context) + ? 14 + : 13, fontWeight: FontWeight.w500, color: Color(0xFF000000), ), @@ -1240,13 +1206,13 @@ class _HomeState extends State { flex: 1, child: Container( alignment: - Alignment.centerRight, + Alignment.centerRight, child: Icon( Icons.chevron_right, color: Color( 0xFFE26728), // Replace with your desired icon size: Responsive.isDesktop( - context) + context) ? 30 : 26, ), @@ -1256,67 +1222,28 @@ class _HomeState extends State { SizedBox(height: 7), Row( children: [ - Flexible( - child: Container( - // color: Colors.red, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Tooltip( - message: '$memberNames', - child: Text( - memberNames ?? '', - textAlign: TextAlign.left, - maxLines: 1, - overflow: - TextOverflow.ellipsis, - softWrap: false, - style: - GoogleFonts.poppins( - fontSize: Responsive - .isDesktop( - context) - ? 14 - : 13, - fontWeight: - FontWeight.w400, - color: const Color( - 0xFF000000), - ), - ), + Expanded( + flex: 12, + 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), ), - ], - ), + ), + ], ), ), - - // 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), @@ -1340,4 +1267,4 @@ class _HomeState extends State { ), ); } -} +} \ No newline at end of file diff --git a/lib/pages/postEnrollment/planclaimsform.dart b/lib/pages/postEnrollment/planclaimsform.dart index 1b99293..1577813 100755 --- a/lib/pages/postEnrollment/planclaimsform.dart +++ b/lib/pages/postEnrollment/planclaimsform.dart @@ -633,6 +633,18 @@ class _planclaimsformState extends State { } } + // ✅ NEW VALIDATION: At least one PDF must be uploaded + bool hasPdf = uploadedFiles.any((uf) { + final ext = uf.file.extension?.toLowerCase() ?? ''; + return ext == 'pdf'; + }); + + if (!hasPdf) { + ToastHelper.showErrorToast(context, 'Please upload at least one PDF document'); + setState(() => isLoading = false); + return; + } + // Add files for (var uf in uploadedFiles) { final pf = uf.file; diff --git a/lib/pages/postEnrollment/profile.dart b/lib/pages/postEnrollment/profile.dart index ecb2ba8..1bdc63a 100755 --- a/lib/pages/postEnrollment/profile.dart +++ b/lib/pages/postEnrollment/profile.dart @@ -794,38 +794,38 @@ class _profileState extends State { ), ), SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), - if (Responsive.isDesktop(context)) - Padding( - padding: const EdgeInsets.only(bottom: 16.0), - child: FutureBuilder( - future: _getAppVersion(), // Function to get the app version - builder: (context, snapshot) { - if (snapshot.connectionState == - ConnectionState.waiting) { - return Text( - 'Loading version...', - style: GoogleFonts.poppins( - fontSize: 12, color: Colors.grey), - textAlign: TextAlign.center, - ); - } else if (snapshot.hasError) { - return Text( - 'Error fetching version', - style: GoogleFonts.poppins( - fontSize: 12, color: Colors.red), - textAlign: TextAlign.center, - ); - } else { - return Text( - 'Version ${snapshot.data}', - style: GoogleFonts.poppins( - fontSize: 12, color: Colors.grey), - textAlign: TextAlign.center, - ); - } - }, - ), - ), + // if (Responsive.isDesktop(context)) + // Padding( + // padding: const EdgeInsets.only(bottom: 16.0), + // child: FutureBuilder( + // future: _getAppVersion(), // Function to get the app version + // builder: (context, snapshot) { + // if (snapshot.connectionState == + // ConnectionState.waiting) { + // return Text( + // 'Loading version...', + // style: GoogleFonts.poppins( + // fontSize: 12, color: Colors.grey), + // textAlign: TextAlign.center, + // ); + // } else if (snapshot.hasError) { + // return Text( + // 'Error fetching version', + // style: GoogleFonts.poppins( + // fontSize: 12, color: Colors.red), + // textAlign: TextAlign.center, + // ); + // } else { + // return Text( + // 'Version ${snapshot.data}', + // style: GoogleFonts.poppins( + // fontSize: 12, color: Colors.grey), + // textAlign: TextAlign.center, + // ); + // } + // }, + // ), + // ), if (Responsive.isMobile(context) || Responsive.isTablet(context)) Padding( diff --git a/lib/pages/service/common_update_mobile_dialog.dart b/lib/pages/service/common_update_mobile_dialog.dart index 078c1e1..1e7eb74 100644 --- a/lib/pages/service/common_update_mobile_dialog.dart +++ b/lib/pages/service/common_update_mobile_dialog.dart @@ -12,6 +12,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'dart:convert'; import 'package:http/http.dart' as http; +import 'package:flutter/services.dart'; Future showUpdateMobileDialog( BuildContext context, @@ -22,6 +23,7 @@ Future showUpdateMobileDialog( ) { final controller = TextEditingController(text: currentMobile ?? ''); bool isLoading = false; + String? errorText; return showDialog( context: context, @@ -37,10 +39,28 @@ Future showUpdateMobileDialog( content: TextField( controller: controller, - keyboardType: TextInputType.phone, - decoration: const InputDecoration( + keyboardType: TextInputType.number, + maxLength: 10, + + // ✅ Only allow digits + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + + onChanged: (value) { + setState(() { + if (value.length < 10) { + errorText = "Mobile number must be 10 digits"; + } else { + errorText = null; + } + }); + }, + + decoration: InputDecoration( labelText: "Enter Mobile Number", border: OutlineInputBorder(), + errorText: errorText, // ✅ show validation message ), ), @@ -56,7 +76,7 @@ Future showUpdateMobileDialog( // Save Button ElevatedButton( - onPressed: isLoading + onPressed: isLoading || controller.text.length != 10 ? null : () async { final newMobile = controller.text.trim(); @@ -66,6 +86,14 @@ Future showUpdateMobileDialog( return; } + // ✅ Double check backend validation + if (newMobile.length != 10) { + ToastHelper.showErrorToast(context, "Enter 10 digit mobile number"); + return; + } + + + setState(() => isLoading = true); final updateParam = { diff --git a/pubspec.yaml b/pubspec.yaml index c10d151..97ff453 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,8 +17,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. #version: 1.0.32+32 -version: 1.0.20+23 -#version: 2.0.3+41 +version: 1.0.21+24 +#version: 2.0.4+42 environment: sdk: '>=3.3.3 <4.0.0'