update mobile added

This commit is contained in:
Surendiran 2025-11-10 16:49:08 +05:30
parent 705731d2ab
commit 9a5ddf2b0a
6 changed files with 721 additions and 754 deletions

View File

@ -19,12 +19,12 @@ if (project.hasProperty('google-services.json')) {
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = '41' flutterVersionCode = '42'
} }
def flutterVersionName = localProperties.getProperty('flutter.versionName') def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = '2.0.3' flutterVersionName = '2.0.4'
} }
def keystoreProperties = new Properties() def keystoreProperties = new Properties()

View File

@ -1,8 +1,7 @@
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';
@ -46,7 +45,6 @@ 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;
@ -62,7 +60,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;
@ -120,6 +118,11 @@ class _HomeState extends State<Home> {
); );
print('loadSelfEmployeeProfile'); print('loadSelfEmployeeProfile');
// if (kIsWeb) { // if (kIsWeb) {
// openBotmanChat(); // openBotmanChat();
// } // }
@ -186,9 +189,6 @@ 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;
}); });
@ -411,22 +411,9 @@ 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
@ -434,14 +421,10 @@ class _HomeState extends State<Home> {
)); ));
return PopScope( return PopScope(
canPop: false, canPop: false,
onPopInvoked: (didPop) { onPopInvokedWithResult: (didPop, result) {
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(),
@ -476,8 +459,7 @@ class _HomeState extends State<Home> {
'Hello, $emp_name!', 'Hello, $emp_name!',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize: Responsive.isDesktop(context)
Responsive.isDesktop(context)
? 20 ? 20
: 20, : 20,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -538,9 +520,8 @@ 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: Responsive.isDesktop(context) fontSize:
? 18 Responsive.isDesktop(context) ? 18 : 12,
: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF404040), color: Color(0xFF404040),
), ),
@ -686,8 +667,7 @@ class _HomeState extends State<Home> {
'Your Policies', 'Your Policies',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: GoogleFonts.poppins( style: GoogleFonts.poppins(
fontSize: fontSize: Responsive.isDesktop(context)
Responsive.isDesktop(context)
? 18 ? 18
: 18, : 18,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -714,16 +694,14 @@ class _HomeState extends State<Home> {
SizedBox(height: 15), SizedBox(height: 15),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color( color:
0xFFEEF5FF), // Set background color for the container Color(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( ? EdgeInsets.only(top: 10, bottom: 10, left: 25, right: 25)
top: 10, bottom: 10, left: 25, right: 25) : EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
: EdgeInsets.only(
top: 10, bottom: 10, left: 10, right: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -755,19 +733,17 @@ class _HomeState extends State<Home> {
? Material( ? Material(
elevation: 5, elevation: 5,
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(10),
10),
color: Colors.white, color: Colors.white,
child: SizedBox( child: SizedBox(
width: Responsive width: Responsive.isDesktop(
.isDesktop(
context) context)
? 400 ? 400
: 150, // Set the width here : 150, // Set the width here
child: TextButton( child: TextButton(
onPressed: () {}, onPressed: () {},
style: TextButton style:
.styleFrom( TextButton.styleFrom(
padding: EdgeInsets padding: EdgeInsets
.symmetric( .symmetric(
vertical: Responsive vertical: Responsive
@ -778,25 +754,6 @@ class _HomeState extends State<Home> {
), ),
), ),
child: Text( child: Text(
'Active',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
),
)
: Text(
'Active', 'Active',
style: style:
GoogleFonts.poppins( GoogleFonts.poppins(
@ -806,9 +763,24 @@ class _HomeState extends State<Home> {
? 18 ? 18
: 13, : 13,
fontWeight: fontWeight:
FontWeight.w400, FontWeight.w500,
color: color:
Color(0xFF636363), Color(0xFF593AFF),
),
),
),
),
)
: Text(
'Active',
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 13,
fontWeight: FontWeight.w400,
color: Color(0xFF636363),
), ),
), ),
), ),
@ -830,19 +802,17 @@ class _HomeState extends State<Home> {
? Material( ? Material(
elevation: 5, elevation: 5,
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(10),
10),
color: Colors.white, color: Colors.white,
child: SizedBox( child: SizedBox(
width: Responsive width: Responsive.isDesktop(
.isDesktop(
context) context)
? 400 ? 400
: 150, // Set the width here : 150, // Set the width here
child: TextButton( child: TextButton(
onPressed: () {}, onPressed: () {},
style: TextButton style:
.styleFrom( TextButton.styleFrom(
padding: EdgeInsets padding: EdgeInsets
.symmetric( .symmetric(
vertical: Responsive vertical: Responsive
@ -853,25 +823,6 @@ class _HomeState extends State<Home> {
), ),
), ),
child: Text( child: Text(
'Inactive',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
),
)
: Text(
'Inactive', 'Inactive',
style: style:
GoogleFonts.poppins( GoogleFonts.poppins(
@ -881,9 +832,24 @@ class _HomeState extends State<Home> {
? 18 ? 18
: 13, : 13,
fontWeight: fontWeight:
FontWeight.w400, FontWeight.w500,
color: color:
Color(0xFF636363), Color(0xFF593AFF),
),
),
),
),
)
: Text(
'Inactive',
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 18
: 13,
fontWeight: FontWeight.w400,
color: Color(0xFF636363),
), ),
), ),
), ),
@ -1256,67 +1222,28 @@ class _HomeState extends State<Home> {
SizedBox(height: 7), SizedBox(height: 7),
Row( Row(
children: [ children: [
Flexible( Expanded(
child: Container( flex: 12,
// color: Colors.red,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Tooltip( Text(
message: '$memberNames',
child: Text(
memberNames ?? '', memberNames ?? '',
textAlign: TextAlign.left, textAlign: TextAlign.left,
maxLines: 1, style: GoogleFonts.poppins(
overflow: fontSize:
TextOverflow.ellipsis, Responsive.isDesktop(
softWrap: false,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
context) context)
? 14 ? 14
: 13, : 13,
fontWeight: fontWeight: FontWeight.w400,
FontWeight.w400, color: Color(0xFF000000),
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),

View File

@ -633,6 +633,18 @@ class _planclaimsformState extends State<planclaimsform> {
} }
} }
// 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 // Add files
for (var uf in uploadedFiles) { for (var uf in uploadedFiles) {
final pf = uf.file; final pf = uf.file;

View File

@ -794,38 +794,38 @@ class _profileState extends State<profile> {
), ),
), ),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 10), SizedBox(height: Responsive.isDesktop(context) ? 40 : 10),
if (Responsive.isDesktop(context)) // if (Responsive.isDesktop(context))
Padding( // Padding(
padding: const EdgeInsets.only(bottom: 16.0), // padding: const EdgeInsets.only(bottom: 16.0),
child: FutureBuilder<String>( // child: FutureBuilder<String>(
future: _getAppVersion(), // Function to get the app version // future: _getAppVersion(), // Function to get the app version
builder: (context, snapshot) { // builder: (context, snapshot) {
if (snapshot.connectionState == // if (snapshot.connectionState ==
ConnectionState.waiting) { // ConnectionState.waiting) {
return Text( // return Text(
'Loading version...', // 'Loading version...',
style: GoogleFonts.poppins( // style: GoogleFonts.poppins(
fontSize: 12, color: Colors.grey), // fontSize: 12, color: Colors.grey),
textAlign: TextAlign.center, // textAlign: TextAlign.center,
); // );
} else if (snapshot.hasError) { // } else if (snapshot.hasError) {
return Text( // return Text(
'Error fetching version', // 'Error fetching version',
style: GoogleFonts.poppins( // style: GoogleFonts.poppins(
fontSize: 12, color: Colors.red), // fontSize: 12, color: Colors.red),
textAlign: TextAlign.center, // textAlign: TextAlign.center,
); // );
} else { // } else {
return Text( // return Text(
'Version ${snapshot.data}', // 'Version ${snapshot.data}',
style: GoogleFonts.poppins( // style: GoogleFonts.poppins(
fontSize: 12, color: Colors.grey), // fontSize: 12, color: Colors.grey),
textAlign: TextAlign.center, // textAlign: TextAlign.center,
); // );
} // }
}, // },
), // ),
), // ),
if (Responsive.isMobile(context) || if (Responsive.isMobile(context) ||
Responsive.isTablet(context)) Responsive.isTablet(context))
Padding( Padding(

View File

@ -12,6 +12,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'dart:convert'; import 'dart:convert';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:flutter/services.dart';
Future<String?> showUpdateMobileDialog( Future<String?> showUpdateMobileDialog(
BuildContext context, BuildContext context,
@ -22,6 +23,7 @@ Future<String?> showUpdateMobileDialog(
) { ) {
final controller = TextEditingController(text: currentMobile ?? ''); final controller = TextEditingController(text: currentMobile ?? '');
bool isLoading = false; bool isLoading = false;
String? errorText;
return showDialog<String>( return showDialog<String>(
context: context, context: context,
@ -37,10 +39,28 @@ Future<String?> showUpdateMobileDialog(
content: TextField( content: TextField(
controller: controller, controller: controller,
keyboardType: TextInputType.phone, keyboardType: TextInputType.number,
decoration: const InputDecoration( 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", labelText: "Enter Mobile Number",
border: OutlineInputBorder(), border: OutlineInputBorder(),
errorText: errorText, // show validation message
), ),
), ),
@ -56,7 +76,7 @@ Future<String?> showUpdateMobileDialog(
// Save Button // Save Button
ElevatedButton( ElevatedButton(
onPressed: isLoading onPressed: isLoading || controller.text.length != 10
? null ? null
: () async { : () async {
final newMobile = controller.text.trim(); final newMobile = controller.text.trim();
@ -66,6 +86,14 @@ Future<String?> showUpdateMobileDialog(
return; return;
} }
// Double check backend validation
if (newMobile.length != 10) {
ToastHelper.showErrorToast(context, "Enter 10 digit mobile number");
return;
}
setState(() => isLoading = true); setState(() => isLoading = true);
final updateParam = { final updateParam = {

View File

@ -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 # 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. # of the product and file versions while build-number is used as the build suffix.
#version: 1.0.32+32 #version: 1.0.32+32
version: 1.0.20+23 version: 1.0.21+24
#version: 2.0.3+41 #version: 2.0.4+42
environment: environment:
sdk: '>=3.3.3 <4.0.0' sdk: '>=3.3.3 <4.0.0'