mohem_flutter_upgrade
Sultan khan 5 months ago
parent ea7467502f
commit 3b3046804e

@ -3,11 +3,11 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
class ApiConsts { class ApiConsts {
// static String baseUrl = "http://10.200.204.11"; // Local server // static String baseUrl = "http://10.200.204.11"; // Local server
// static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver
// static String baseUrl = "http://10.20.200.111:1010/"; // static String baseUrl = "http://10.20.200.111:1010/";
// static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://webservices.hmg.com"; // PreProd
// static String baseUrl = "https://mohemm.hmg.com"; static String baseUrl = "https://mohemm.hmg.com";
// static String baseUrl = "https://hmgwebservices.com"; // Live server // static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server

@ -203,11 +203,11 @@ class OtpDialog {
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(10.0)), borderRadius: const BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor), borderSide: BorderSide(color: Colors.red),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(10.0)), borderRadius: const BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor), borderSide: BorderSide(color: Colors.red),
), ),
); );
} }

@ -5,21 +5,21 @@ UserAutoLoginModel userAutoLoginModelFromJson(String str) => UserAutoLoginModel.
String userAutoLoginModelToJson(UserAutoLoginModel data) => json.encode(data.toJson()); String userAutoLoginModelToJson(UserAutoLoginModel data) => json.encode(data.toJson());
class UserAutoLoginModel { class UserAutoLoginModel {
UserAutoLoginModel({ UserAutoLoginModel({this.response, this.errorResponses, this.StatusCode});
this.response,
this.errorResponses,
});
Response? response; Response? response;
List<ErrorResponse>? errorResponses; List<ErrorResponse>? errorResponses;
int? StatusCode;
factory UserAutoLoginModel.fromJson(Map<String, dynamic> json) => UserAutoLoginModel( factory UserAutoLoginModel.fromJson(Map<String, dynamic> json) => UserAutoLoginModel(
response: json["response"] == null ? null : Response.fromJson(json["response"]), response: json["response"] == null ? null : Response.fromJson(json["response"]),
StatusCode: json["StatusCode"],
errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))), errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"response": response == null ? null : response!.toJson(), "response": response == null ? null : response!.toJson(),
"StatusCode": StatusCode,
"errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())), "errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())),
}; };
} }

@ -93,6 +93,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<void> getUserAutoLoginToken() async { Future<void> getUserAutoLoginToken() async {
userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
if (userLoginResponse.StatusCode == 500) {
disbaleChatForThisUser = true;
notifyListeners();
}
if (userLoginResponse.response != null) { if (userLoginResponse.response != null) {
AppState().setchatUserDetails = userLoginResponse; AppState().setchatUserDetails = userLoginResponse;
} else { } else {
@ -399,8 +405,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (data.first.userChatReplyResponse != null) { if (data.first.userChatReplyResponse != null) {
if (data.first.fileTypeResponse != null) { if (data.first.fileTypeResponse != null) {
if (data.first.userChatReplyResponse!.fileTypeId == 12 || data.first.userChatReplyResponse!.fileTypeId == 4 || data.first.userChatReplyResponse!.fileTypeId == 3) { if (data.first.userChatReplyResponse!.fileTypeId == 12 || data.first.userChatReplyResponse!.fileTypeId == 4 || data.first.userChatReplyResponse!.fileTypeId == 3) {
data.first.userChatReplyResponse!.image = data.first.userChatReplyResponse!.image = await ChatApiClient()
await ChatApiClient().downloadURL(fileName: data.first.userChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 1); .downloadURL(fileName: data.first.userChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 1);
data.first.userChatReplyResponse!.isImageLoaded = true; data.first.userChatReplyResponse!.isImageLoaded = true;
} }
} }
@ -476,8 +482,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (data.first.groupChatReplyResponse != null) { if (data.first.groupChatReplyResponse != null) {
if (data.first.fileTypeResponse != null) { if (data.first.fileTypeResponse != null) {
if (data.first.groupChatReplyResponse!.fileTypeId == 12 || data.first.groupChatReplyResponse!.fileTypeId == 4 || data.first.groupChatReplyResponse!.fileTypeId == 3) { if (data.first.groupChatReplyResponse!.fileTypeId == 12 || data.first.groupChatReplyResponse!.fileTypeId == 4 || data.first.groupChatReplyResponse!.fileTypeId == 3) {
data.first.groupChatReplyResponse!.image = data.first.groupChatReplyResponse!.image = await ChatApiClient()
await ChatApiClient().downloadURL(fileName: data.first.groupChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 2); .downloadURL(fileName: data.first.groupChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg", fileSource: 2);
data.first.groupChatReplyResponse!.isImageLoaded = true; data.first.groupChatReplyResponse!.isImageLoaded = true;
} }
} }

@ -18,29 +18,29 @@ class AppTheme {
hintColor: Colors.grey[400], hintColor: Colors.grey[400],
colorScheme: ColorScheme.fromSwatch(accentColor: MyColors.backgroundColor).copyWith(surfaceTint : Colors.transparent), colorScheme: ColorScheme.fromSwatch(accentColor: MyColors.backgroundColor).copyWith(surfaceTint : Colors.transparent),
disabledColor: Colors.grey[300], disabledColor: Colors.grey[300],
errorColor: const Color.fromRGBO(235, 80, 60, 1.0), // errorColor: const Color.fromRGBO(235, 80, 60, 1.0),
applyElevationOverlayColor: false, applyElevationOverlayColor: false,
scaffoldBackgroundColor: MyColors.backgroundColor, scaffoldBackgroundColor: MyColors.backgroundColor,
textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey), textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey),
canvasColor: Colors.white, canvasColor: Colors.white,
backgroundColor: const Color.fromRGBO(255, 255, 255, 1), // backgroundColor: const Color.fromRGBO(255, 255, 255, 1),
highlightColor: Colors.grey[100]!.withOpacity(0.4), highlightColor: Colors.grey[100]!.withOpacity(0.4),
splashColor: Colors.transparent, splashColor: Colors.transparent,
primaryColor: primaryColor, primaryColor: primaryColor,
primaryColorDark: primaryColor, primaryColorDark: primaryColor,
toggleableActiveColor: secondaryColor, // toggleableActiveColor: secondaryColor,
indicatorColor: secondaryColor, indicatorColor: secondaryColor,
bottomSheetTheme: const BottomSheetThemeData( bottomSheetTheme: const BottomSheetThemeData(
backgroundColor: Color(0xFFE0E0E0), backgroundColor: Color(0xFFE0E0E0),
), ),
primaryTextTheme: const TextTheme( primaryTextTheme: const TextTheme(
bodyText2: TextStyle(color: Colors.white), // bodyText2: TextStyle(color: Colors.white),
), ),
iconTheme: const IconThemeData(color: MyColors.darkIconColor), iconTheme: const IconThemeData(color: MyColors.darkIconColor),
textTheme: const TextTheme( textTheme: const TextTheme(
bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6), // bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6),
headline1: TextStyle(color: Colors.white, letterSpacing: 0.6), // headline1: TextStyle(color: Colors.white, letterSpacing: 0.6),
headline2: TextStyle(color: Colors.white, letterSpacing: 0.6), // headline2: TextStyle(color: Colors.white, letterSpacing: 0.6),
), ),
floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2), floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(

@ -117,8 +117,8 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
initialDate: formattedDate, initialDate: formattedDate,
firstDate: DateTime(searchYear - 2), firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(), lastDate: DateTime.now(),
confirmWidget: Text(LocaleKeys.confirm.tr()), // confirmWidget: Text(LocaleKeys.confirm.tr()),
cancelWidget: Text(LocaleKeys.cancel.tr()), // cancelWidget: Text(LocaleKeys.cancel.tr()),
).then((selectedDate) { ).then((selectedDate) {
if (selectedDate != null) { if (selectedDate != null) {
searchMonth = getMonth(selectedDate.month); searchMonth = getMonth(selectedDate.month);
@ -303,6 +303,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
monthCellBuilder: (build, details) { monthCellBuilder: (build, details) {
if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) { if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) {
int val = details.date.day; int val = details.date.day;
int index = val-1;
//check day is off //check day is off
// if (getDayHoursTypeDetailsList.isNotEmpty) { // if (getDayHoursTypeDetailsList.isNotEmpty) {
// bool isDayIsOff = getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].dAYTYPE == 'OFF'; // bool isDayIsOff = getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].dAYTYPE == 'OFF';
@ -312,9 +313,9 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
getDayHoursTypeDetailsList.where((GetDayHoursTypeDetailsList element) => DateFormat("MM/dd/yyyy", "en_US").parse(element.sCHEDULEDATE!).day == details.date.day).toList(); getDayHoursTypeDetailsList.where((GetDayHoursTypeDetailsList element) => DateFormat("MM/dd/yyyy", "en_US").parse(element.sCHEDULEDATE!).day == details.date.day).toList();
if (getDayHours.isNotEmpty) { if (getDayHours.isNotEmpty) {
bool isDayIsOff = getDayHoursTypeDetailsList[0].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[0].dAYTYPE == 'OFF'; bool isDayIsOff = getDayHoursTypeDetailsList[index].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[index].dAYTYPE == 'OFF';
bool isDayIsPresent = getDayHoursTypeDetailsList[0].aTTENDEDFLAG == 'Y'; bool isDayIsPresent = getDayHoursTypeDetailsList[index].aTTENDEDFLAG == 'Y';
bool isDayIsAbsent = getDayHoursTypeDetailsList[0].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[0].aBSENTFLAG == 'Y'; bool isDayIsAbsent = getDayHoursTypeDetailsList[index].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[index].aBSENTFLAG == 'Y';
if (isDayIsOff) { if (isDayIsOff) {
return Container( return Container(

@ -32,9 +32,12 @@ class _ChatHomeState extends State<ChatHome> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (chatHubConnection.state == HubConnectionState.Connected) {
data = Provider.of<ChatProviderModel>(context, listen: false); data = Provider.of<ChatProviderModel>(context, listen: false);
data.registerEvents(); data.registerEvents();
} }
}
@override @override
void dispose() { void dispose() {
@ -47,7 +50,6 @@ class _ChatHomeState extends State<ChatHome> {
data.getUserAutoLoginToken().whenComplete(() async { data.getUserAutoLoginToken().whenComplete(() async {
await data.buildHubConnection(); await data.buildHubConnection();
data.getUserRecentChats(); data.getUserRecentChats();
}); });
return; return;
} }

@ -60,10 +60,10 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
void initState() { void initState() {
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
super.initState(); super.initState();
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
scheduleMicrotask(() { scheduleMicrotask(() {
data = Provider.of<DashboardProviderModel>(context, listen: false); data = Provider.of<DashboardProviderModel>(context, listen: false);
marathonProvider = Provider.of<MarathonProvider>(context, listen: false); marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
if (checkIfPrivilegedForChat()) { if (checkIfPrivilegedForChat()) {
_bHubCon(); _bHubCon();
} }
@ -117,6 +117,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
} }
Future<void> checkHubCon() async { Future<void> checkHubCon() async {
// chatHubConnection = await context.read<ChatProviderModel>().getHubConnection();
if (chatHubConnection.state == HubConnectionState.Connected) { if (chatHubConnection.state == HubConnectionState.Connected) {
await chatHubConnection.stop(); await chatHubConnection.stop();
await chatHubConnection.start(); await chatHubConnection.start();

@ -169,8 +169,8 @@ class _ViewAttendanceState extends State<ViewAttendance> {
initialDate: formattedDate, initialDate: formattedDate,
firstDate: DateTime(searchYear - 2), firstDate: DateTime(searchYear - 2),
lastDate: DateTime.now(), lastDate: DateTime.now(),
confirmWidget: Text(LocaleKeys.confirm.tr()), // confirmWidget: Text(LocaleKeys.confirm.tr()),
cancelWidget: Text(LocaleKeys.cancel.tr()), // cancelWidget: Text(LocaleKeys.cancel.tr()),
).then( ).then(
(selectedDate) { (selectedDate) {
if (selectedDate != null) { if (selectedDate != null) {

@ -159,7 +159,7 @@ class _BottomSheet extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
padding: const EdgeInsets.symmetric(vertical: 12.0), padding: const EdgeInsets.symmetric(vertical: 12.0),
decoration: BoxDecoration(color: Theme.of(context).backgroundColor, borderRadius: const BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))), decoration: BoxDecoration( borderRadius: const BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))),
child: SafeArea( child: SafeArea(
top: false, top: false,
child: Column( child: Column(

@ -46,7 +46,7 @@ dependencies:
sizer: ^2.0.15 sizer: ^2.0.15
local_auth: ^2.2.0 local_auth: ^2.2.0
fluttertoast: ^8.0.8 fluttertoast: ^8.0.8
syncfusion_flutter_calendar: 21.2.9 syncfusion_flutter_calendar: ^27.2.5
# flutter_calendar_carousel: ^2.1.0 # flutter_calendar_carousel: ^2.1.0
pie_chart: ^5.1.0 pie_chart: ^5.1.0
shared_preferences: ^2.0.12 shared_preferences: ^2.0.12
@ -62,8 +62,8 @@ dependencies:
image_picker: ^0.8.5+3 image_picker: ^0.8.5+3
file_picker: 5.2.5 file_picker: 5.2.5
geolocator: ^9.0.2 geolocator: ^9.0.2
month_year_picker: ^0.3.0+1 month_year_picker: ^0.4.0+1
month_picker_dialog: ^2.12.0 month_picker_dialog: ^3.0.0
# open_file: ^3.2.1 # open_file: ^3.2.1
open_filex: ^4.4.0 open_filex: ^4.4.0
wifi_iot: ^0.3.18 wifi_iot: ^0.3.18

Loading…
Cancel
Save