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
c92f4c79
Commit
c92f4c79
authored
Jul 10, 2025
by
Sai Srinivas
Browse files
ios changes in Navigation swipe gestures.
parent
ee178d55
Changes
35
Hide whitespace changes
Inline
Side-by-side
ios/Podfile.lock
View file @
c92f4c79
PODS:
- app_settings (5.1.1):
- Flutter
- camera_avfoundation (0.0.1):
- Flutter
- connectivity_plus (0.0.1):
...
...
@@ -167,6 +169,7 @@ PODS:
- FlutterMacOS
DEPENDENCIES:
- app_settings (from `.symlinks/plugins/app_settings/ios`)
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
...
...
@@ -219,6 +222,8 @@ SPEC REPOS:
- SDWebImageWebPCoder
EXTERNAL SOURCES:
app_settings:
:path: ".symlinks/plugins/app_settings/ios"
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
connectivity_plus:
...
...
@@ -281,6 +286,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
app_settings: 58017cd26b604ae98c3e65acbdd8ba173703cc82
camera_avfoundation: adb0207d868b2d873e895371d88448399ab78d87
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
...
...
lib/Notifiers/commonProvider/accountsListProvider.dart
View file @
c92f4c79
...
...
@@ -334,7 +334,7 @@ class Accountslistprovider extends ChangeNotifier {
MaterialPageRoute
(
builder:
(
context
)
=>
Accountslistdetails
(
accountID:
data
.
id
),
),
(
Route
<
dynamic
>
route
)
{
(
Route
<
dynamic
>
route
)
{
return
route
.
settings
.
arguments
==
'Financedashboard'
;
},
);
...
...
@@ -610,6 +610,7 @@ class Accountslistprovider extends ChangeNotifier {
}
resetValues
()
{
print
(
"rv"
);
_selectedAccountType
=
null
;
_selectedState
=
null
;
_selectedDistricts
=
null
;
...
...
lib/Notifiers/financeProvider/RequestionListProvider.dart
View file @
c92f4c79
...
...
@@ -975,6 +975,7 @@ class Requestionlistprovider extends ChangeNotifier {
// }
void
resetForm
()
{
print
(
"ios calling"
);
_submitClicked
=
false
;
accountSearchController
.
clear
();
paymentAccountSearchController
.
clear
();
...
...
lib/Notifiers/financeProvider/paymentReceiptsProvider.dart
View file @
c92f4c79
...
...
@@ -448,10 +448,10 @@ class Paymentreceiptsprovider extends ChangeNotifier {
...
data
.
receiptAccounts
!,
];
_receiptPaymentModes
=
data
.
paymentModes
!;
_receiptPaymentModes
=
[
PaymentModes
(
name:
"Select"
,
id:
""
),...
data
.
paymentModes
!
];
_receiptPaymentModes
=
[
PaymentModes
(
name:
"Select"
,
id:
""
),
...
data
.
paymentModes
!,
];
_receiptAccounts
=
data
.
accounts
!;
_receiptAccounts
=
[
Accounts
(
name:
"Select"
,
id:
""
),
...
...
@@ -709,6 +709,7 @@ class Paymentreceiptsprovider extends ChangeNotifier {
}
void
resetForm
()
{
print
(
"rf"
);
_submitClicked
=
false
;
accountSearchController
.
clear
();
paymentAccountSearchController
.
clear
();
...
...
lib/Utils/GlobalConstants.dart
View file @
c92f4c79
String
didPushed
=
""
;
String
didPopped
=
""
;
String
routeSettingName
=
""
;
lib/Utils/commonWidgets.dart
View file @
c92f4c79
...
...
@@ -208,11 +208,10 @@ NoNetwork(context) {
// Image.asset('assets/images/no_wifi.png', width: 100, height: 100),
SizedBox
(
height:
10
),
Center
(
child:
Text
(
"You are Offline"
,
style:
TextStyle
(
fontSize:
16
,
color:
AppColors
.
semi_black
),),
child:
Text
(
"You are Offline"
,
style:
TextStyle
(
fontSize:
16
,
color:
AppColors
.
semi_black
),
),
),
SizedBox
(
height:
10
),
Text
(
...
...
@@ -306,16 +305,18 @@ class MyNavigatorObserver extends NavigatorObserver {
super
.
didPush
(
route
,
previousRoute
);
// Called when a route has been pushed onto the navigator.
didPushed
=
"true"
;
routeSettingName
=
route
.
settings
.
name
.
toString
();
print
(
'Route pushed:
${route.settings.name}
'
);
print
(
'didPushed
$didPushed
'
);
print
(
'didPushed
:
$didPushed
'
);
}
@override
void
didPop
(
Route
route
,
Route
?
previousRoute
)
{
super
.
didPop
(
route
,
previousRoute
);
didPopped
=
"true"
;
routeSettingName
=
route
.
settings
.
name
.
toString
();
// Called when a route has been popped off the navigator.
print
(
'Route popped:
${route.settings.name}
'
);
print
(
'didPopped
${didPopped}
'
);
print
(
'didPopped
:
${didPopped}
'
);
}
}
lib/screens/commom/accountLedger.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:auto_size_text/auto_size_text.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/commonProvider/accountLedgerProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/screens/commom/transactionDetails.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -24,10 +26,17 @@ class Accountledger extends StatefulWidget {
class
_AccountledgerState
extends
State
<
Accountledger
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Accountledgerprovider
>(
context
,
listen:
false
);
provider
.
dropDownAPI
(
context
);
...
...
@@ -35,13 +44,48 @@ class _AccountledgerState extends State<Accountledger> {
_showFilterSheet
(
context
);
});
}
Future
<
bool
>
_onBackPressed
(
BuildContext
context
)
async
{
Provider
.
of
<
Accountledgerprovider
>(
context
,
listen:
false
).
resetAll
();
Navigator
.
pop
(
context
,
true
);
return
true
;
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Accountledgerprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
groupedData
=
provider
.
groupByDate
(
provider
.
ledgerList
);
...
...
@@ -70,7 +114,7 @@ class _AccountledgerState extends State<Accountledger> {
"Bank UPI ID"
,
"State"
,
"District"
,
"Sub Locality"
"Sub Locality"
,
];
var
values
=
[
...
...
@@ -97,486 +141,530 @@ class _AccountledgerState extends State<Accountledger> {
totalHeadings
=
[...
headings
,
...
headings2
];
totalValues
=
[...
values
,
...
values2
];
}
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Account Ledger List"
,
provider
.
resetAll
,
Row
(
children:
[
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
Row
(
children:
[
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
,),
SizedBox
(
width:
5
,),
Text
(
"
${provider.balanceDetails.balance.toString()}
"
??
"-"
,
style:
TextStyle
(
fontSize:
12
,
),)
],
),
),
SizedBox
(
width:
10
,),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
child:
GestureDetector
(
onTap:
()
{
print
(
"Tapped"
);
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/search_ic.svg"
,
height:
25
),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Account Ledger List"
,
provider
.
resetAll
,
Row
(
children:
[
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
Row
(
children:
[
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
),
SizedBox
(
width:
5
),
Text
(
"
${provider.balanceDetails.balance.toString()}
"
??
"-"
,
style:
TextStyle
(
fontSize:
12
),
),
],
),
),
SizedBox
(
width:
10
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
child:
GestureDetector
(
onTap:
()
{
print
(
"Tapped"
);
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/search_ic.svg"
,
height:
25
,
),
]
,
)
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
)
)):
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
"
${provider.selectedAcVal??""}
"
+
" "
+
"Account Ledger List"
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
if
(
provider
.
ledgerList
.
isEmpty
)...[
Emptywidget
(
context
),
]
else
...[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
)
:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
"
${provider.selectedAcVal ?? ""}
"
+
" "
+
"Account Ledger List"
,
),
),
child:
Row
(
children:
[
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
AutoSizeText
(
"
${provider.balanceDetails.totalCredit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
20
,
),
minFontSize:
20
,
maxFontSize:
25
,
if
(
provider
.
ledgerList
.
isEmpty
)
...[
Emptywidget
(
context
),
]
else
...[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Row
(
children:
[
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
AutoSizeText
(
"
${provider.balanceDetails.totalCredit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
25
,
),
maxLines:
2
,
minFontSize:
18
,
maxFontSize:
25
,
),
Text
(
"credit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
)),
Text
(
"credit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
],
),
],
),
),
),
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
AutoSizeText
(
"
${provider.balanceDetails.totalDebit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
20
,
),
minFontSize:
20
,
maxFontSize:
25
,
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
Text
(
"debit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
))
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
],
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
AutoSizeText
(
"
${provider.balanceDetails.totalDebit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
25
,
),
minFontSize:
18
,
maxFontSize:
25
,
maxLines:
2
,
),
Text
(
"debit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
],
),
),
),
)
,
]
,
),
],
),
),
Container
(
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
child:
Text
(
"Account Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
...
List
.
generate
(
totalHeadings
.
length
,
(
index
)
{
Container
(
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
child:
Text
(
"Account Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
...
List
.
generate
(
totalHeadings
.
length
,
(
index
,
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
child:
Row
(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children:
[
Expanded
(
child:
Text
(
"
${totalHeadings[index]}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
),
Expanded
(
child:
Text
(
"
${totalValues[index]}
"
,
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
child:
Row
(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children:
[
Expanded
(
child:
Text
(
"
${totalHeadings[index]}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
)
,
]
,
),
Expanded
(
child:
Text
(
"
${totalValues[index]}
"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
);
}),
InkResponse
(
onTap:
()
async
{
provider
.
showMoreDetails
=
!
provider
.
showMoreDetails
;
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
provider
.
showMoreDetails
?
"- Show Less"
:
"+ More Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
)
,
]
,
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
provider
.
showMoreDetails
=
!
provider
.
showMoreDetails
;
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
),
child:
Row
(
],
),
),
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemCount:
groupedData
.
keys
.
length
,
itemBuilder:
(
context
,
index
)
{
String
date
=
groupedData
.
keys
.
elementAt
(
index
);
List
<
LedgerList
>
items
=
groupedData
[
date
]!;
if
(
provider
.
ledgerList
.
isEmpty
)
{
return
Center
(
child:
Text
(
"No Data Available"
),
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
CrossAxisAlignment
.
start
,
children:
[
Text
(
provider
.
showMoreDetails
?
"- Show Less"
:
"+ More Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
Container
(
padding:
EdgeInsets
.
only
(
bottom:
5
),
child:
Text
(
date
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
],
),
),
),
],
),
),
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemCount:
groupedData
.
keys
.
length
,
itemBuilder:
(
context
,
index
)
{
String
date
=
groupedData
.
keys
.
elementAt
(
index
);
List
<
LedgerList
>
items
=
groupedData
[
date
]!;
if
(
provider
.
ledgerList
.
isEmpty
)
{
return
Center
(
child:
Text
(
"No Data Available"
));
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
only
(
bottom:
5
),
child:
Text
(
date
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
...
items
.
map
((
item
)
{
double
running_balance
=
0
;
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
item
,
);
for
(
var
i
=
0
;
i
<=
currentIndex
;
i
++)
{
var
ledgerItem
=
provider
.
ledgerList
[
i
];
double
credit
=
double
.
tryParse
(
ledgerItem
.
creditAmount
.
toString
(),
)
??
...
items
.
map
((
item
)
{
double
running_balance
=
0
;
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
item
);
for
(
var
i
=
0
;
i
<=
currentIndex
;
i
++
)
{
var
ledgerItem
=
provider
.
ledgerList
[
i
];
double
credit
=
double
.
tryParse
(
ledgerItem
.
creditAmount
.
toString
(),
)
??
0
;
double
debit
=
double
.
tryParse
(
ledgerItem
.
debitAmount
.
toString
(),
)
??
double
debit
=
double
.
tryParse
(
ledgerItem
.
debitAmount
.
toString
(),
)
??
0
;
running_balance
+=
(
debit
-
credit
);
}
running_balance
+=
(
debit
-
credit
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
)
,
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
vertical:
5
,
)
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
,
),
),
child:
Column
(
children:
[
Expanded
(
flex:
1
,
child:
SizedBox
(
child:
item
.
type
==
"Credit"
?
Image
.
asset
(
"assets/images/trans_debit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
)
:
Image
.
asset
(
"assets/images/trans_credit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
child:
SizedBox
(
child:
item
.
type
==
"Credit"
?
Image
.
asset
(
"assets/images/trans_debit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
)
:
Image
.
asset
(
"assets/images/trans_credit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
),
),
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
5
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
item
.
description
??
"-"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
12
,
),
SizedBox
(
width:
10
),
Expanded
(
flex:
5
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
item
.
description
??
"-"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
12
,
),
),
],
),
]
,
)
,
),
),
),
Spacer
(),
Expanded
(
flex:
3
,
child:
SizedBox
(
child:
RichText
(
textAlign:
TextAlign
.
right
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
TextSpan
(
text:
item
.
type
==
"Credit"
?
"-"
:
"+"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
,
Spacer
(),
Expanded
(
flex:
3
,
child:
SizedBox
(
child:
RichText
(
textAlign:
TextAlign
.
right
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
TextSpan
(
text:
item
.
type
==
"Credit"
?
"-"
:
"+"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
,
),
fontSize:
13
,
fontFamily:
"JakartaRegular"
,
),
),
fontSize:
13
,
fontFamily
:
"JakartaRegular
"
,
),
),
TextSpan
(
text:
"₹
${item.type == "Credit" ? "${item.creditAmount}
"
:
"
${item.debitAmount}
"
}
"
,
style: TextStyle(
color: Color(
0xFF2D2D2D
,
TextSpan
(
text
:
"₹
${item.type == "Credit" ? "${item.creditAmount}
"
:
"
${item.debitAmount}
"
}
",
style: TextStyle(
color: Color(
0xFF2D2D2D,
),
fontSize: 13
,
fontFamily:
"
JakartaMedium
",
)
,
),
fontSize: 13,
fontFamily:
"
JakartaMedium
",
),
],
),
]
,
)
,
),
),
)
,
]
,
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFd7d7d7),
),
// Row(
// children: [
// Expanded(
// child: Text(
// "
Balance
",
// style: TextStyle(
// fontSize: 13,
// color: Color(0xFF2d2d2d),
// ),
// ),
// ),
// Expanded(
// child: Text(
// textAlign: TextAlign.right,
// "
₹$
{
running_balance
.
toString
()}
" ??
// "
-
",
// style: TextStyle(
// color: Color(0xFF818181),
// fontSize: 13,
// ),
// ),
// ),
// ],
// ),
InkResponse(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Transactiondetails(
paymentID: item.refId,
type: item.type,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
Divider(
thickness: 0.5,
color: Color(0xFFd7d7d7),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"
View
Details
",
style: TextStyle(
fontFamily: "
JakartaMedium
",
fontSize: 14,
color: AppColors.app_blue,
// Row(
// children: [
// Expanded(
// child: Text(
// "
Balance
",
// style: TextStyle(
// fontSize: 13,
// color: Color(0xFF2d2d2d),
// ),
// ),
// ),
// Expanded(
// child: Text(
// textAlign: TextAlign.right,
// "
₹$
{
running_balance
.
toString
()}
" ??
// "
-
",
// style: TextStyle(
// color: Color(0xFF818181),
// fontSize: 13,
// ),
// ),
// ),
// ],
// ),
InkResponse(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Transactiondetails(
paymentID:
item.refId,
type: item.type,
),
settings: RouteSettings(
name:
"
Transactiondetails
",
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
SizedBox(width: 5),
SvgPicture.asset(
"
assets
/
svg
/
next_button
.
svg
",
child: Row(
crossAxisAlignment:
CrossAxisAlignment
.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"
View
Details
",
style: TextStyle(
fontFamily:
"
JakartaMedium
",
fontSize: 14,
color:
AppColors
.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"
assets
/
svg
/
next_button
.
svg
",
),
],
),
]
,
)
,
),
)
,
]
,
),
],
),
);
}).toList(),
],
),
);
},
),
],
],
);
}).toList(),
],
),
);
},
),
],
],
),
),
),
),
),
),
),
onWillPop: () {
return _onBackPressed(context);
},
);
},
);
}
Future<void> _showFilterSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
...
...
@@ -593,7 +681,7 @@ class _AccountledgerState extends State<Accountledger> {
child: Consumer<Accountledgerprovider>(
builder: (context, provider, child) {
return Container(
height: MediaQuery.of(context).size.height
*
0.35,
height: MediaQuery.of(context).size.height
*
0.35,
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
...
...
@@ -653,7 +741,12 @@ class _AccountledgerState extends State<Accountledger> {
),
)
.toList(),
value:provider.accounts.contains(provider.selectedAccount)?provider.selectedAccount:null,
value:
provider.accounts.contains(
provider.selectedAccount,
)
? provider.selectedAccount
: null,
// value: provider.selectedAccount,
onChanged: (Accounts? value) {
if (value != null) {
...
...
@@ -678,35 +771,33 @@ class _AccountledgerState extends State<Accountledger> {
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.searchAccountController,
provider.searchAccountController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.searchAccountController,
provider.searchAccountController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
...
...
@@ -720,8 +811,10 @@ class _AccountledgerState extends State<Accountledger> {
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
...
...
lib/screens/commom/accountsList.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/commonProvider/accountsListProvider.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/screens/commom/accountsListDetails.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -20,75 +22,102 @@ class _AccountslistState extends State<Accountslist> {
ScrollController
scrollController
=
ScrollController
();
FocusNode
focusNode1
=
FocusNode
();
FocusNode
focusNode2
=
FocusNode
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
provider
=
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
provider
.
commonAccountListAPIFunction
(
context
);
provider
.
pageNum
=
1
;
provider
.
commonAccountListAPIFunction
(
context
);
// if (scrollController.position.maxScrollExtent ==
// scrollController.offset) {
scrollController
.
addListener
(()
{
if
(
scrollController
.
position
.
pixels
>=
scrollController
.
position
.
maxScrollExtent
*
0.9
&&
!
provider
.
isLoading
&&
provider
.
hasMoreData
)
{
provider
.
commonAccountListAPIFunction
(
context
);
}
});
// if (scrollController.position.maxScrollExtent ==
// scrollController.offset) {
scrollController
.
addListener
(()
{
if
(
scrollController
.
position
.
pixels
>=
scrollController
.
position
.
maxScrollExtent
*
0.9
&&
!
provider
.
isLoading
&&
provider
.
hasMoreData
)
{
provider
.
commonAccountListAPIFunction
(
context
);
}
});
});
}
@override
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
scrollController
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
@override
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
accountList
=
provider
.
accountsList
;
print
(
accountList
.
length
);
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Account List"
,
provider
.
resetValues
,
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Account List"
,
provider
.
resetValues
,
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
child:
InkResponse
(
onTap:
()
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
18
,
),
),
),
child:
InkResponse
(
onTap:
()
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
18
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
app_blue
),
),
)
:
accountList
.
isNotEmpty
:
accountList
.
isNotEmpty
?
SizedBox
(
child:
Scrollbar
(
child:
SingleChildScrollView
(
...
...
@@ -96,7 +125,11 @@ class _AccountslistState extends State<Accountslist> {
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
accountList
.
length
+
(
provider
.
hasMoreData
&&
provider
.
isLoading
?
1
:
0
),
itemCount:
accountList
.
length
+
(
provider
.
hasMoreData
&&
provider
.
isLoading
?
1
:
0
),
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
...
...
@@ -112,13 +145,12 @@ class _AccountslistState extends State<Accountslist> {
return
Padding
(
padding:
EdgeInsets
.
all
(
8.0
),
child:
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
),
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
),
),
);
}
...
...
@@ -171,8 +203,7 @@ class _AccountslistState extends State<Accountslist> {
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
AppColors
.
semi_black
,
),
),
Text
(
...
...
@@ -183,8 +214,7 @@ class _AccountslistState extends State<Accountslist> {
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
color:
AppColors
.
app_blue
,
),
),
],
...
...
@@ -223,11 +253,9 @@ class _AccountslistState extends State<Accountslist> {
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
...
...
@@ -236,11 +264,9 @@ class _AccountslistState extends State<Accountslist> {
child:
Text
(
subHeadings
[
j
]
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
grey_thick
,
color:
AppColors
.
grey_thick
,
),
),
),
...
...
@@ -303,12 +329,6 @@ class _AccountslistState extends State<Accountslist> {
),
)
:
Emptywidget
(
context
),
),
),
onWillPop:
()
{
provider
.
pageNum
=
1
;
return
_onBackPressed
(
context
);
},
);
},
);
...
...
@@ -367,7 +387,7 @@ class _AccountslistState extends State<Accountslist> {
null
,
focusNode1
,
focusNode2
,
TextInputAction
.
next
TextInputAction
.
next
,
),
textControllerWidget
(
context
,
...
...
@@ -381,7 +401,7 @@ class _AccountslistState extends State<Accountslist> {
focusNode2
,
null
,
TextInputAction
.
done
,
10
10
,
),
InkResponse
(
onTap:
()
{
...
...
lib/screens/commom/accountsListDetails.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/commonProvider/accountDetailsProvider.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/screens/commom/transactionDetails.dart'
;
import
'package:generp/screens/finance/submitPaymentRequestionListsByMode.dart'
;
...
...
@@ -21,18 +23,58 @@ class Accountslistdetails extends StatefulWidget {
}
class
_AccountslistdetailsState
extends
State
<
Accountslistdetails
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
prov
=
Provider
.
of
<
Accountdetailsprovider
>(
context
,
listen:
false
);
prov
.
accountdetailsAPIFunction
(
context
,
widget
.
accountID
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Accountdetailsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
groupedData
=
provider
.
groupByDate
(
provider
.
ledgerList
);
...
...
@@ -49,499 +91,473 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
}
overallBalance
=
totalDebit
-
totalCredit
;
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
appBar:
appbar2
(
context
,
"Account Details"
,
provider
.
resetValues
,
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
Row
(
children:
[
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
),
SizedBox
(
width:
5
),
Text
(
overallBalance
.
toString
()
??
"-"
,
style:
TextStyle
(
fontSize:
12
),
),
],
return
Scaffold
(
appBar:
appbar2
(
context
,
"Account Details"
,
provider
.
resetValues
,
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
Row
(
children:
[
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
),
SizedBox
(
width:
5
),
Text
(
overallBalance
.
toString
()
??
"-"
,
style:
TextStyle
(
fontSize:
12
),
),
)
,
]
,
),
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Row
(
children:
[
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
"
${totalCredit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
25
,
),
),
],
),
),
Text
(
"credit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
],
),
),
),
),
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Row
(
children:
[
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
"
${totalDebit}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontFamily:
"JakartaRegular"
,
fontSize:
25
,
),
),
],
),
),
Text
(
"debit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
],
),
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
],
),
),
// Text(
// "Account Details",
// style: TextStyle(
// fontSize: 16,
// color: AppColors.grey_thick,
// fontFamily: "JakartaMedium",
// ),
// ),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
...
List
.
generate
(
12
,
(
j
)
{
final
headings
=
[
"Name"
,
"Address"
,
"Date"
,
"Bank Name"
,
"Bank Branch"
,
"Bank IFSC Code"
,
"Account Holder"
,
"Account Number"
,
"Bank UPI ID"
,
"State"
,
"District"
,
"Sub Locality"
,
];
final
subHeadings
=
[
provider
.
accountDetails
.
name
??
"-"
,
provider
.
accountDetails
.
address
??
"-"
,
provider
.
accountDetails
.
createdDatetime
??
"-"
,
provider
.
accountDetails
.
bankName
??
"-"
,
provider
.
accountDetails
.
bankBranchName
??
"-"
,
provider
.
accountDetails
.
bankIfscCode
??
"-"
,
provider
.
accountDetails
.
bankAccountHolderName
??
"-"
,
provider
.
accountDetails
.
bankAccountNumber
??
"-"
,
provider
.
accountDetails
.
bankUpiId
??
"-"
,
provider
.
accountDetails
.
state
??
"-"
,
provider
.
accountDetails
.
district
??
"-"
,
provider
.
accountDetails
.
subLocality
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
"
${totalCredit}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
font
Size:
14
,
color:
AppColors
.
semi_black
,
color:
Color
(
0xFFED3424
)
,
font
Family:
"JakartaRegular"
,
fontSize:
25
,
),
),
),
SizedBox
(
width:
15
),
Expanded
(
child:
Text
(
subHeadings
[
j
]
==
""
?
"-"
:
subHeadings
[
j
]
??
"-"
,
],
),
),
Text
(
"credit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
)),
),
],
),
),
),
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFEFEF
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
RichText
(
text:
TextSpan
(
children:
[
TextSpan
(
text:
"
${totalDebit}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
font
Size:
14
,
color:
AppColors
.
grey_thick
,
color:
Color
(
0xFFED3424
)
,
font
Family:
"JakartaRegular"
,
fontSize:
25
,
),
),
)
,
]
,
]
,
)
,
),
);
}),
],
Text
(
"debit"
,
style:
TextStyle
(
color:
Color
(
0xFF818181
)),
),
],
),
),
),
),
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemCount:
groupedData
.
keys
.
length
,
itemBuilder:
(
context
,
index
)
{
String
date
=
groupedData
.
keys
.
elementAt
(
index
);
List
<
LedgerList
>
items
=
groupedData
[
date
]!;
],
),
),
// Text(
// "Account Details",
// style: TextStyle(
// fontSize: 16,
// color: AppColors.grey_thick,
// fontFamily: "JakartaMedium",
// ),
// ),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
...
List
.
generate
(
12
,
(
j
)
{
final
headings
=
[
"Name"
,
"Address"
,
"Date"
,
"Bank Name"
,
"Bank Branch"
,
"Bank IFSC Code"
,
"Account Holder"
,
"Account Number"
,
"Bank UPI ID"
,
"State"
,
"District"
,
"Sub Locality"
,
];
final
subHeadings
=
[
provider
.
accountDetails
.
name
??
"-"
,
provider
.
accountDetails
.
address
??
"-"
,
provider
.
accountDetails
.
createdDatetime
??
"-"
,
provider
.
accountDetails
.
bankName
??
"-"
,
provider
.
accountDetails
.
bankBranchName
??
"-"
,
provider
.
accountDetails
.
bankIfscCode
??
"-"
,
provider
.
accountDetails
.
bankAccountHolderName
??
"-"
,
provider
.
accountDetails
.
bankAccountNumber
??
"-"
,
provider
.
accountDetails
.
bankUpiId
??
"-"
,
provider
.
accountDetails
.
state
??
"-"
,
provider
.
accountDetails
.
district
??
"-"
,
provider
.
accountDetails
.
subLocality
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Column
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
only
(
bottom:
5
),
Expanded
(
child:
Text
(
date
,
headings
[
j
]
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
SizedBox
(
width:
15
),
Expanded
(
child:
Text
(
subHeadings
[
j
]
==
""
?
"-"
:
subHeadings
[
j
]
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
fontSize:
14
,
color:
AppColors
.
grey_thick
,
),
),
),
...
items
.
map
((
item
)
{
double
running_balance
=
0
;
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
item
);
for
(
var
i
=
0
;
i
<=
currentIndex
;
i
++)
{
var
ledgerItem
=
provider
.
ledgerList
[
i
];
double
credit
=
double
.
tryParse
(
ledgerItem
.
creditAmount
.
toString
(),
)
??
0
;
double
debit
=
double
.
tryParse
(
ledgerItem
.
debitAmount
.
toString
(),
)
??
0
;
running_balance
+=
(
debit
-
credit
);
}
],
),
);
}),
],
),
),
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemCount:
groupedData
.
keys
.
length
,
itemBuilder:
(
context
,
index
)
{
String
date
=
groupedData
.
keys
.
elementAt
(
index
);
List
<
LedgerList
>
items
=
groupedData
[
date
]!;
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
only
(
bottom:
5
),
child:
Text
(
date
,
style:
TextStyle
(
fontSize:
14
,
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
...
items
.
map
((
item
)
{
double
running_balance
=
0
;
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
item
,
);
for
(
var
i
=
0
;
i
<=
currentIndex
;
i
++)
{
var
ledgerItem
=
provider
.
ledgerList
[
i
];
double
credit
=
double
.
tryParse
(
ledgerItem
.
creditAmount
.
toString
(),
)
??
0
;
double
debit
=
double
.
tryParse
(
ledgerItem
.
debitAmount
.
toString
(),
)
??
0
;
running_balance
+=
(
debit
-
credit
);
}
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
vertical:
5
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
child:
SizedBox
(
child:
item
.
type
==
"Credit"
?
Image
.
asset
(
"assets/images/trans_debit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
)
:
Image
.
asset
(
"assets/images/trans_credit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
5
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
item
.
description
??
"-"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
12
,
),
Expanded
(
flex:
1
,
child:
SizedBox
(
child:
item
.
type
==
"Credit"
?
Image
.
asset
(
"assets/images/trans_debit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
)
:
Image
.
asset
(
"assets/images/trans_credit.png"
,
height:
45
,
width:
45
,
fit:
BoxFit
.
contain
,
),
],
),
),
),
Spacer
(),
Expanded
(
flex:
3
,
child:
SizedBox
(
child:
RichText
(
maxLines:
1
,
textAlign:
TextAlign
.
right
,
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
5
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
item
.
description
??
"-"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
TextSpan
(
text:
item
.
type
==
"Credit"
?
"-"
:
"+"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
,
),
fontSize:
13
,
fontFamily:
"JakartaRegular"
,
),
),
TextSpan
(
text:
"₹
${item.type == "Credit" ? "${item.creditAmount}
"
:
"
${item.debitAmount}
"
}
",
style: TextStyle(
color: Color(
0xFF2D2D2D,
),
fontSize: 13,
fontFamily:
"
JakartaMedium
",
),
),
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
12
,
),
),
)
,
]
,
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFd7d7d7),
),
),
Row(
children: [
Expanded(
child: Text(
"
Balance
",
style: TextStyle(
fontSize: 13,
color: Color(0xFF2d2d2d),
),
),
),
Expanded(
child: Text(
textAlign: TextAlign.right,
"
$
{
running_balance
.
toString
()}
" ??
"
-
",
style: TextStyle(
color: Color(0xFF818181),
fontSize: 13,
),
Spacer
(),
Expanded
(
flex:
3
,
child:
SizedBox
(
child:
RichText
(
maxLines:
1
,
textAlign:
TextAlign
.
right
,
overflow:
TextOverflow
.
ellipsis
,
text:
TextSpan
(
children:
[
TextSpan
(
text:
item
.
type
==
"Credit"
?
"-"
:
"+"
,
style:
TextStyle
(
color:
Color
(
0xFF2D2D2D
),
fontSize:
13
,
fontFamily:
"JakartaRegular"
,
),
),
TextSpan
(
text:
"₹
${item.type == "Credit" ? "${item.creditAmount}
"
:
"
${item.debitAmount}
"
}
",
style: TextStyle(
color: Color(0xFF2D2D2D),
fontSize: 13,
fontFamily:
"
JakartaMedium
",
),
),
],
),
),
]
,
)
,
),
InkResponse(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Transactiondetails(
paymentID: item.refId,
type: item.type,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
],
),
Divider(
thickness: 0.5,
color: Color(0xFFd7d7d7),
),
Row(
children: [
Expanded(
child: Text(
"
Balance
",
style: TextStyle(
fontSize: 13,
color: Color(0xFF2d2d2d),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"
View
Details
",
style: TextStyle(
fontFamily: "
JakartaMedium
",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"
assets
/
svg
/
next_button
.
svg
",
),
],
),
),
Expanded(
child: Text(
textAlign: TextAlign.right,
"
$
{
running_balance
.
toString
()}
" ??
"
-
",
style: TextStyle(
color: Color(0xFF818181),
fontSize: 13,
),
),
),
],
),
);
}).toList(),
],
),
);
},
),
if(["
Vendor
","
Customer
"].contains(provider.accountDetails.type))...[
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Submitpaymentrequestionlistsbymode(
mode: "
other
",
pageTitleName:
"
Add
Payment
Request
(
Other
)
",
accountId:provider.accountDetails.id!
InkResponse(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Transactiondetails(
paymentID: item.refId,
type: item.type,
),
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"
View
Details
",
style: TextStyle(
fontFamily: "
JakartaMedium
",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"
assets
/
svg
/
next_button
.
svg
",
),
],
),
),
),
);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(15.0),
),
],
),
);
}).toList(),
],
),
);
},
),
if ([
"
Vendor
",
"
Customer
",
].contains(provider.accountDetails.type)) ...[
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Submitpaymentrequestionlistsbymode(
mode: "
other
",
pageTitleName: "
Add
Payment
Request
(
Other
)
",
accountId: provider.accountDetails.id!,
),
),
child: Center(
child: Text(
"
Add
Payment
Request
(
Other
)
",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "
JakartaMedium
",
fontSize: 15,
),
);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child: Text(
"
Add
Payment
Request
(
Other
)
",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "
JakartaMedium
",
fontSize: 15,
),
),
),
),
]
],
),
),
),
],
],
),
),
),
onWillPop: () {
return _onBackPressed(context);
},
);
},
);
...
...
lib/screens/commom/addCommonPayment.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
...
...
@@ -7,6 +8,7 @@ import 'package:flutter_svg/svg.dart';
import
'package:generp/Notifiers/commonProvider/accountsListProvider.dart'
;
import
'package:generp/Utils/ShakeWidget.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -17,880 +19,954 @@ import '../../Models/commonModels/commonAddAccountsViewResponse.dart';
class
Addcommonpayment
extends
StatefulWidget
{
final
from
;
const
Addcommonpayment
({
super
.
key
,
required
this
.
from
});
const
Addcommonpayment
({
super
.
key
,
required
this
.
from
});
@override
State
<
Addcommonpayment
>
createState
()
=>
_AddcommonpaymentState
();
}
class
_AddcommonpaymentState
extends
State
<
Addcommonpayment
>{
class
_AddcommonpaymentState
extends
State
<
Addcommonpayment
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
List
<
FocusNode
>
focusNodes
=
List
.
generate
(
20
,
(
index
)
=>
FocusNode
());
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
var
prov
=
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
prov
.
addCommonAccountViewAPI
(
context
);
});
}
@override
void
dispose
()
{
focusNodes
.
map
((
e
)
=>
e
.
dispose
()
,
);
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
async
{
provider
.
resetValues
();
return
onBackPressed
(
context
);
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Add Account"
,
provider
.
resetValues
,
SizedBox
(
width:
0
),
),
backgroundColor:
AppColors
.
white
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Add Account"
,
provider
.
resetValues
,
SizedBox
(
width:
0
),
),
backgroundColor:
AppColors
.
white
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Account Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Account Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
SizedBox
(
height:
10
),
Text
(
"Account"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Account'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
),
],
SizedBox
(
height:
10
),
Text
(
"Account"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Account'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
),
items:
provider
.
accountTypes
.
map
(
(
act
)
=>
DropdownMenuItem
<
String
>(
value:
act
,
child:
Text
(
act
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
// value: provider.selectedAccountType,
value:
provider
.
accountTypes
.
contains
(
provider
.
selectedAccountType
,
)
?
provider
.
selectedAccountType
:
null
,
onChanged:
(
value
)
{
if
(
value
!=
null
)
{
provider
.
selectedAccountType
=
value
;
print
(
"statusId:
${provider.selectedAccountType}
"
,
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
],
items:
provider
.
accountTypes
.
map
(
(
act
)
=>
DropdownMenuItem
<
String
>(
value:
act
,
child:
Text
(
act
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
// value: provider.selectedAccountType,
value:
provider
.
accountTypes
.
contains
(
provider
.
selectedAccountType
,
)
?
provider
.
selectedAccountType
:
null
,
onChanged:
(
value
)
{
if
(
value
!=
null
)
{
provider
.
selectedAccountType
=
value
;
print
(
"statusId:
${provider.selectedAccountType}
"
,
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
),
errorWidget
(
context
,
provider
.
accountError
),
textControllerWidget
(
context
,
provider
.
nameController
,
"Company Name"
,
"Enter Company Name"
,
(
p0
)
{
provider
.
updateName
(
p0
);
provider
.
checkInputsAPI
(
context
,
"name"
,
provider
.
nameController
.
text
,
);
},
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
focusNodes
[
1
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
nameError
),
textControllerWidget
(
],
),
),
errorWidget
(
context
,
provider
.
accountError
),
textControllerWidget
(
context
,
provider
.
nameController
,
"Company Name"
,
"Enter Company Name"
,
(
p0
)
{
provider
.
updateName
(
p0
);
provider
.
checkInputsAPI
(
context
,
provider
.
mobileController
,
"Mobile Number"
,
"Enter Mobile"
,
(
p0
)
{
provider
.
updateMobile
(
p0
);
provider
.
checkInputsAPI
(
context
,
"mob1"
,
provider
.
mobileController
.
text
,
);
},
TextInputType
.
phone
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
10
,
),
errorWidget
(
context
,
provider
.
mobileError
),
textControllerWidget
(
context
,
provider
.
contactPersonController
,
"Contact Person Name"
,
"Enter Contact Person Name"
,
provider
.
updateContactPerson
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
12
],
focusNodes
[
13
],
TextInputAction
.
next
),
errorWidget
(
"name"
,
provider
.
nameController
.
text
,
);
},
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
focusNodes
[
1
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
nameError
),
textControllerWidget
(
context
,
provider
.
mobileController
,
"Mobile Number"
,
"Enter Mobile"
,
(
p0
)
{
provider
.
updateMobile
(
p0
);
provider
.
checkInputsAPI
(
context
,
provider
.
contactPersonError
,
"mob1"
,
provider
.
mobileController
.
text
,
);
},
TextInputType
.
phone
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
10
,
),
errorWidget
(
context
,
provider
.
mobileError
),
textControllerWidget
(
context
,
provider
.
contactPersonController
,
"Contact Person Name"
,
"Enter Contact Person Name"
,
provider
.
updateContactPerson
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
12
],
focusNodes
[
13
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
contactPersonError
),
],
),
),
SizedBox
(
height:
12
),
Column
(
children:
[
InkResponse
(
onTap:
()
=>
provider
.
isVisible
=
!
provider
.
isVisible
,
child:
Center
(
child:
Text
(
provider
.
isVisible
?
"- Hide More Details"
:
"+ Add More Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
]
,
)
,
),
),
SizedBox
(
height:
12
),
Column
(
children:
[
InkResponse
(
onTap:
()
=>
provider
.
isVisible
=
!
provider
.
isVisible
,
child:
Center
(
child:
Text
(
provider
.
isVisible
?
"- Hide More Details"
:
"+ Add More Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
if
(
provider
.
addMoreDetailsError
!=
null
)
...[
Center
(
child:
ShakeWidget
(
key:
Key
(
"value"
),
duration:
Duration
(
milliseconds:
700
),
child:
Text
(
provider
.
addMoreDetailsError
??
""
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
13
,
fontFamily:
"JakartaMedium"
,
),
),
),
if
(
provider
.
addMoreDetailsError
!=
null
)...[
Center
(
child:
ShakeWidget
(
key:
Key
(
"value"
),
duration:
Duration
(
milliseconds:
700
),
child:
Text
(
provider
.
addMoreDetailsError
??
""
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
13
,
fontFamily:
"JakartaMedium"
,
),
),
],
Visibility
(
visible:
provider
.
isVisible
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
),
),
],
Visibility
(
visible:
provider
.
isVisible
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"State"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>(
focusNode:
focusNodes
[
2
],
autofocus:
focusNodes
[
2
].
hasFocus
?
true
:
false
,
isExpanded:
true
,
hint:
Text
(
'Select State'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"State"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>(
focusNode:
focusNodes
[
2
],
autofocus:
focusNodes
[
2
].
hasFocus
?
true
:
false
,
isExpanded:
true
,
hint:
Text
(
'Select State'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
states
.
map
(
(
states
)
=>
DropdownMenuItem
<
States
>(
(
states
,
)
=>
DropdownMenuItem
<
States
>(
value:
states
,
child:
Text
(
states
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
TextOverflow
.
ellipsis
,
),
),
)
)
.
toList
(),
value:
value:
provider
.
states
.
contains
(
provider
.
selectedState
,
)
provider
.
selectedState
,
)
?
provider
.
selectedState
:
null
,
// value: provider.selectedState,
onChanged:
(
States
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
states
.
isNotEmpty
)
{
provider
.
selectedState
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedStateID
=
// value: provider.selectedState,
onChanged:
(
States
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
states
.
isNotEmpty
)
{
provider
.
selectedState
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedStateID
=
value
.
id
!;
print
(
"hfjkshfg"
+
provider
.
selectedStateID
.
toString
(),
);
if
(
provider
.
selectedDistricts
!=
null
)
{
provider
.
states
.
clear
();
// provider.selectedDistricts = null;
provider
.
selectedDistrictId
=
print
(
"hfjkshfg"
+
provider
.
selectedStateID
.
toString
(),
);
if
(
provider
.
selectedDistricts
!=
null
)
{
provider
.
states
.
clear
();
// provider.selectedDistricts = null;
provider
.
selectedDistrictId
=
null
;
provider
.
selectedDistrictValue
=
provider
.
selectedDistrictValue
=
null
;
}
provider
.
getDistrictAPI
(
context
,
provider
.
selectedStateID
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
stateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
stateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
provider
.
getDistrictAPI
(
context
,
provider
.
selectedStateID
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
stateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
,
),
child:
TextFormField
(
controller:
provider
.
stateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search States...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
hintText:
'Search States...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
),
),
searchMatchFn:
(
item
,
searchValue
,
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
stateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
stateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
),
errorWidget
(
context
,
provider
.
stateError
),
Text
(
"District"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
focusNode:
focusNodes
[
3
],
isExpanded:
true
,
hint:
Text
(
'Select District'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
],
),
),
errorWidget
(
context
,
provider
.
stateError
),
Text
(
"District"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
focusNode:
focusNodes
[
3
],
isExpanded:
true
,
hint:
Text
(
'Select District'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
districts
.
map
(
(
dist
)
=>
DropdownMenuItem
<
Districts
>(
(
dist
,
)
=>
DropdownMenuItem
<
Districts
>(
value:
dist
,
child:
Text
(
dist
.
district
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
TextOverflow
.
ellipsis
,
),
),
)
)
.
toList
(),
value:
value:
provider
.
districts
.
contains
(
provider
.
selectedDistricts
,
)
provider
.
selectedDistricts
,
)
?
provider
.
selectedDistricts
:
null
,
// value: provider.selectedDistricts,
onChanged:
(
Districts
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
districts
.
isNotEmpty
)
{
provider
.
selectedDistricts
=
value
;
print
(
"Selected ID:
${value.id}
"
);
provider
.
selectedDistrictId
=
// value: provider.selectedDistricts,
onChanged:
(
Districts
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
districts
.
isNotEmpty
)
{
provider
.
selectedDistricts
=
value
;
print
(
"Selected ID:
${value.id}
"
,
);
provider
.
selectedDistrictId
=
value
.
id
!;
provider
.
selectedDistrictValue
=
provider
.
selectedDistrictValue
=
value
.
district
!;
print
(
"hfjkshfg"
+
provider
.
selectedDistrictId
.
toString
(),
);
if
(
provider
.
selectedSubLocations
!=
null
)
{
// provider.selectedSubLocations =
// null;
provider
.
selectedSubLocID
=
null
;
provider
.
selectedSubLocValue
=
print
(
"hfjkshfg"
+
provider
.
selectedDistrictId
.
toString
(),
);
if
(
provider
.
selectedSubLocations
!=
null
)
{
// provider.selectedSubLocations =
// null;
provider
.
selectedSubLocID
=
null
;
provider
.
selectedSubLocValue
=
null
;
}
provider
.
getSubLocationAPI
(
context
,
provider
.
selectedDistrictId
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
districtSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
getSubLocationAPI
(
context
,
provider
.
selectedDistrictId
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
districtSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
,
),
child:
TextFormField
(
controller:
provider
.
districtSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Districts...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
hintText:
'Search Districts...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
),
),
searchMatchFn:
(
item
,
searchValue
,
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
districtSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
districtSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
),
errorWidget
(
context
,
provider
.
districtError
),
Text
(
"Sub Locality"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
focusNode:
focusNodes
[
4
],
isExpanded:
true
,
hint:
Text
(
'Select Sub Locality'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
],
),
),
errorWidget
(
context
,
provider
.
districtError
),
Text
(
"Sub Locality"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
focusNode:
focusNodes
[
4
],
isExpanded:
true
,
hint:
Text
(
'Select Sub Locality'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
subLocations
.
map
(
(
subloc
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
subloc
,
child:
Text
(
subloc
.
subLocality
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
(
subloc
,
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
subloc
,
child:
Text
(
subloc
.
subLocality
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
)
.
toList
(),
// value: provider.selectedSubLocations,
value:
// value: provider.selectedSubLocations,
value:
provider
.
subLocations
.
contains
(
provider
.
selectedSubLocations
,
)
?
provider
.
selectedSubLocations
provider
.
selectedSubLocations
,
)
?
provider
.
selectedSubLocations
:
null
,
onChanged:
(
SubLocations
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
subLocations
.
isNotEmpty
)
{
provider
.
selectedSubLocations
=
value
;
print
(
"Selected ID:
${value.id}
"
);
provider
.
selectedSubLocID
=
onChanged:
(
SubLocations
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
subLocations
.
isNotEmpty
)
{
provider
.
selectedSubLocations
=
value
;
print
(
"Selected ID:
${value.id}
"
,
);
provider
.
selectedSubLocID
=
value
.
id
!;
provider
.
selectedSubLocValue
=
provider
.
selectedSubLocValue
=
value
.
subLocality
!;
print
(
"hfjkshfg"
+
provider
.
selectedSubLocID
.
toString
(),
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
subLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
subLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
print
(
"hfjkshfg"
+
provider
.
selectedSubLocID
.
toString
(),
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
subLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
,
),
child:
TextFormField
(
controller:
provider
.
subLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
hintText:
'Search Sub Locality...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
)
,
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
),
),
searchMatchFn:
(
item
,
searchValue
,
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
subLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
subLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
errorWidget
(
context
,
provider
.
localityError
),
textControllerWidget
(
context
,
provider
.
addressController
,
"Address"
,
"Enter Address"
,
provider
.
updateAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
addressError
),
Text
(
"Bank Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
),
textControllerWidget
(
context
,
provider
.
bankNameController
,
"Bank Name"
,
"Enter Bank Name"
,
provider
.
updateBankName
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
banknameError
,
),
textControllerWidget
(
context
,
provider
.
branchNameController
,
"Bank Branch"
,
"Enter Bank Branch"
,
provider
.
updateBankBranch
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
7
],
focusNodes
[
8
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
bankBranchError
,
),
textControllerWidget
(
context
,
provider
.
bankIfscCotroller
,
"Bank IFSC"
,
"Enter Bank IFSC"
,
provider
.
updateIFSC
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
8
],
focusNodes
[
9
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
bankIFSCError
,
),
textControllerWidget
(
context
,
provider
.
bankHolderNameController
,
"Bank Holder Name"
,
"Enter Bank Holder Name"
,
provider
.
updateHolder
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
9
],
focusNodes
[
10
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
bankHolderNameError
,
),
textControllerWidget
(
context
,
provider
.
bankAcNumberController
,
"Bank Account Number"
,
"Enter Bank Account Number"
,
provider
.
updateNumber
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
10
],
focusNodes
[
11
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
bankAcNumberError
,
),
textControllerWidget
(
context
,
provider
.
bankUpiController
,
"Bank UPI ID"
,
"Enter Bank UPI ID"
,
provider
.
updateUPI
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
11
],
focusNodes
[
12
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
upiError
),
],
],
),
),
),
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
errorWidget
(
context
,
provider
.
localityError
),
textControllerWidget
(
context
,
provider
.
addressController
,
"Address"
,
"Enter Address"
,
provider
.
updateAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
errorWidget
(
context
,
provider
.
addressError
),
Text
(
"Bank Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
textControllerWidget
(
context
,
provider
.
bankNameController
,
"Bank Name"
,
"Enter Bank Name"
,
provider
.
updateBankName
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
banknameError
),
textControllerWidget
(
context
,
provider
.
branchNameController
,
"Bank Branch"
,
"Enter Bank Branch"
,
provider
.
updateBankBranch
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
7
],
focusNodes
[
8
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankBranchError
,
),
textControllerWidget
(
context
,
provider
.
bankIfscCotroller
,
"Bank IFSC"
,
"Enter Bank IFSC"
,
provider
.
updateIFSC
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
8
],
focusNodes
[
9
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankIFSCError
),
textControllerWidget
(
context
,
provider
.
bankHolderNameController
,
"Bank Holder Name"
,
"Enter Bank Holder Name"
,
provider
.
updateHolder
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
9
],
focusNodes
[
10
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankHolderNameError
,
),
textControllerWidget
(
context
,
provider
.
bankAcNumberController
,
"Bank Account Number"
,
"Enter Bank Account Number"
,
provider
.
updateNumber
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
10
],
focusNodes
[
11
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankAcNumberError
,
),
textControllerWidget
(
context
,
provider
.
bankUpiController
,
"Bank UPI ID"
,
"Enter Bank UPI ID"
,
provider
.
updateUPI
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
11
],
focusNodes
[
12
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
upiError
),
],
),
),
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Contact Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Contact Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontSize:
16
,
fontFamily:
"JakartaMedium"
,
),
),
textControllerWidget
(
textControllerWidget
(
context
,
provider
.
contectPersonDesignationController
,
"Contact Person Designation"
,
"Enter Contact Person Designation"
,
provider
.
updateDesignation
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
13
],
focusNodes
[
14
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
desigantionError
,
),
textControllerWidget
(
context
,
provider
.
contectPersonAltMobController
,
"Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
(
p0
)
{
provider
.
updateAltMobile
(
p0
);
provider
.
checkInputsAPI
(
context
,
"mob2"
,
provider
.
contectPersonDesignationController
,
"Contact Person Designation"
,
"Enter Contact Person Designation"
,
provider
.
updateDesignation
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
13
],
focusNodes
[
14
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
desigantionError
,
),
textControllerWidget
(
context
,
provider
.
contectPersonAltMobController
,
"Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
(
p0
)
{
provider
.
updateAltMobile
(
p0
);
provider
.
checkInputsAPI
(
context
,
"mob2"
,
provider
.
contectPersonAltMobController
.
text
,
);
},
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
14
],
focusNodes
[
15
],
TextInputAction
.
next
,
10
,
),
errorWidget
(
context
,
provider
.
altMobError
,
),
textControllerWidget
(
context
,
provider
.
contectPersonTeleController
,
"Telephone Number"
,
"Enter Telephone Number"
,
provider
.
updateTeleMobile
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
15
],
focusNodes
[
16
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
teleError
),
textControllerWidget
(
context
,
provider
.
contectPersonMailController
,
"Customer Mail ID"
,
"Enter Customer Mail ID"
,
provider
.
updateMail
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
16
],
focusNodes
[
17
],
TextInputAction
.
next
),
errorWidget
(
context
,
provider
.
mailError
),
],
.
contectPersonAltMobController
.
text
,
);
},
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
14
],
focusNodes
[
15
],
TextInputAction
.
next
,
10
,
),
),
],
errorWidget
(
context
,
provider
.
altMobError
),
textControllerWidget
(
context
,
provider
.
contectPersonTeleController
,
"Telephone Number"
,
"Enter Telephone Number"
,
provider
.
updateTeleMobile
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
15
],
focusNodes
[
16
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
teleError
),
textControllerWidget
(
context
,
provider
.
contectPersonMailController
,
"Customer Mail ID"
,
"Enter Customer Mail ID"
,
provider
.
updateMail
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
16
],
focusNodes
[
17
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
mailError
),
],
),
),
)
,
]
,
]
,
)
,
),
],
),
)
,
]
,
),
),
),
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClickced
?
null
:
()
{
provider
.
submitClickced
=
true
;
provider
.
submitCommonAccountsAPI
(
context
,
widget
.
from
);
},
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:
provider
.
submitClickced
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClickced
?
null
:
()
{
provider
.
submitClickced
=
true
;
provider
.
submitCommonAccountsAPI
(
context
,
widget
.
from
);
},
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:
provider
.
submitClickced
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
);
...
...
lib/screens/crm/LeadDetailsByMode.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/crmProvider/crmLeadDetailsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/screens/crm/AppointmentDetails.dart'
;
import
'package:generp/screens/crm/FollowUpDetails.dart'
;
import
'package:generp/screens/crm/QuotationDetails.dart'
;
...
...
@@ -32,10 +34,17 @@ class LeadDetailsByMode extends StatefulWidget {
}
class
_LeadDetailsByModeState
extends
State
<
LeadDetailsByMode
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmLeadDetailsProvider
>(
context
,
...
...
@@ -45,33 +54,60 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
crmLeadDetailsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
leadDetails
=
provider
.
leadDetails
;
var
headings1
=
[
"Account Manager Name"
,
"Account Created By"
,
"Address"
,
"Lead Status"
,
"Last Followup Date"
"Last Followup Date"
,
];
var
subHeadings1
=
[
provider
.
accountDetails
!.
accManager
??
"-"
,
provider
.
accountDetails
!.
owner
??
"-"
,
provider
.
leadDetails
!.
address
??
"-"
,
provider
.
leadDetails
!.
status
??
"-"
,
provider
.
followupDetails
.
first
!.
fdate
??
"-"
,
provider
.
accountDetails
!.
accManager
??
"-"
,
provider
.
accountDetails
!.
owner
??
"-"
,
provider
.
leadDetails
!.
address
??
"-"
,
provider
.
leadDetails
!.
status
??
"-"
,
provider
.
followupDetails
.
first
!.
fdate
??
"-"
,
];
var
headings2
=
[
"State"
,
"District"
,
...
...
@@ -84,216 +120,207 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
];
var
subHeadings2
=
[
provider
.
accountDetails
!.
state
??
"-"
,
provider
.
accountDetails
!.
district
??
"-"
,
provider
.
accountDetails
!.
subLocality
??
"-"
,
provider
.
accountDetails
!.
source
??
"-"
,
provider
.
accountDetails
!.
reference
??
"-"
,
provider
.
accountDetails
!.
team
??
"-"
,
provider
.
accountDetails
!.
segment
??
"-"
,
"
${provider.leadDetails!.lage??"-"}
days"
,
provider
.
accountDetails
!.
state
??
"-"
,
provider
.
accountDetails
!.
district
??
"-"
,
provider
.
accountDetails
!.
subLocality
??
"-"
,
provider
.
accountDetails
!.
source
??
"-"
,
provider
.
accountDetails
!.
reference
??
"-"
,
provider
.
accountDetails
!.
team
??
"-"
,
provider
.
accountDetails
!.
segment
??
"-"
,
"
${provider.leadDetails!.lage
??
"-"}
days"
,
];
var
totalHeadings
=
[...
headings1
];
var
totalSubHeadings
=
[...
subHeadings1
];
if
(
provider
.
showMoreDetails
){
totalHeadings
=
[...
headings1
,...
headings2
];
totalSubHeadings
=
[...
subHeadings1
,...
subHeadings2
];
if
(
provider
.
showMoreDetails
)
{
totalHeadings
=
[...
headings1
,
...
headings2
];
totalSubHeadings
=
[...
subHeadings1
,
...
subHeadings2
];
}
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Lead Details (
${widget.mode}
)"
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Lead Details (
${widget.mode}
)"
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
leadDetails
.
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
],
),
),
),
SizedBox
(
width:
10
),
if
(
provider
.
showEditButton
==
"1"
)
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
EditAccountDetails
(
leadID:
leadDetails
.
id
,
mode:
widget
.
mode
,
accountID:
leadDetails
.
accId
,
companyName:
leadDetails
.
name
,
),
),
);
if
(
res
==
true
)
{
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
,
);
}
},
child:
Container
(
height:
50
,
width:
3
5
,
height:
32
,
width:
3
0
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/
se_block_head
.svg"
,
"assets/svg/
crm_contact_edit
.svg"
,
),
),
),
SizedBox
(
width:
10
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
totalSubHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
leadDetails
.
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
],
child:
Text
(
totalHeadings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
SizedBox
(
width:
10
),
if
(
provider
.
showEditButton
==
"1"
)
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
EditAccountDetails
(
leadID:
leadDetails
.
id
,
mode:
widget
.
mode
,
accountID:
leadDetails
.
accId
,
companyName:
leadDetails
.
name
,
child:
totalHeadings
[
j
]
==
"Lead Age"
?
Tooltip
(
triggerMode:
TooltipTriggerMode
.
tap
,
message:
"
${provider.leadDetails.createdDatetime}
"
,
child:
Text
(
totalSubHeadings
[
j
]
==
""
?
"-"
:
totalSubHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
decorationColor:
AppColors
.
grey_semi
,
decoration:
TextDecoration
.
underline
,
),
),
),
);
if
(
res
==
true
){
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadId
,
widget
.
mode
);
}
},
child:
Container
(
height:
32
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_edit.svg"
,
),
),
)
:
Text
(
totalSubHeadings
[
j
]
==
""
?
"-"
:
totalSubHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
totalSubHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
totalHeadings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
totalHeadings
[
j
]
==
"Lead Age"
?
Tooltip
(
triggerMode:
TooltipTriggerMode
.
tap
,
message:
"
${provider.leadDetails.createdDatetime}
"
,
child:
Text
(
totalSubHeadings
[
j
]
==
""
?
"-"
:
totalSubHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
decorationColor:
AppColors
.
grey_semi
,
decoration:
TextDecoration
.
underline
,
),
),
)
:
Text
(
totalSubHeadings
[
j
]
==
""
?
"-"
:
totalSubHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
provider
.
showMoreDetails
=
!
provider
.
showMoreDetails
;
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
provider
.
showMoreDetails
?
"- Show Less"
:
"+ More Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
);
}),
InkResponse
(
onTap:
()
async
{
provider
.
showMoreDetails
=
!
provider
.
showMoreDetails
;
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
provider
.
showMoreDetails
?
"- Show Less"
:
"+ More Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
)
,
]
,
),
]
,
)
,
),
)
,
]
,
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
...
...
@@ -336,7 +363,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
left:
15
,
right:
15
,
top:
10
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,),
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
...
...
@@ -345,19 +375,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
SizedBox
(
height:
15
),
...
List
.
generate
(
assetnames
.
length
,
(
index
)
{
return
ListTile
(
onTap:
()
{
Navigator
.
pop
(
context
,
true
);
Navigator
.
pop
(
context
,
true
);
switch
(
index
)
{
case
0
:
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Productdetails
(
leadID:
provider
.
leadDetails
.
id
,
mode:
widget
.
mode
,
),
builder:
(
context
)
=>
Productdetails
(
leadID:
provider
.
leadDetails
.
id
,
mode:
widget
.
mode
,
),
),
);
break
;
...
...
@@ -418,8 +448,6 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
);
}),
],
),
),
...
...
lib/screens/crm/LeadListByMode.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
...
...
@@ -10,6 +11,7 @@ import 'package:generp/Models/crmModels/GetSourceOnReferenceResponse.dart';
import
'package:generp/Models/crmModels/GetSubLocOnDistrictResponse.dart'
;
import
'package:generp/Models/crmModels/LeadListViewResponse.dart'
;
import
'package:generp/Notifiers/crmProvider/LeadListProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:provider/provider.dart'
;
import
'package:generp/screens/screensExports.dart'
;
...
...
@@ -36,11 +38,17 @@ class Leadlistbymode extends StatefulWidget {
class
_LeadlistbymodeState
extends
State
<
Leadlistbymode
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
Leadlistprovider
>(
context
,
listen:
false
);
provider
.
crmLeadListViewAPIFunction
(
context
,
widget
.
mode
);
...
...
@@ -78,40 +86,67 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Leadlistprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
crmLists
=
provider
.
crmLeadList
;
return
WillPopScope
(
onWillPop:
()
{
return
onBackPressed
(
context
);
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetForm
,
Row
(
children:
[
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,
),
),
],
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetForm
,
Row
(
children:
[
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
...
...
@@ -130,9 +165,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
itemBuilder:
(
context
,
index
)
{
if
(
crmLists
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
child:
Center
(
child:
Text
(
"No Data Available"
)),
);
}
return
Container
(
...
...
@@ -160,8 +193,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
...
...
@@ -196,8 +230,9 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
...
...
@@ -234,9 +269,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
crmLists
[
index
].
openStatus
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
@@ -283,9 +316,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -316,8 +347,6 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
),
)
:
Emptywidget
(
context
),
),
),
);
},
);
...
...
lib/screens/crm/NearbyOpenLeads.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -5,6 +8,7 @@ import 'package:flutter/material.dart';
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/NearByGeneratorsProvider.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:google_maps_flutter/google_maps_flutter.dart'
;
import
'package:interactive_slider/interactive_slider.dart'
;
...
...
@@ -21,37 +25,85 @@ class NearbyOpenLeads extends StatefulWidget {
}
class
_NearbyOpenLeadsState
extends
State
<
NearbyOpenLeads
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
provider
=
Provider
.
of
<
crmNearbyOpenLeadsProvider
>(
context
,
listen:
false
);
final
provider
=
Provider
.
of
<
crmNearbyOpenLeadsProvider
>(
context
,
listen:
false
,
);
provider
.
getLocationPermission
(
context
);
},);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
debugPrint
(
"Nearbygenerators widget rebuilt"
);
return
Consumer
<
crmNearbyOpenLeadsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
sendWidget
=
GestureDetector
(
return
Consumer
<
crmNearbyOpenLeadsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
sendWidget
=
GestureDetector
(
onTap:
()
{
_showFilterBottomSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,));
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
),
);
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
Scaffold
(
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
"Nearby Leads (Open)"
,
provider
.
resetAll
,
sendWidget
),
appBar:
appbar2
(
context
,
"Nearby Leads (Open)"
,
provider
.
resetAll
,
sendWidget
,
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SafeArea
(
child:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
child:
Column
(
children:
[
ClipRRect
(
// Apply border radius using ClipRRect
...
...
@@ -62,32 +114,40 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
// padding: EdgeInsets.fromLTRB(10, 20, 10, 20),
child:
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
Stack
(
children:
[
GoogleMap
(
myLocationEnabled:
true
,
zoomGesturesEnabled:
true
,
zoomControlsEnabled:
true
,
gestureRecognizers:
{
Factory
<
OneSequenceGestureRecognizer
>(()
=>
EagerGestureRecognizer
()),
Factory
<
PanGestureRecognizer
>(()
=>
PanGestureRecognizer
()),
Factory
<
ScaleGestureRecognizer
>(()
=>
ScaleGestureRecognizer
()),
// Prioritize pinch-to-zoom
},
initialCameraPosition:
CameraPosition
(
child:
Stack
(
children:
[
GoogleMap
(
myLocationEnabled:
true
,
zoomGesturesEnabled:
true
,
zoomControlsEnabled:
true
,
gestureRecognizers:
{
Factory
<
OneSequenceGestureRecognizer
>(
()
=>
EagerGestureRecognizer
(),
),
Factory
<
PanGestureRecognizer
>(
()
=>
PanGestureRecognizer
(),
),
Factory
<
ScaleGestureRecognizer
>(
()
=>
ScaleGestureRecognizer
(),
),
// Prioritize pinch-to-zoom
},
initialCameraPosition:
CameraPosition
(
target:
provider
.
startLocation
,
zoom:
14.0
zoom:
14.0
,
),
markers:
provider
.
markers
.
toSet
(),
mapType:
MapType
.
normal
,
onMapCreated:
(
controller
)
{
setState
(()
{
provider
.
mapController
=
controller
;
});
},
onCameraMove:
(
position
)
{
provider
.
onCameraMove
(
context
,
position
);
},
),
markers:
provider
.
markers
.
toSet
(),
mapType:
MapType
.
normal
,
onMapCreated:
(
controller
)
{
setState
(()
{
provider
.
mapController
=
controller
;
});
},
onCameraMove:
(
position
)
{
provider
.
onCameraMove
(
context
,
position
);
},
),
]),
],
),
),
),
],
...
...
@@ -95,12 +155,11 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
),
),
),
)
,
);
},
);
)
;
},
);
}
Future
<
void
>
_showFilterBottomSheet
(
BuildContext
context
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
...
...
@@ -115,123 +174,131 @@ class _NearbyOpenLeadsState extends State<NearbyOpenLeads> {
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Consumer
<
crmNearbyOpenLeadsProvider
>(
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
15
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaSemiBold"
,
fontSize:
16
,
),
builder:
(
context
,
provider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
left:
15
,
right:
15
,
top:
15
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Filter"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaSemiBold"
,
fontSize:
16
,
),
SizedBox
(
height:
15
),
),
SizedBox
(
height:
15
),
Row
(
children:
[
Text
(
"Radius"
,
style:
TextStyle
(
fontSize:
18.0
,
fontWeight:
FontWeight
.
w500
,
),
Row
(
children:
[
Text
(
"Radius"
,
style:
TextStyle
(
fontSize:
18.0
,
fontWeight:
FontWeight
.
w500
,
),
Spacer
(
),
Text
(
'
${provider.currentValue.toStringAsFixed(2)}
KM'
,
style:
TextStyle
(
fontSize:
18.0
,
font
Weight:
FontWeight
.
w50
0
,
)
,
),
Spacer
(),
Text
(
'
${provider.currentValue.toStringAsFixed(2)}
KM'
,
style:
TextStyle
(
font
Size:
18.
0
,
fontWeight:
FontWeight
.
w500
,
),
],
),
],
),
InteractiveSlider
(
min:
1.0
,
max:
50.0
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
0
,
),
InteractiveSlider
(
min:
1.0
,
max:
50.0
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
0
),
iconSize:
0.0
,
enabled:
true
,
// backgroundColor: AppColors.app_blue,
foregroundColor:
AppColors
.
app_blue
,
segmentDividerColor:
Color
(
0xFFF6F6F8
),
onChanged:
(
value
)
{
provider
.
currentValue
=
value
;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
iconSize:
0.0
,
enabled:
true
,
// backgroundColor: AppColors.app_blue,
foregroundColor:
AppColors
.
app_blue
,
segmentDividerColor:
Color
(
0xFFF6F6F8
),
onChanged:
(
value
)
{
provider
.
currentValue
=
value
;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
},
),
// Slider(
// value: provider.currentValue,
// max: 100,
// divisions: 100,
//
// label: provider.currentValue.toStringAsFixed(2),
// inactiveColor: Color(0xFFD7D7D7),
// activeColor: AppColors.cyan_blue,
// onChanged: (value) {
// provider.currentValue = value;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
// },
// ),
SizedBox
(
height:
30.0
),
Container
(
child:
InkWell
(
onTap:
()
{
provider
.
debounce
(()
{
provider
.
LoadNearbyOpenLeadsAPI
(
context
,
provider
.
currentValue
,
);
Navigator
.
pop
(
context
);
},
Duration
(
milliseconds:
500
));
},
),
// Slider(
// value: provider.currentValue,
// max: 100,
// divisions: 100,
//
// label: provider.currentValue.toStringAsFixed(2),
// inactiveColor: Color(0xFFD7D7D7),
// activeColor: AppColors.cyan_blue,
// onChanged: (value) {
// provider.currentValue = value;
// provider.debounce(() {
// provider.LoadNearbyOpenLeadsAPI(context);
// }, Duration(milliseconds: 200));
// },
// ),
SizedBox
(
height:
30.0
),
Container
(
child:
InkWell
(
onTap:
()
{
provider
.
debounce
(()
{
provider
.
LoadNearbyOpenLeadsAPI
(
context
,
provider
.
currentValue
);
Navigator
.
pop
(
context
);
},
Duration
(
milliseconds:
500
));
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14.0
),
color:
AppColors
.
app_blue
),
child:
Text
(
"Search"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
'JakartaMedium'
,
color:
Colors
.
white
),
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14.0
),
color:
AppColors
.
app_blue
,
),
child:
Text
(
"Search"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
'JakartaMedium'
,
color:
Colors
.
white
,
),
),
),
),
]
,
)
,
]
,
)
,
)
,
]
,
)
,
]
,
),
);
}
),
);
},
),
);
},
...
...
lib/screens/crm/ProspectDetailsByMode.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/crmProvider/crmEditProspectAccountProvider.dart'
;
import
'package:generp/Notifiers/crmProvider/crmLeadDetailsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:generp/screens/crm/prospectContactDetails.dart'
;
import
'package:generp/screens/crm/prospectLeadDetails.dart'
;
...
...
@@ -39,11 +41,17 @@ class ProspectDetailsByMode extends StatefulWidget {
class
ProspectDetailsByModeState
extends
State
<
ProspectDetailsByMode
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
...
...
@@ -63,6 +71,13 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
void
prefill
()
async
{
final
editProvider
=
Provider
.
of
<
Crmeditprospectaccountprovider
>(
context
,
...
...
@@ -160,6 +175,32 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer2
<
crmProspectDetailsProvider
,
Crmeditprospectaccountprovider
...
...
@@ -167,184 +208,174 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
builder:
(
context
,
provider
,
editProvider
,
child
)
{
var
leadDetails
=
provider
.
accountDetails
;
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Container
(
child:
SingleChildScrollView
(
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"
${leadDetails.salutationName ?? "-"}
${leadDetails.name ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
],
),
),
),
if
(
provider
.
showTransferAccount
==
"1"
)
...[
SizedBox
(
width:
5
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
_showTransferAccountSheet
(
context
,
provider
.
accountDetails
.
id
!,
);
},
child:
Container
(
height:
50
,
width:
3
5
,
height:
32
,
width:
3
0
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/
se_block_head
.svg"
,
"assets/svg/
transfer_ac
.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"
${leadDetails.salutationName ?? "-"}
${leadDetails.name ?? "-"}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
],
),
),
],
SizedBox
(
width:
5
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
editProvider
.
checkDropDownValues
();
prefill
();
await
_showEditAccountSheet
(
context
,
provider
.
accountDetails
.
id
!,
);
},
child:
Container
(
height:
32
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_edit.svg"
,
),
),
if
(
provider
.
showTransferAccount
==
"1"
)...[
SizedBox
(
width:
5
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
_showTransferAccountSheet
(
context
,
provider
.
accountDetails
.
id
!,
);
},
child:
Container
(
height:
32
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/transfer_ac.svg"
,
),
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
],
SizedBox
(
width:
5
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
editProvider
.
checkDropDownValues
();
prefill
();
await
_showEditAccountSheet
(
context
,
provider
.
accountDetails
.
id
!,
);
},
child:
Container
(
height:
32
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_edit.svg"
,
),
),
child:
provider
.
Headings
[
j
]
==
"Lead Age"
?
Tooltip
(
triggerMode:
TooltipTriggerMode
.
tap
,
message:
"
${provider.accountDetails.createdDatetime}
"
,
child:
Text
(
provider
.
subHeadings
[
j
]
==
""
?
"-"
:
provider
.
subHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
decorationColor:
AppColors
.
grey_semi
,
decoration:
TextDecoration
.
underline
,
),
),
)
:
Text
(
provider
.
subHeadings
[
j
]
==
""
?
"-"
:
provider
.
subHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
provider
.
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
provider
.
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
provider
.
Headings
[
j
]
==
"Lead Age"
?
Tooltip
(
triggerMode:
TooltipTriggerMode
.
tap
,
message:
"
${provider.accountDetails.createdDatetime}
"
,
child:
Text
(
provider
.
subHeadings
[
j
]
==
""
?
"-"
:
provider
.
subHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
decorationColor:
AppColors
.
grey_semi
,
decoration:
TextDecoration
.
underline
,
),
),
)
:
Text
(
provider
.
subHeadings
[
j
]
==
""
?
"-"
:
provider
.
subHeadings
[
j
],
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
),
),
),
),
],
),
);
}),
],
),
),
);
}),
],
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
...
...
@@ -560,8 +591,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
return
SafeArea
(
child:
Consumer2
<
Crmeditprospectaccountprovider
,
crmProspectDetailsProvider
>(
builder:
(
context
,
provider
,
prosDetProvider
,
child
)
{
child:
Consumer2
<
Crmeditprospectaccountprovider
,
crmProspectDetailsProvider
>(
builder:
(
context
,
provider
,
prosDetProvider
,
child
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
bottom:
15
,
...
...
@@ -746,11 +780,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
)
.
toList
(),
value:
provider
.
districtsList
.
contains
(
provider
.
selectedDistricts
,
)
?
provider
.
selectedDistricts
:
null
,
provider
.
districtsList
.
contains
(
provider
.
selectedDistricts
,
)
?
provider
.
selectedDistricts
:
null
,
// value: provider.selectedDistricts,
onChanged:
(
Districts
?
value
)
{
if
(
value
!=
null
)
{
...
...
@@ -777,7 +811,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
widget
.
mode
,
provider
.
selectedDistrictId
,
);
prosDetProvider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
);
prosDetProvider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadId
,
);
}
}
},
...
...
@@ -821,11 +859,11 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
)
.
toList
(),
value:
provider
.
subLocationsList
.
contains
(
provider
.
selectedSubLocations
,
)
?
provider
.
selectedSubLocations
:
null
,
provider
.
subLocationsList
.
contains
(
provider
.
selectedSubLocations
,
)
?
provider
.
selectedSubLocations
:
null
,
// value: provider.selectedSubLocations,
onChanged:
(
SubLocations
?
value
)
{
if
(
value
!=
null
)
{
...
...
@@ -892,7 +930,6 @@ class ProspectDetailsByModeState extends State<ProspectDetailsByMode> {
provider
.
selectedSubLocationId
,
);
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
45
,
...
...
lib/screens/crm/ProspectListByMode.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -23,83 +25,113 @@ class ProspectListByMode extends StatefulWidget {
}
class
_ProspectListByModeState
extends
State
<
ProspectListByMode
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
ProspectListProvider
>(
context
,
listen:
false
);
provider
.
crmProspectListViewAPIFunction
(
context
,
widget
.
mode
);
provider
.
crmProspectListAPIFunction
(
final
provider
=
Provider
.
of
<
ProspectListProvider
>(
context
,
widget
.
mode
,
""
,
listen:
false
,
);
provider
.
crmProspectListViewAPIFunction
(
context
,
widget
.
mode
);
provider
.
crmProspectListAPIFunction
(
context
,
widget
.
mode
,
""
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
ProspectListProvider
>(
builder:
(
context
,
provider
,
child
)
{
final
crmLists
=
provider
.
accountList
;
return
WillPopScope
(
onWillPop:
()
{
return
onBackPressed
(
context
);
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetForm
,
Row
(
children:
[
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,
),
),
],
// ignore: deprecated_member_use
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetForm
,
Row
(
children:
[
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
),
),
)
:
crmLists
.
isNotEmpty
?
SizedBox
(
child:
Scrollbar
(
thumbVisibility:
false
,
child:
ListView
.
builder
(
itemCount:
crmLists
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
crmLists
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
)
:
crmLists
.
isNotEmpty
?
SizedBox
(
child:
Scrollbar
(
thumbVisibility:
false
,
child:
ListView
.
builder
(
itemCount:
crmLists
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
crmLists
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
)),
);
}
// if(crmLists[index].aid=="1726"){
// if(crmLists[index].aid=="1726"){
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
...
...
@@ -125,8 +157,9 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
...
...
@@ -139,7 +172,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
Text
(
crmLists
[
index
].
aname
!,
...
...
@@ -153,7 +186,6 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
),
),
),
],
),
Divider
(
...
...
@@ -179,12 +211,10 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
crmLists
[
index
].
gstNumber
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
...
...
@@ -215,26 +245,25 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
ProspectDetailsByMode
(
(
context
)
=>
ProspectDetailsByMode
(
pageTitleName:
widget
.
pageTitleName
,
widget
.
pageTitleName
,
mode:
widget
.
mode
,
leadId:
provider
.
accountList
[
index
].
aid
,
leadId:
provider
.
accountList
[
index
]
.
aid
,
),
),
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
vertical:
5
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
...
...
@@ -255,16 +284,11 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
],
),
);
},
},
),
),
),
)
:
Emptywidget
(
context
)
),
),
)
:
Emptywidget
(
context
),
);
},
);
...
...
@@ -292,7 +316,9 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
right:
15
,
top:
10
,
),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,),
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
child:
SingleChildScrollView
(
child:
Column
(
...
...
@@ -314,7 +340,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
],
),
if
(
widget
.
mode
!=
"executive"
)...[
if
(
widget
.
mode
!=
"executive"
)
...[
TextWidget
(
context
,
"Employee"
),
DropdownButtonHideUnderline
(
child:
Row
(
...
...
@@ -326,66 +352,72 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
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
.
selectedEmployees
)
?
provider
.
selectedEmployees
:
null
,
provider
.
employeesList
.
map
(
(
slist
)
=>
DropdownMenuItem
<
Employees
>(
value:
slist
,
child:
Text
(
slist
.
name
!,
style:
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
employeesList
.
contains
(
provider
.
selectedEmployees
,
)
?
provider
.
selectedEmployees
:
null
,
// value: provider.selectedEmployees,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
employeesList
.
isNotEmpty
){
if
(
provider
.
employeesList
.
isNotEmpty
)
{
provider
.
selectedEmployees
=
value
;
provider
.
selectedEmployeeId
=
value
!.
id
!;
provider
.
selectedEmployeeValue
=
value
!.
name
!;
provider
.
selectedEmployeeId
=
value
!.
id
!;
provider
.
selectedEmployeeValue
=
value
!.
name
!;
}
}
},
isExpanded:
true
,
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
searchController
,
searchController:
provider
.
searchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
searchController
,
provider
.
searchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search account...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
...
...
@@ -396,8 +428,10 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
...
...
@@ -426,17 +460,23 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
null
,
),
InkResponse
(
onTap:
()
{
provider
.
crmProspectListAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmployeeId
);
provider
.
crmProspectListAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmployeeId
,
);
Navigator
.
pop
(
context
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
...
...
@@ -450,7 +490,7 @@ class _ProspectListByModeState extends State<ProspectListByMode> {
),
),
),
)
)
,
],
),
),
...
...
lib/screens/crm/addProspectLeads.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:generp/Notifiers/crmProvider/addProspectLeadsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Models/crmModels/crmProspectDetailsAddLeadsResponse.dart'
;
...
...
@@ -23,384 +25,434 @@ class AddProspectLeads extends StatefulWidget {
class
_AddProspectLeadsState
extends
State
<
AddProspectLeads
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
async
{
final
provider
=
Provider
.
of
<
Addprospectleadsprovider
>(
context
,
listen:
false
);
await
provider
.
crmProspectDetailsAddLeadsViewAPIFunction
(
context
,
widget
.
mode
);
final
provider
=
Provider
.
of
<
Addprospectleadsprovider
>(
context
,
listen:
false
,
);
await
provider
.
crmProspectDetailsAddLeadsViewAPIFunction
(
context
,
widget
.
mode
,
);
// Initialize controllers and dropdowns after API call
provider
.
initializeForm
(
context
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
Addprospectleadsprovider
>(
builder:
(
context
,
editProvider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
async
{
editProvider
.
resetForm
();
return
true
;
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"Add Lead"
,
editProvider
.
resetForm
,
const
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Employee"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
hint:
Text
(
"Select Source"
,
style:
TextStyle
(
fontSize:
14
),
),
items:
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"Add Lead"
,
editProvider
.
resetForm
,
const
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Employee"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
hint:
Text
(
"Select Source"
,
style:
TextStyle
(
fontSize:
14
),
),
items:
editProvider
.
employeeList
.
map
(
(
slist
)
=>
DropdownMenuItem
<
Employees
>(
(
slist
)
=>
DropdownMenuItem
<
Employees
>(
value:
slist
,
child:
Text
(
slist
.
name
!,
style:
TextStyle
(
fontSize:
14
,
),
style:
TextStyle
(
fontSize:
14
),
),
),
)
)
.
toList
(),
value:
value:
editProvider
.
employeeList
.
contains
(
editProvider
.
selectedEmployee
,
)
editProvider
.
selectedEmployee
,
)
?
editProvider
.
selectedEmployee
:
null
,
// value: provider.selectedEmployees,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
editProvider
.
employeeList
.
isNotEmpty
)
{
editProvider
.
selectedEmployee
=
value
;
editProvider
.
selectedEmployeeId
=
value
!.
id
!;
editProvider
.
selectedEmployeeValue
=
// value: provider.selectedEmployees,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
editProvider
.
employeeList
.
isNotEmpty
)
{
editProvider
.
selectedEmployee
=
value
;
editProvider
.
selectedEmployeeId
=
value
!.
id
!;
editProvider
.
selectedEmployeeValue
=
value
!.
name
!;
}
}
},
isExpanded:
true
,
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
editProvider
.
searchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
editProvider
.
searchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search account...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
}
}
},
isExpanded:
true
,
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
editProvider
.
searchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
editProvider
.
searchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search account...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
editProvider
.
searchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
().
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
],
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
editProvider
.
searchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
),
],
),
),
InkResponse
(
onTap:
()
{
editProvider
.
editAddNewRow
();
},
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
const
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"+ Add Product"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
InkResponse
(
onTap:
()
{
editProvider
.
editAddNewRow
();
},
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
const
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"+ Add Product"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
if
(
editProvider
.
leadProductsList
.
isNotEmpty
||
editProvider
.
editProductPriceControllers
.
isNotEmpty
)...[
ListView
.
builder
(
itemCount:
editProvider
.
editProductPriceControllers
.
length
,
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
context
,
j
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Product"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Products
>(
isExpanded:
true
,
hint:
const
Text
(
'Select Product'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
editProvider
.
leadProductsList
.
map
((
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.name}
)"
,
style:
const
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
))
),
),
if
(
editProvider
.
leadProductsList
.
isNotEmpty
||
editProvider
.
editProductPriceControllers
.
isNotEmpty
)
...[
ListView
.
builder
(
itemCount:
editProvider
.
editProductPriceControllers
.
length
,
physics:
const
NeverScrollableScrollPhysics
(),
shrinkWrap:
true
,
itemBuilder:
(
context
,
j
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
const
EdgeInsets
.
symmetric
(
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Product"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Products
>(
isExpanded:
true
,
hint:
const
Text
(
'Select Product'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
editProvider
.
leadProductsList
.
map
(
(
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.name}
)"
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
editProvider
.
selectedProductIds
[
j
]
!=
null
?
editProvider
.
leadProductsList
.
firstWhere
(
(
ord
)
=>
ord
.
id
==
editProvider
.
selectedProductIds
[
j
],
orElse:
()
=>
editProvider
.
leadProductsList
[
0
],
)
value:
editProvider
.
selectedProductIds
[
j
]
!=
null
?
editProvider
.
leadProductsList
.
firstWhere
(
(
ord
)
=>
ord
.
id
==
editProvider
.
selectedProductIds
[
j
],
orElse:
()
=>
editProvider
.
leadProductsList
[
0
],
)
:
null
,
onChanged:
(
Products
?
value
)
{
if
(
value
!=
null
)
{
editProvider
.
updateSelectedProductIds
(
j
,
value
);
editProvider
.
selectedProductIds
[
j
]
=
value
.
id
?.
toString
()
??
''
;
editProvider
.
updateTotalAmount
(
j
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editProductPriceControllers
[
j
],
"Product Price"
,
"Enter Product Price"
,
(
value
)
=>
editProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
onChanged:
(
Products
?
value
)
{
if
(
value
!=
null
)
{
editProvider
.
updateSelectedProductIds
(
j
,
value
,
);
editProvider
.
selectedProductIds
[
j
]
=
value
.
id
?.
toString
()
??
''
;
editProvider
.
updateTotalAmount
(
j
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
],
),
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editProductPriceControllers
[
j
],
"Product Price"
,
"Enter Product Price"
,
(
value
)
=>
editProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editQuantityControllers
[
j
],
"Quantity"
,
"Enter Quantity"
,
(
value
)
=>
editProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
],
],
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editQuantityControllers
[
j
],
"Quantity"
,
"Enter Quantity"
,
(
value
)
=>
editProvider
.
updateTotalAmount
(
j
),
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editTotalAmountControllers
[
j
],
"Total Amount"
,
"Enter Total Amount"
,
(
_
)
{},
TextInputType
.
number
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
],
],
),
const
SizedBox
(
height:
10
),
Row
(
children:
[
Expanded
(
flex:
2
,
child:
textControllerWidget
(
context
,
editProvider
.
editTotalAmountControllers
[
j
],
"Total Amount"
,
"Enter Total Amount"
,
(
_
)
{},
TextInputType
.
number
,
true
,
FilteringTextInputFormatter
.
digitsOnly
,
),
),
],
),
);
},
),
],
TextWidget
(
context
,
"Status"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Salutation"
,
style:
TextStyle
(
fontSize:
14
),
),
items:
],
),
);
},
),
],
TextWidget
(
context
,
"Status"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Status"
,
style:
TextStyle
(
fontSize:
14
),
),
items:
editProvider
.
statusList
.
map
(
(
slist
)
=>
DropdownMenuItem
<
String
>(
(
slist
)
=>
DropdownMenuItem
<
String
>(
value:
slist
,
child:
Text
(
slist
,
style:
TextStyle
(
fontSize:
14
,
),
style:
TextStyle
(
fontSize:
14
),
),
),
)
)
.
toList
(),
value:
editProvider
.
selectedStatus
,
onChanged:
(
String
?
value
)
{
if
(
value
!=
null
)
{
if
(
editProvider
.
statusList
.
isNotEmpty
)
{
editProvider
.
selectedStatus
=
value
;
}
}
},
isExpanded:
true
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
value:
editProvider
.
selectedStatus
,
onChanged:
(
String
?
value
)
{
if
(
value
!=
null
)
{
if
(
editProvider
.
statusList
.
isNotEmpty
)
{
editProvider
.
selectedStatus
=
value
;
}
}
},
isExpanded:
true
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
)
,
]
,
]
,
)
,
),
)
,
]
,
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
editProvider
.
submitLoading
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
editProvider
.
submitLoading
?
null
:
()
{
editProvider
.
submitForm
(
context
,
widget
.
mode
,
widget
.
leadID
,
editProvider
.
selectedEmployeeId
,
editProvider
.
selectedStatus
);
// editProvider.crmProspectDetailsAddLeadsSubmitAPIFunction(context, mode, account_id, acc_manager_id, products, lead_status)
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
editProvider
.
submitLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
),
)
:
const
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
editProvider
.
submitForm
(
context
,
widget
.
mode
,
widget
.
leadID
,
editProvider
.
selectedEmployeeId
,
editProvider
.
selectedStatus
,
);
// editProvider.crmProspectDetailsAddLeadsSubmitAPIFunction(context, mode, account_id, acc_manager_id, products, lead_status)
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
editProvider
.
submitLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
)
:
const
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
);
},
);
}
}
\ No newline at end of file
}
lib/screens/crm/crmDashboard.dart
View file @
c92f4c79
...
...
@@ -39,12 +39,14 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
prov
.
crmPendingTasksAPIFunction
(
context
);
});
}
@override
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
...
@@ -517,7 +519,12 @@ class _CrmdashboardScreenState extends State<CrmdashboardScreen> {
FloatingActionButtonLocation
.
centerFloat
,
floatingActionButton:
InkResponse
(
onTap:
()
{
_showPaymentOptionsSheet
(
context
);
if
(
provider
.
accessPages
.
where
((
page
)
=>
[
8
,
9
].
contains
(
page
.
id
))
.
toList
()
.
contains
([
8
,
9
]))
{
_showPaymentOptionsSheet
(
context
);
}
},
child:
Container
(
height:
45
,
...
...
lib/screens/crm/productDetails.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/screens/crm/editProductsList.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -12,147 +14,201 @@ import '../../Utils/commonWidgets.dart';
class
Productdetails
extends
StatefulWidget
{
final
leadID
;
final
mode
;
const
Productdetails
({
super
.
key
,
required
this
.
leadID
,
required
this
.
mode
});
const
Productdetails
({
super
.
key
,
required
this
.
leadID
,
required
this
.
mode
});
@override
State
<
Productdetails
>
createState
()
=>
_ProductdetailsState
();
}
class
_ProductdetailsState
extends
State
<
Productdetails
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmLeadDetailsProvider
>(
context
,
listen:
false
);
final
provider
=
Provider
.
of
<
crmLeadDetailsProvider
>(
context
,
listen:
false
,
);
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadID
,
widget
.
mode
);
},);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
crmLeadDetailsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
customerDetails
=
provider
.
leadProducts
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Product Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
// TextWidget(context,"Product Details"),
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
4
,
(
j
)
{
final
textheads
=
[
"Product Name"
,
"Product Price"
,
"Quantity"
,
"Total Price"
];
final
textSubheads
=
[
customerDetails
[
index
].
productName
??
"-"
,
customerDetails
[
index
].
price
??
"-"
,
customerDetails
[
index
].
qty
??
"-"
,
customerDetails
[
index
].
price
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
2
,
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,),
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Product Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
leadProducts
.
isNotEmpty
?
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
// TextWidget(context,"Product Details"),
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
4
,
(
j
)
{
final
textheads
=
[
"Product Name"
,
"Product Price"
,
"Quantity"
,
"Total Price"
,
];
final
textSubheads
=
[
customerDetails
[
index
].
productName
??
"-"
,
customerDetails
[
index
].
price
??
"-"
,
customerDetails
[
index
].
qty
??
"-"
,
customerDetails
[
index
].
price
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
Expanded
(
flex:
3
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
2
,
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
),
),
),
Expanded
(
flex:
3
,
child:
Text
(
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
],
),
],
),
);
}),
),
);
}
),
);
}),
),
);
},
),
SizedBox
(
height:
75
),
],
SizedBox
(
height:
75
),
],
),
),
)
:
Emptywidget
(
context
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
EditProductsList
(
leadID:
widget
.
leadID
),
),
),
),
floatingActionButton:
Align
(
);
if
(
res
==
true
)
{
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadID
,
widget
.
mode
,
);
}
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
EditProductsList
(
leadID:
widget
.
leadID
,
),));
if
(
res
==
true
){
provider
.
crmLeadDetailsAPIFunction
(
context
,
widget
.
leadID
,
widget
.
mode
);
}
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Edit Products"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
),
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Edit Products"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
);
},
);
...
...
lib/screens/crm/prospectContactDetails.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/crmProvider/crmProspectDetailsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Utils/app_colors.dart'
;
...
...
@@ -11,218 +13,264 @@ import '../../Utils/commonWidgets.dart';
class
ProspectContactDetails
extends
StatefulWidget
{
final
accountId
;
const
ProspectContactDetails
({
super
.
key
,
required
this
.
accountId
});
const
ProspectContactDetails
({
super
.
key
,
required
this
.
accountId
});
@override
State
<
ProspectContactDetails
>
createState
()
=>
_ProspectContactDetailsState
();
}
class
_ProspectContactDetailsState
extends
State
<
ProspectContactDetails
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
crmProspectDetailsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
customerDetails
=
provider
.
contactList
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Contact Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Contact Details"
),
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Contact Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
// TextWidget(context, "Contact Details"),
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
,
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_profile.svg"
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
customerDetails
[
index
].
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_profile.svg"
,
),
],
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
provider
.
editNameController
.
text
=
customerDetails
[
index
].
name
??
""
;
provider
.
editDesignationController
.
text
=
customerDetails
[
index
].
designation
??
""
;
provider
.
editMobileNumberController
.
text
=
customerDetails
[
index
].
mob1
??
""
;
provider
.
editAlternativeMobileController
.
text
=
customerDetails
[
index
].
mob2
??
""
;
provider
.
editTelephoneController
.
text
=
customerDetails
[
index
].
tel
??
""
;
provider
.
editEmailController
.
text
=
customerDetails
[
index
].
email
??
""
;
_showEditContactSheet
(
context
,
index
,
provider
.
accountDetails
.
id
!,
);
},
child:
Container
(
height:
35
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_edit.svg"
,
),
),
SizedBox
(
width:
10
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
5
,
(
j
)
{
final
textheads
=
[
"Mobile"
,
"Alternate Mobile"
,
"Telephone Number"
,
"Email"
,
"Designation"
,
];
final
textSubheads
=
[
customerDetails
[
index
].
mob1
??
"-"
,
customerDetails
[
index
].
mob2
??
"-"
,
customerDetails
[
index
].
tel
??
"-"
,
customerDetails
[
index
].
email
??
"-"
,
customerDetails
[
index
].
designation
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
customerDetails
[
index
].
name
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
],
),
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
provider
.
editNameController
.
text
=
customerDetails
[
index
].
name
??
""
;
provider
.
editDesignationController
.
text
=
customerDetails
[
index
].
designation
??
""
;
provider
.
editMobileNumberController
.
text
=
customerDetails
[
index
].
mob1
??
""
;
provider
.
editAlternativeMobileController
.
text
=
customerDetails
[
index
].
mob2
??
""
;
provider
.
editTelephoneController
.
text
=
customerDetails
[
index
].
tel
??
""
;
provider
.
editEmailController
.
text
=
customerDetails
[
index
].
email
??
""
;
_showEditContactSheet
(
context
,
index
,
provider
.
accountDetails
.
id
!);
},
child:
Container
(
height:
35
,
width:
30
,
padding:
EdgeInsets
.
all
(
8.0
),
child:
SvgPicture
.
asset
(
"assets/svg/crm_contact_edit.svg"
,
),
child:
Text
(
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
5
,
(
j
)
{
final
textheads
=
[
"Mobile"
,
"Alternate Mobile"
,
"Telephone Number"
,
"Email"
,
"Designation"
,
];
final
textSubheads
=
[
customerDetails
[
index
].
mob1
??
"-"
,
customerDetails
[
index
].
mob2
??
"-"
,
customerDetails
[
index
].
tel
??
"-"
,
customerDetails
[
index
].
email
??
"-"
,
customerDetails
[
index
].
designation
??
"-"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
),
),
Expanded
(
child:
Text
(
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
],
),
);
}),
],
),
);
},
),
SizedBox
(
height:
75
),
],
);
}),
],
),
);
},
),
),
SizedBox
(
height:
75
),
],
),
floatingActionButton:
Align
(
),
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
{
_showAddContactSheet
(
context
,
provider
.
accountDetails
.
id
!);
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
{
_showAddContactSheet
(
context
,
provider
.
accountDetails
.
id
!);
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Add Contact"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Add Contact"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
);
},
);
}
Future
<
void
>
_showAddContactSheet
(
BuildContext
context
,
accID
)
{
Future
<
void
>
_showAddContactSheet
(
BuildContext
context
,
accID
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
...
...
@@ -330,10 +378,17 @@ class _ProspectContactDetailsState extends State<ProspectContactDetails> {
),
errorWidget
(
context
,
provider
.
emailError
),
InkWell
(
onTap:
provider
.
isLoading
?
null
:(){
provider
.
isLoading
=
true
;
provider
.
crmProspectDetailsAddContactAPIFunction
(
context
,
accID
);
},
onTap:
provider
.
isLoading
?
null
:
()
{
provider
.
isLoading
=
true
;
provider
.
crmProspectDetailsAddContactAPIFunction
(
context
,
accID
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
...
...
@@ -348,11 +403,18 @@ class _ProspectContactDetailsState extends State<ProspectContactDetails> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
child:
provider
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
...
...
@@ -369,7 +431,7 @@ class _ProspectContactDetailsState extends State<ProspectContactDetails> {
);
}
Future
<
void
>
_showEditContactSheet
(
BuildContext
context
,
index
,
accid
)
{
Future
<
void
>
_showEditContactSheet
(
BuildContext
context
,
index
,
accid
)
{
return
showModalBottomSheet
(
useSafeArea:
true
,
isDismissible:
true
,
...
...
@@ -479,10 +541,18 @@ class _ProspectContactDetailsState extends State<ProspectContactDetails> {
errorWidget
(
context
,
provider
.
editEmailError
),
InkWell
(
onTap:
provider
.
isLoading
?
null
:(){
provider
.
isLoading
=
true
;
provider
.
crmProspectDetailsEditContactAPIFunction
(
context
,
provider
.
contactList
[
index
].
id
,
accid
);
},
onTap:
provider
.
isLoading
?
null
:
()
{
provider
.
isLoading
=
true
;
provider
.
crmProspectDetailsEditContactAPIFunction
(
context
,
provider
.
contactList
[
index
].
id
,
accid
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
...
...
@@ -497,11 +567,18 @@ class _ProspectContactDetailsState extends State<ProspectContactDetails> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
child:
provider
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
...
...
lib/screens/crm/prospectLeadDetails.dart
View file @
c92f4c79
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/Notifiers/crmProvider/crmProspectDetailsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/screens/crm/LeadDetailsByMode.dart'
;
import
'package:provider/provider.dart'
;
...
...
@@ -13,17 +15,28 @@ class ProspectLeadDetails extends StatefulWidget {
final
leadID
;
final
mode
;
const
ProspectLeadDetails
({
super
.
key
,
required
this
.
leadID
,
required
this
.
mode
});
const
ProspectLeadDetails
({
super
.
key
,
required
this
.
leadID
,
required
this
.
mode
,
});
@override
State
<
ProspectLeadDetails
>
createState
()
=>
_ProspectLeadDetailsState
();
}
class
_ProspectLeadDetailsState
extends
State
<
ProspectLeadDetails
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
timeStamp
)
{
final
provider
=
Provider
.
of
<
crmProspectDetailsProvider
>(
context
,
...
...
@@ -32,166 +45,218 @@ class _ProspectLeadDetailsState extends State<ProspectLeadDetails> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
case
ConnectivityResult
.
mobile
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
wifi
:
connection
=
'Online'
;
break
;
case
ConnectivityResult
.
none
:
default
:
connection
=
'Offline'
;
}
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
),
),
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
}
Widget
_scaffold
(
BuildContext
context
)
{
return
Consumer
<
crmProspectDetailsProvider
>(
builder:
(
context
,
provider
,
child
)
{
var
customerDetails
=
provider
.
leadList
;
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Lead Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Lead Details"
),
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
5
,
(
j
)
{
final
textheads
=
[
"Lead Id"
,
"Date Created"
,
"Lead Status"
,
"Lead Open / Close"
,
"View Details"
];
final
textSubheads
=
[
customerDetails
[
index
].
id
??
"-"
,
customerDetails
[
index
].
date
??
"-"
,
customerDetails
[
index
].
status
??
"-"
,
customerDetails
[
index
].
openStatus
??
"-"
,
"View"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Lead Details"
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
SizedBox
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
ListView
.
builder
(
itemCount:
customerDetails
.
length
,
shrinkWrap:
true
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
List
.
generate
(
5
,
(
j
)
{
final
textheads
=
[
"Lead Id"
,
"Date Created"
,
"Lead Status"
,
"Lead Open / Close"
,
"View Details"
,
];
final
textSubheads
=
[
customerDetails
[
index
].
id
??
"-"
,
customerDetails
[
index
].
date
??
"-"
,
customerDetails
[
index
].
status
??
"-"
,
customerDetails
[
index
].
openStatus
??
"-"
,
"View"
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
6
,
horizontal:
0
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
2
,
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
),
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
flex:
2
,
child:
Text
(
textheads
[
j
].
toString
(),
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
),
),
if
(
textSubheads
[
j
]==
"View"
)...[
Expanded
(
flex:
3
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
widget
.
leadID
),));
if
(
res
==
true
){
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadID
);
}
},
child:
Text
(
textSubheads
[
j
]==
""
?
"-"
:
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
decorationColor:
AppColors
.
app_blue
,
decoration:
TextDecoration
.
underline
),
if
(
textSubheads
[
j
]
==
"View"
)
...[
Expanded
(
flex:
3
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
mode:
""
,
pageTitleName:
"Lead Details"
,
leadId:
widget
.
leadID
,
),
),
),
),
]
else
...[
Expanded
(
flex:
3
,
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadID
,
);
}
},
child:
Text
(
textSubheads
[
j
]==
""
?
"-"
:
textSubheads
[
j
],
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
color:
AppColors
.
app_blue
,
decorationColor:
AppColors
.
app_blue
,
decoration:
TextDecoration
.
underline
,
),
),
),
]
],
),
);
}),
),
);
},
),
SizedBox
(
height:
75
),
],
),
]
else
...[
Expanded
(
flex:
3
,
child:
Text
(
textSubheads
[
j
]
==
""
?
"-"
:
textSubheads
[
j
],
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
],
],
),
);
}),
),
);
},
),
),
SizedBox
(
height:
75
),
],
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
AddProspectLeads
(
leadID:
widget
.
leadID
,
mode:
widget
.
mode
,),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadID
,
);
}
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Add Lead"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
floatingActionButton:
Align
(
alignment:
Alignment
.
bottomCenter
,
child:
InkWell
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
AddProspectLeads
(
leadID:
widget
.
leadID
,
mode:
widget
.
mode
,
),
),
),
);
if
(
res
==
true
)
{
provider
.
crmProspectDetailsAPIFunction
(
context
,
widget
.
leadID
,
);
}
},
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
Text
(
"Add Lead"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
,
fontFamily:
"JakartaMedium"
,
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
);
},
);
...
...
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