Commit 185e0896 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

changes by mohit

parent ee5b7a8e
...@@ -11,6 +11,7 @@ class ProfileResponse { ...@@ -11,6 +11,7 @@ class ProfileResponse {
String? profilePic; String? profilePic;
int? sessionExists; int? sessionExists;
ProfileResponse( ProfileResponse(
{this.totpSecret, {this.totpSecret,
this.empId, this.empId,
......
...@@ -715,17 +715,30 @@ class Accountslistprovider extends ChangeNotifier { ...@@ -715,17 +715,30 @@ class Accountslistprovider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> commonAccountListAPIFunction(context) async {
String? _errorMessage;
String? get errorMessage => _errorMessage;
// Common Account list provider
Future<void> commonAccountListAPIFunction(
BuildContext context, {
bool append = false,
}) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
if (_pageNum == 1) {
if (!append) {
// Fresh load / Refresh
_accountsList.clear(); _accountsList.clear();
_pageNum = 1;
_hasMoreData = true; _hasMoreData = true;
_isLoading = true; _isLoading = true;
notifyListeners(); } else {
_isLoading = true;
} }
if (!_hasMoreData || !_isLoading) return;
_hasMoreData = true;
notifyListeners(); notifyListeners();
final data = await ApiCalling.commonAccountListAPI( final data = await ApiCalling.commonAccountListAPI(
...@@ -735,24 +748,38 @@ class Accountslistprovider extends ChangeNotifier { ...@@ -735,24 +748,38 @@ class Accountslistprovider extends ChangeNotifier {
companyNameController.text, companyNameController.text,
mobileNumberController.text, mobileNumberController.text,
); );
if (data != null) { debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_pageNum');
print("pageNum $_pageNum");
if (data.error == "0") { if (data != null && data.error == "0") {
_hasMoreData = true; if (data.accountList != null) {
_accountsList.addAll(data.accountList!); if (append) {
// Append with deduplication
final existingIds = _accountsList.map((e) => e.id).toSet();
final newItems = data.accountList!
.where((item) => !existingIds.contains(item.id))
.toList();
_accountsList.addAll(newItems);
} else {
_accountsList = data.accountList!;
}
_pageNum++; // Check if we still have more records
_isLoading = false; _hasMoreData = data.accountList!.length >= 10;
notifyListeners(); if (_hasMoreData) _pageNum++;
} else {
_hasMoreData = false;
_isLoading = false;
notifyListeners();
} }
} }
} catch (e, s) {} } catch (e, s) {
debugPrint("Error in commonAccountListAPIFunction: $e");
} finally {
_isLoading = false;
notifyListeners();
}
} }
resetValues() { resetValues() {
print("rv"); print("rv");
_selectedAccountType = null; _selectedAccountType = null;
......
...@@ -1120,8 +1120,26 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -1120,8 +1120,26 @@ class Leadlistprovider extends ChangeNotifier {
} }
} }
bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool _hasMoreData = true;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
String? _errorMessage;
String? get errorMessage => _errorMessage;
/// Reset pagination
void resetPagination() {
_currentPage = 1;
_hasMoreData = true;
_crmLeadList.clear();
notifyListeners();
}
Future<void> crmLeadListAPIFunction( Future<void> crmLeadListAPIFunction(
context, BuildContext context,
String? mode, String? mode,
String? leadStatus, String? leadStatus,
String? openStatus, String? openStatus,
...@@ -1129,13 +1147,21 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -1129,13 +1147,21 @@ class Leadlistprovider extends ChangeNotifier {
String? referenceID, String? referenceID,
String? teamID, String? teamID,
String? segmentID, String? segmentID,
String? alphabet, String? alphabet, {
) async { bool append = false,
}) async {
try { try {
_isLoading = true;
_crmLeadList.clear();
notifyListeners();
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false); var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.crmLeadListFilterSubmitAPI( final data = await ApiCalling.crmLeadListFilterSubmitAPI(
HomeProv.empId, HomeProv.empId,
HomeProv.session, HomeProv.session,
...@@ -1149,28 +1175,59 @@ class Leadlistprovider extends ChangeNotifier { ...@@ -1149,28 +1175,59 @@ class Leadlistprovider extends ChangeNotifier {
teamID, teamID,
segmentID, segmentID,
alphabet, alphabet,
_currentPage.toString(), //
); );
if (data != null) { debugPrint('empId: ${HomeProv.empId}, session: ${HomeProv.session}, pageNumber: $_currentPage');
_isLoading = true;
notifyListeners(); if (data != null && data.error == "0") {
if (data.error == "0") { if (append) {
_crmLeadList = data.leadList?.where((lead) => lead != null).toList() ?? []; _crmLeadList.addAll(data.leadList ?? []);
_isLoading = false;
checkDropDownValues();
notifyListeners();
} else { } else {
_isLoading = false; _crmLeadList = data.leadList ?? [];
notifyListeners(); }
if (data.leadList == null || data.leadList!.length < 10) {
_hasMoreData = false; // no more pages
} }
} else { } else {
_isLoading = false; if (!append) _errorMessage = "No leads found!";
notifyListeners(); _hasMoreData = false;
} }
} catch (e, s) { } catch (e, s) {
print('crmLeadListAPIFunction error: $e, stack: $s'); _errorMessage = "Error: $e";
_isLoading = false;
notifyListeners();
} }
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
/// Load next page
Future<void> loadMore(
BuildContext context,
String? mode,
String? leadStatus,
String? openStatus,
String? sourceID,
String? referenceID,
String? teamID,
String? segmentID,
String? alphabet,
) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await crmLeadListAPIFunction(
context,
mode,
leadStatus,
openStatus,
sourceID,
referenceID,
teamID,
segmentID,
alphabet,
append: true,
);
} }
onChangedLeadId(String? value) { onChangedLeadId(String? value) {
......
...@@ -110,6 +110,7 @@ class ProspectListProvider extends ChangeNotifier { ...@@ -110,6 +110,7 @@ class ProspectListProvider extends ChangeNotifier {
employeeID, employeeID,
mobileNumberController.text, mobileNumberController.text,
companyNameController.text, companyNameController.text,
"1"
); );
if (data != null) { if (data != null) {
_isLoading = true; _isLoading = true;
......
...@@ -625,39 +625,88 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -625,39 +625,88 @@ class Requestionlistprovider extends ChangeNotifier {
} }
} }
int _pageNum = 1;
bool _hasMoreData = true;
bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
int get currentPage => _currentPage;
/// Reset before a fresh load (pull-to-refresh or filter change)
void resetPagination() {
_currentPage = 1;
_hasMoreData = true;
_requisitionList.clear();
notifyListeners();
}
Future<void> paymentRequestionListsAPIFunction( Future<void> paymentRequestionListsAPIFunction(
context, BuildContext context,
mode, String mode,
from, String from,
to, String to, {
) async { bool append = false,
}) async {
try { try {
var homeProvider = Provider.of<HomescreenNotifier>( var homeProvider = Provider.of<HomescreenNotifier>(
context, context,
listen: false, listen: false,
); );
_requisitionList.clear();
_isLoading = true; if (!append) {
// reset for first page
_pageNum = 1;
_hasMoreData = true;
_requisitionList.clear();
_isLoading = true;
} else {
_isLoadingMore = true;
}
notifyListeners(); notifyListeners();
final data = await ApiCalling.paymentRequestionListsAPI( final data = await ApiCalling.paymentRequestionListsAPI(
homeProvider.empId, homeProvider.empId,
homeProvider.session, homeProvider.session,
mode, mode,
from, from,
to, to,
_pageNum.toString(),
); );
if (data != null) { debugPrint('empId: ${homeProvider.empId}, session: ${homeProvider.session}, pageNumber: $_pageNum');
if (data.error == "0") {
_isLoading = false; if (data != null && data.error == "0") {
_requisitionList = data.requistionList!; if (append) {
} else if (data.error == "1") { final existingIds = _requisitionList.map((e) => e.id).toSet();
_isLoading = false; final newItems = data.requistionList!
.where((item) => !existingIds.contains(item.id))
.toList();
_requisitionList.addAll(newItems);
} else {
_requisitionList = data.requistionList ?? [];
} }
notifyListeners();
// check if more data
if (data.requistionList == null || data.requistionList!.length < 10) {
_hasMoreData = false;
} else {
_pageNum++;
}
} else {
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e) {
_hasMoreData = false;
} finally {
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
} }
void showDatePickerDialog(BuildContext context) { void showDatePickerDialog(BuildContext context) {
showCupertinoModalPopup<void>( showCupertinoModalPopup<void>(
context: context, context: context,
......
...@@ -366,28 +366,80 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -366,28 +366,80 @@ class Paymentreceiptsprovider extends ChangeNotifier {
} }
} }
Future<void> paymentsListAPI(context, from, to) async {
bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool _hasMoreData = true;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
String? _errorMessage;
String? get errorMessage => _errorMessage;
/// Reset pagination
void resetPagination() {
_currentPage = 1;
_hasMoreData = true;
_receiptsList.clear();
notifyListeners();
}
Future<void> paymentsListAPI(
BuildContext context,
String from,
String to, {
bool append = false,
}) async {
try { try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false); var prov = Provider.of<HomescreenNotifier>(context, listen: false);
_isLoading = true;
notifyListeners(); if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.paymentRequisitionPaymentReceiptListAPI( final data = await ApiCalling.paymentRequisitionPaymentReceiptListAPI(
prov.empId, prov.empId,
prov.session, prov.session,
from, from,
to, to,
_currentPage.toString(),
); );
if (data != null) { debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage');
if (data.error == "0") {
_receiptsList = data.receiptsList!; if (data != null && data.error == "0") {
_isLoading = false; if (append) {
notifyListeners(); _receiptsList.addAll(data.receiptsList ?? []);
} else if (data.error == "1") { } else {
_isLoading = false; _receiptsList = data.receiptsList ?? [];
} }
notifyListeners();
if (data.receiptsList == null || data.receiptsList!.length < 10) {
_hasMoreData = false; // no more pages
}
} else {
if (!append) _errorMessage = "No receipts found!";
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e) {
_errorMessage = "Error: $e";
}
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
/// Load next page
Future<void> loadMore(BuildContext context, String from, String to) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await paymentsListAPI(context, from, to, append: true);
} }
Future<void> paymentsListDetailsAPI(context, paymentId) async { Future<void> paymentsListDetailsAPI(context, paymentId) async {
......
...@@ -38,26 +38,79 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ ...@@ -38,26 +38,79 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
notifyListeners(); notifyListeners();
} }
Future<void> paymentsListAPI(context,from,to) async { bool _isLoadingMore = false;
try{ bool get isLoadingMore => _isLoadingMore;
var prov = Provider.of<HomescreenNotifier>(context,listen: false);
_paymentsList.clear(); bool _hasMoreData = true;
_isLoading = true; bool get hasMoreData => _hasMoreData;
notifyListeners();
final data = await ApiCalling.paymentRequisitionPaymentListAPI(prov.empId, prov.session,from,to); int _currentPage = 1;
if(data!=null){ String? _errorMessage;
if(data.error=="0"){ String? get errorMessage => _errorMessage;
_isLoading = false;
_paymentsList = data.paymentsList!; /// Reset pagination before new filter or refresh
notifyListeners(); void resetPagination() {
}else if(data.error=="1"){ _currentPage = 1;
_isLoading = false; _hasMoreData = true;
} _paymentsList.clear();
notifyListeners();
}
Future<void> paymentsListAPI(
BuildContext context,
String from,
String to, {
bool append = false,
}) async {
try {
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners(); notifyListeners();
} }
}catch(e,s){
final data = await ApiCalling.paymentRequisitionPaymentListAPI(
prov.empId,
prov.session,
from,
to,
_currentPage.toString(), // pass page number
);
debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage');
if (data != null && data.error == "0") {
if (append) {
_paymentsList.addAll(data.paymentsList ?? []);
} else {
_paymentsList = data.paymentsList ?? [];
}
if (data.paymentsList == null || data.paymentsList!.length < 10) {
_hasMoreData = false; // no more pages
}
} else {
if (!append) _errorMessage = "No data found!";
_hasMoreData = false;
}
} catch (e) {
_errorMessage = "Error: $e";
} }
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
/// Load next page
Future<void> loadMore(BuildContext context, String from, String to) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await paymentsListAPI(context, from, to, append: true);
} }
Future<void> paymentsListDetailsAPI(context,paymentId) async { Future<void> paymentsListDetailsAPI(context,paymentId) async {
......
...@@ -51,7 +51,8 @@ class TourExpensesProvider extends ChangeNotifier { ...@@ -51,7 +51,8 @@ class TourExpensesProvider extends ChangeNotifier {
} }
/// Fetch tour expenses list /// Fetch tour expenses list
Future<void> fetchTourExpenses(BuildContext context, String pageNumber) async { Future<void> fetchTourExpenses(BuildContext context, String pageNumber,
{bool append = false}) async {
_isLoading = true; _isLoading = true;
_errorMessage = null; _errorMessage = null;
notifyListeners(); notifyListeners();
...@@ -65,10 +66,22 @@ class TourExpensesProvider extends ChangeNotifier { ...@@ -65,10 +66,22 @@ class TourExpensesProvider extends ChangeNotifier {
pageNumber, pageNumber,
); );
debugPrint('empId: ${provider.empId}, session: ${provider.session}'); debugPrint(
'empId: ${provider.empId}, session: ${provider.session}, pageNumber: $pageNumber');
if (result != null) { if (result != null) {
_response = result; if (append && _response != null && _response!.tourList != null) {
// Append with deduplication
final existingIds = _response!.tourList!.map((e) => e.id).toSet();
final newItems = (result.tourList ?? [])
.where((item) => !existingIds.contains(item.id))
.toList();
_response!.tourList!.addAll(newItems);
} else {
// First page or refresh
_response = result;
}
} else { } else {
_errorMessage = "No data found!"; _errorMessage = "No data found!";
} }
...@@ -80,6 +93,8 @@ class TourExpensesProvider extends ChangeNotifier { ...@@ -80,6 +93,8 @@ class TourExpensesProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> fetchTourExpensesAddView(BuildContext context, String tourBillId) async { Future<void> fetchTourExpensesAddView(BuildContext context, String tourBillId) async {
_isLoading = true; _isLoading = true;
_errorMessage = null; _errorMessage = null;
......
...@@ -324,42 +324,112 @@ class Pagesdashboardprovider extends ChangeNotifier { ...@@ -324,42 +324,112 @@ class Pagesdashboardprovider extends ChangeNotifier {
} catch (e, s) {} } catch (e, s) {}
} }
bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool _hasMoreData = true;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
String? _errorMessage;
String? get errorMessage => _errorMessage;
/// Reset everything
void resetPagination() {
_ordersList.clear();
_currentPage = 1;
_hasMoreData = true;
_isLoading = false;
_isLoadingMore = false;
_errorMessage = null;
notifyListeners();
}
Future<void> ordersListByModeAPIFunction( Future<void> ordersListByModeAPIFunction(
context, BuildContext context,
mode, String mode,
teamEmployee, String teamEmployee,
status, String status, {
) async { bool append = false,
}) async {
try { try {
var provider = Provider.of<HomescreenNotifier>(context, listen: false); var provider = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.ordersListByModeAPI( final data = await ApiCalling.ordersListByModeAPI(
provider.empId, provider.empId,
provider.session, provider.session,
mode, mode,
teamEmployee, teamEmployee,
status, status,
_currentPage.toString(),
); );
if (data != null) { debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage');
_ordersList.clear();
_isLoading = true; if (data != null && data.error == "0") {
notifyListeners(); if (append) {
if (data.error == "0") { _ordersList.addAll(data.orderList ?? []);
_ordersList = data.orderList!; } else {
_isLoading = false; _ordersList = data.orderList ?? [];
if (_selectedEmployee != null && if (_selectedEmployee != null &&
!_employeesList.contains(_selectedEmployee)) { !_employeesList.contains(_selectedEmployee)) {
_selectedEmployee = null; _selectedEmployee = null;
_selectedEmpID = ""; _selectedEmpID = "";
_selectedEmpName = ""; _selectedEmpName = "";
} }
notifyListeners();
} else {
_isLoading = false;
notifyListeners();
} }
if (data.orderList == null || data.orderList!.length < 10) {
_hasMoreData = false;
}
} else {
if (!append) _errorMessage = "No orders found!";
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e, s) {
_errorMessage = "Error: $e";
}
if (_selectedEmployee != null &&
!_employeesList.contains(_selectedEmployee)) {
_selectedEmployee = null;
_selectedEmpID = "";
_selectedEmpName = "";
}
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
/// Load next page
Future<void> loadMore(
BuildContext context,
String mode,
String teamEmployee,
String status,
) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await ordersListByModeAPIFunction(
context,
mode,
teamEmployee,
status,
append: true,
);
} }
Future<void> ordersDetailsByModeAPIFunction(context, orderId, mode) async { Future<void> ordersDetailsByModeAPIFunction(context, orderId, mode) async {
......
...@@ -120,40 +120,89 @@ class Paymentsprovider extends ChangeNotifier { ...@@ -120,40 +120,89 @@ class Paymentsprovider extends ChangeNotifier {
} catch (e, s) {} } catch (e, s) {}
} }
bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool _hasMoreData = true;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
String? _errorMessage;
String? get errorMessage => _errorMessage;
void resetPagination() {
_paymentsList.clear();
_currentPage = 1;
_hasMoreData = true;
_isLoading = false;
_isLoadingMore = false;
_errorMessage = null;
notifyListeners();
}
Future<void> paymentsListsByModeAPIFunction( Future<void> paymentsListsByModeAPIFunction(
context, BuildContext context,
mode, String mode,
teamEmployee, String teamEmployee, {
) async { bool append = false,
}) async {
try { try {
var provider = Provider.of<HomescreenNotifier>(context, listen: false); var provider = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.paymentListsByModeAPI( final data = await ApiCalling.paymentListsByModeAPI(
provider.empId, provider.empId,
provider.session, provider.session,
mode, mode,
teamEmployee, teamEmployee,
_currentPage.toString(),
); );
if (data != null) { debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage');
_paymentsList.clear();
_isLoading = true; if (data != null && data.error == "0") {
notifyListeners(); if (append) {
if (data.error == "0") { _paymentsList.addAll(data.orderList ?? []);
_paymentsList = data.orderList!;
print(data.orderList!.length);
_isLoading = false;
if (_selectedEmployee != null &&
!_employeesList.contains(_selectedEmployee)) {
_selectedEmployee = null;
_selectedEmpID = "";
_selectedEmpName = "";
}
notifyListeners();
} else { } else {
_isLoading = false; _paymentsList = data.orderList ?? [];
} }
notifyListeners();
if (data.orderList == null || data.orderList!.length < 10) {
_hasMoreData = false;
}
} else {
if (!append) _errorMessage = "No payments found!";
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e, s) {
_errorMessage = "Error: $e";
}
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
Future<void> loadMore(
BuildContext context,
String mode,
String teamEmployee,
) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await paymentsListsByModeAPIFunction(
context,
mode,
teamEmployee,
append: true,
);
} }
Future<void> paymentsDetailsByModeAPIFunction( Future<void> paymentsDetailsByModeAPIFunction(
......
...@@ -101,53 +101,139 @@ class Tpcagentsprovider extends ChangeNotifier{ ...@@ -101,53 +101,139 @@ class Tpcagentsprovider extends ChangeNotifier{
} }
Future<void> TPCAgentsListAPIFunction(context, mode,) async { bool _isLoadingMore = false;
bool get isLoadingMore => _isLoadingMore;
bool _hasMoreData = true;
bool get hasMoreData => _hasMoreData;
int _currentPage = 1;
String? _errorMessage;
String? get errorMessage => _errorMessage;
void resetPagination() {
_tpcAgentsList.clear();
_currentPage = 1;
_hasMoreData = true;
_isLoading = false;
_isLoadingMore = false;
_errorMessage = null;
notifyListeners();
}
Future<void> TPCAgentsListAPIFunction(
BuildContext context,
String mode, {
bool append = false,
}) async {
try { try {
var provider = Provider.of<HomescreenNotifier>(context, listen: false); var provider = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.TPCAgentListAPI( final data = await ApiCalling.TPCAgentListAPI(
provider.empId, provider.empId,
provider.session, provider.session,
mode, mode,
_currentPage.toString(), // page number
); );
if (data != null) { debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage');
_tpcAgentsList.clear();
_isLoading = true; if (data != null && data.error == "0") {
notifyListeners(); if (append) {
if (data.error == "0") { _tpcAgentsList.addAll(data.tpcAgentList ?? []);
_tpcAgentsList = data.tpcAgentList!;
_isLoading = false;
} else { } else {
_isLoading = false; _tpcAgentsList = data.tpcAgentList ?? [];
} }
notifyListeners();
// stop if API returns less than page size
if (data.tpcAgentList == null || data.tpcAgentList!.length < 10) {
_hasMoreData = false;
}
} else {
if (!append) _errorMessage = "No agents found!";
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e, s) {
_errorMessage = "Error: $e";
}
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
}
Future<void> loadMore(BuildContext context, String mode) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await TPCAgentsListAPIFunction(context, mode, append: true);
} }
Future<void> TPCAgentsIssueListAPIFunction(context,) async {
Future<void> TPCAgentsIssueListAPIFunction(
BuildContext context, {
bool append = false,
}) async {
try { try {
var provider = Provider.of<HomescreenNotifier>(context, listen: false); var provider = Provider.of<HomescreenNotifier>(context, listen: false);
if (!append) {
_isLoading = true;
_errorMessage = null;
_currentPage = 1;
notifyListeners();
} else {
_isLoadingMore = true;
notifyListeners();
}
final data = await ApiCalling.pendingTPCAgentIssueListAPI( final data = await ApiCalling.pendingTPCAgentIssueListAPI(
provider.empId, provider.empId,
provider.session, provider.session,
_currentPage.toString(), // page number
); );
if (data != null) { debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage');
_tpcAgentsIssueList.clear();
_isLoading = true;
notifyListeners();
if (data.error == "0") {
_tpcAgentsIssueList = data.pendingTpcIssueList!;
_isLoading = false;
notifyListeners(); if (data != null && data.error == "0") {
if (append) {
_tpcAgentsIssueList.addAll(data.pendingTpcIssueList ?? []);
} else { } else {
_isLoading = false; _tpcAgentsIssueList = data.pendingTpcIssueList ?? [];
} }
notifyListeners();
// if API returns less than page size, stop loading more
if (data.pendingTpcIssueList == null ||
data.pendingTpcIssueList!.length < 10) {
_hasMoreData = false;
}
} else {
if (!append) _errorMessage = "No issues found!";
_hasMoreData = false;
} }
} catch (e, s) {} } catch (e) {
_errorMessage = "Error: $e";
}
_isLoading = false;
_isLoadingMore = false;
notifyListeners();
} }
Future<void> loadMoreIssues(BuildContext context) async {
if (_isLoadingMore || !_hasMoreData) return;
_currentPage++;
await TPCAgentsIssueListAPIFunction(context, append: true);
}
Future<void> TPCAgentsDetailsAPIFunction(context, tpc_agent_id) async { Future<void> TPCAgentsDetailsAPIFunction(context, tpc_agent_id) async {
try { try {
var provider = Provider.of<HomescreenNotifier>(context, listen: false); var provider = Provider.of<HomescreenNotifier>(context, listen: false);
......
...@@ -7,12 +7,12 @@ class AppColors { ...@@ -7,12 +7,12 @@ class AppColors {
static Color greenish = Color(0xFF00BC57); static Color greenish = Color(0xFF00BC57);
static Color grey_semi = Color(0xFF999999); static Color grey_semi = Color(0xFF999999);
static Color grey_thick = Color(0xFF818181); static Color grey_thick = Color(0xFF818181);
static Color red = Color (0xFFFF0000); static Color red = Color(0xFFFF0000);
static Color thick_navy_blue = Color(0xff023047); static Color thick_navy_blue = Color(0xff023047);
static Color cyan_blue = Color(0xFF219EBC); static Color cyan_blue = Color(0xFF219EBC);
static Color profile_card_gradient1 = Color(0xFFCFEEFF); static Color profile_card_gradient1 = Color(0xFFCFEEFF);
static Color profile_card_gradient2 = Color(0xFF97D9FF); static Color profile_card_gradient2 = Color(0xFF97D9FF);
static Color profile_card = Color(0xFFDBF2FF); static Color profile_card = Color(0xFFDBF2FF);
static Color scaffold_bg_color = Color(0xFFF6F6F8); static Color scaffold_bg_color = Color(0xFFF6F6F8);
static Color button_disabled = Color(0xFFBEE5FB); static Color button_disabled = Color(0xFFBEE5FB);
static Color text_field_color = Color(0xFFF0F4F5); static Color text_field_color = Color(0xFFF0F4F5);
...@@ -26,5 +26,5 @@ class AppColors { ...@@ -26,5 +26,5 @@ class AppColors {
static Color requested_bg_color = Color(0xFFE6F6FF); static Color requested_bg_color = Color(0xFFE6F6FF);
static Color rejected_bg_color = Color(0xFFFFF5F5); static Color rejected_bg_color = Color(0xFFFFF5F5);
static Color approved_bg_color = Color(0xFFE9FFE8); static Color approved_bg_color = Color(0xFFE9FFE8);
static Color processed_bg_color = Color(0xFFEFFF8E5); static Color processed_bg_color = Color(0xffefff8e5);
} }
\ No newline at end of file
...@@ -18,8 +18,9 @@ import 'WebSocketManager.dart'; ...@@ -18,8 +18,9 @@ import 'WebSocketManager.dart';
class BackgroundLocation { class BackgroundLocation {
// The channel to be used for communication. // The channel to be used for communication.
// This channel is also refrenced inside both iOS and Abdroid classes // This channel is also refrenced inside both iOS and Abdroid classes
static const MethodChannel _channel = static const MethodChannel _channel = MethodChannel(
MethodChannel('com.almoullim.background_location/methods'); 'com.almoullim.background_location/methods',
);
static Timer? _locationTimer; static Timer? _locationTimer;
static get context => null; static get context => null;
...@@ -52,26 +53,28 @@ class BackgroundLocation { ...@@ -52,26 +53,28 @@ class BackgroundLocation {
try { try {
final InitializationSettings initializationSettings = final InitializationSettings initializationSettings =
InitializationSettings( InitializationSettings(
android: AndroidInitializationSettings('@mipmap/ic_launcher'), android: AndroidInitializationSettings('@mipmap/ic_launcher'),
iOS: DarwinInitializationSettings( iOS: DarwinInitializationSettings(
requestAlertPermission: false, requestAlertPermission: false,
requestBadgePermission: false, requestBadgePermission: false,
requestSoundPermission: false, requestSoundPermission: false,
)); ),
);
await flutterLocalNotificationsPlugin.initialize(initializationSettings); await flutterLocalNotificationsPlugin.initialize(initializationSettings);
// Disable sound for the default notification channel // Disable sound for the default notification channel
const AndroidNotificationChannel androidChannel = const AndroidNotificationChannel androidChannel =
AndroidNotificationChannel( AndroidNotificationChannel(
customChannelId, customChannelId,
customChannelName, customChannelName,
description: customChannelDescription, description: customChannelDescription,
importance: Importance.max, importance: Importance.max,
playSound: false, // Set this to false to disable playing sound playSound: false, // Set this to false to disable playing sound
); );
await flutterLocalNotificationsPlugin await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation< .resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>() AndroidFlutterLocalNotificationsPlugin
>()
?.createNotificationChannel(androidChannel); ?.createNotificationChannel(androidChannel);
// print("Flutter Local Notifications initialized successfully."); // print("Flutter Local Notifications initialized successfully.");
...@@ -87,9 +90,10 @@ class BackgroundLocation { ...@@ -87,9 +90,10 @@ class BackgroundLocation {
// Check if location services are enabled // Check if location services are enabled
isLocationEnabled = await Geolocator.isLocationServiceEnabled(); isLocationEnabled = await Geolocator.isLocationServiceEnabled();
// Check if the app has been granted location permission // Check if the app has been granted location permission
LocationPermission permission = await Geolocator.checkPermission(); LocationPermission permission = await Geolocator.checkPermission();
hasLocationPermission = permission == LocationPermission.always || hasLocationPermission =
permission == LocationPermission.always ||
permission == LocationPermission.whileInUse; permission == LocationPermission.whileInUse;
final loc.Location location = loc.Location(); final loc.Location location = loc.Location();
...@@ -114,29 +118,31 @@ class BackgroundLocation { ...@@ -114,29 +118,31 @@ class BackgroundLocation {
static void showNotification(String title, String message) async { static void showNotification(String title, String message) async {
const AndroidNotificationDetails androidPlatformChannelSpecifics = const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails( AndroidNotificationDetails(
customChannelId, customChannelId,
customChannelName, customChannelName,
importance: Importance.defaultImportance, importance: Importance.defaultImportance,
ticker: 'ticker', ticker: 'ticker',
ongoing: true, ongoing: true,
playSound: false, playSound: false,
); );
const DarwinNotificationDetails darwinNotificationDetails = const DarwinNotificationDetails darwinNotificationDetails =
DarwinNotificationDetails( DarwinNotificationDetails(
presentSound: false, presentSound: false,
sound: "", sound: "",
// Set this to false to disable playing sound // Set this to false to disable playing sound
); );
const NotificationDetails platformChannelSpecifics = NotificationDetails( const NotificationDetails platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics, android: androidPlatformChannelSpecifics,
iOS: darwinNotificationDetails); iOS: darwinNotificationDetails,
);
// Check if the notification with the same ID is already being shown // Check if the notification with the same ID is already being shown
final List<PendingNotificationRequest> pendingNotifications = final List<PendingNotificationRequest> pendingNotifications =
await flutterLocalNotificationsPlugin.pendingNotificationRequests(); await flutterLocalNotificationsPlugin.pendingNotificationRequests();
final notificationAlreadyExists = pendingNotifications final notificationAlreadyExists = pendingNotifications.any(
.any((notification) => notification.id == notificationId); (notification) => notification.id == notificationId,
);
// If notification already exists, update it; otherwise, show a new one // If notification already exists, update it; otherwise, show a new one
if (notificationAlreadyExists) { if (notificationAlreadyExists) {
await flutterLocalNotificationsPlugin.show( await flutterLocalNotificationsPlugin.show(
...@@ -209,14 +215,18 @@ class BackgroundLocation { ...@@ -209,14 +215,18 @@ class BackgroundLocation {
// Notify user to enable GPS // Notify user to enable GPS
checkAndRequestLocationPermissions(); checkAndRequestLocationPermissions();
showNotification( showNotification(
"GEN ERP", "You're Offline !, Check your GPS connection."); "GEN ERP",
"You're Offline !, Check your GPS connection.",
);
// print( // print(
// 'GPS is not enabled. Please enable GPS to start the location service.'); // 'GPS is not enabled. Please enable GPS to start the location service.');
} }
if (!isNetworkAvailable) { if (!isNetworkAvailable) {
// Notify user to connect to a network // Notify user to connect to a network
showNotification( showNotification(
"GEN ERP", "You're Offline !, Check your network connection."); "GEN ERP",
"You're Offline !, Check your network connection.",
);
// print( // print(
// 'Network is not available. Please connect to a network to start the location service.'); // 'Network is not available. Please connect to a network to start the location service.');
} }
...@@ -266,16 +276,16 @@ class BackgroundLocation { ...@@ -266,16 +276,16 @@ class BackgroundLocation {
saveLastLocationTime(); saveLastLocationTime();
var completer = Completer<Location>(); var completer = Completer<Location>();
var _location = Location(); var location = Location();
await getLocationUpdates((location) { await getLocationUpdates((location) {
_location.latitude = location.latitude; location.latitude = location.latitude;
_location.longitude = location.longitude; location.longitude = location.longitude;
_location.accuracy = location.accuracy; location.accuracy = location.accuracy;
_location.altitude = location.altitude; location.altitude = location.altitude;
_location.bearing = location.bearing; location.bearing = location.bearing;
_location.speed = location.speed; location.speed = location.speed;
_location.time = location.time; location.time = location.time;
completer.complete(_location); completer.complete(location);
}); });
return completer.future; return completer.future;
...@@ -293,36 +303,39 @@ class BackgroundLocation { ...@@ -293,36 +303,39 @@ class BackgroundLocation {
// Call the user passed function // Call the user passed function
location( location(
Location( Location(
latitude: locationData['latitude'], latitude: locationData['latitude'],
longitude: locationData['longitude'], longitude: locationData['longitude'],
altitude: locationData['altitude'], altitude: locationData['altitude'],
accuracy: locationData['accuracy'], accuracy: locationData['accuracy'],
bearing: locationData['bearing'], bearing: locationData['bearing'],
speed: locationData['speed'], speed: locationData['speed'],
time: locationData['time'], time: locationData['time'],
isMock: locationData['is_mock']), isMock: locationData['is_mock'],
),
); );
//Send location updates using WebSocketManager //Send location updates using WebSocketManager
if (await webSocketManager.isNetworkAvailable()) { if (await webSocketManager.isNetworkAvailable()) {
webSocketManager.sendMessage(jsonEncode({ webSocketManager.sendMessage(
"command": "server_request", jsonEncode({
"route": "attendenece_live_location_update", "command": "server_request",
"session_id": sessionId, "route": "attendenece_live_location_update",
"ref_data": {
"session_id": sessionId, "session_id": sessionId,
"location": "ref_data": {
"${locationData['latitude']},${locationData['longitude']}", "session_id": sessionId,
"speed": locationData['speed'], "location":
"altitude": locationData['altitude'], "${locationData['latitude']},${locationData['longitude']}",
"direction": locationData['bearing'], "speed": locationData['speed'],
"direction_accuracy": locationData['bearingAccuracyDegrees'], "altitude": locationData['altitude'],
"altitude_accuracy": locationData['verticalAccuracyMeters'], "direction": locationData['bearing'],
"speed_accuracy": locationData['speedAccuracyMetersPerSecond'], "direction_accuracy": locationData['bearingAccuracyDegrees'],
"location_accuracy": locationData['accuracy'], "altitude_accuracy": locationData['verticalAccuracyMeters'],
"location_provider": "", "speed_accuracy": locationData['speedAccuracyMetersPerSecond'],
} "location_accuracy": locationData['accuracy'],
})); "location_provider": "",
},
}),
);
// print("Hello GENERP! You're Online!"); // print("Hello GENERP! You're Online!");
showNotification("GEN ERP", "You're Online!"); showNotification("GEN ERP", "You're Online!");
} else { } else {
...@@ -438,15 +451,16 @@ class Location { ...@@ -438,15 +451,16 @@ class Location {
double? time; double? time;
bool? isMock; bool? isMock;
Location( Location({
{@required this.longitude, @required this.longitude,
@required this.latitude, @required this.latitude,
@required this.altitude, @required this.altitude,
@required this.accuracy, @required this.accuracy,
@required this.bearing, @required this.bearing,
@required this.speed, @required this.speed,
@required this.time, @required this.time,
@required this.isMock}); @required this.isMock,
});
toMap() { toMap() {
var obj = { var obj = {
...@@ -457,7 +471,7 @@ class Location { ...@@ -457,7 +471,7 @@ class Location {
'accuracy': accuracy, 'accuracy': accuracy,
'speed': speed, 'speed': speed,
'time': time, 'time': time,
'is_mock': isMock 'is_mock': isMock,
}; };
return obj; return obj;
} }
......
...@@ -42,7 +42,7 @@ PreferredSizeWidget appbar(BuildContext context, title) { ...@@ -42,7 +42,7 @@ PreferredSizeWidget appbar(BuildContext context, title) {
); );
} }
PreferredSizeWidget appbarNew(BuildContext context, title,int color) { PreferredSizeWidget appbarNew(BuildContext context, title, int color) {
return AppBar( return AppBar(
backgroundColor: Color(color), backgroundColor: Color(color),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
...@@ -53,9 +53,12 @@ PreferredSizeWidget appbarNew(BuildContext context, title,int color) { ...@@ -53,9 +53,12 @@ PreferredSizeWidget appbarNew(BuildContext context, title,int color) {
children: [ children: [
InkResponse( InkResponse(
onTap: () => Navigator.pop(context, true), onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset("assets/svg/appbar_back_button.svg", height: 25), child: SvgPicture.asset(
"assets/svg/appbar_back_button.svg",
height: 25,
),
), ),
SizedBox(width: 10,), SizedBox(width: 10),
InkResponse( InkResponse(
onTap: () => Navigator.pop(context, true), onTap: () => Navigator.pop(context, true),
child: Text( child: Text(
...@@ -128,7 +131,13 @@ PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) { ...@@ -128,7 +131,13 @@ PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) {
); );
} }
PreferredSizeWidget appbar2New(BuildContext context, title, reset, widget,int color) { PreferredSizeWidget appbar2New(
BuildContext context,
title,
reset,
widget,
int color,
) {
return AppBar( return AppBar(
backgroundColor: Color(color), backgroundColor: Color(color),
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
...@@ -141,22 +150,23 @@ PreferredSizeWidget appbar2New(BuildContext context, title, reset, widget,int co ...@@ -141,22 +150,23 @@ PreferredSizeWidget appbar2New(BuildContext context, title, reset, widget,int co
InkResponse( InkResponse(
onTap: () { onTap: () {
HapticFeedback.selectionClick(); HapticFeedback.selectionClick();
if(reset!=null){ if (reset != null) {
reset(); reset();
} }
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: SvgPicture.asset("assets/svg/appbar_back_button.svg", height: 25), child: SvgPicture.asset(
"assets/svg/appbar_back_button.svg",
height: 25,
),
), ),
SizedBox(width: 10,), SizedBox(width: 10),
Expanded( Expanded(
flex: 4, flex: 4,
child: InkResponse( child: InkResponse(
onTap: () { onTap: () {
HapticFeedback.selectionClick(); HapticFeedback.selectionClick();
if(reset!=null){ if (reset != null) {
reset(); reset();
} }
Navigator.pop(context, true); Navigator.pop(context, true);
...@@ -207,10 +217,11 @@ Widget TextWidget(context, text) { ...@@ -207,10 +217,11 @@ Widget TextWidget(context, text) {
} }
Widget errorWidget(context, text) { Widget errorWidget(context, text) {
if (text != null) if (text != null) {
return Text(text!, style: TextStyle(color: Colors.red, fontSize: 12)); return Text(text!, style: TextStyle(color: Colors.red, fontSize: 12));
else } else {
return SizedBox(height: 10); return SizedBox(height: 10);
}
} }
Widget textControllerWidget( Widget textControllerWidget(
...@@ -230,14 +241,17 @@ Widget textControllerWidget( ...@@ -230,14 +241,17 @@ Widget textControllerWidget(
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if(textHead!="")...[ if (textHead != "") ...[
Padding( Padding(
padding: const EdgeInsets.only(bottom: 5.0, top: 8.0), padding: const EdgeInsets.only(bottom: 5.0, top: 8.0),
child: Text(textHead), child: Text(textHead),
), ),
], ],
Container( Container(
height: hintText == "Enter Description" || hintText=="Write Feedback" ? 150 : 50, height:
hintText == "Enter Description" || hintText == "Write Feedback"
? 150
: 50,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: readonly ? Color(0xFFD7D7D7) : AppColors.text_field_color, color: readonly ? Color(0xFFD7D7D7) : AppColors.text_field_color,
...@@ -250,7 +264,10 @@ Widget textControllerWidget( ...@@ -250,7 +264,10 @@ Widget textControllerWidget(
controller: controller, controller: controller,
readOnly: readonly, readOnly: readonly,
keyboardType: inputtype, keyboardType: inputtype,
maxLines: hintText == "Enter Description" || hintText=="Write Feedback" ? 60 : 1, maxLines:
hintText == "Enter Description" || hintText == "Write Feedback"
? 60
: 1,
onChanged: onChanged, onChanged: onChanged,
focusNode: focusNode, focusNode: focusNode,
onTapUpOutside: (event) { onTapUpOutside: (event) {
...@@ -415,6 +432,6 @@ class MyNavigatorObserver extends NavigatorObserver { ...@@ -415,6 +432,6 @@ class MyNavigatorObserver extends NavigatorObserver {
routeSettingName = route.settings.name.toString(); routeSettingName = route.settings.name.toString();
// Called when a route has been popped off the navigator. // Called when a route has been popped off the navigator.
print('Route popped: ${route.settings.name}'); print('Route popped: ${route.settings.name}');
print('didPopped: ${didPopped}'); print('didPopped: $didPopped');
} }
} }
...@@ -32,13 +32,12 @@ class Dropdowntheme { ...@@ -32,13 +32,12 @@ class Dropdowntheme {
), ),
scrollbarTheme: ScrollbarThemeData( scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(15), radius: const Radius.circular(15),
thickness: MaterialStateProperty.all<double>(6), thickness: WidgetStateProperty.all<double>(6),
thumbVisibility: MaterialStateProperty.all<bool>(true), thumbVisibility: WidgetStateProperty.all<bool>(true),
), ),
); );
final menuItemStyleData = const MenuItemStyleData( final menuItemStyleData = const MenuItemStyleData(
height: 40, height: 40,
padding: EdgeInsets.only(left: 14, right: 14), padding: EdgeInsets.only(left: 14, right: 14),
); );
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_svg/svg.dart';
import '../../Utils/app_colors.dart';
class JobDescriptionScreen extends StatefulWidget {
final String htmlData;
final String title;
final String designation;
const JobDescriptionScreen({
Key? key,
required this.htmlData,
this.title = "Job Description",
required this.designation,
}) : super(key: key);
@override
State<JobDescriptionScreen> createState() => _JobDescriptionScreenState();
}
class _JobDescriptionScreenState extends State<JobDescriptionScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.scaffold_bg_color,
/// AppBar
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
title: Row(
children: [
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset(
"assets/svg/appbar_back_button.svg",
height: 25,
),
),
const SizedBox(width: 10),
Text(
"Job Description",
style: TextStyle(
fontSize: 18,
fontFamily: "Plus Jakarta Sans",
fontWeight: FontWeight.w600,
color: AppColors.semi_black,
),
),
],
),
),
/// Body
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// Designation Heading
Text(
widget.designation,
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 12),
/// HTML Description
Html(
data: widget.htmlData,
style: {
"h2": Style(
wordSpacing: 0,
letterSpacing: 0,
fontSize: FontSize(16),
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
),
"h3": Style(
wordSpacing: 0,
letterSpacing: 0,
fontSize: FontSize(12),
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
),
"p": Style(
wordSpacing: 0,
letterSpacing: 0,
fontSize: FontSize(12),
fontFamily: "JakartaMedium",
color: AppColors.grey_semi,
lineHeight: LineHeight.number(2.4),
),
"ul": Style(
wordSpacing: 0,
letterSpacing: 0,
fontSize: FontSize(15),
fontFamily: "JakartaMedium",
color: AppColors.grey_semi,
padding: HtmlPaddings.only(left: 12, right: 8),
lineHeight: LineHeight.number(1.4),
),
"li": Style(
wordSpacing: 0,
letterSpacing: 0,
fontSize: FontSize(14),
fontFamily: "JakartaMedium",
color: Colors.black,
padding: HtmlPaddings.only(left: 4),
lineHeight: LineHeight.number(1.4),
margin: Margins.only(bottom: 10),
),
"a": Style(
color: Colors.blue,
textDecoration: TextDecoration.underline,
),
},
onLinkTap: (url, _, __) {
debugPrint("Link tapped: $url");
if (url != null) {
// launchUrl(Uri.parse(url)); //
}
},
),
],
),
),
),
);
}
}
...@@ -27,15 +27,13 @@ Future main() async { ...@@ -27,15 +27,13 @@ Future main() async {
class WebERPIOS extends StatefulWidget { class WebERPIOS extends StatefulWidget {
final String url; final String url;
const WebERPIOS({Key? key, required this.url}) : super(key: key); const WebERPIOS({super.key, required this.url});
@override @override
State<WebERPIOS> createState() => _WebERPIOSState(); State<WebERPIOS> createState() => _WebERPIOSState();
} }
class _WebERPIOSState extends State<WebERPIOS> { class _WebERPIOSState extends State<WebERPIOS> {
Map _source = {ConnectivityResult.mobile: true}; Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
...@@ -100,12 +98,18 @@ class _WebERPIOSState extends State<WebERPIOS> { ...@@ -100,12 +98,18 @@ class _WebERPIOSState extends State<WebERPIOS> {
default: default:
connection = 'Offline'; connection = 'Offline';
} }
return connection=="Online"?Platform.isAndroid return connection == "Online"
? WillPopScope( ? Platform.isAndroid
onWillPop: () => onBackPressed(context), ? WillPopScope(
child: SafeArea(top: false, bottom: true, child: _scaffold(context)), onWillPop: () => onBackPressed(context),
) child: SafeArea(
: _scaffold(context):NoNetwork(context); top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
} }
Widget _scaffold(BuildContext context) { Widget _scaffold(BuildContext context) {
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment