Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
GEN_ERP_2025
Commits
185e0896
Commit
185e0896
authored
Sep 17, 2025
by
Sai Srinivas
Browse files
changes by mohit
parent
ee5b7a8e
Changes
35
Show whitespace changes
Inline
Side-by-side
lib/Models/ProfileResponse.dart
View file @
185e0896
...
@@ -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
,
...
...
lib/Notifiers/commonProvider/accountsListProvider.dart
View file @
185e0896
...
@@ -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,23 +748,37 @@ class Accountslistprovider extends ChangeNotifier {
...
@@ -735,23 +748,37 @@ 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
_pageNum
++;
final
existingIds
=
_accountsList
.
map
((
e
)
=>
e
.
id
).
toSet
();
_isLoading
=
false
;
final
newItems
=
data
.
accountList
!
notifyListeners
();
.
where
((
item
)
=>
!
existingIds
.
contains
(
item
.
id
))
.
toList
();
_accountsList
.
addAll
(
newItems
);
}
else
{
}
else
{
_hasMoreData
=
false
;
_accountsList
=
data
.
accountList
!;
}
// Check if we still have more records
_hasMoreData
=
data
.
accountList
!.
length
>=
10
;
if
(
_hasMoreData
)
_pageNum
++;
}
}
}
catch
(
e
,
s
)
{
debugPrint
(
"Error in commonAccountListAPIFunction:
$e
"
);
}
finally
{
_isLoading
=
false
;
_isLoading
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
}
}
catch
(
e
,
s
)
{}
}
resetValues
()
{
resetValues
()
{
print
(
"rv"
);
print
(
"rv"
);
...
...
lib/Notifiers/crmProvider/LeadListProvider.dart
View file @
185e0896
...
@@ -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
{
var
HomeProv
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
if
(!
append
)
{
_isLoading
=
true
;
_isLoading
=
true
;
_crmLeadList
.
clear
()
;
_errorMessage
=
null
;
notifyListeners
();
notifyListeners
();
var
HomeProv
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
}
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
;
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
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
)
{
...
...
lib/Notifiers/crmProvider/ProspectListProvider.dart
View file @
185e0896
...
@@ -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
;
...
...
lib/Notifiers/financeProvider/RequestionListProvider.dart
View file @
185e0896
...
@@ -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
,
);
);
if
(!
append
)
{
// reset for first page
_pageNum
=
1
;
_hasMoreData
=
true
;
_requisitionList
.
clear
();
_requisitionList
.
clear
();
_isLoading
=
true
;
_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
??
[];
}
// check if more data
if
(
data
.
requistionList
==
null
||
data
.
requistionList
!.
length
<
10
)
{
_hasMoreData
=
false
;
}
else
{
_pageNum
++;
}
}
else
{
_hasMoreData
=
false
;
}
}
}
catch
(
e
)
{
_hasMoreData
=
false
;
}
finally
{
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
}
}
void
showDatePickerDialog
(
BuildContext
context
)
{
void
showDatePickerDialog
(
BuildContext
context
)
{
showCupertinoModalPopup
<
void
>(
showCupertinoModalPopup
<
void
>(
context:
context
,
context:
context
,
...
...
lib/Notifiers/financeProvider/paymentReceiptsProvider.dart
View file @
185e0896
...
@@ -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
);
if
(!
append
)
{
_isLoading
=
true
;
_isLoading
=
true
;
_errorMessage
=
null
;
notifyListeners
();
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
??
[];
}
if
(
data
.
receiptsList
==
null
||
data
.
receiptsList
!.
length
<
10
)
{
_hasMoreData
=
false
;
// no more pages
}
}
else
{
if
(!
append
)
_errorMessage
=
"No receipts found!"
;
_hasMoreData
=
false
;
}
}
catch
(
e
)
{
_errorMessage
=
"Error:
$e
"
;
}
}
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
/// 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
{
...
...
lib/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart
View file @
185e0896
...
@@ -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
);
bool
_hasMoreData
=
true
;
bool
get
hasMoreData
=>
_hasMoreData
;
int
_currentPage
=
1
;
String
?
_errorMessage
;
String
?
get
errorMessage
=>
_errorMessage
;
/// Reset pagination before new filter or refresh
void
resetPagination
()
{
_currentPage
=
1
;
_hasMoreData
=
true
;
_paymentsList
.
clear
();
_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
;
_isLoading
=
true
;
_errorMessage
=
null
;
notifyListeners
();
notifyListeners
();
final
data
=
await
ApiCalling
.
paymentRequisitionPaymentListAPI
(
prov
.
empId
,
prov
.
session
,
from
,
to
);
}
else
{
if
(
data
!=
null
){
_isLoadingMore
=
true
;
if
(
data
.
error
==
"0"
){
_isLoading
=
false
;
_paymentsList
=
data
.
paymentsList
!;
notifyListeners
();
notifyListeners
();
}
else
if
(
data
.
error
==
"1"
){
_isLoading
=
false
;
}
}
notifyListeners
();
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
??
[];
}
}
}
catch
(
e
,
s
){
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
{
...
...
lib/Notifiers/hrmProvider/tourExpensesProvider.dart
View file @
185e0896
...
@@ -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
)
{
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
;
_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
;
...
...
lib/Notifiers/ordersProvider/pagesDashboardProvider.dart
View file @
185e0896
...
@@ -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
();
}
if
(
data
.
orderList
==
null
||
data
.
orderList
!.
length
<
10
)
{
_hasMoreData
=
false
;
}
}
else
{
}
else
{
if
(!
append
)
_errorMessage
=
"No orders found!"
;
_hasMoreData
=
false
;
}
}
catch
(
e
,
s
)
{
_errorMessage
=
"Error:
$e
"
;
}
if
(
_selectedEmployee
!=
null
&&
!
_employeesList
.
contains
(
_selectedEmployee
))
{
_selectedEmployee
=
null
;
_selectedEmpID
=
""
;
_selectedEmpName
=
""
;
}
_isLoading
=
false
;
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
}
catch
(
e
,
s
)
{}
/// 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
{
...
...
lib/Notifiers/ordersProvider/paymentsProvider.dart
View file @
185e0896
...
@@ -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
!;
}
else
{
print
(
data
.
orderList
!.
length
);
_paymentsList
=
data
.
orderList
??
[];
_isLoading
=
false
;
}
if
(
_selectedEmployee
!=
null
&&
!
_employeesList
.
contains
(
_selectedEmployee
))
{
if
(
data
.
orderList
==
null
||
data
.
orderList
!.
length
<
10
)
{
_selectedEmployee
=
null
;
_hasMoreData
=
false
;
_selectedEmpID
=
""
;
_selectedEmpName
=
""
;
}
}
notifyListeners
();
}
else
{
}
else
{
_isLoading
=
false
;
if
(!
append
)
_errorMessage
=
"No payments found!"
;
_hasMoreData
=
false
;
}
}
catch
(
e
,
s
)
{
_errorMessage
=
"Error:
$e
"
;
}
}
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
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
(
...
...
lib/Notifiers/ordersProvider/tpcAgentsProvider.dart
View file @
185e0896
...
@@ -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
??
[]
;
}
}
// 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
)
{
_errorMessage
=
"Error:
$e
"
;
}
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
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
??
[];
}
// 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
)
{
_errorMessage
=
"Error:
$e
"
;
}
_isLoading
=
false
;
_isLoadingMore
=
false
;
notifyListeners
();
notifyListeners
();
}
}
}
catch
(
e
,
s
)
{}
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
);
...
...
lib/Utils/app_colors.dart
View file @
185e0896
...
@@ -7,7 +7,7 @@ class AppColors {
...
@@ -7,7 +7,7 @@ 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
);
...
@@ -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
(
0x
FFEFFF8E
5
);
static
Color
processed_bg_color
=
Color
(
0x
ffefff8e
5
);
}
}
lib/Utils/background_service.dart
View file @
185e0896
...
@@ -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
;
...
@@ -57,7 +58,8 @@ class BackgroundLocation {
...
@@ -57,7 +58,8 @@ class BackgroundLocation {
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
...
@@ -71,7 +73,8 @@ class BackgroundLocation {
...
@@ -71,7 +73,8 @@ class BackgroundLocation {
);
);
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
();
...
@@ -131,12 +135,14 @@ class BackgroundLocation {
...
@@ -131,12 +135,14 @@ class BackgroundLocation {
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
;
...
@@ -300,12 +310,14 @@ class BackgroundLocation {
...
@@ -300,12 +310,14 @@ class BackgroundLocation {
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
(
jsonEncode
({
"command"
:
"server_request"
,
"command"
:
"server_request"
,
"route"
:
"attendenece_live_location_update"
,
"route"
:
"attendenece_live_location_update"
,
"session_id"
:
sessionId
,
"session_id"
:
sessionId
,
...
@@ -321,8 +333,9 @@ class BackgroundLocation {
...
@@ -321,8 +333,9 @@ class BackgroundLocation {
"speed_accuracy"
:
locationData
[
'speedAccuracyMetersPerSecond'
],
"speed_accuracy"
:
locationData
[
'speedAccuracyMetersPerSecond'
],
"location_accuracy"
:
locationData
[
'accuracy'
],
"location_accuracy"
:
locationData
[
'accuracy'
],
"location_provider"
:
""
,
"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
;
}
}
...
...
lib/Utils/commonWidgets.dart
View file @
185e0896
...
@@ -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
'
);
}
}
}
}
lib/Utils/dropdownTheme.dart
View file @
185e0896
...
@@ -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:
Material
StateProperty
.
all
<
double
>(
6
),
thickness:
Widget
StateProperty
.
all
<
double
>(
6
),
thumbVisibility:
Material
StateProperty
.
all
<
bool
>(
true
),
thumbVisibility:
Widget
StateProperty
.
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
),
);
);
}
}
lib/screens/HomeScreen.dart
View file @
185e0896
...
@@ -9,6 +9,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
...
@@ -9,6 +9,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'../Utils/commonServices.dart'
;
import
'../Utils/commonServices.dart'
;
import
'JobDescription.dart'
;
import
'genTracker/ScanEnterGeneratorIDScreen.dart'
;
import
'genTracker/ScanEnterGeneratorIDScreen.dart'
;
import
'hrm/HrmDashboardScreen.dart'
;
import
'hrm/HrmDashboardScreen.dart'
;
import
'notifierExports.dart'
;
import
'notifierExports.dart'
;
...
@@ -20,11 +21,6 @@ import 'package:location/location.dart' as loc;
...
@@ -20,11 +21,6 @@ import 'package:location/location.dart' as loc;
import
'../Utils/app_colors.dart'
;
import
'../Utils/app_colors.dart'
;
import
'inventory/InventoryScreen.dart'
;
import
'inventory/InventoryScreen.dart'
;
import
'package:auto_size_text/auto_size_text.dart'
;
import
'package:auto_size_text/auto_size_text.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_html/flutter_html.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_html/flutter_html.dart'
;
import
'package:flutter_html/flutter_html.dart'
as
html
;
class
MyHomePage
extends
StatefulWidget
{
class
MyHomePage
extends
StatefulWidget
{
const
MyHomePage
({
super
.
key
});
const
MyHomePage
({
super
.
key
});
...
@@ -46,14 +42,13 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -46,14 +42,13 @@ class _MyHomePageState extends State<MyHomePage> {
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
});
});
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
var
prov
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
var
prof_prov
=
Provider
.
of
<
ProfileNotifer
>(
context
,
listen:
false
);
var
profProv
=
Provider
.
of
<
ProfileNotifer
>(
context
,
listen:
false
);
// var jobDisc_prov = Provider.of<fetchJobDescription>(context, listen: false);
Future
.
microtask
(()
{
Future
.
microtask
(()
{
prov
.
DashboardApiFunction
(
context
);
prov
.
DashboardApiFunction
(
context
);
});
});
Future
.
delayed
(
Duration
(
milliseconds:
600
),
()
{
Future
.
delayed
(
Duration
(
milliseconds:
600
),
()
{
prof
_p
rov
.
ProfileApiFunction
(
prov
,
context
);
prof
P
rov
.
ProfileApiFunction
(
prov
,
context
);
prof
_p
rov
.
VersionApiFunction
();
prof
P
rov
.
VersionApiFunction
();
});
});
super
.
initState
();
super
.
initState
();
}
}
...
@@ -68,8 +63,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -68,8 +63,8 @@ class _MyHomePageState extends State<MyHomePage> {
actions:
[
actions:
[
TextButton
(
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
Material
StateProperty
.
all
(
Colors
.
white
),
backgroundColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Material
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
),
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
false
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
false
),
child:
Text
(
child:
Text
(
...
@@ -80,8 +75,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -80,8 +75,8 @@ class _MyHomePageState extends State<MyHomePage> {
const
SizedBox
(
height:
16
),
const
SizedBox
(
height:
16
),
TextButton
(
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
Material
StateProperty
.
all
(
Colors
.
white
),
backgroundColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Material
StateProperty
.
all
(
Colors
.
white70
),
overlayColor:
Widget
StateProperty
.
all
(
Colors
.
white70
),
),
),
onPressed:
onPressed:
()
=>
SystemChannels
.
platform
.
invokeMethod
(
()
=>
SystemChannels
.
platform
.
invokeMethod
(
...
@@ -133,6 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -133,6 +128,7 @@ class _MyHomePageState extends State<MyHomePage> {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
double
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
screenHeight
=
MediaQuery
.
of
(
context
).
size
.
height
;
double
screenHeight
=
MediaQuery
.
of
(
context
).
size
.
height
;
double
bottomPadding
=
MediaQuery
.
of
(
context
).
padding
.
bottom
;
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
connection
=
'Online'
;
...
@@ -227,8 +223,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -227,8 +223,8 @@ class _MyHomePageState extends State<MyHomePage> {
toolbarHeight:
0
,
toolbarHeight:
0
,
backgroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
white
,
),
),
body:
SingleChildScrollView
(
body:
Container
(
child:
Container
(
height:
screenHeight
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
gradient:
LinearGradient
(
gradient:
LinearGradient
(
colors:
[
colors:
[
...
@@ -240,7 +236,26 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -240,7 +236,26 @@ class _MyHomePageState extends State<MyHomePage> {
end:
Alignment
.
bottomCenter
,
end:
Alignment
.
bottomCenter
,
),
),
),
),
child:
SingleChildScrollView
(
child:
Column
(
child:
Column
(
children:
[
Stack
(
children:
[
// Container(
// height: screenHeight,
// decoration: BoxDecoration(
// gradient: LinearGradient(
// colors: [
// AppColors.scaffold_bg_color,
// AppColors.scaffold_bg_color,
// Color(0xFFCEEDFF),
// ],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// ),
// ),
// ),
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
children:
[
InkResponse
(
InkResponse
(
...
@@ -268,7 +283,9 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -268,7 +283,9 @@ class _MyHomePageState extends State<MyHomePage> {
right:
10
,
right:
10
,
),
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
),
borderRadius:
BorderRadius
.
circular
(
20
,
),
gradient:
LinearGradient
(
gradient:
LinearGradient
(
colors:
[
colors:
[
AppColors
.
profile_card
,
AppColors
.
profile_card
,
...
@@ -279,7 +296,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -279,7 +296,8 @@ class _MyHomePageState extends State<MyHomePage> {
child:
Row
(
child:
Row
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
center
,
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Expanded
(
Expanded
(
flex:
8
,
flex:
8
,
...
@@ -291,9 +309,11 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -291,9 +309,11 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
child:
Column
(
child:
Column
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
children:
[
// Text(
// Text(
...
@@ -311,8 +331,11 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -311,8 +331,11 @@ class _MyHomePageState extends State<MyHomePage> {
minFontSize:
12
,
minFontSize:
12
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
16
,
fontSize:
16
,
color:
AppColors
.
app_blue
,
color:
fontFamily:
"JakartaSemiBold"
,
AppColors
.
app_blue
,
fontFamily:
"JakartaSemiBold"
,
),
),
maxLines:
2
,
maxLines:
2
,
),
),
...
@@ -322,8 +345,11 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -322,8 +345,11 @@ class _MyHomePageState extends State<MyHomePage> {
minFontSize:
10
,
minFontSize:
10
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
fontFamily:
"JakartaRegular"
,
AppColors
.
semi_black
,
fontFamily:
"JakartaRegular"
,
),
),
maxLines:
1
,
maxLines:
1
,
),
),
...
@@ -339,21 +365,27 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -339,21 +365,27 @@ class _MyHomePageState extends State<MyHomePage> {
Text
(
Text
(
"
${profile.employeeeID}
"
,
"
${profile.employeeeID}
"
,
style:
TextStyle
(
style:
TextStyle
(
color:
AppColors
.
semi_black
,
color:
fontFamily:
"JakartaRegular"
,
AppColors
.
semi_black
,
fontFamily:
"JakartaRegular"
,
fontSize:
14
,
fontSize:
14
,
),
),
),
),
SizedBox
(
height:
12
),
SizedBox
(
height:
12
),
Row
(
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
start
,
MainAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
width:
12
,
width:
12
,
height:
12
,
height:
12
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
shape:
BoxShape
.
circle
,
color:
color:
homescreen
.
onlineStatus
==
homescreen
.
onlineStatus
==
"Online"
"Online"
...
@@ -370,7 +402,9 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -370,7 +402,9 @@ class _MyHomePageState extends State<MyHomePage> {
fontSize:
14
,
fontSize:
14
,
fontFamily:
fontFamily:
"JakartaRegular"
,
"JakartaRegular"
,
color:
Color
(
0xFF2D2D2D
),
color:
Color
(
0xFF2D2D2D
,
),
),
),
),
),
],
],
...
@@ -388,30 +422,43 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -388,30 +422,43 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
child:
Column
(
child:
Column
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
children:
[
children:
[
SizedBox
(
SizedBox
(
width:
60
,
width:
60
,
height:
60
,
height:
60
,
child:
ClipRRect
(
child:
ClipRRect
(
borderRadius:
borderRadius:
BorderRadius
.
circular
(
50
),
BorderRadius
.
circular
(
50
,
),
child:
CachedNetworkImage
(
child:
CachedNetworkImage
(
cacheKey:
cacheKey:
profile
.
profileImage
,
profile
.
profileImage
,
fit:
BoxFit
.
cover
,
fit:
BoxFit
.
cover
,
imageUrl:
imageUrl:
"
${profile.profileImage}
"
,
"
${profile.profileImage}
"
,
useOldImageOnUrlChange:
useOldImageOnUrlChange:
false
,
false
,
placeholder:
placeholder:
(
context
,
url
)
=>
(
context
,
url
,
)
=>
CircularProgressIndicator
.
adaptive
(),
CircularProgressIndicator
.
adaptive
(),
errorWidget:
errorWidget:
(
context
,
url
,
error
)
=>
(
Icon
(
Icons
.
error
),
context
,
url
,
error
,
)
=>
Icon
(
Icons
.
error
,
),
),
),
),
),
),
),
...
@@ -426,7 +473,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -426,7 +473,8 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
SizedBox
(
SizedBox
(
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
// if (coreFilteredItems.isNotEmpty) ...[
// if (coreFilteredItems.isNotEmpty) ...[
// Container(
// Container(
...
@@ -589,14 +637,15 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -589,14 +637,15 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
borderRadius:
14
,
BorderRadius
.
circular
(
14
),
),
),
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
children:
List
.
generate
(
4
,
(
ic
)
{
children:
List
.
generate
(
4
,
(
ic
,
)
{
return
Expanded
(
return
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
()
async
{
onTap:
()
async
{
...
@@ -608,7 +657,9 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -608,7 +657,9 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
builder:
(
context
)
=>
(
context
,
)
=>
AttendanceScreen
(),
AttendanceScreen
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
arguments:
arguments:
...
@@ -618,7 +669,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -618,7 +669,8 @@ class _MyHomePageState extends State<MyHomePage> {
);
);
break
;
break
;
case
"ERP"
:
case
"ERP"
:
bool
isGpsEnabled
=
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
if
(
isGpsEnabled
)
{
if
(
Platform
if
(
Platform
...
@@ -631,8 +683,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -631,8 +683,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebErpScreen
(
)
=>
WebErpScreen
(
erp_url:
erp_url:
homescreen
homescreen
.
webPageUrl
,
.
webPageUrl
,
),
),
),
),
);
);
...
@@ -645,8 +696,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -645,8 +696,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebERPIOS
(
)
=>
WebERPIOS
(
url:
url:
homescreen
homescreen
.
webPageUrl
,
.
webPageUrl
,
),
),
),
),
);
);
...
@@ -656,7 +706,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -656,7 +706,8 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
break
;
break
;
case
"Whizzdom"
:
case
"Whizzdom"
:
bool
isGpsEnabled
=
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
if
(
isGpsEnabled
)
{
res
=
await
Navigator
.
push
(
res
=
await
Navigator
.
push
(
...
@@ -667,8 +718,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -667,8 +718,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebWhizzdomScreen
(
)
=>
WebWhizzdomScreen
(
whizzdom_url:
whizzdom_url:
homescreen
homescreen
.
whizzdomPageUrl
,
.
whizzdomPageUrl
,
),
),
),
),
);
);
...
@@ -681,7 +731,9 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -681,7 +731,9 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
builder:
(
context
)
=>
(
context
,
)
=>
Financedashboard
(),
Financedashboard
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
arguments:
arguments:
...
@@ -713,13 +765,16 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -713,13 +765,16 @@ class _MyHomePageState extends State<MyHomePage> {
filteredItems
[
ic
][
'icon'
]
??
filteredItems
[
ic
][
'icon'
]
??
"-"
,
"-"
,
),
),
SizedBox
(
height:
10
),
SizedBox
(
height:
10
,
),
Text
(
Text
(
filteredItems
[
ic
][
'name'
]
??
filteredItems
[
ic
][
'name'
]
??
"-"
,
"-"
,
maxLines:
2
,
maxLines:
2
,
textAlign:
textAlign:
TextAlign
.
center
,
TextAlign
.
center
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
12
,
fontSize:
12
,
fontFamily:
fontFamily:
...
@@ -761,7 +816,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -761,7 +816,8 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
builder:
(
context
)
=>
InventoryScreen
(),
(
context
)
=>
InventoryScreen
(),
),
),
);
);
if
(
res
==
true
)
{
if
(
res
==
true
)
{
...
@@ -780,9 +836,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -780,9 +836,8 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
borderRadius:
14
,
BorderRadius
.
circular
(
14
),
),
),
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
...
@@ -800,14 +855,16 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -800,14 +855,16 @@ class _MyHomePageState extends State<MyHomePage> {
child:
SizedBox
(
child:
SizedBox
(
child:
Column
(
child:
Column
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
children:
[
Text
(
Text
(
"Inventory"
,
"Inventory"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
color:
AppColors
.
app_blue
,
AppColors
.
app_blue
,
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
),
),
...
@@ -817,7 +874,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -817,7 +874,8 @@ class _MyHomePageState extends State<MyHomePage> {
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
color:
AppColors
.
grey_semi
,
AppColors
.
grey_semi
,
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
),
),
...
@@ -857,11 +915,13 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -857,11 +915,13 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
child:
GridView
.
builder
(
child:
GridView
.
builder
(
shrinkWrap:
true
,
shrinkWrap:
true
,
itemCount:
filteredItems
.
length
,
itemCount:
filteredItems
.
length
,
gridDelegate:
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
crossAxisCount:
2
,
childAspectRatio:
2
/
1.1
,
childAspectRatio:
2
/
1.1
,
),
),
itemBuilder:
(
context
,
ci
)
{
itemBuilder:
(
context
,
ci
)
{
return
InkResponse
(
return
InkResponse
(
...
@@ -876,7 +936,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -876,7 +936,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
builder:
(
context
)
=>
(
context
)
=>
AttendanceScreen
(),
AttendanceScreen
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
arguments:
arguments:
'AttendanceScreen'
,
'AttendanceScreen'
,
),
),
...
@@ -887,7 +948,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -887,7 +948,8 @@ class _MyHomePageState extends State<MyHomePage> {
bool
isGpsEnabled
=
bool
isGpsEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
await
Geolocator
.
isLocationServiceEnabled
();
if
(
isGpsEnabled
)
{
if
(
isGpsEnabled
)
{
if
(
Platform
.
isAndroid
)
{
if
(
Platform
.
isAndroid
)
{
res
=
await
Navigator
.
push
(
res
=
await
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
...
@@ -896,8 +958,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -896,8 +958,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebErpScreen
(
)
=>
WebErpScreen
(
erp_url:
erp_url:
homescreen
homescreen
.
webPageUrl
,
.
webPageUrl
,
),
),
),
),
);
);
...
@@ -910,8 +971,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -910,8 +971,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebERPIOS
(
)
=>
WebERPIOS
(
url:
url:
homescreen
homescreen
.
webPageUrl
,
.
webPageUrl
,
),
),
),
),
);
);
...
@@ -932,8 +992,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -932,8 +992,7 @@ class _MyHomePageState extends State<MyHomePage> {
context
,
context
,
)
=>
WebWhizzdomScreen
(
)
=>
WebWhizzdomScreen
(
whizzdom_url:
whizzdom_url:
homescreen
homescreen
.
whizzdomPageUrl
,
.
whizzdomPageUrl
,
),
),
),
),
);
);
...
@@ -948,7 +1007,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -948,7 +1007,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
builder:
(
context
)
=>
(
context
)
=>
Financedashboard
(),
Financedashboard
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
arguments:
arguments:
'Financedashboard'
,
'Financedashboard'
,
),
),
...
@@ -967,24 +1027,30 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -967,24 +1027,30 @@ class _MyHomePageState extends State<MyHomePage> {
},
},
child:
Container
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
vertical:
5
,
horizontal:
15
,
horizontal:
15
,
),
),
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
vertical:
7
,
vertical:
7
,
horizontal:
5
,
horizontal:
5
,
),
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
borderRadius:
borderRadius:
BorderRadius
.
circular
(
14
),
BorderRadius
.
circular
(
14
,
),
),
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
center
,
CrossAxisAlignment
.
center
,
children:
[
children:
[
Expanded
(
Expanded
(
flex:
2
,
flex:
2
,
...
@@ -1001,10 +1067,10 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1001,10 +1067,10 @@ class _MyHomePageState extends State<MyHomePage> {
filteredItems
[
ci
][
'name'
]
??
filteredItems
[
ci
][
'name'
]
??
"-"
,
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
color:
AppColors
AppColors
.
app_blue
,
.
app_blue
,
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
),
),
...
@@ -1013,10 +1079,10 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1013,10 +1079,10 @@ class _MyHomePageState extends State<MyHomePage> {
filteredItems
[
ci
][
'subtitle'
]
??
filteredItems
[
ci
][
'subtitle'
]
??
"-"
,
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
12
,
fontSize:
12
,
color:
color:
AppColors
AppColors
.
grey_semi
,
.
grey_semi
,
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
),
),
...
@@ -1276,8 +1342,10 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1276,8 +1342,10 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
child:
GridView
.
builder
(
child:
GridView
.
builder
(
shrinkWrap:
true
,
shrinkWrap:
true
,
itemCount:
coreFilteredItems
.
length
,
itemCount:
physics:
NeverScrollableScrollPhysics
(),
coreFilteredItems
.
length
,
physics:
NeverScrollableScrollPhysics
(),
gridDelegate:
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
crossAxisCount:
2
,
...
@@ -1296,7 +1364,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1296,7 +1364,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
builder:
(
context
)
=>
(
context
)
=>
Gentrackerdashboard
(),
Gentrackerdashboard
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
arguments:
arguments:
'Gentrackerdashboard'
,
'Gentrackerdashboard'
,
),
),
...
@@ -1341,7 +1410,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1341,7 +1410,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
builder:
(
context
)
=>
(
context
)
=>
CrmdashboardScreen
(),
CrmdashboardScreen
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
name:
name:
'CrmdashboardScreen'
,
'CrmdashboardScreen'
,
),
),
...
@@ -1354,7 +1424,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1354,7 +1424,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder:
builder:
(
context
)
=>
(
context
)
=>
HrmdashboardScreen
(),
HrmdashboardScreen
(),
settings:
RouteSettings
(
settings:
RouteSettings
(
name:
name:
'CrmdashboardScreen'
,
'CrmdashboardScreen'
,
),
),
...
@@ -1372,24 +1443,30 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1372,24 +1443,30 @@ class _MyHomePageState extends State<MyHomePage> {
},
},
child:
Container
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
vertical:
5
,
horizontal:
15
,
horizontal:
15
,
),
),
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
vertical:
7
,
vertical:
7
,
horizontal:
5
,
horizontal:
5
,
),
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
borderRadius:
borderRadius:
BorderRadius
.
circular
(
14
),
BorderRadius
.
circular
(
14
,
),
),
),
child:
Row
(
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
center
,
MainAxisAlignment
.
center
,
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
center
,
CrossAxisAlignment
.
center
,
children:
[
children:
[
Expanded
(
Expanded
(
flex:
2
,
flex:
2
,
...
@@ -1406,7 +1483,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1406,7 +1483,8 @@ class _MyHomePageState extends State<MyHomePage> {
coreFilteredItems
[
ci
][
'name'
]
??
coreFilteredItems
[
ci
][
'name'
]
??
"-"
,
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
color:
color:
AppColors
AppColors
.
app_blue
,
.
app_blue
,
...
@@ -1418,7 +1496,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1418,7 +1496,8 @@ class _MyHomePageState extends State<MyHomePage> {
coreFilteredItems
[
ci
][
'subtitle'
]
??
coreFilteredItems
[
ci
][
'subtitle'
]
??
"-"
,
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
12
,
fontSize:
12
,
color:
color:
AppColors
AppColors
.
grey_semi
,
.
grey_semi
,
...
@@ -1436,8 +1515,6 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1436,8 +1515,6 @@ class _MyHomePageState extends State<MyHomePage> {
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
coreFilteredItems
[
ci
][
'icon'
]
??
coreFilteredItems
[
ci
][
'icon'
]
??
"-"
,
"-"
,
height:
40
,
width:
40
,
),
),
),
),
],
],
...
@@ -1451,12 +1528,15 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1451,12 +1528,15 @@ class _MyHomePageState extends State<MyHomePage> {
],
],
),
),
),
),
SizedBox
(
height:
10
),
Align
(
Align
(
alignment:
Alignment
.
bottomCenter
,
alignment:
Alignment
.
bottomCenter
,
child:
Container
(
child:
Container
(
height:
40
,
height:
40
,
alignment:
Alignment
.
bottomCenter
,
alignment:
Alignment
.
bottomCenter
,
margin:
EdgeInsets
.
only
(
bottom:
20
),
margin:
EdgeInsets
.
only
(
bottom:
bottomPadding
,
),
child:
Image
.
asset
(
child:
Image
.
asset
(
fit:
BoxFit
.
scaleDown
,
fit:
BoxFit
.
scaleDown
,
"assets/images/horizontal_logo.png"
,
"assets/images/horizontal_logo.png"
,
...
@@ -1681,6 +1761,10 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1681,6 +1761,10 @@ class _MyHomePageState extends State<MyHomePage> {
// ),
// ),
],
],
),
),
],
),
],
),
),
),
),
),
// floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
// floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
...
@@ -1695,6 +1779,12 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1695,6 +1779,12 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
Future
<
void
>
_showProfileBottomSheet
(
BuildContext
context
)
{
Future
<
void
>
_showProfileBottomSheet
(
BuildContext
context
)
{
final
profileNotifier
=
Provider
.
of
<
ProfileNotifer
>(
context
,
listen:
false
);
profileNotifier
.
fetchJobDescription
(
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
),
context
,
);
return
showModalBottomSheet
(
return
showModalBottomSheet
(
useSafeArea:
true
,
useSafeArea:
true
,
isDismissible:
true
,
isDismissible:
true
,
...
@@ -1819,20 +1909,16 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1819,20 +1909,16 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
),
),
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
15
,
),
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Expanded
(
flex:
1
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
shrinkWrap:
true
,
shrinkWrap:
true
,
itemCount:
5
,
physics:
physics:
NeverScrollableScrollPhysics
(),
const
NeverScrollableScrollPhysics
(),
itemCount:
5
,
itemBuilder:
(
context
,
index
)
{
itemBuilder:
(
context
,
index
)
{
final
textHeadings
=
[
final
textHeadings
=
[
"Company"
,
"Company"
,
...
@@ -1841,34 +1927,8 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1841,34 +1927,8 @@ class _MyHomePageState extends State<MyHomePage> {
"Employee ID"
,
"Employee ID"
,
"Mobile Number"
,
"Mobile Number"
,
];
];
return
SizedBox
(
height:
40
,
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
"
${textHeadings[index]}
"
,
textAlign:
TextAlign
.
left
,
final
textValues
=
[
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
);
},
),
),
Expanded
(
flex:
1
,
child:
ListView
.
builder
(
shrinkWrap:
true
,
itemCount:
5
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
final
textHeadings
=
[
profile
.
company
,
profile
.
company
,
profile
.
branch
,
profile
.
branch
,
profile
.
designation
,
profile
.
designation
,
...
@@ -1877,43 +1937,89 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1877,43 +1937,89 @@ class _MyHomePageState extends State<MyHomePage> {
];
];
final
itemText
=
final
itemText
=
textHeadings
[
index
]
textValues
[
index
]?.
toString
()
??
"-"
;
?.
toString
()
??
"-"
;
return
SizedBox
(
return
Padding
(
height:
40
,
padding:
const
EdgeInsets
.
symmetric
(
child:
Align
(
vertical:
10
,
alignment:
Alignment
.
centerLeft
,
),
child:
InkWell
(
child:
Row
(
onTap:
()
async
{
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
/// Heading
Expanded
(
flex:
1
,
child:
Text
(
textHeadings
[
index
],
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
/// Value + "View" (only for Designation row)
Expanded
(
flex:
1
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
itemText
,
style:
TextStyle
(
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
if
(
profileNotifier
.
response
?.
jobDescription
?.
jobDescription
!=
null
&&
profileNotifier
.
response
!
.
jobDescription
!
.
jobDescription
!=
""
)
if
(
index
==
2
)
// only for Designation
InkWell
(
onTap:
index
==
2
?
()
async
{
/// now navigate to job desc screen
final
profileNotifier
=
final
profileNotifier
=
Provider
.
of
<
Provider
.
of
<
ProfileNotifer
ProfileNotifer
>(
>(
context
,
context
,
listen:
false
,
listen:
false
,
);
);
// Call API
await
profileNotifier
await
profileNotifier
.
fetchJobDescription
(
.
fetchJobDescription
(
Provider
.
of
<
Provider
.
of
<
HomescreenNotifier
HomescreenNotifier
>(
>(
context
,
context
,
listen:
false
,
listen:
false
,
),
),
context
,
context
,
);
);
// fetching, check response
if
(
profileNotifier
if
(
profileNotifier
.
response
!=
.
response
!=
null
&&
null
&&
profileNotifier
profileNotifier
.
response
!
.
response
!
.
jobDescription
!=
.
jobDescription
!=
null
)
{
null
&&
if
(
profileNotifier
profileNotifier
.
response
!
.
response
!
.
jobDescription
!
.
jobDescription
!
.
jobDescription
!=
.
jobDescription
!=
...
@@ -1923,63 +2029,69 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -1923,63 +2029,69 @@ class _MyHomePageState extends State<MyHomePage> {
.
jobDescription
!
.
jobDescription
!
.
jobDescription
!=
.
jobDescription
!=
""
)
{
""
)
{
showJobDescriptionSheet
(
Navigator
.
push
(
context:
context
,
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
JobDescriptionScreen
(
htmlData:
htmlData:
profileNotifier
profileNotifier
.
response
!.
jobDescription
!.
jobDescription
??
.
response
!
.
jobDescription
!
.
jobDescription
??
"<p>No description</p>"
,
"<p>No description</p>"
,
title:
title:
"Job Description"
,
//profileNotifier.response!.jobDescription!.name ??
profileNotifier
.
response
!.
jobDescription
!.
name
??
"Job Description"
,
designation:
itemText
,
),
),
);
);
}
}
else
{
}
else
{
ScaffoldMessenger
.
of
(
ScaffoldMessenger
.
of
(
context
,
context
,
).
showSnackBar
(
).
showSnackBar
(
SnackBar
(
SnackBar
(
content:
Text
(
content:
Text
(
profileNotifier
profileNotifier
.
errorMessage
??
.
errorMessage
??
"Failed to fetch job description"
,
"Failed to fetch job description"
,
),
),
),
),
);
);
}
}
}
,
}
:
null
,
// no click for others
child:
Row
(
child:
Text
(
children:
[
item
Text
,
Text
(
textAlign:
TextAlign
.
left
,
"View"
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
fontWeight:
FontWeight
.
w600
,
color:
color:
index
==
2
Colors
.
blue
,
?
AppColors
.
semi_black
:
AppColors
.
semi_black
,
decoration:
index
==
2
?
TextDecoration
.
underline
:
null
,
decorationStyle:
TextDecorationStyle
.
dotted
,
),
),
),
),
Icon
(
Icons
.
play_arrow
,
size:
18
,
color:
Color
(
0xFF1487C9
,
),
),
),
),
);
],
},
),
),
],
),
),
),
),
],
],
),
),
);
},
),
),
),
],
],
),
),
...
@@ -2041,258 +2153,6 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -2041,258 +2153,6 @@ class _MyHomePageState extends State<MyHomePage> {
);
);
}
}
// Job Descriptions
Future
<
void
>
showJobDescriptionSheet
({
required
BuildContext
context
,
required
String
htmlData
,
// pass details_articles!.description
String
title
=
"Job Description"
,
})
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
enableDrag:
true
,
backgroundColor:
Colors
.
white
,
context:
context
,
builder:
(
context
)
{
return
SafeArea
(
child:
Container
(
margin:
const
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
15
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
/// Heading
Text
(
title
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
18
,
color:
AppColors
.
app_blue
,
fontWeight:
FontWeight
.
w600
,
),
),
const
SizedBox
(
height:
5
),
/// HTML description
Html
(
data:
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:
10
,
right:
8
,
),
// fixed for v3.0.0
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
,
),
// bullet text line height
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)); // needs url_launcher
}
},
),
const
SizedBox
(
height:
6
),
/// Close button
InkWell
(
onTap:
()
=>
Navigator
.
pop
(
context
),
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
,
vertical:
5.0
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15.0
),
),
child:
Center
(
child:
Text
(
"Close"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaMedium"
,
fontSize:
15
,
),
),
),
),
),
],
),
),
),
);
},
);
}
// Future<void> showJobDescriptionSheet(
// BuildContext context,
// List<String> jobPoints,
// ) {
// return showModalBottomSheet(
// useSafeArea: true,
// isDismissible: true,
// isScrollControlled: true,
// showDragHandle: true,
// enableDrag: true,
// backgroundColor: Colors.white,
// context: context,
// builder: (context) {
// return SafeArea(
// child: Container(
// margin: const EdgeInsets.only(
// bottom: 15,
// left: 15,
// right: 15,
// top: 30,
// ),
// padding: EdgeInsets.only(
// bottom: MediaQuery.of(context).viewInsets.bottom,
// ),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// /// Heading
// Text(
// "Job Description",
// style: TextStyle(
// fontFamily: "JakartaMedium",
// fontSize: 16,
// color: AppColors.app_blue, // same as Logout "Yes, Logout" button
// fontWeight: FontWeight.w600,
// ),
// ),
// const SizedBox(height: 15),
//
// /// Bullet points list
// ...jobPoints.map(
// (point) => Padding(
// padding: const EdgeInsets.symmetric(vertical: 6),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "• ",
// style: TextStyle(
// fontSize: 14,
// color: AppColors.semi_black,
// ),
// ),
// Expanded(
// child: Text(
// point,
// style: TextStyle(
// fontSize: 14,
// color: AppColors.semi_black,
// fontFamily: "JakartaRegular",
// height: 1.4, // line spacing
// ),
// ),
// ),
// ],
// ),
// ),
// ),
//
// const SizedBox(height: 20),
//
// /// Close button
// InkWell(
// onTap: () => Navigator.pop(context),
// child: Container(
// alignment: Alignment.center,
// height: 45,
// margin: const EdgeInsets.symmetric(
// horizontal: 5.0,
// vertical: 5.0,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(15.0),
// ),
// child: Center(
// child: Text(
// "Close",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: AppColors.app_blue,
// fontFamily: "JakartaMedium",
// fontSize: 15,
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// );
// },
// );
// }
Future
<
void
>
_showLogoutBottomSheet
(
BuildContext
context
)
{
Future
<
void
>
_showLogoutBottomSheet
(
BuildContext
context
)
{
return
showModalBottomSheet
(
return
showModalBottomSheet
(
useSafeArea:
true
,
useSafeArea:
true
,
...
...
lib/screens/JobDescription.dart
View file @
185e0896
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)); //
}
},
),
],
),
),
),
);
}
}
lib/screens/WebERPIOS.dart
View file @
185e0896
...
@@ -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"
?
Platform
.
isAndroid
?
WillPopScope
(
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
)),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
)
:
_scaffold
(
context
):
NoNetwork
(
context
);
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
}
Widget
_scaffold
(
BuildContext
context
)
{
Widget
_scaffold
(
BuildContext
context
)
{
...
...
lib/screens/commom/accountsList.dart
View file @
185e0896
...
@@ -19,52 +19,88 @@ class Accountslist extends StatefulWidget {
...
@@ -19,52 +19,88 @@ class Accountslist extends StatefulWidget {
}
}
class
_AccountslistState
extends
State
<
Accountslist
>
{
class
_AccountslistState
extends
State
<
Accountslist
>
{
ScrollController
scrollController
=
ScrollController
();
final
ScrollController
_scrollController
=
ScrollController
();
FocusNode
focusNode1
=
FocusNode
();
int
_currentPage
=
1
;
FocusNode
focusNode2
=
FocusNode
();
bool
_isLoadingMore
=
false
;
bool
_hasMoreItems
=
true
;
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
@override
void
initState
()
{
void
initState
()
{
// TODO: implement initState
super
.
initState
();
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
});
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
_scrollController
.
addListener
(
_scrollListener
);
provider
.
commonAccountListAPIFunction
(
context
);
provider
.
pageNum
=
1
;
// fetch first page once
provider
.
commonAccountListAPIFunction
(
context
);
Future
.
microtask
(()
{
// if (scrollController.position.maxScrollExtent ==
final
provider
=
// scrollController.offset) {
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
scrollController
.
addListener
(()
{
if
(
scrollController
.
position
.
pixels
>=
scrollController
.
position
.
maxScrollExtent
*
0.9
&&
!
provider
.
isLoading
&&
provider
.
hasMoreData
)
{
provider
.
commonAccountListAPIFunction
(
context
);
provider
.
commonAccountListAPIFunction
(
context
);
}
});
});
});
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
// TODO: implement dispose
_scrollController
.
removeListener
(
_scrollListener
);
super
.
dispose
();
_scrollController
.
dispose
();
scrollController
.
dispose
();
_connectivity
.
disposeStream
();
_connectivity
.
disposeStream
();
super
.
dispose
();
}
void
_scrollListener
()
{
if
(
_scrollController
.
position
.
pixels
>=
_scrollController
.
position
.
maxScrollExtent
)
{
_loadMoreItems
(
context
);
}
}
void
_loadMoreItems
(
BuildContext
context
)
{
if
(
_isLoadingMore
||
!
_hasMoreItems
)
return
;
final
provider
=
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
setState
(()
{
_isLoadingMore
=
true
;
_currentPage
++;
});
provider
.
commonAccountListAPIFunction
(
context
,
append:
true
).
then
((
_
)
{
setState
(()
{
_isLoadingMore
=
false
;
final
newItems
=
provider
.
accountsList
;
if
(
newItems
.
length
<
_currentPage
*
15
)
{
//api gives 15 records
_hasMoreItems
=
false
;
}
});
}).
catchError
((
_
)
{
setState
(()
{
_isLoadingMore
=
false
;
_currentPage
--;
// rollback
});
});
}
void
_refreshList
(
BuildContext
context
)
{
final
provider
=
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
setState
(()
{
_currentPage
=
1
;
_hasMoreItems
=
true
;
_isLoadingMore
=
false
;
});
provider
.
commonAccountListAPIFunction
(
context
);
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
connection
=
'Online'
;
break
;
break
;
...
@@ -72,6 +108,7 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -72,6 +108,7 @@ class _AccountslistState extends State<Accountslist> {
default
:
default
:
connection
=
'Offline'
;
connection
=
'Offline'
;
}
}
return
(
connection
==
"Online"
)
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
Platform
.
isAndroid
?
WillPopScope
(
?
WillPopScope
(
...
@@ -86,12 +123,21 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -86,12 +123,21 @@ class _AccountslistState extends State<Accountslist> {
:
NoNetwork
(
context
);
:
NoNetwork
(
context
);
}
}
@override
Widget
_scaffold
(
BuildContext
context
)
{
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Accountslistprovider
>(
return
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
builder:
(
context
,
provider
,
child
)
{
var
accountList
=
provider
.
accountsList
;
final
accountList
=
provider
.
accountsList
;
print
(
accountList
.
length
);
if
(
provider
.
isLoading
&&
_currentPage
==
1
)
{
return
const
Scaffold
(
body:
Center
(
child:
CircularProgressIndicator
()),
);
}
if
(
accountList
.
isEmpty
)
{
return
Scaffold
(
body:
Emptywidget
(
context
));
}
return
Scaffold
(
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
resizeToAvoidBottomInset:
true
,
appBar:
appbar2New
(
appBar:
appbar2New
(
...
@@ -99,66 +145,44 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -99,66 +145,44 @@ class _AccountslistState extends State<Accountslist> {
"Account List"
,
"Account List"
,
provider
.
resetValues
,
provider
.
resetValues
,
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
child:
InkResponse
(
child:
InkResponse
(
onTap:
()
{
onTap:
()
{
_showFilterSheet1
(
context
);
_showFilterSheet1
(
context
);
},
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
18
),
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
18
),
),
),
),
),
),
),
0xFFFFFFFF
0xFFFFFFFF
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
body:
RefreshIndicator
(
provider
.
isLoading
onRefresh:
()
async
=>
_refreshList
(
context
),
?
Center
(
child:
ListView
.
builder
(
child:
CircularProgressIndicator
(
controller:
_scrollController
,
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
app_blue
),
padding:
const
EdgeInsets
.
all
(
12
),
),
itemCount:
accountList
.
length
+
(
_hasMoreItems
?
1
:
0
),
)
:
accountList
.
isNotEmpty
?
SizedBox
(
child:
Scrollbar
(
child:
SingleChildScrollView
(
controller:
scrollController
,
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
accountList
.
length
+
(
provider
.
hasMoreData
&&
provider
.
isLoading
?
1
:
0
),
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
itemBuilder:
(
context
,
index
)
{
if
(
accountList
.
isEmpty
)
{
if
(
index
>=
accountList
.
length
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
if
(
index
==
accountList
.
length
&&
!
provider
.
isLoading
)
{
return
Padding
(
return
Padding
(
padding:
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16
),
child:
Center
(
child:
Center
(
child:
CircularProgressIndicator
.
adaptive
(
child:
_isLoadingMore
valueColor:
?
const
CircularProgressIndicator
(
AlwaysStoppedAnimation
<
Color
>(
color:
Colors
.
blue
,
AppColors
.
app_blue
,
)
),
:
!
_hasMoreItems
),
?
const
Text
(
"No more accounts to load"
)
:
const
SizedBox
.
shrink
(),
),
),
);
);
}
}
final
account
=
accountList
[
index
];
return
InkResponse
(
return
InkResponse
(
onTap:
()
async
{
onTap:
()
async
{
print
(
print
(
...
@@ -260,132 +284,11 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -260,132 +284,11 @@ class _AccountslistState extends State<Accountslist> {
);
);
},
},
),
),
],
),
),
),
)
:
Emptywidget
(
context
),
);
},
);
}
Future
<
void
>
_showFilterSheet
(
BuildContext
context
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
backgroundColor:
Colors
.
white
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
10
,
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Padding
(
padding:
EdgeInsets
.
symmetric
(
vertical:
10
),
child:
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
),
textControllerWidget
(
context
,
provider
.
companyNameController
,
"Company Name"
,
"Enter Company Name"
,
(
p0
)
{},
TextInputType
.
text
,
false
,
null
,
focusNode1
,
focusNode2
,
TextInputAction
.
next
,
),
textControllerWidget
(
context
,
provider
.
mobileNumberController
,
"Mobile Number"
,
"Enter Mobile Number"
,
(
p0
)
{},
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNode2
,
null
,
TextInputAction
.
done
,
10
,
),
InkResponse
(
onTap:
()
{
Navigator
.
pop
(
context
);
provider
.
pageNum
=
1
;
provider
.
commonAccountListAPIFunction
(
context
);
provider
.
companyNameController
.
clear
();
provider
.
mobileNumberController
.
clear
();
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
Text
(
"Search"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
],
),
),
),
);
);
},
},
),
);
},
);
},
);
);
}
}
Future
<
void
>
_showFilterSheet1
(
BuildContext
context
)
{
Future
<
void
>
_showFilterSheet1
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
List
<
bool
>
isSelected
=
List
.
generate
(
2
,
2
,
...
@@ -617,14 +520,9 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -617,14 +520,9 @@ class _AccountslistState extends State<Accountslist> {
},
},
);
);
}
}
Future
<
bool
>
_onBackPressed
(
BuildContext
context
)
async
{
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
).
pageNum
=
1
;
Navigator
.
pop
(
context
,
true
);
return
true
;
}
}
}
// Divider(
// Divider(
// thickness: 0.5,
// thickness: 0.5,
// color: Color(0xFFD7D7D7),
// color: Color(0xFFD7D7D7),
...
...
lib/screens/crm/LeadListByMode.dart
View file @
185e0896
...
@@ -42,17 +42,21 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -42,17 +42,21 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
final
ScrollController
_scrollController
=
ScrollController
();
@override
@override
void
initState
()
{
void
initState
()
{
// TODO: implement initState
super
.
initState
();
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
});
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
provider
=
Provider
.
of
<
Leadlistprovider
>(
context
,
listen:
false
);
final
provider
=
Provider
.
of
<
Leadlistprovider
>(
context
,
listen:
false
);
provider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
provider
.
resetPagination
();
if
(
widget
.
filter
!=
null
)
{
if
(
widget
.
filter
!=
null
)
{
provider
.
crmLeadListAPIFunction
(
provider
.
crmLeadListAPIFunction
(
context
,
context
,
...
@@ -78,16 +82,32 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -78,16 +82,32 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
""
,
""
,
);
);
}
}
_scrollController
.
addListener
(()
{
if
(
_scrollController
.
position
.
pixels
>=
_scrollController
.
position
.
maxScrollExtent
-
200
)
{
provider
.
loadMore
(
context
,
widget
.
mode
,
widget
.
filter
?.
status
??
""
,
widget
.
filter
?.
openStatus
??
""
,
""
,
""
,
""
,
""
,
""
,
);
}
});
});
});
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
// TODO: implement dispose
_scrollController
.
dispose
();
super
.
dispose
();
_connectivity
.
disposeStream
();
_connectivity
.
disposeStream
();
super
.
dispose
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
@@ -142,29 +162,31 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -142,29 +162,31 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
0xFFFFFFFF
,
0xFFFFFFFF
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
body:
provider
.
isLoading
provider
.
isLoading
?
Center
(
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
valueColor:
AppColors
.
app_blue
,
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
),
),
),
),
)
)
:
crmLists
.
isNotEmpty
:
crmLists
.
isNotEmpty
?
SizedBox
(
?
Scrollbar
(
child:
Scrollbar
(
controller:
_scrollController
,
thumbVisibility:
false
,
child:
ListView
.
builder
(
child:
ListView
.
builder
(
itemCount:
crmLists
.
length
,
controller:
_scrollController
,
shrinkWrap:
true
,
itemCount:
crmLists
.
length
+
(
provider
.
hasMoreData
?
1
:
0
),
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
itemBuilder:
(
context
,
index
)
{
if
(
crmLists
.
isEmpty
)
{
if
(
index
==
crmLists
.
length
)
{
return
SizedBox
(
return
provider
.
isLoadingMore
child:
Center
(
child:
Text
(
"No Data Available"
)),
?
const
Padding
(
);
padding:
EdgeInsets
.
all
(
16
),
child:
Center
(
child:
CircularProgressIndicator
()),
)
:
const
SizedBox
.
shrink
();
}
}
final
lead
=
crmLists
[
index
];
return
InkResponse
(
return
InkResponse
(
onTap:
()
async
{
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
HapticFeedback
.
selectionClick
();
...
@@ -266,7 +288,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -266,7 +288,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
);
},
},
),
),
),
)
)
:
Emptywidget
(
context
),
:
Emptywidget
(
context
),
);
);
...
@@ -274,1324 +295,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -274,1324 +295,8 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
);
}
}
// Future<void> _showFilterSheet(BuildContext context) {
// return showModalBottomSheet(
// useSafeArea: true,
// isDismissible: true,
// isScrollControlled: true,
// showDragHandle: true,
// backgroundColor: Colors.white,
// enableDrag: true,
// context: context,
// builder: (context) {
// return StatefulBuilder(
// builder: (context, setState) {
// return SafeArea(
// child: Consumer<Leadlistprovider>(
// builder: (context, provider, child) {
// return Container(
// margin: EdgeInsets.only(
// bottom: 15,
// left: 15,
// right: 15,
// top: 10,
// ),
// padding: EdgeInsets.only(
// bottom: MediaQuery.of(context).viewInsets.bottom,
// ),
// child: SingleChildScrollView(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// SizedBox(height: 15),
// Row(
// children: [
// Expanded(
// child: Text(
// "Filter",
// style: TextStyle(
// color: AppColors.app_blue,
// fontSize: 14,
// ),
// ),
// ),
// ],
// ),
// textControllerWidget(
// context,
// provider.sLeadIDController,
// "Lead ID",
// "Enter Lead ID",
// provider.onChangedLeadId,
// TextInputType.text,
// false,
// null,
// ),
// if (widget.mode != "executive") ...[
// TextWidget(context, "Employee"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Employees>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.employeesList
// .map(
// (slist) =>
// DropdownMenuItem<Employees>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value:
// provider.employeesList.contains(
// provider.selectedEmployee,
// )
// ? provider.selectedEmployee
// : null,
//
// // value: provider.selectedEmployees,
// onChanged: (Employees? value) {
// if (value != null) {
// if (provider
// .employeesList
// .isNotEmpty) {
// provider.selectedEmployee = value;
// provider.selectedEmployeeId =
// value!.id!;
// provider.selectedEmployeeValue =
// value!.name!;
// provider
// .crmLeadListSourceOnReferenceAPIFunction(
// context,
// widget.mode,
// provider.selectedSourceId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
// ],
// TextWidget(context, "Lead Status"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<String>(
// hint: Text(
// "Select Lead Status",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.leadStatusList
// .map(
// (leadStatus) =>
// DropdownMenuItem<String>(
// value: leadStatus,
// child: Text(
// leadStatus!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedLeadStatus,
// onChanged: (String? value) {
// if (value != null) {
// provider.selectedLeadStatus = value;
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Open/Close Status"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<String>(
// hint: Text(
// "Select Open/Close Status",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.openStatusList
// .map(
// (leadStatus) =>
// DropdownMenuItem<String>(
// value: leadStatus,
// child: Text(
// leadStatus!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedOpenStatus,
// onChanged: (String? value) {
// if (value != null) {
// provider.selectedOpenStatus = value;
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
// textControllerWidget(
// context,
// provider.mobileNumberController,
// "Mobile Number",
// "Enter Mobile Number",
// provider.onChangedMobileNum,
// TextInputType.number,
// false,
// FilteringTextInputFormatter.digitsOnly,
// ),
// textControllerWidget(
// context,
// provider.companyNameController,
// "Company Name",
// "Enter Company Name",
// provider.onChangedCompanyName,
// TextInputType.text,
// false,
// null,
// ),
//
// TextWidget(context, "Source"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Sources>(
// hint: Text(
// "Select Source",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.sourcesList
// .map(
// (slist) =>
// DropdownMenuItem<Sources>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSource,
// onChanged: (Sources? value) {
// if (value != null) {
// if (provider.sourcesList.isNotEmpty) {
// provider.selectedSource = value;
// provider.selectedSourceId =
// value!.id!;
// provider.selectedSourceValue =
// value!.name!;
// provider
// .crmLeadListSourceOnReferenceAPIFunction(
// context,
// widget.mode,
// provider.selectedSourceId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Reference"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<References>(
// hint: Text(
// "Select Reference",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.referencesList
// .map(
// (slist) =>
// DropdownMenuItem<References>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedReference,
// onChanged: (References? value) {
// if (value != null) {
// if (provider
// .referencesList
// .isNotEmpty) {
// provider.selectedReference = value;
// provider.selectedReferenceId =
// value!.id!;
// provider.selectedReferenceValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Team"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Teams>(
// hint: Text(
// "Select Team",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.teamsList
// .map(
// (slist) =>
// DropdownMenuItem<Teams>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedTeam,
// onChanged: (Teams? value) {
// if (value != null) {
// if (provider.teamsList.isNotEmpty) {
// provider.selectedTeam = value;
// provider.selectedTeamId = value!.id!;
// provider.selectedTeamValue =
// value!.name!;
// provider
// .crmLeadListSegmentOnTeamAPIFunction(
// context,
// widget.mode,
// provider.selectedTeamId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Segment"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Segments>(
// hint: Text(
// "Select Segment",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.segmentsList
// .map(
// (slist) =>
// DropdownMenuItem<Segments>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSegment,
// onChanged: (Segments? value) {
// if (value != null) {
// if (provider.segmentsList.isNotEmpty) {
// provider.selectedSegment = value;
// provider.selectedSegmentId =
// value!.id!;
// provider.selectedSegmentValue =
// value!.name!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "State"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<States>(
// hint: Text(
// "Select State",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.statesList
// .map(
// (slist) =>
// DropdownMenuItem<States>(
// value: slist,
// child: Text(
// slist.name!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedStates,
// onChanged: (States? value) {
// if (value != null) {
// if (provider.statesList.isNotEmpty) {
// provider.selectedStates = value;
// provider.selectedStateId = value!.id!;
// provider.selectedStateValue =
// value!.name!;
// if (provider
// .districtsList
// .isNotEmpty) {
// provider.districtsList.clear();
// // provider.selectedDistricts = null;
// provider.selectedDistrictId = null;
// provider.selectedDistrictValue = "";
// }
// provider
// .crmLeadListDistrictsOnStateAPIFunction(
// context,
// widget.mode,
// provider.selectedStateId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "District"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<Districts>(
// hint: Text(
// "Select District",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.districtsList
// .map(
// (slist) =>
// DropdownMenuItem<Districts>(
// value: slist,
// child: Text(
// slist.district!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedDistricts,
// onChanged: (Districts? value) {
// if (value != null) {
// if (provider.districtsList.isNotEmpty) {
// provider.selectedDistricts = value;
// provider.selectedDistrictId =
// value!.id!;
// provider.selectedDistrictValue =
// value!.district!;
// if (provider
// .subLocationsList
// .isNotEmpty) {
// provider.subLocationsList.clear();
// // provider.selectedSubLocations =
// // null;
// provider.selectedSubLocationId =
// null;
// provider.selectedSubLocationValue =
// "";
// }
// provider
// .crmLeadListSubLocOnDistrictAPIFunction(
// context,
// widget.mode,
// provider.selectedDistrictId,
// );
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// TextWidget(context, "Sub Location"),
// DropdownButtonHideUnderline(
// child: Row(
// children: [
// Expanded(
// child: DropdownButton2<SubLocations>(
// hint: Text(
// "Select Sub Location",
// style: TextStyle(fontSize: 14),
// ),
// items:
// provider.subLocationsList
// .map(
// (slist) => DropdownMenuItem<
// SubLocations
// >(
// value: slist,
// child: Text(
// slist.subLocality!,
// style: TextStyle(
// fontSize: 14,
// ),
// ),
// ),
// )
// .toList(),
// value: provider.selectedSubLocations,
// onChanged: (SubLocations? value) {
// if (value != null) {
// if (provider
// .subLocationsList
// .isNotEmpty) {
// provider.selectedSubLocations = value;
// provider.selectedSubLocationId =
// value!.id!;
// provider.selectedSubLocationValue =
// value!.subLocality!;
// }
// }
// },
// isExpanded: true,
// buttonStyleData: ddtheme.buttonStyleData,
// iconStyleData: ddtheme.iconStyleData,
// menuItemStyleData:
// ddtheme.menuItemStyleData,
// dropdownStyleData:
// ddtheme.dropdownStyleData,
// ),
// ),
// ],
// ),
// ),
//
// InkResponse(
// onTap: () {
// // provider.crmLeadListAPIFunction(
// // context,
// // widget.mode,
// // provider.selectedEmployeeId,
// // provider.selectedLeadStatus,
// // provider.selectedOpenStatus,
// // provider.selectedSourceId,
// // provider.selectedReferenceId,
// // provider.selectedTeamId,
// // provider.selectedSegmentId,
// // provider.selectedStateId,
// // provider.selectedDistrictId,
// // provider.selectedSubLocationId,
// // );
// Navigator.pop(context);
// },
// child: Container(
// height: 45,
// alignment: Alignment.center,
// margin: EdgeInsets.symmetric(horizontal: 10),
// padding: EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 5,
// ),
// decoration: BoxDecoration(
// color: AppColors.app_blue,
// borderRadius: BorderRadius.circular(15),
// ),
// child: Text(
// "Submit",
// style: TextStyle(
// fontSize: 15,
// fontFamily: "JakartaMedium",
// color: Colors.white,
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// );
// },
// );
// },
// );
// }
Future
<
void
>
_showFilterSheetNew1
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
9
,
(
index
)
=>
index
==
0
?
true
:
false
,
);
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
isScrollControlled:
true
,
showDragHandle:
true
,
backgroundColor:
Colors
.
white
,
enableDrag:
true
,
context:
context
,
builder:
(
context
)
{
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
Consumer
<
Leadlistprovider
>(
builder:
(
context
,
provider
,
child
)
{
int
selectedIndex
=
isSelected
.
indexWhere
(
(
element
)
=>
element
==
true
,
);
final
headings
=
[
"Lead Status"
,
"Open/Close Status"
,
"Mobile Number"
,
"Company Name"
,
"Source"
,
"Reference"
,
"Team"
,
"Segment"
,
];
if
(
widget
.
mode
!=
"executive"
)
{
headings
.
add
(
"Employee"
);
}
return
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
EdgeInsets
.
only
(
left:
15
),
child:
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
18
,
fontFamily:
"JakartaSemiBold"
,
),
),
),
const
SizedBox
(
height:
20
),
// Two-Column Layout
Expanded
(
child:
Container
(
decoration:
BoxDecoration
(
border:
Border
(
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
bottom:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
),
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
// Left Column: Headings
Expanded
(
flex:
3
,
child:
Column
(
children:
List
.
generate
(
headings
.
length
,
(
jj
,
)
{
return
Expanded
(
child:
InkResponse
(
onTap:
()
{
setState
(()
{
// Reset all to false
isSelected
=
List
.
generate
(
headings
.
length
,
(
index
)
=>
false
,
);
// Set the clicked item to true
isSelected
[
jj
]
=
true
;
});
},
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
7.5
,
horizontal:
10
,
),
decoration:
BoxDecoration
(
border:
Border
(
left:
isSelected
[
jj
]
?
BorderSide
(
color:
AppColors
.
app_blue
,
width:
5.0
,
)
:
const
BorderSide
(
color:
Colors
.
transparent
,
),
bottom:
jj
==
headings
.
length
-
1
?
const
BorderSide
(
color:
Colors
.
transparent
,
)
:
const
BorderSide
(
color:
Color
(
0xFFA5DAF9
,
),
),
),
color:
const
Color
(
0xFFE6F6FF
),
),
child:
Center
(
child:
Text
(
headings
[
jj
],
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaRegular"
,
color:
AppColors
.
semi_black
,
),
),
),
),
),
);
}),
),
),
// Right Column: Dynamic Input Fields
Expanded
(
flex:
5
,
child:
SingleChildScrollView
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
if
(
selectedIndex
==
0
)
...[
...
provider
.
leadStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
status
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedLeadStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedLeadStatus
=
status
;
}
else
{
provider
.
selectedLeadStatus
=
null
;
}
print
(
provider
.
selectedLeadStatus
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
1
)
...[
...
provider
.
openStatusList
.
map
((
status
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
status
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedOpenStatus
==
status
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedOpenStatus
=
status
;
}
else
{
provider
.
selectedOpenStatus
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
2
)
...[
textControllerWidget
(
context
,
provider
.
mobileNumberController
,
"Mobile Number"
,
"Enter Mobile Number"
,
provider
.
onChangedMobileNum
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
]
else
if
(
selectedIndex
==
3
)
...[
textControllerWidget
(
context
,
provider
.
companyNameController
,
"Company Name"
,
"Enter Company Name"
,
provider
.
onChangedCompanyName
,
TextInputType
.
text
,
false
,
null
,
),
]
else
if
(
selectedIndex
==
4
)
...[
...
provider
.
sourcesList
.
map
((
source
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
source
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedSource
==
source
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedSource
=
source
!;
provider
.
selectedSourceId
=
source
.
id
!;
provider
.
selectedSourceValue
=
source
.
name
!;
}
else
{
provider
.
selectedSourceId
=
null
;
provider
.
selectedSourceValue
=
null
;
if
(
provider
.
selectedReference
!=
null
)
{
provider
.
referencesList
.
clear
();
provider
.
selectedReferenceId
=
null
;
provider
.
selectedReferenceValue
=
null
;
}
}
// Call API if needed
provider
.
crmLeadListSourceOnReferenceAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedSourceId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
5
)
...[
if
(
provider
.
referencesList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Source First"
,
),
]
else
...[
...
provider
.
referencesList
.
map
((
reference
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
reference
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedReference
==
reference
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedReference
=
reference
;
provider
.
selectedReferenceId
=
reference
.
id
!;
provider
.
selectedReferenceValue
=
reference
.
name
!;
}
else
{
provider
.
referencesList
.
clear
();
provider
.
selectedReferenceId
=
null
;
provider
.
selectedReferenceValue
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
]
else
if
(
selectedIndex
==
6
)
...[
...
provider
.
teamsList
.
map
((
team
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
title:
Text
(
team
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
value:
provider
.
selectedTeam
==
team
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedTeam
=
team
;
provider
.
selectedTeamId
=
team
.
id
!;
provider
.
selectedTeamValue
=
team
.
name
!;
}
else
{
provider
.
selectedTeamId
=
null
;
provider
.
selectedTeamValue
=
null
;
if
(
provider
.
selectedSegment
!=
null
)
{
provider
.
segmentsList
.
clear
();
provider
.
selectedSegmentId
=
null
;
provider
.
selectedSegmentValue
=
null
;
}
}
provider
.
crmLeadListSegmentOnTeamAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedTeamId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
]
else
if
(
selectedIndex
==
7
)
...[
if
(
provider
.
segmentsList
.
isEmpty
)
...[
errorWidget
(
context
,
"Please Select Team ID First"
,
),
]
else
...[
...
provider
.
segmentsList
.
map
((
segment
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
segment
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedSegment
==
segment
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedSegment
=
segment
;
provider
.
selectedSegmentId
=
segment
.
id
!;
provider
.
selectedSegmentValue
=
segment
.
name
!;
}
else
{
provider
.
segmentsList
.
clear
();
provider
.
selectedSegmentId
=
null
;
provider
.
selectedSegmentValue
=
null
;
}
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
]
else
if
(
widget
.
mode
!=
"executive"
)
...[
...
provider
.
employeesList
.
map
((
employee
,
)
{
return
SizedBox
(
height:
35
,
child:
CheckboxListTile
(
activeColor:
AppColors
.
app_blue
,
controlAffinity:
ListTileControlAffinity
.
leading
,
checkboxShape:
CircleBorder
(
side:
BorderSide
(
width:
0.5
,
),
),
title:
Text
(
employee
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
value:
provider
.
selectedEmployee
==
employee
,
onChanged:
(
bool
?
value
)
{
setState
(()
{
if
(
value
==
true
)
{
provider
.
selectedEmployee
=
employee
;
provider
.
selectedEmployeeId
=
employee
.
id
!;
provider
.
selectedEmployeeValue
=
employee
.
name
!;
}
provider
.
crmLeadListSourceOnReferenceAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedSourceId
,
);
});
},
contentPadding:
EdgeInsets
.
zero
,
),
);
}).
toList
(),
],
],
),
),
),
],
),
),
),
// Search Button
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
20
,
),
child:
InkResponse
(
onTap:
()
{
provider
.
crmLeadListAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedLeadStatus
,
provider
.
selectedOpenStatus
,
provider
.
selectedSourceId
,
provider
.
selectedReferenceId
,
provider
.
selectedTeamId
,
provider
.
selectedSegmentId
,
provider
.
selectedAlphabet
,
);
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
const
Text
(
"Search"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
),
],
),
);
},
),
),
);
},
);
},
);
}
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
List
<
bool
>
isSelected
=
List
.
generate
(
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment