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')
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()

View File

@ -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<Home> {
bool _dialogShown = false;
late StreamSubscription<html.PopStateEvent> _popStateListener;
bool isLoadingGif = false;
late ApiService apiService;
int _currentIndex = 0;
@ -62,7 +60,7 @@ class _HomeState extends State<Home> {
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<Home> {
// 🔹 Load ads
// dataManager.loadAdvertisementImages();
if (kIsWeb) {
if(kIsWeb){
getAdvertisementSliderImage();
} else {
advertisementImages = DataManager().advertisementImages;
@ -120,6 +118,11 @@ class _HomeState extends State<Home> {
);
print('loadSelfEmployeeProfile');
// if (kIsWeb) {
// openBotmanChat();
// }
@ -186,9 +189,6 @@ class _HomeState extends State<Home> {
final preToken = TokenService.getPreToken();
print('preToken');
print(preToken);
WidgetsBinding.instance.addPostFrameCallback((_) {
checkbackbutton();
});
setState(() {
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
Widget build(BuildContext context) {
if (!Responsive.isDesktop(context))
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Color(0xFFFFFBDE), // Status bar color
@ -434,14 +421,10 @@ class _HomeState extends State<Home> {
));
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(),
@ -476,8 +459,7 @@ class _HomeState extends State<Home> {
'Hello, $emp_name!',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context)
fontSize: Responsive.isDesktop(context)
? 20
: 20,
fontWeight: FontWeight.w500,
@ -538,9 +520,8 @@ class _HomeState extends State<Home> {
'Policies for enrollment : $pre_policy_count',
textAlign: TextAlign.center,
style: GoogleFonts.poppins(
fontSize: Responsive.isDesktop(context)
? 18
: 12,
fontSize:
Responsive.isDesktop(context) ? 18 : 12,
fontWeight: FontWeight.w500,
color: Color(0xFF404040),
),
@ -686,8 +667,7 @@ class _HomeState extends State<Home> {
'Your Policies',
textAlign: TextAlign.left,
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(context)
fontSize: Responsive.isDesktop(context)
? 18
: 18,
fontWeight: FontWeight.w500,
@ -714,16 +694,14 @@ class _HomeState extends State<Home> {
SizedBox(height: 15),
Container(
decoration: BoxDecoration(
color: Color(
0xFFEEF5FF), // Set background color for the container
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),
? 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: [
@ -755,19 +733,17 @@ class _HomeState extends State<Home> {
? Material(
elevation: 5,
borderRadius:
BorderRadius.circular(
10),
BorderRadius.circular(10),
color: Colors.white,
child: SizedBox(
width: Responsive
.isDesktop(
width: Responsive.isDesktop(
context)
? 400
: 150, // Set the width here
child: TextButton(
onPressed: () {},
style: TextButton
.styleFrom(
style:
TextButton.styleFrom(
padding: EdgeInsets
.symmetric(
vertical: Responsive
@ -778,25 +754,6 @@ class _HomeState extends State<Home> {
),
),
child: Text(
'Active',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
),
)
: Text(
'Active',
style:
GoogleFonts.poppins(
@ -806,9 +763,24 @@ class _HomeState extends State<Home> {
? 18
: 13,
fontWeight:
FontWeight.w400,
FontWeight.w500,
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(
elevation: 5,
borderRadius:
BorderRadius.circular(
10),
BorderRadius.circular(10),
color: Colors.white,
child: SizedBox(
width: Responsive
.isDesktop(
width: Responsive.isDesktop(
context)
? 400
: 150, // Set the width here
child: TextButton(
onPressed: () {},
style: TextButton
.styleFrom(
style:
TextButton.styleFrom(
padding: EdgeInsets
.symmetric(
vertical: Responsive
@ -853,25 +823,6 @@ class _HomeState extends State<Home> {
),
),
child: Text(
'Inactive',
style: GoogleFonts
.poppins(
fontSize: Responsive
.isDesktop(
context)
? 18
: 13,
fontWeight:
FontWeight
.w500,
color: Color(
0xFF593AFF),
),
),
),
),
)
: Text(
'Inactive',
style:
GoogleFonts.poppins(
@ -881,9 +832,24 @@ class _HomeState extends State<Home> {
? 18
: 13,
fontWeight:
FontWeight.w400,
FontWeight.w500,
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),
Row(
children: [
Flexible(
child: Container(
// color: Colors.red,
Expanded(
flex: 12,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Tooltip(
message: '$memberNames',
child: Text(
Text(
memberNames ?? '',
textAlign: TextAlign.left,
maxLines: 1,
overflow:
TextOverflow.ellipsis,
softWrap: false,
style:
GoogleFonts.poppins(
fontSize: Responsive
.isDesktop(
style: GoogleFonts.poppins(
fontSize:
Responsive.isDesktop(
context)
? 14
: 13,
fontWeight:
FontWeight.w400,
color: const Color(
0xFF000000),
),
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),

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
for (var uf in uploadedFiles) {
final pf = uf.file;

View File

@ -794,38 +794,38 @@ class _profileState extends State<profile> {
),
),
SizedBox(height: Responsive.isDesktop(context) ? 40 : 10),
if (Responsive.isDesktop(context))
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: FutureBuilder<String>(
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<String>(
// 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(

View File

@ -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<String?> showUpdateMobileDialog(
BuildContext context,
@ -22,6 +23,7 @@ Future<String?> showUpdateMobileDialog(
) {
final controller = TextEditingController(text: currentMobile ?? '');
bool isLoading = false;
String? errorText;
return showDialog<String>(
context: context,
@ -37,10 +39,28 @@ Future<String?> 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<String?> showUpdateMobileDialog(
// Save Button
ElevatedButton(
onPressed: isLoading
onPressed: isLoading || controller.text.length != 10
? null
: () async {
final newMobile = controller.text.trim();
@ -66,6 +86,14 @@ Future<String?> showUpdateMobileDialog(
return;
}
// Double check backend validation
if (newMobile.length != 10) {
ToastHelper.showErrorToast(context, "Enter 10 digit mobile number");
return;
}
setState(() => isLoading = true);
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
# 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'