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
ee178d55
Commit
ee178d55
authored
Jul 09, 2025
by
Sai Srinivas
Browse files
09-07-2025 By Sai Srinivas
Network and Finance Module issue and Back
parent
2ade5aad
Changes
44
Hide whitespace changes
Inline
Side-by-side
lib/screens/finance/submitPaymentRequestionListsByMode.dart
View file @
ee178d55
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'
;
...
...
@@ -13,6 +14,7 @@ import 'package:get/utils.dart';
import
'package:provider/provider.dart'
;
import
'../../Models/financeModels/addPaymentRequestionResponse.dart'
;
import
'../../Utils/commonServices.dart'
;
class
Submitpaymentrequestionlistsbymode
extends
StatefulWidget
{
final
String
mode
;
...
...
@@ -33,14 +35,22 @@ class Submitpaymentrequestionlistsbymode extends StatefulWidget {
class
_SubmitpaymentrequestionlistsbymodeState
extends
State
<
Submitpaymentrequestionlistsbymode
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
Dropdowntheme
ddtheme
=
Dropdowntheme
();
List
<
FocusNode
>
focusNodes
=
List
.
generate
(
11
,
(
index
)
=>
FocusNode
());
GlobalKey
_globalKey
=
GlobalKey
();
ScrollController
scrollcontroller
=
ScrollController
();
@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
<
Requestionlistprovider
>(
context
,
...
...
@@ -77,6 +87,7 @@ class _SubmitpaymentrequestionlistsbymodeState
void
dispose
()
{
scrollcontroller
.
dispose
();
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
_connectivity
.
disposeStream
();
super
.
dispose
();
}
...
...
@@ -101,303 +112,331 @@ class _SubmitpaymentrequestionlistsbymodeState
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Requestionlistprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"
${widget.pageTitleName}
"
,
provider
.
resetForm
,
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
SingleChildScrollView
(
controller:
scrollcontroller
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Select Account"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
flex:
5
,
child:
DropdownButton2
<
Accounts
>(
isExpanded:
true
,
hint:
Text
(
'Select Account'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
accounts
.
map
(
(
accs
)
=>
DropdownMenuItem
<
Accounts
>(
value:
accs
,
child:
Text
(
"
${accs.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedAccount
,
onChanged:
(
widget
.
mode
==
"self"
&&
provider
.
accounts
.
length
==
1
)
?
null
:
(
Accounts
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
accounts
.
isNotEmpty
)
{
provider
.
selectedAccount
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
accountId
=
value
.
id
!;
print
(
"hfjkshfg"
+
provider
.
accountId
.
toString
(),
);
provider
.
paymentRequestionBankDetailsAPIFunction
(
context
,
provider
.
accountId
,
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"
?
Consumer
<
Requestionlistprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"
${widget.pageTitleName}
"
,
provider
.
resetForm
,
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
SingleChildScrollView
(
controller:
scrollcontroller
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Select Account"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
flex:
5
,
child:
DropdownButton2
<
Accounts
>(
isExpanded:
true
,
hint:
Text
(
'Select Account'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
accounts
.
map
(
(
accs
)
=>
DropdownMenuItem
<
Accounts
>(
value:
accs
,
child:
Text
(
"
${accs.name}
"
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedAccount
,
onChanged:
(
widget
.
mode
==
"self"
&&
provider
.
accounts
.
length
==
1
)
?
null
:
(
Accounts
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
accounts
.
isNotEmpty
)
{
provider
.
selectedAccount
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
accountSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
accountId
=
value
.
id
!;
print
(
"hfjkshfg"
+
provider
.
accountId
.
toString
(),
);
provider
.
paymentRequestionBankDetailsAPIFunction
(
context
,
provider
.
accountId
,
);
}
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
accountSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
accountSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search account...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
hintText:
'Search account...'
,
border:
OutlineInputBorder
(
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
accountSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
if
(
widget
.
mode
==
"other"
)
...[
SizedBox
(
width:
5
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Addcommonpayment
(
from:
"Requesition"
,
),
),
);
print
(
"return Response:
${res}
"
);
if
(
res
!=
true
)
{
provider
.
addPaymentRequestionViewAPI
(
context
,
widget
.
mode
,
);
if
(
res
!=
null
)
{
print
(
"true"
);
Future
.
delayed
(
Durations
.
long4
,
()
async
{
print
(
"Long411"
);
autofill
(
res
);
},
);
}
}
},
child:
Container
(
height:
45
,
padding:
EdgeInsets
.
all
(
8
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
child:
SvgPicture
.
asset
(
"assets/svg/add_account.svg"
,
color:
Colors
.
white
,
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
accountSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
],
),
if
(
widget
.
mode
==
"other"
)
...[
SizedBox
(
width:
5
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Addcommonpayment
(
from:
"Requesition"
,
),
),
errorWidget
(
context
,
provider
.
selectAccountError
),
if
([
"self"
,
"admin"
].
contains
(
widget
.
mode
))
...[
TextWidget
(
context
,
"Select Requisition Type"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
hint:
Text
(
'Select Request Type'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
);
print
(
"return Response:
${res}
"
);
if
(
res
!=
true
)
{
provider
.
addPaymentRequestionViewAPI
(
context
,
widget
.
mode
,
);
if
(
res
!=
null
)
{
print
(
"true"
);
Future
.
delayed
(
Durations
.
long4
,
()
async
{
print
(
"Long411"
);
autofill
(
res
);
},
);
}
}
},
child:
Container
(
height:
45
,
padding:
EdgeInsets
.
all
(
8
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/add_account.svg"
,
color:
Colors
.
white
,
items:
provider
.
requestingPurposes
.
map
(
(
accs
)
=>
DropdownMenuItem
<
String
>(
value:
accs
,
child:
Text
(
accs
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectReqPurpose
,
onChanged:
(
String
?
value
)
{
if
(
value
!=
null
)
{
provider
.
selectReqPurpose
=
value
;
print
(
"Selected Complaint Type:
${value}
,"
,
);
print
(
"hfjkshfg"
+
provider
.
selectReqPurpose
.
toString
(),
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
)
,
]
,
),
],
),
]
else
...[
textControllerWidget
(
context
,
provider
.
reqPurposeController
,
"Request Purpose"
,
"Enter Request Purpose"
,
provider
.
updateReqPupose
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
focusNodes
[
1
],
TextInputAction
.
next
,
),
],
),
),
errorWidget
(
context
,
provider
.
selectAccountError
),
errorWidget
(
context
,
provider
.
reqPurposeError
),
if
([
"self"
,
"admin"
].
contains
(
widget
.
mode
))
...[
TextWidget
(
context
,
"Select Requisition Type"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
hint:
Text
(
'Select Request Type'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
requestingPurposes
.
map
(
(
accs
)
=>
DropdownMenuItem
<
String
>(
value:
accs
,
child:
Text
(
accs
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectReqPurpose
,
onChanged:
(
String
?
value
)
{
if
(
value
!=
null
)
{
provider
.
selectReqPurpose
=
value
;
print
(
"Selected Complaint Type:
${value}
,"
,
);
print
(
"hfjkshfg"
+
provider
.
selectReqPurpose
.
toString
(),
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
textControllerWidget
(
context
,
provider
.
descController
,
"Description"
,
"Enter Description"
,
provider
.
updateDescription
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
),
),
]
else
...[
textControllerWidget
(
context
,
provider
.
reqPurposeController
,
"Request Purpose"
,
"Enter Request Purpose"
,
provider
.
updateReqPupose
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
focusNodes
[
1
],
TextInputAction
.
next
,
),
],
errorWidget
(
context
,
provider
.
reqPurposeError
),
errorWidget
(
context
,
provider
.
descriptionError
),
textControllerWidget
(
context
,
provider
.
descController
,
"Description"
,
"Enter Description"
,
provider
.
updateDescription
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
descriptionError
),
textControllerWidget
(
context
,
provider
.
amountController
,
"Amount"
,
"Enter Amount"
,
provider
.
updateAmount
,
TextInputType
.
numberWithOptions
(),
false
,
null
,
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
amountError
),
textControllerWidget
(
context
,
provider
.
amountController
,
"Amount"
,
"Enter Amount"
,
provider
.
updateAmount
,
TextInputType
.
numberWithOptions
(),
false
,
null
,
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
amountError
),
TextWidget
(
context
,
"Select Payment Mode"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
PaymentModes
>(
isExpanded:
true
,
hint:
Text
(
'Select Payment mode'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
paymentModes
.
map
(
(
paymenents
)
=>
DropdownMenuItem
<
PaymentModes
>(
TextWidget
(
context
,
"Select Payment Mode"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
PaymentModes
>(
isExpanded:
true
,
hint:
Text
(
'Select Payment mode'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
paymentModes
.
map
(
(
paymenents
)
=>
DropdownMenuItem
<
PaymentModes
>(
value:
paymenents
,
child:
Text
(
paymenents
.
name
??
''
,
...
...
@@ -408,343 +447,365 @@ class _SubmitpaymentrequestionlistsbymodeState
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedPayment
,
onChanged:
(
PaymentModes
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
paymentModes
.
isNotEmpty
)
{
provider
.
selectedPayment
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
paymentModeId
=
value
.
id
!;
provider
.
paymentModeValue
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
paymentModeId
.
toString
(),
);
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
].
contains
(
provider
.
paymentModeValue
))
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
context
=
_globalKey
.
currentContext
;
if
(
context
!=
null
)
{
Scrollable
.
ensureVisible
(
context
,
duration:
Duration
(
milliseconds:
300
,
),
curve:
Curves
.
easeInOut
,
);
}
});
)
.
toList
(),
value:
provider
.
selectedPayment
,
onChanged:
(
PaymentModes
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
paymentModes
.
isNotEmpty
)
{
provider
.
selectedPayment
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
paymentModeId
=
value
.
id
!;
provider
.
paymentModeValue
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
paymentModeId
.
toString
(),
);
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
].
contains
(
provider
.
paymentModeValue
,
))
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
context
=
_globalKey
.
currentContext
;
if
(
context
!=
null
)
{
Scrollable
.
ensureVisible
(
context
,
duration:
Duration
(
milliseconds:
300
,
),
curve:
Curves
.
easeInOut
,
);
}
});
}
}
}
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
errorWidget
(
context
,
provider
.
selectPaymentError
),
if
(
widget
.
mode
==
"other"
)
...[
TextWidget
(
context
,
"Select Approval Employee"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
'Select Approval Employee'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
items:
provider
.
approvalEmployee
.
map
(
(
paymenents
)
=>
DropdownMenuItem
<
Employees
>(
value:
paymenents
,
child:
Text
(
paymenents
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedApprovalEmployee
,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
approvalEmployee
.
isNotEmpty
)
{
provider
.
selectedApprovalEmployee
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedApprovalEmployeeID
=
value
.
id
!;
provider
.
selectedApprovalEmployeeValue
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
paymentModeId
.
toString
(),
);
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
errorWidget
(
context
,
provider
.
selectPaymentError
),
],
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
],
),
),
child:
Center
(
child:
Text
(
"File Attachment"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
errorWidget
(
context
,
provider
.
selectPaymentError
),
if
(
widget
.
mode
==
"other"
)
...[
TextWidget
(
context
,
"Select Approval Employee"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
'Select Approval Employee'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
approvalEmployee
.
map
(
(
paymenents
)
=>
DropdownMenuItem
<
Employees
>(
value:
paymenents
,
child:
Text
(
paymenents
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedApprovalEmployee
,
onChanged:
(
Employees
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
approvalEmployee
.
isNotEmpty
)
{
provider
.
selectedApprovalEmployee
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedApprovalEmployeeID
=
value
.
id
!;
provider
.
selectedApprovalEmployeeValue
=
value
.
name
!;
print
(
"hfjkshfg"
+
provider
.
paymentModeId
.
toString
(),
);
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
),
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)
...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
flex:
4
,
errorWidget
(
context
,
provider
.
selectPaymentError
),
],
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"
${provider.imagePath}
"
,
"
File Attachment
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)
...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
flex:
4
,
child:
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
),
),
),
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
),
),
),
],
),
],
),
),
],
errorWidget
(
context
,
provider
.
FileError
),
),
],
errorWidget
(
context
,
provider
.
FileError
),
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
].
contains
(
provider
.
paymentModeValue
))
...[
SizedBox
(
height:
3
,
key:
_globalKey
),
textControllerWidget
(
context
,
provider
.
bankNameController
,
"Bank Name"
,
"Enter Bank Name"
,
provider
.
updateBankName
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankNameError
),
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
].
contains
(
provider
.
paymentModeValue
))
...[
SizedBox
(
height:
3
,
key:
_globalKey
),
textControllerWidget
(
context
,
provider
.
bankNameController
,
"Bank Name"
,
"Enter Bank Name"
,
provider
.
updateBankName
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankNameError
),
textControllerWidget
(
context
,
provider
.
bankBranchController
,
"Bank Branch"
,
"Enter Bank Branch"
,
provider
.
updateBankBranch
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankBranchError
),
textControllerWidget
(
context
,
provider
.
bankBranchController
,
"Bank Branch"
,
"Enter Bank Branch"
,
provider
.
updateBankBranch
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankBranchError
),
textControllerWidget
(
context
,
provider
.
bankAccNumberController
,
"Account Number"
,
"Enter Account Number"
,
provider
.
updateNumber
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
5
],
focusNodes
[
6
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankNumberError
),
textControllerWidget
(
context
,
provider
.
bankAccNumberController
,
"Account Number"
,
"Enter Account Number"
,
provider
.
updateNumber
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
5
],
focusNodes
[
6
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankNumberError
),
textControllerWidget
(
context
,
provider
.
bankIfscController
,
"Bank IFSC"
,
"Enter Bank IFSC"
,
provider
.
updateIFSC
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankIFSCError
),
],
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
"UPI"
,
].
contains
(
provider
.
paymentModeValue
))
...[
textControllerWidget
(
context
,
provider
.
bankAcHolderController
,
"Bank Account Holder Name"
,
"Enter Bank Account Holder Name"
,
provider
.
updateHolder
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
7
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
bankHolderError
),
]
else
if
(
provider
.
paymentModeValue
==
"UPI"
)
...[
textControllerWidget
(
context
,
provider
.
bankUpiController
,
"UPI ID"
,
"Enter UPI ID"
,
provider
.
updateUPI
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
8
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
UPIError
),
],
],
textControllerWidget
(
context
,
provider
.
bankIfscController
,
"Bank IFSC"
,
"Enter Bank IFSC"
,
provider
.
updateIFSC
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
bankIFSCError
),
],
if
([
"Cheque"
,
"RTGS"
,
"IMPS"
,
"NEFT"
,
"UPI"
,
].
contains
(
provider
.
paymentModeValue
))
...[
textControllerWidget
(
context
,
provider
.
bankAcHolderController
,
"Bank Account Holder Name"
,
"Enter Bank Account Holder Name"
,
provider
.
updateHolder
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
7
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
bankHolderError
),
]
else
if
(
provider
.
paymentModeValue
==
"UPI"
)
...[
textControllerWidget
(
context
,
provider
.
bankUpiController
,
"UPI ID"
,
"Enter UPI ID"
,
provider
.
updateUPI
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
8
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
UPIError
),
],
],
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
addPaymentRequestionSubmitAPI
(
context
,
widget
.
mode
,
provider
.
selectedApprovalEmployeeID
,
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
provider
.
addPaymentRequestionSubmitAPI
(
context
,
widget
.
mode
,
provider
.
selectedApprovalEmployeeID
,
);
},
child:
Container
(
height:
45
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
),
),
onWillPop:
()
{
provider
.
resetForm
();
return
onBackPressed
(
context
);
onWillPop:
()
{
provider
.
resetForm
();
return
onBackPressed
(
context
);
},
);
},
);
},
);
)
:
NoNetwork
(
context
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
...
...
lib/screens/genTracker/ComplaintHistory.dart
View file @
ee178d55
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/GeneratorDetailsProvider.dart'
;
...
...
@@ -18,10 +20,18 @@ class Complainthistory extends StatefulWidget {
}
class
_ComplainthistoryState
extends
State
<
Complainthistory
>
{
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
((
_
)
{
var
details
=
Provider
.
of
<
Generatordetailsprovider
>(
context
,
...
...
@@ -38,10 +48,27 @@ class _ComplainthistoryState extends State<Complainthistory> {
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Generatordetailsprovider
>(
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"
?
Consumer
<
Generatordetailsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
...
...
@@ -153,6 +180,6 @@ class _ComplainthistoryState extends State<Complainthistory> {
),
);
},
);
):
NoNetwork
(
context
);
}
}
lib/screens/genTracker/GenTrackerDashboard.dart
View file @
ee178d55
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/commonWidgets.dart'
;
import
'package:generp/screens/genTracker/ScanEnterGeneratorIDScreen.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonServices.dart'
;
class
Gentrackerdashboard
extends
StatefulWidget
{
const
Gentrackerdashboard
({
super
.
key
});
...
...
@@ -15,14 +17,45 @@ class Gentrackerdashboard extends StatefulWidget {
}
class
_GentrackerdashboardState
extends
State
<
Gentrackerdashboard
>
{
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
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Platform
.
isAndroid
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
);
:
_scaffold
(
context
)
:
NoNetwork
(
context
)
;
}
Widget
_scaffold
(
BuildContext
context
)
{
...
...
lib/screens/genTracker/GeneratorDetails.dart
View file @
ee178d55
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/GeneratorDetailsProvider.dart'
;
...
...
@@ -9,6 +10,7 @@ import 'package:url_launcher/url_launcher.dart';
import
'../../Notifiers/HomeScreenNotifier.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonServices.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'ScanEnterGeneratorIDScreen.dart'
;
...
...
@@ -29,10 +31,19 @@ class Generatordetails extends StatefulWidget {
}
class
_GeneratordetailsState
extends
State
<
Generatordetails
>
{
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
((
_
)
{
var
details
=
Provider
.
of
<
Generatordetailsprovider
>(
context
,
...
...
@@ -62,9 +73,27 @@ class _GeneratordetailsState extends State<Generatordetails> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer2
<
Generatordetailsprovider
,
HomescreenNotifier
>(
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"
?
Consumer2
<
Generatordetailsprovider
,
HomescreenNotifier
>(
builder:
(
context
,
provider
,
Homeprovider
,
child
)
{
var
sendwidget
=
SizedBox
(
width:
0
);
return
WillPopScope
(
...
...
@@ -862,7 +891,7 @@ class _GeneratordetailsState extends State<Generatordetails> {
),
);
},
);
):
NoNetwork
(
context
);
}
}
...
...
lib/screens/genTracker/RegisterComplaint.dart
View file @
ee178d55
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_svg/svg.dart'
;
...
...
@@ -10,6 +11,7 @@ import 'package:provider/provider.dart';
import
'../../Models/loadGeneratorDetailsResponse.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonServices.dart'
;
class
Registercomplaint
extends
StatefulWidget
{
const
Registercomplaint
({
super
.
key
});
...
...
@@ -19,525 +21,662 @@ class Registercomplaint extends StatefulWidget {
}
class
_RegistercomplaintState
extends
State
<
Registercomplaint
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
TextEditingController
running_hrs
=
TextEditingController
();
TextEditingController
Complaint_Note
=
TextEditingController
();
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer2
<
Generatordetailsprovider
,
HomescreenNotifier
>(
builder:
(
context
,
provider
,
homeProvider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
appBar:
appbar
(
context
,
"Register Complaint"
),
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
SizedBox
(
height:
5.0
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
0
,
10
,
0
),
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
});
}
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
SizedBox
(
height:
25
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"Customer Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
)),
),
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
10
,
10
,
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
)
),
child:
Column
(
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
children:
[
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Expanded
(
flex:
1
,
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
),
),
SizedBox
(
width:
10
),
@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"
?
Consumer2
<
Generatordetailsprovider
,
HomescreenNotifier
>(
builder:
(
context
,
provider
,
homeProvider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
appBar:
appbar
(
context
,
"Register Complaint"
),
body:
Container
(
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
SizedBox
(
height:
5.0
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
0
,
10
,
0
),
Expanded
(
flex:
9
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"
${provider.cname}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),),
Text
(
"
${provider.aname}
"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
// Text("Gen Pvt. Ltd"),
],
),
),
),
],
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
SizedBox
(
height:
25
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"Customer Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
),
),
),
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
10
,
10
,
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
2
,
(
j
)
{
final
textheads
=
[
"Product Name"
,
"Engine ID"
];
final
textSubheads
=
[
provider
.
spname
,
provider
.
engineNo
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
),
child:
Column
(
child:
Column
(
children:
[
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
Expanded
(
flex:
1
,
child:
SvgPicture
.
asset
(
"assets/svg/se_block_head.svg"
,
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
9
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
textheads
[
j
].
toString
(),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
),),
],
children:
[
Text
(
"
${provider.cname}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
),
),
Expanded
(
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
textSubheads
[
j
].
toString
(),
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
],
Text
(
"
${provider.aname}
"
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Color
(
0xFF818181
),
),
),
),
// Text("Gen Pvt. Ltd"),
],
),
]
,
)
,
),
],
),
);
}),
SizedBox
(
height:
10.0
),
],
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"Complaint Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
Color
(
0xFF818181
)),
),
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
10
,
10
,
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
)
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
child:
Text
(
"Complaint Type"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintTypeList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Complaint Type'
,
style:
TextStyle
(
fontSize:
14
,
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
2
,
(
j
)
{
final
textheads
=
[
"Product Name"
,
"Engine ID"
,
];
final
textSubheads
=
[
provider
.
spname
,
provider
.
engineNo
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
3
,
),
child:
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Expanded
(
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
textheads
[
j
]
.
toString
(),
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
],
),
),
overflow:
TextOverflow
.
ellipsis
,
),
),
],
),
items:
provider
.
complaintTypeDropdown
.
map
(
(
complaintType
)
=>
DropdownMenuItem
<
ComplaintTypeList
>(
value:
complaintType
,
child:
Text
(
complaintType
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
Expanded
(
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
textSubheads
[
j
]
.
toString
(),
style:
TextStyle
(
color:
Color
(
0xFF818181
,
),
),
),
],
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedComplaintType
,
onChanged:
(
ComplaintTypeList
?
value
)
{
if
(
value
!=
null
)
{
if
(
provider
.
complaintCategorydropdown
.
isNotEmpty
)
{
provider
.
selectedComplaintType
=
value
;
print
(
"Selected Complaint Type:
${value
.name}
, ID:
${value.id}
"
,
);
provider
.
selectedType
=
value
?.
name
;
provider
.
selectedTypeId
=
value
?.
id
;
print
(
"hfjkshfg"
+
provider
.
selectedTypeId
.
toString
(),
);
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
],
),
],
),
),
],
),
);
}),
SizedBox
(
height:
10.0
),
],
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
child:
Text
(
"Complaint Category"
,
style:
TextStyle
(
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"Complaint Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),),
color:
Color
(
0xFF818181
),
),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintCategoryList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Complaint Category'
,
style:
TextStyle
(
fontSize:
14
,
),
Container
(
padding:
EdgeInsets
.
fromLTRB
(
10
,
10
,
10
,
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
),
child:
Text
(
"Complaint Type"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintTypeList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Complaint Type'
,
style:
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
overflow:
TextOverflow
.
ellipsis
,
),
],
),
],
items:
provider
.
complaintTypeDropdown
.
map
(
(
complaintType
,
)
=>
DropdownMenuItem
<
ComplaintTypeList
>(
value:
complaintType
,
child:
Text
(
complaintType
.
name
??
''
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedComplaintType
,
onChanged:
(
ComplaintTypeList
?
value
,
)
{
if
(
value
!=
null
)
{
if
(
provider
.
complaintCategorydropdown
.
isNotEmpty
)
{
provider
.
selectedComplaintType
=
value
;
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
provider
.
selectedType
=
value
?.
name
;
provider
.
selectedTypeId
=
value
?.
id
;
print
(
"hfjkshfg"
+
provider
.
selectedTypeId
.
toString
(),
);
}
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
items:
provider
.
complaintCategorydropdown
.
map
(
(
Category
)
=>
DropdownMenuItem
<
ComplaintCategoryList
>(
value:
Category
,
child:
Text
(
Category
.
name
??
""
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedCategoryType
,
onChanged:
(
ComplaintCategoryList
?
value
)
{
if
(
provider
.
complaintCategorydropdown
.
isNotEmpty
)
{
provider
.
selectedCategoryType
=
value
;
provider
.
selectedCategory
=
value
?.
name
;
provider
.
selectedCategoryId
=
value
?.
id
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
],
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
),
child:
Text
(
"Complaint Category"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
],
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
child:
Text
(
"Select Description"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintDescriptionList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Description'
,
style:
TextStyle
(
fontSize:
14
,
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintCategoryList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Complaint Category'
,
style:
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
overflow:
TextOverflow
.
ellipsis
,
),
],
),
],
items:
provider
.
complaintCategorydropdown
.
map
(
(
Category
,
)
=>
DropdownMenuItem
<
ComplaintCategoryList
>(
value:
Category
,
child:
Text
(
Category
.
name
??
""
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedCategoryType
,
onChanged:
(
ComplaintCategoryList
?
value
,
)
{
if
(
provider
.
complaintCategorydropdown
.
isNotEmpty
)
{
provider
.
selectedCategoryType
=
value
;
provider
.
selectedCategory
=
value
?.
name
;
provider
.
selectedCategoryId
=
value
?.
id
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
items:
provider
.
complaintDescriptionDropdown
.
map
(
(
Description
)
=>
DropdownMenuItem
<
ComplaintDescriptionList
>(
value:
Description
,
child:
Text
(
Description
.
name
??
""
,
style:
const
TextStyle
(
fontSize:
14
,
],
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
),
child:
Text
(
"Select Description"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
ComplaintDescriptionList
>(
isExpanded:
true
,
hint:
const
Row
(
children:
[
Expanded
(
child:
Text
(
'Select Description'
,
style:
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedDescriptionType
,
onChanged:
(
ComplaintDescriptionList
?
value
)
{
if
(
provider
.
complaintDescriptionDropdown
.
isNotEmpty
)
{
provider
.
selectedDescriptionType
=
value
;
provider
.
selectedDescription
=
value
?.
name
;
provider
.
selectedDescriptionId
=
value
?.
id
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
items:
provider
.
complaintDescriptionDropdown
.
map
(
(
Description
,
)
=>
DropdownMenuItem
<
ComplaintDescriptionList
>(
value:
Description
,
child:
Text
(
Description
.
name
??
""
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
provider
.
selectedDescriptionType
,
onChanged:
(
ComplaintDescriptionList
?
value
,
)
{
if
(
provider
.
complaintDescriptionDropdown
.
isNotEmpty
)
{
provider
.
selectedDescriptionType
=
value
;
provider
.
selectedDescription
=
value
?.
name
;
provider
.
selectedDescriptionId
=
value
?.
id
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
],
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
child:
Text
(
"Duration"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),),
),
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
controller:
running_hrs
,
keyboardType:
TextInputType
.
text
,
decoration:
InputDecoration
(
),
hintText:
"Enter Running Number"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
),
child:
Text
(
"Duration"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
child:
Text
(
"Message"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),),
),
Container
(
height:
150
,
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
child:
TextFormField
(
maxLines:
6
,
controller:
Complaint_Note
,
keyboardType:
TextInputType
.
text
,
decoration:
InputDecoration
(
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
,
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
controller:
running_hrs
,
keyboardType:
TextInputType
.
text
,
decoration:
InputDecoration
(
hintText:
"Enter Running Number"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
hintText:
"Enter Message"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
SizedBox
(
height:
10.0
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
,
),
child:
Text
(
"Message"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
),
),
),
Container
(
height:
150
,
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
,
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
maxLines:
6
,
controller:
Complaint_Note
,
keyboardType:
TextInputType
.
text
,
decoration:
InputDecoration
(
hintText:
"Enter Message"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
)
,
]
,
),
],
),
),
),
SizedBox
(
height:
65.0
),
],
),
SizedBox
(
height:
65.0
),
],
),
),
],
),
],
),
),
),
floatingActionButton:
Container
(
child:
InkWell
(
onTap:
()
{
provider
.
SubmitComplaintFunction
(
context
,
homeProvider
,
provider
.
genID
,
provider
.
selectedTypeId
,
provider
.
selectedDescriptionId
,
running_hrs
.
text
,
Complaint_Note
.
text
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
10.0
),
),
child:
Text
(
"Submit Complaint"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
15
,
color:
Colors
.
white
),
floatingActionButton:
Container
(
child:
InkWell
(
onTap:
()
{
provider
.
SubmitComplaintFunction
(
context
,
homeProvider
,
provider
.
genID
,
provider
.
selectedTypeId
,
provider
.
selectedDescriptionId
,
running_hrs
.
text
,
Complaint_Note
.
text
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
margin:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
),
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
10.0
),
),
child:
Text
(
"Submit Complaint"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
15
,
color:
Colors
.
white
,
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
),
),
);
},
);
);
},
)
:
NoNetwork
(
context
);
}
}
lib/screens/genTracker/ScanEnterGeneratorIDScreen.dart
View file @
ee178d55
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/Notifiers/GeneratorDetailsProvider.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
...
...
@@ -24,10 +25,17 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
TextEditingController
genIDcontroller
=
TextEditingController
();
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
((
_
)
{
var
provider
=
Provider
.
of
<
Generatordetailsprovider
>(
context
,
...
...
@@ -50,6 +58,7 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
super
.
dispose
();
genIDcontroller
.
clear
();
genIDcontroller
.
dispose
();
_connectivity
.
disposeStream
();
}
...
...
@@ -57,7 +66,18 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Generatordetailsprovider
>(
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"
?
Consumer
<
Generatordetailsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
...
...
@@ -134,7 +154,7 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
),
);
},
);
):
NoNetwork
(
context
);
}
Future
<
void
>
_showgenIdBottomSheet
(
BuildContext
context
)
{
...
...
lib/screens/inventory/GeneratorPartDetailsScreen.dart
View file @
ee178d55
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/screens/finance/FileViewer.dart'
;
import
'package:generp/screens/notifierExports.dart'
;
...
...
@@ -23,11 +24,17 @@ class _GeneratorPartDetailsScreenState
TextEditingController
descriptioncontroller
=
TextEditingController
();
TextEditingController
quantitycontroller
=
TextEditingController
();
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
((
_
)
{
var
homeProvider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
...
...
@@ -36,6 +43,12 @@ class _GeneratorPartDetailsScreenState
initialiseFunction
(
context
,
homeProvider
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
void
initialiseFunction
(
BuildContext
context
,
homeProvider
)
async
{
var
inventoryProvider
=
Provider
.
of
<
InventoryProvider
>(
...
...
@@ -52,7 +65,19 @@ class _GeneratorPartDetailsScreenState
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer2
<
InventoryProvider
,
HomescreenNotifier
>(
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"
?
Consumer2
<
InventoryProvider
,
HomescreenNotifier
>(
builder:
(
context
,
provider
,
homeProvider
,
child
)
{
return
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
...
...
@@ -546,7 +571,8 @@ class _GeneratorPartDetailsScreenState
),
);
},
);
):
NoNetwork
(
context
);
}
Future
<
void
>
_showStockIssueBottomSheet
(
BuildContext
context
,
type
)
{
...
...
lib/screens/inventory/InventoryScreen.dart
View file @
ee178d55
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:generp/screens/notifierExports.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
...
...
@@ -7,6 +8,7 @@ import 'package:provider/provider.dart';
import
'package:qr_code_scanner/qr_code_scanner.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonServices.dart'
;
class
InventoryScreen
extends
StatefulWidget
{
const
InventoryScreen
({
super
.
key
});
...
...
@@ -18,11 +20,17 @@ class InventoryScreen extends StatefulWidget {
class
_InventoryScreenState
extends
State
<
InventoryScreen
>
{
FocusNode
partIDfocusNode
=
FocusNode
();
TextEditingController
partIDcontroller
=
TextEditingController
();
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
((
_
)
{
var
inventoryProvider
=
Provider
.
of
<
InventoryProvider
>(
context
,
...
...
@@ -33,14 +41,38 @@ class _InventoryScreenState extends State<InventoryScreen> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Platform
.
isAndroid
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
top:
false
,
bottom:
true
,
child:
_scaffold
(
context
)),
)
:
_scaffold
(
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
)
{
...
...
lib/screens/order/addOrder.dart
View file @
ee178d55
...
...
@@ -13,6 +13,8 @@ import 'package:provider/provider.dart';
import
'../../Models/ordersModels/AddOrderViewResponse.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
AddorderScreen
extends
StatefulWidget
{
final
pageTitleName
;
...
...
@@ -30,10 +32,17 @@ class _AddorderScreenState extends State<AddorderScreen> {
List
<
FocusNode
>
focusNodes
=
List
.
generate
(
10
,
(
index
)
=>
FocusNode
());
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
<
Addorderprovider
>(
context
,
listen:
false
);
if
(
provider
.
dateNow
==
null
)
{
...
...
@@ -50,6 +59,8 @@ class _AddorderScreenState extends State<AddorderScreen> {
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
focusNode
.
dispose
();
focusNodetpc
.
dispose
();
_connectivity
.
disposeStream
();
super
.
dispose
();
}
...
...
@@ -60,47 +71,45 @@ class _AddorderScreenState extends State<AddorderScreen> {
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Addorderprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"
${widget.pageTitleName}
"
,
provider
.
resetForm
,
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Account"
),
InkResponse
(
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
).
requestFocus
(
focusNode
);
}
},
child:
Container
(
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
ListTile
(
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"
?
Consumer
<
Addorderprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
white
,
appBar:
appbar2
(
context
,
"
${widget.pageTitleName}
"
,
provider
.
resetForm
,
SizedBox
(
width:
0
),
),
body:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
SingleChildScrollView
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Account"
),
InkResponse
(
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
...
...
@@ -108,1331 +117,1471 @@ class _AddorderScreenState extends State<AddorderScreen> {
FocusScope
.
of
(
context
).
requestFocus
(
focusNode
);
}
},
title:
TextFormField
(
focusNode:
focusNode
,
onTapUpOutside:
(
event
)
{
focusNode
.
unfocus
();
},
controller:
provider
.
dropDownSearchController
,
onChanged:
(
value
)
async
{
Future
.
delayed
(
Duration
(
milliseconds:
100
),
()
async
{
await
provider
.
ordersAddOrderSelectAccountAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedAccountID
,
value
,
);
},
);
},
decoration:
InputDecoration
(
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
8
,
),
hintText:
'Select Account Type'
,
hintStyle:
const
TextStyle
(
fontSize:
14
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
trailing:
InkResponse
(
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
).
requestFocus
(
focusNode
);
}
},
child:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
child:
Container
(
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
),
),
),
),
if
(
provider
.
accountList
.
isNotEmpty
&&
focusNode
.
hasFocus
)
...[
Card
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
height:
widget
.
mode
==
"self"
?
50
:
150
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Scrollbar
(
thickness:
2.5
,
radius:
Radius
.
circular
(
6
),
thumbVisibility:
true
,
child:
ListView
.
builder
(
itemCount:
provider
.
accountList
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
InkResponse
(
onTap:
()
async
{
if
(
provider
.
accountList
.
isNotEmpty
)
{
provider
.
selectedAccountList
=
provider
.
accountList
[
index
];
print
(
"Selected Complaint Type:
${provider.accountList[index].text}
, ID:
${provider.accountList[index].id}
"
,
);
provider
.
selectedAccountID
=
provider
.
accountList
[
index
].
id
!;
provider
.
selectedAccountName
=
provider
.
accountList
[
index
].
text
!;
print
(
"hfjkshfg"
+
provider
.
selectedAccountID
.
toString
(),
);
provider
.
dropDownSearchController
.
text
=
provider
.
accountList
[
index
].
text
!;
provider
.
ordersAddOrderAccountDetailsAPIFunction
(
child:
ListTile
(
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
,
).
requestFocus
(
focusNode
);
}
},
title:
TextFormField
(
focusNode:
focusNode
,
onTapUpOutside:
(
event
)
{
focusNode
.
unfocus
();
},
controller:
provider
.
dropDownSearchController
,
onChanged:
(
value
)
async
{
Future
.
delayed
(
Duration
(
milliseconds:
100
),
()
async
{
await
provider
.
ordersAddOrderSelectAccountAPIFunction
(
context
,
widget
.
mode
,
provider
.
selectedAccountID
,
value
,
);
}
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
provider
.
accountList
=
[];
},
child:
SizedBox
(
height:
45
,
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
provider
.
accountList
[
index
].
text
!,
),
),
},
);
},
decoration:
InputDecoration
(
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
8
,
),
hintText:
'Select Account Type'
,
hintStyle:
const
TextStyle
(
fontSize:
14
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
);
},
),
),
),
),
],
errorWidget
(
context
,
provider
.
selectAccountError
),
if
(
widget
.
mode
==
"admin"
)
...[
TextWidget
(
context
,
"Sales Person"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
"Select Sales Person"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
employees
.
map
(
(
e
)
=>
DropdownMenuItem
<
Employees
>(
value:
e
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedEmployees
,
onChanged:
(
Employees
?
value
)
{
if
(
provider
.
employees
.
isNotEmpty
)
{
provider
.
selectedEmployees
=
value
;
provider
.
selectedEmployeeID
=
value
!.
id
!;
provider
.
selectedEmployeeName
=
value
!.
name
!;
),
trailing:
InkResponse
(
onTap:
()
{
if
(
focusNode
.
hasFocus
)
{
focusNode
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
,
).
requestFocus
(
focusNode
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
child:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
),
),
),
]
,
)
,
),
),
],
TextWidget
(
context
,
"Order Received Date"
),
GestureDetector
(
onTap:
()
{
provider
.
showDatePickerDialog
(
context
);
},
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Expanded
(
if
(
provider
.
accountList
.
isNotEmpty
&&
focusNode
.
hasFocus
)
...[
Card
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
height:
50
,
alignment:
Alignment
.
center
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
)
,
height:
widget
.
mode
==
"self"
?
50
:
150
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
controller:
provider
.
orderReceivedDateController
,
keyboardType:
TextInputType
.
text
,
enabled:
false
,
maxLines:
1
,
readOnly:
true
,
onChanged:
(
value
)
{},
decoration:
InputDecoration
(
hintText:
"Enter Date"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
enabledBorder:
InputBorder
.
none
,
disabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
borderRadius:
BorderRadius
.
circular
(
16
),
),
),
),
],
),
),
errorWidget
(
context
,
provider
.
orderDateError
),
child:
Scrollbar
(
thickness:
2.5
,
radius:
Radius
.
circular
(
6
),
thumbVisibility:
true
,
child:
ListView
.
builder
(
itemCount:
provider
.
accountList
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
InkResponse
(
onTap:
()
async
{
if
(
provider
.
accountList
.
isNotEmpty
)
{
provider
.
selectedAccountList
=
provider
.
accountList
[
index
];
textControllerWidge
t
(
context
,
provider
.
billingNameController
,
"Billing Name"
,
"Enter Billing Name"
,
provider
.
onChangedBilling
Name
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
billingNameError
),
TextWidget
(
context
,
"Billing State"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>
(
isExpanded:
true
,
hint:
Text
(
"Select State"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
billingStates
.
map
(
(
e
)
=>
DropdownMenuItem
<
States
>
(
v
al
ue:
e
,
prin
t
(
"Selected Complaint Type:
${provider.accountList[index].text}
, ID:
${provider.accountList[index].id}
"
,
);
provider
.
selectedAccountID
=
provider
.
accountList
[
index
].
id
!;
provider
.
selectedAccount
Name
=
provider
.
accountList
[
index
]
.
text
!;
print
(
"hfjkshfg"
+
provider
.
selectedAccountID
.
toString
(
),
);
provider
.
dropDownSearchController
.
text
=
provider
.
accountList
[
index
]
.
text
!;
provider
.
ordersAddOrderAccountDetailsAPIFunction
(
context
,
provider
.
selectedAccountID
,
);
}
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
provider
.
accountList
=
[];
},
child:
SizedBox
(
height:
45
,
child:
Align
(
al
ignment:
Alignment
.
centerLeft
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
provider
.
accountList
[
index
].
text
!,
),
),
)
.
toList
(),
value:
provider
.
selecetdBillingStates
,
onChanged:
(
States
?
value
)
{
if
(
provider
.
billingStates
.
isNotEmpty
)
{
provider
.
selecetdBillingStates
=
value
;
provider
.
selectedBillingStateID
=
value
!.
id
!;
provider
.
selectedBillingStateName
=
value
!.
name
!;
if
(
provider
.
billingDistricts
.
isNotEmpty
)
{
provider
.
billingDistricts
.
clear
();
// provider.selectedBillingDistricts=null;
provider
.
selectedBillingDistrictId
=
null
;
provider
.
selectedBillingDistrictValue
=
""
;
}
provider
.
getDistrictAPI
(
context
,
provider
.
selectedBillingStateID
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
)
,
)
,
)
;
}
,
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingStateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingStateError
),
TextWidget
(
context
,
"Billing District"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
isExpanded:
true
,
hint:
Text
(
"Select District"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
billingDistricts
.
map
(
(
e
)
=>
DropdownMenuItem
<
Districts
>(
value:
e
,
child:
Text
(
e
.
district
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedBillingDistricts
,
onChanged:
(
Districts
?
value
)
{
if
(
provider
.
billingDistricts
.
isNotEmpty
)
{
provider
.
selectedBillingDistricts
=
value
;
provider
.
selectedBillingDistrictId
=
value
!.
id
!;
provider
.
selectedBillingDistrictValue
=
value
!.
district
!;
if
(
provider
.
billingSubLocations
.
isNotEmpty
)
{
provider
.
billingSubLocations
.
clear
();
// provider.selectedBillingSubLocations = null;
provider
.
selectedBillingSubLocID
=
null
;
provider
.
selectedBillingSubLocValue
=
""
;
}
provider
.
getSubLocationAPI
(
context
,
provider
.
selectedBillingDistrictId
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
errorWidget
(
context
,
provider
.
selectAccountError
),
if
(
widget
.
mode
==
"admin"
)
...[
TextWidget
(
context
,
"Sales Person"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Employees
>(
isExpanded:
true
,
hint:
Text
(
"Select Sales Person"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
employees
.
map
(
(
e
)
=>
DropdownMenuItem
<
Employees
>(
value:
e
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedEmployees
,
onChanged:
(
Employees
?
value
)
{
if
(
provider
.
employees
.
isNotEmpty
)
{
provider
.
selectedEmployees
=
value
;
provider
.
selectedEmployeeID
=
value
!.
id
!;
provider
.
selectedEmployeeName
=
value
!.
name
!;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingDistrictSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
],
),
),
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingDistrictError
),
TextWidget
(
context
,
"Billing Sub Location"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
hint:
Text
(
"Select Sub Locality"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
billingSubLocations
.
map
(
(
e
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
e
,
child:
Text
(
e
.
subLocality
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
TextWidget
(
context
,
"Order Received Date"
),
GestureDetector
(
onTap:
()
{
provider
.
showDatePickerDialog
(
context
);
},
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Expanded
(
child:
Container
(
height:
50
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
controller:
provider
.
orderReceivedDateController
,
keyboardType:
TextInputType
.
text
,
enabled:
false
,
maxLines:
1
,
readOnly:
true
,
onChanged:
(
value
)
{},
decoration:
InputDecoration
(
hintText:
"Enter Date"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFB4BEC0
),
fontSize:
14
,
),
)
.
toList
(),
value:
provider
.
selectedBillingSubLocations
,
onChanged:
(
SubLocations
?
value
)
{
if
(
provider
.
billingSubLocations
.
isNotEmpty
)
{
provider
.
selectedBillingSubLocations
=
value
;
provider
.
selectedBillingSubLocID
=
value
!.
id
!;
provider
.
selectedBillingSubLocValue
=
value
!.
subLocality
!;
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
enabledBorder:
InputBorder
.
none
,
disabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingSubLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
],
),
),
errorWidget
(
context
,
provider
.
selectedBillingSubLocError
),
textControllerWidget
(
context
,
provider
.
billingAddressController
,
"Billing Address"
,
"Enter Billing Address"
,
provider
.
onChangedBillingAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
billingAddressError
),
textControllerWidget
(
context
,
provider
.
billingPincodeController
,
"Billing Pin code"
,
"Enter Billing Pin code"
,
provider
.
onChangedBillingPincode
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
6
,
),
errorWidget
(
context
,
provider
.
billingPincodeError
),
),
errorWidget
(
context
,
provider
.
orderDateError
),
TextWidget
(
context
,
"Dispatch State"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>(
isExpanded:
true
,
hint:
Text
(
"Select State"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
dispatchStates
.
map
(
(
e
)
=>
DropdownMenuItem
<
States
>(
value:
e
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
textControllerWidget
(
context
,
provider
.
billingNameController
,
"Billing Name"
,
"Enter Billing Name"
,
provider
.
onChangedBillingName
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
0
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
billingNameError
),
TextWidget
(
context
,
"Billing State"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>(
isExpanded:
true
,
hint:
Text
(
"Select State"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
billingStates
.
map
(
(
e
)
=>
DropdownMenuItem
<
States
>(
value:
e
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selecetdBillingStates
,
onChanged:
(
States
?
value
)
{
if
(
provider
.
billingStates
.
isNotEmpty
)
{
provider
.
selecetdBillingStates
=
value
;
provider
.
selectedBillingStateID
=
value
!.
id
!;
provider
.
selectedBillingStateName
=
value
!.
name
!;
if
(
provider
.
billingDistricts
.
isNotEmpty
)
{
provider
.
billingDistricts
.
clear
();
// provider.selectedBillingDistricts=null;
provider
.
selectedBillingDistrictId
=
null
;
provider
.
selectedBillingDistrictValue
=
""
;
}
provider
.
getDistrictAPI
(
context
,
provider
.
selectedBillingStateID
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
)
.
toList
(),
value:
provider
.
selecetdDispatchStates
,
onChanged:
(
States
?
value
)
{
if
(
provider
.
dispatchStates
.
isNotEmpty
)
{
provider
.
selecetdDispatchStates
=
value
;
provider
.
selectedDispatchStateID
=
value
!.
id
!;
provider
.
selectedDispatchStateName
=
value
!.
name
!;
if
(
provider
.
dispatchDistricts
.
isNotEmpty
)
{
provider
.
dispatchDistricts
.
clear
();
// provider.selectedDispatchDistricts = null;
provider
.
selectedDispatchDistrictId
=
null
;
provider
.
selectedDispatchDistrictValue
=
""
;
}
provider
.
getDispatchDistrictAPI
(
context
,
provider
.
selectedDispatchStateID
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
name
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingStateSearchController
.
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
)
{
provider
.
dispatchStateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchStateError
),
//dd
TextWidget
(
context
,
"Dispatch District"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
isExpanded:
true
,
hint:
Text
(
"Select District"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
dispatchDistricts
.
map
(
(
e
)
=>
DropdownMenuItem
<
Districts
>(
value:
e
,
child:
Text
(
e
.
district
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedDispatchDistricts
,
onChanged:
(
Districts
?
value
)
{
if
(
provider
.
dispatchDistricts
.
isNotEmpty
)
{
provider
.
selectedDispatchDistricts
=
value
;
provider
.
selectedDispatchDistrictId
=
value
!.
id
!;
provider
.
selectedDispatchDistrictValue
=
value
!.
district
!;
if
(
provider
.
dispatchSubLocations
.
isNotEmpty
)
{
provider
.
dispatchSubLocations
.
clear
();
// provider.selectedDispatchSubLocations=null;
provider
.
selectedDispatchSubLocID
=
null
;
provider
.
selectedDispatchSubLocValue
=
""
;
}
provider
.
getDispatchSubLocationAPI
(
context
,
provider
.
selectedDispatchDistrictId
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
),
errorWidget
(
context
,
provider
.
selectedBillingStateError
,
),
TextWidget
(
context
,
"Billing District"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
isExpanded:
true
,
hint:
Text
(
"Select District"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
billingDistricts
.
map
(
(
e
)
=>
DropdownMenuItem
<
Districts
>(
value:
e
,
child:
Text
(
e
.
district
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedBillingDistricts
,
onChanged:
(
Districts
?
value
)
{
if
(
provider
.
billingDistricts
.
isNotEmpty
)
{
provider
.
selectedBillingDistricts
=
value
;
provider
.
selectedBillingDistrictId
=
value
!.
id
!;
provider
.
selectedBillingDistrictValue
=
value
!.
district
!;
if
(
provider
.
billingSubLocations
.
isNotEmpty
)
{
provider
.
billingSubLocations
.
clear
();
// provider.selectedBillingSubLocations = null;
provider
.
selectedBillingSubLocID
=
null
;
provider
.
selectedBillingSubLocValue
=
""
;
}
provider
.
getSubLocationAPI
(
context
,
provider
.
selectedBillingDistrictId
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
.
billingDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingDistrictSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
dispatchDistrictSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
],
),
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchDistrictError
),
TextWidget
(
context
,
"Dispatch Sub Location"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
hint:
Text
(
"Select Sub Locality"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
dispatchSubLocations
.
map
(
(
e
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
e
,
child:
Text
(
e
.
subLocality
!,
style:
const
TextStyle
(
fontSize:
14
,
),
errorWidget
(
context
,
provider
.
selectedBillingDistrictError
,
),
TextWidget
(
context
,
"Billing Sub Location"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
hint:
Text
(
"Select Sub Locality"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
billingSubLocations
.
map
(
(
e
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
e
,
child:
Text
(
e
.
subLocality
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedBillingSubLocations
,
onChanged:
(
SubLocations
?
value
)
{
if
(
provider
.
billingSubLocations
.
isNotEmpty
)
{
provider
.
selectedBillingSubLocations
=
value
;
provider
.
selectedBillingSubLocID
=
value
!.
id
!;
provider
.
selectedBillingSubLocValue
=
value
!.
subLocality
!;
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
billingSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
billingSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
)
.
toList
(),
value:
provider
.
selectedDispatchSubLocations
,
onChanged:
(
SubLocations
?
value
)
{
if
(
provider
.
dispatchSubLocations
.
isNotEmpty
)
{
provider
.
selectedDispatchSubLocations
=
value
;
provider
.
selectedDispatchSubLocID
=
value
!.
id
!;
provider
.
selectedDispatchSubLocValue
=
value
!.
subLocality
!;
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
billingSubLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
dispatchSubLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchSubLocError
),
//dd
textControllerWidget
(
context
,
provider
.
dispatchAddressController
,
"Dispatch Address"
,
"Enter Dispatch Address"
,
provider
.
onChangedDispatchAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
dispatchAddressError
),
textControllerWidget
(
context
,
provider
.
dispatchPincodeController
,
"Dispatch Pin code"
,
"Enter Dispatch Pin code"
,
provider
.
onChangedDispatchPincode
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
6
,
),
errorWidget
(
context
,
provider
.
dispatchPincodeError
),
textControllerWidget
(
context
,
provider
.
gstController
,
"GST Number"
,
"Enter GST Number"
,
provider
.
onChangedGst
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
gstError
),
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
],
),
),
child:
Center
(
child:
Text
(
"Upload Purchase Order"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
),
errorWidget
(
context
,
provider
.
selectedBillingSubLocError
,
),
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)
...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
),
),
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
),
),
],
textControllerWidget
(
context
,
provider
.
billingAddressController
,
"Billing Address"
,
"Enter Billing Address"
,
provider
.
onChangedBillingAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
1
],
focusNodes
[
2
],
TextInputAction
.
next
,
),
),
],
errorWidget
(
context
,
provider
.
billingAddressError
),
TextWidget
(
context
,
"Unloading Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Unloading Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
unloadingScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
textControllerWidget
(
context
,
provider
.
billingPincodeController
,
"Billing Pin code"
,
"Enter Billing Pin code"
,
provider
.
onChangedBillingPincode
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
2
],
null
,
TextInputAction
.
done
,
6
,
),
errorWidget
(
context
,
provider
.
billingPincodeError
),
TextWidget
(
context
,
"Dispatch State"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
States
>(
isExpanded:
true
,
hint:
Text
(
"Select State"
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
provider
.
dispatchStates
.
map
(
(
e
)
=>
DropdownMenuItem
<
States
>(
value:
e
,
child:
Text
(
e
.
name
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selecetdDispatchStates
,
onChanged:
(
States
?
value
)
{
if
(
provider
.
dispatchStates
.
isNotEmpty
)
{
provider
.
selecetdDispatchStates
=
value
;
provider
.
selectedDispatchStateID
=
value
!.
id
!;
provider
.
selectedDispatchStateName
=
value
!.
name
!;
if
(
provider
.
dispatchDistricts
.
isNotEmpty
)
{
provider
.
dispatchDistricts
.
clear
();
// provider.selectedDispatchDistricts = null;
provider
.
selectedDispatchDistrictId
=
null
;
provider
.
selectedDispatchDistrictValue
=
""
;
}
provider
.
getDispatchDistrictAPI
(
context
,
provider
.
selectedDispatchStateID
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchStateSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchStateSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sate...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
)
.
toList
(),
value:
provider
.
selectedUnloadingScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
unloadingScope
.
isNotEmpty
)
{
provider
.
selectedUnloadingScope
=
value
;
}
},
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
)
{
provider
.
dispatchStateSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
],
),
),
TextWidget
(
context
,
"Freight Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Freight Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
),
errorWidget
(
context
,
provider
.
selectedDispatchStateError
,
),
//dd
TextWidget
(
context
,
"Dispatch District"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
Districts
>(
isExpanded:
true
,
hint:
Text
(
"Select District"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
dispatchDistricts
.
map
(
(
e
)
=>
DropdownMenuItem
<
Districts
>(
value:
e
,
child:
Text
(
e
.
district
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedDispatchDistricts
,
onChanged:
(
Districts
?
value
)
{
if
(
provider
.
dispatchDistricts
.
isNotEmpty
)
{
provider
.
selectedDispatchDistricts
=
value
;
provider
.
selectedDispatchDistrictId
=
value
!.
id
!;
provider
.
selectedDispatchDistrictValue
=
value
!.
district
!;
if
(
provider
.
dispatchSubLocations
.
isNotEmpty
)
{
provider
.
dispatchSubLocations
.
clear
();
// provider.selectedDispatchSubLocations=null;
provider
.
selectedDispatchSubLocID
=
null
;
provider
.
selectedDispatchSubLocValue
=
""
;
}
provider
.
getDispatchSubLocationAPI
(
context
,
provider
.
selectedDispatchDistrictId
,
);
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchDistrictSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchDistrictSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search District...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
district
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
dispatchDistrictSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
items:
provider
.
freightScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchDistrictError
,
),
TextWidget
(
context
,
"Dispatch Sub Location"
),
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
SubLocations
>(
hint:
Text
(
"Select Sub Locality"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
dispatchSubLocations
.
map
(
(
e
)
=>
DropdownMenuItem
<
SubLocations
>(
value:
e
,
child:
Text
(
e
.
subLocality
!,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedDispatchSubLocations
,
onChanged:
(
SubLocations
?
value
)
{
if
(
provider
.
dispatchSubLocations
.
isNotEmpty
)
{
provider
.
selectedDispatchSubLocations
=
value
;
provider
.
selectedDispatchSubLocID
=
value
!.
id
!;
provider
.
selectedDispatchSubLocValue
=
value
!.
subLocality
!;
}
},
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchController:
provider
.
dispatchSubLocSearchController
,
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
8
),
child:
TextFormField
(
controller:
provider
.
dispatchSubLocSearchController
,
decoration:
InputDecoration
(
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
8
,
),
hintText:
'Search Sub Location...'
,
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
)
.
toList
(),
value:
provider
.
selectedFreightScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
freightScope
.
isNotEmpty
)
{
provider
.
selectedFreightScope
=
value
;
}
},
buttonStyleData:
ButtonStyleData
(
height:
50
,
width:
160
,
padding:
const
EdgeInsets
.
only
(
left:
14
,
right:
14
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
),
color:
AppColors
.
text_field_color
,
),
),
searchMatchFn:
(
item
,
searchValue
)
{
return
item
.
value
?.
subLocality
?.
toLowerCase
()
.
contains
(
searchValue
.
toLowerCase
(),
)
??
false
;
},
),
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
provider
.
dispatchSubLocSearchController
.
clear
();
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
iconStyleData:
IconStyleData
(
icon:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
],
),
),
errorWidget
(
context
,
provider
.
selectedDispatchSubLocError
,
),
//dd
textControllerWidget
(
context
,
provider
.
dispatchAddressController
,
"Dispatch Address"
,
"Enter Dispatch Address"
,
provider
.
onChangedDispatchAddress
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
3
],
focusNodes
[
4
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
dispatchAddressError
),
textControllerWidget
(
context
,
provider
.
dispatchPincodeController
,
"Dispatch Pin code"
,
"Enter Dispatch Pin code"
,
provider
.
onChangedDispatchPincode
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
4
],
focusNodes
[
5
],
TextInputAction
.
next
,
6
,
),
errorWidget
(
context
,
provider
.
dispatchPincodeError
),
textControllerWidget
(
context
,
provider
.
gstController
,
"GST Number"
,
"Enter GST Number"
,
provider
.
onChangedGst
,
TextInputType
.
text
,
false
,
null
,
focusNodes
[
5
],
null
,
TextInputAction
.
done
,
),
errorWidget
(
context
,
provider
.
gstError
),
InkResponse
(
onTap:
()
{
_showAttachmentSheet
(
context
);
},
child:
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
10
),
height:
45
,
width:
MediaQuery
.
of
(
context
).
size
.
width
,
decoration:
BoxDecoration
(
color:
Color
(
0xFFE6F6FF
),
borderRadius:
BorderRadius
.
circular
(
12
),
border:
Border
.
all
(
color:
AppColors
.
app_blue
,
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Upload Purchase Order"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
app_blue
,
),
iconSize:
12
,
iconEnabledColor:
Color
(
0xFF2D2D2D
),
iconDisabledColor:
Colors
.
grey
,
),
dropdownStyleData:
DropdownStyleData
(
maxHeight:
200
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
),
color:
AppColors
.
text_field_color
,
),
),
),
if
(
provider
.
imagePicked
==
1
&&
provider
.
imagePath
!=
null
)
...[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
4.0
,
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
),
),
scrollbarTheme:
ScrollbarThemeData
(
radius:
const
Radius
.
circular
(
15
),
thickness:
MaterialStateProperty
.
all
<
double
>(
6
,
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
),
thumbVisibility:
MaterialStateProperty
.
all
<
bool
>(
true
),
),
),
menuItemStyleData:
const
MenuItemStyleData
(
height:
40
,
padding:
EdgeInsets
.
only
(
left:
14
,
right:
14
),
),
],
),
),
],
),
),
TextWidget
(
context
,
"Erection Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Erection Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
TextWidget
(
context
,
"Unloading Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Unloading Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
unloadingScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedUnloadingScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
unloadingScope
.
isNotEmpty
)
{
provider
.
selectedUnloadingScope
=
value
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
items:
provider
.
erectionScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
],
),
),
TextWidget
(
context
,
"Freight Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Freight Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
freightScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedFreightScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
freightScope
.
isNotEmpty
)
{
provider
.
selectedFreightScope
=
value
;
}
},
buttonStyleData:
ButtonStyleData
(
height:
50
,
width:
160
,
padding:
const
EdgeInsets
.
only
(
left:
14
,
right:
14
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
),
color:
AppColors
.
text_field_color
,
),
),
iconStyleData:
IconStyleData
(
icon:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
),
iconSize:
12
,
iconEnabledColor:
Color
(
0xFF2D2D2D
),
iconDisabledColor:
Colors
.
grey
,
),
dropdownStyleData:
DropdownStyleData
(
maxHeight:
200
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
14
),
color:
AppColors
.
text_field_color
,
),
scrollbarTheme:
ScrollbarThemeData
(
radius:
const
Radius
.
circular
(
15
),
thickness:
MaterialStateProperty
.
all
<
double
>(
6
,
),
),
)
.
toList
(),
value:
provider
.
selectedErectionScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
erectionScope
.
isNotEmpty
)
{
provider
.
selectedErectionScope
=
value
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
thumbVisibility:
MaterialStateProperty
.
all
<
bool
>(
true
,
),
),
),
menuItemStyleData:
const
MenuItemStyleData
(
height:
40
,
padding:
EdgeInsets
.
only
(
left:
14
,
right:
14
,
),
),
),
),
],
),
],
),
),
TextWidget
(
context
,
"TPC Applicable"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"TPC Applicable"
,
style:
const
TextStyle
(
fontSize:
14
),
),
TextWidget
(
context
,
"Erection Scope"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"Select Erection Scope"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
erectionScope
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
)
.
toList
(),
value:
provider
.
selectedErectionScope
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
erectionScope
.
isNotEmpty
)
{
provider
.
selectedErectionScope
=
value
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
items:
provider
.
tpcApplicable
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
],
),
),
TextWidget
(
context
,
"TPC Applicable"
),
//dd
DropdownButtonHideUnderline
(
child:
Row
(
children:
[
Expanded
(
child:
DropdownButton2
<
String
>(
hint:
Text
(
"TPC Applicable"
,
style:
const
TextStyle
(
fontSize:
14
),
),
items:
provider
.
tpcApplicable
.
map
(
(
e
)
=>
DropdownMenuItem
<
String
>(
value:
e
!,
child:
Text
(
e
,
style:
const
TextStyle
(
fontSize:
14
,
),
),
),
),
),
)
.
toList
(),
value:
provider
.
selectedTpcStatus
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
tpcApplicable
.
isNotEmpty
)
{
provider
.
selectedTpcStatus
=
value
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
)
.
toList
(),
value:
provider
.
selectedTpcStatus
,
onChanged:
(
String
?
value
)
{
if
(
provider
.
tpcApplicable
.
isNotEmpty
)
{
provider
.
selectedTpcStatus
=
value
;
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
),
],
),
),
),
if
(
provider
.
selectedTpcStatus
==
"Yes"
)
...[
TextWidget
(
context
,
"TPC Agent"
),
if
(
provider
.
selectedTpcStatus
==
"Yes"
)
...[
TextWidget
(
context
,
"TPC Agent"
),
//dd
Container
(
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
ListTile
(
title:
TextFormField
(
focusNode:
focusNodetpc
,
onTapUpOutside:
(
event
)
{
focusNodetpc
.
unfocus
();
},
controller:
provider
.
dropDownTpcSearchController
,
onChanged:
(
value
)
async
{
Future
.
delayed
(
Duration
(
milliseconds:
100
),
()
async
{
await
provider
.
ordersAddOrderTPCAgentFunction
(
context
,
widget
.
mode
,
value
,
//dd
Container
(
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
),
child:
ListTile
(
title:
TextFormField
(
focusNode:
focusNodetpc
,
onTapUpOutside:
(
event
)
{
focusNodetpc
.
unfocus
();
},
controller:
provider
.
dropDownTpcSearchController
,
onChanged:
(
value
)
async
{
Future
.
delayed
(
Duration
(
milliseconds:
100
),
()
async
{
await
provider
.
ordersAddOrderTPCAgentFunction
(
context
,
widget
.
mode
,
value
,
);
},
);
},
);
}
,
decoration:
InputDecoration
(
enabledBorder:
InputBorder
.
non
e
,
focusedBorder:
InputBorder
.
none
,
isDense:
true
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
8
,
),
hintText:
'Select TPC Agent'
,
hintStyle:
const
TextStyle
(
fontSize:
14
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
decoration:
InputDecoration
(
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
isDense:
tru
e
,
contentPadding:
const
EdgeInsets
.
symmetric
(
horizontal:
0
,
vertical:
8
,
)
,
hintText:
'Select TPC Agent'
,
hintStyle:
const
TextStyle
(
fontSize:
14
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
),
),
),
),
trailing:
InkResponse
(
onTap:
()
{
if
(
focusNodetpc
.
hasFocus
)
{
focusNodetpc
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
,
).
requestFocus
(
focusNodetpc
);
}
},
child:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
trailing:
InkResponse
(
onTap:
()
{
if
(
focusNodetpc
.
hasFocus
)
{
focusNodetpc
.
unfocus
();
}
else
{
FocusScope
.
of
(
context
,
).
requestFocus
(
focusNodetpc
);
}
},
child:
SvgPicture
.
asset
(
"assets/svg/arrow_dropdown.svg"
,
height:
25
,
width:
20
,
),
),
),
),
),
),
if
(
provider
.
tpcAgent
.
isNotEmpty
&&
focusNodetpc
.
hasFocus
)
...[
Card
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
height:
150
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Scrollbar
(
thickness:
2.5
,
radius:
Radius
.
circular
(
6
),
thumbVisibility:
true
,
child:
ListView
.
builder
(
itemCount:
provider
.
tpcAgent
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
InkResponse
(
onTap:
()
async
{
if
(
provider
.
tpcAgent
.
isNotEmpty
)
{
provider
.
selectedTpcAgent
=
provider
.
tpcAgent
[
index
];
if
(
provider
.
tpcAgent
.
isNotEmpty
&&
focusNodetpc
.
hasFocus
)
...[
Card
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
0
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
height:
150
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Scrollbar
(
thickness:
2.5
,
radius:
Radius
.
circular
(
6
),
thumbVisibility:
true
,
child:
ListView
.
builder
(
itemCount:
provider
.
tpcAgent
.
length
,
shrinkWrap:
true
,
physics:
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
InkResponse
(
onTap:
()
async
{
if
(
provider
.
tpcAgent
.
isNotEmpty
)
{
provider
.
selectedTpcAgent
=
provider
.
tpcAgent
[
index
];
print
(
"Selected Complaint Type:
${provider.tpcAgent[index].text}
, ID:
${provider.tpcAgent[index].id}
"
,
);
provider
.
selectedTpcAgentID
=
provider
.
tpcAgent
[
index
].
id
!;
provider
.
selectedTpcAgentValue
=
provider
.
tpcAgent
[
index
].
text
!;
print
(
"hfjkshfg"
+
provider
.
selectedTpcAgentID
.
toString
(),
);
provider
.
dropDownTpcSearchController
.
text
=
provider
.
tpcAgent
[
index
].
text
!;
}
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
// provider.tpcAgent = [];
},
child:
SizedBox
(
height:
45
,
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
provider
.
tpcAgent
[
index
].
text
!,
print
(
"Selected Complaint Type:
${provider.tpcAgent[index].text}
, ID:
${provider.tpcAgent[index].id}
"
,
);
provider
.
selectedTpcAgentID
=
provider
.
tpcAgent
[
index
].
id
!;
provider
.
selectedTpcAgentValue
=
provider
.
tpcAgent
[
index
]
.
text
!;
print
(
"hfjkshfg"
+
provider
.
selectedTpcAgentID
.
toString
(),
);
provider
.
dropDownTpcSearchController
.
text
=
provider
.
tpcAgent
[
index
]
.
text
!;
}
// provider.ordersAddPaymentSelectOrderAPIFunction(context, provider.selectedAccountID);
// provider.tpcAgent = [];
},
child:
SizedBox
(
height:
45
,
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
provider
.
tpcAgent
[
index
].
text
!,
),
),
),
)
,
)
,
)
;
}
,
)
;
}
,
)
,
)
,
),
),
),
),
],
],
textControllerWidget
(
context
,
provider
.
tpcAmountController
,
"TPC Amount"
,
"Enter TPC Amount"
,
provider
.
onChangeTpcAmount
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
tpcAmountError
),
],
textControllerWidget
(
context
,
provider
.
tpcAmountController
,
"TPC Amount"
,
"Enter TPC Amount"
,
provider
.
onChangeTpcAmount
,
TextInputType
.
number
,
false
,
FilteringTextInputFormatter
.
digitsOnly
,
focusNodes
[
6
],
focusNodes
[
7
],
TextInputAction
.
next
,
),
errorWidget
(
context
,
provider
.
tpcAmountError
),
],
///Addorderbutton
OrderForm
(),
//dd
],
///Addorderbutton
OrderForm
(),
//dd
],
),
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
var
order_prod_data
=
provider
.
getFormData
();
print
(
order_prod_data
);
print
(
order_prod_data
[
'orders'
]);
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
bottomNavigationBar:
InkResponse
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
var
order_prod_data
=
provider
.
getFormData
();
print
(
order_prod_data
);
print
(
order_prod_data
[
'orders'
]);
///[{"product_id":"1","qty":"1","price":"500","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"500"},
///{"product_id":"2","qty":"1","price":"1000","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"1000"}]
provider
.
getCurrentLocation
();
provider
.
ordersAddOrderAPISubmitFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmployeeID
,
provider
.
selectedAccountID
,
provider
.
selectedDispatchDistrictId
,
provider
.
selectedDispatchSubLocID
,
provider
.
selectedUnloadingScope
,
provider
.
selectedFreightScope
,
provider
.
selectedErectionScope
,
provider
.
selectedTpcStatus
,
provider
.
selectedTpcStatus
,
provider
.
selectedBillingStateID
,
provider
.
selectedBillingDistrictId
,
provider
.
selectedBillingSubLocID
,
provider
.
selectedTpcAgentID
,
order_prod_data
[
'orders'
],
);
},
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
),
///[{"product_id":"1","qty":"1","price":"500","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"500"},
///{"product_id":"2","qty":"1","price":"1000","cgst_p":"9","sgst_p":"9","igst_p":"0","total_price":"1000"}]
provider
.
getCurrentLocation
();
provider
.
ordersAddOrderAPISubmitFunction
(
context
,
widget
.
mode
,
provider
.
selectedEmployeeID
,
provider
.
selectedAccountID
,
provider
.
selectedDispatchDistrictId
,
provider
.
selectedDispatchSubLocID
,
provider
.
selectedUnloadingScope
,
provider
.
selectedFreightScope
,
provider
.
selectedErectionScope
,
provider
.
selectedTpcStatus
,
provider
.
selectedTpcStatus
,
provider
.
selectedBillingStateID
,
provider
.
selectedBillingDistrictId
,
provider
.
selectedBillingSubLocID
,
provider
.
selectedTpcAgentID
,
order_prod_data
[
'orders'
],
);
},
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
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
style:
TextStyle
(
fontSize:
15
,
fontFamily:
"JakartaMedium"
,
color:
Colors
.
white
,
),
),
),
),
),
),
onWillPop:
()
async
{
provider
.
resetForm
();
return
_onBackPressed
(
context
);
onWillPop:
()
async
{
provider
.
resetForm
();
return
_onBackPressed
(
context
);
},
);
},
);
},
);
)
:
NoNetwork
(
context
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
...
...
@@ -1626,7 +1775,9 @@ class OrderForm extends StatelessWidget {
),
)
.
toList
(),
value:
provider
.
selectedSaleProductID
[
index
]!=
null
value:
provider
.
selectedSaleProductID
[
index
]
!=
null
?
provider
.
saleProducts
.
firstWhere
(
(
product
)
=>
product
.
id
==
...
...
lib/screens/order/addPayment.dart
View file @
ee178d55
...
...
@@ -14,7 +14,8 @@ import '../../Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart';
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'../../Utils/dropdownTheme.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
AddpaymentScreen
extends
StatefulWidget
{
final
pageTitleName
;
final
mode
;
...
...
@@ -33,11 +34,17 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
String
?
selectedValue
;
final
TextEditingController
textEditingController
=
TextEditingController
();
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
<
Addpaymentprovider
>(
context
,
listen:
false
);
if
(
provider
.
dateNow
==
null
)
{
...
...
@@ -56,6 +63,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
@override
void
dispose
()
{
focusNodes
.
map
((
e
)=>
e
.
dispose
());
_connectivity
.
disposeStream
();
super
.
dispose
();
}
...
...
@@ -66,7 +74,18 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Addpaymentprovider
>(
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"
?
Consumer
<
Addpaymentprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
...
...
@@ -722,7 +741,7 @@ class _AddpaymentScreenState extends State<AddpaymentScreen> {
},
);
},
);
):
NoNetwork
(
context
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
...
...
lib/screens/order/addTpcAgent.dart
View file @
ee178d55
...
...
@@ -10,6 +10,9 @@ import '../../Utils/app_colors.dart';
import
'../../Utils/commonWidgets.dart'
;
import
'../../Utils/dropdownTheme.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
AddtpcagentScreen
extends
StatefulWidget
{
const
AddtpcagentScreen
({
super
.
key
});
...
...
@@ -20,19 +23,43 @@ class AddtpcagentScreen extends StatefulWidget {
class
_AddtpcagentScreenState
extends
State
<
AddtpcagentScreen
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
List
<
FocusNode
>
focusNodes
=
List
.
generate
(
10
,
(
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
provider
=
Provider
.
of
<
Tpcagentsprovider
>(
context
,
listen:
false
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
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"
?
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
return
WillPopScope
(
child:
SafeArea
(
...
...
@@ -290,7 +317,7 @@ class _AddtpcagentScreenState extends State<AddtpcagentScreen> {
},
);
},
);
):
NoNetwork
(
context
);
}
Future
<
void
>
_showAttachmentSheet
(
BuildContext
context
)
{
...
...
lib/screens/order/orderModuleDashboard.dart
View file @
ee178d55
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
...
...
@@ -7,6 +8,7 @@ import 'package:generp/screens/screensExports.dart';
import
'package:provider/provider.dart'
;
import
'../../Notifiers/ordersProvider/pagesDashboardProvider.dart'
;
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonServices.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'addTpcAgent.dart'
;
...
...
@@ -18,10 +20,20 @@ class Ordermoduledashboard extends StatefulWidget {
}
class
_OrdermoduledashboardState
extends
State
<
Ordermoduledashboard
>
{
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
<
Pagesdashboardprovider
>(
context
,
...
...
@@ -31,15 +43,31 @@ class _OrdermoduledashboardState extends State<Ordermoduledashboard> {
provider
.
ordersAccessiblePagesAPIFunction
(
context
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Platform
.
isAndroid
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
);
:
_scaffold
(
context
)
:
NoNetwork
(
context
)
;
}
Widget
_scaffold
(
BuildContext
context
)
{
...
...
lib/screens/order/ordersDetailsByModes.dart
View file @
ee178d55
...
...
@@ -16,6 +16,9 @@ import '../finance/FileViewer.dart';
import
'editOrderAccountDetails.dart'
;
import
'package:generp/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
Ordersdetailsbymodes
extends
StatefulWidget
{
final
pageTitleName
;
final
orderId
;
...
...
@@ -34,17 +37,27 @@ class Ordersdetailsbymodes extends StatefulWidget {
class
_OrdersdetailsbymodesState
extends
State
<
Ordersdetailsbymodes
>
{
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
<
Pagesdashboardprovider
>(
context
,
listen:
false
,
);
provider
.
showMoreDetails
=
false
;
var
disproved
=
Provider
.
of
<
Dispatchorderprovider
>(
context
,
listen:
false
);
var
disproved
=
Provider
.
of
<
Dispatchorderprovider
>(
context
,
listen:
false
,
);
provider
.
ordersDetailsByModeAPIFunction
(
context
,
widget
.
orderId
,
...
...
@@ -54,493 +67,530 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer2
<
Pagesdashboardprovider
,
Dispatchorderprovider
>(
builder:
(
context
,
provider
,
disProvider
,
child
)
{
var
orderDetails
=
provider
.
orderDetails
;
var
Headings1
=
[
"Order Number"
,
"Account Name"
,
"Sales Person Name"
,
"Order Received Date"
,
];
var
subHeadings1
=
[
provider
.
orderDetails
.
orderNumber
??
"-"
,
provider
.
orderDetails
.
accountName
??
"-"
,
provider
.
orderDetails
.
salesPersonEmpName
??
"-"
,
provider
.
orderDetails
.
orderReceivedDate
??
"-"
,
];
var
Headings2
=
[
"Billing State"
,
"Billing District"
,
"Billing Sub Location"
,
"Billing Pincode"
,
"Billing Address"
,
"Entered By"
,
"Dispatch State"
,
"Dispatch District"
,
"District Sub Location"
,
"Dispatch Pincode"
,
"Dispatch Address"
,
"GST Number"
,
"Unloading Scope"
,
"Freight Scope"
,
"Erection Scope"
,
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
"CGST Amount"
,
"SGST Amount"
,
"IGST Amount"
,
@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"
?
Consumer2
<
Pagesdashboardprovider
,
Dispatchorderprovider
>(
builder:
(
context
,
provider
,
disProvider
,
child
)
{
var
orderDetails
=
provider
.
orderDetails
;
"OTP"
,
var
Headings1
=
[
"Order Number"
,
"Account Name"
,
"Sales Person Name"
,
"Order Received Date"
,
];
var
subHeadings1
=
[
provider
.
orderDetails
.
orderNumber
??
"-"
,
provider
.
orderDetails
.
accountName
??
"-"
,
provider
.
orderDetails
.
salesPersonEmpName
??
"-"
,
provider
.
orderDetails
.
orderReceivedDate
??
"-"
,
];
"Basic Amount"
,
"Paid Amount"
,
"Balance Amount"
,
"Total Amount"
,
var
Headings2
=
[
"Billing State"
,
"Billing District"
,
"Billing Sub Location"
,
"Billing Pincode"
,
"Billing Address"
,
"TPC Applicable"
,
"TPC Agent"
,
"TPC Requested Amount"
,
"Entered By"
,
"TPC Level 1 Approved Amount"
,
"TPC Level 2 Approved Amount"
,
"Dispatch State"
,
"Dispatch District"
,
"District Sub Location"
,
"Dispatch Pincode"
,
"Dispatch Address"
,
"TPC Payment Mode"
,
"TPC Payment Reference No"
,
"TPC Payment Attachment"
,
"TPC Status"
,
"Purchase Order"
,
"GST Number"
,
"Created Datetime"
,
"Note"
,
"Status"
,
];
var
subHeadings2
=
[
"Unloading Scope"
,
"Freight Scope"
,
"Erection Scope"
,
provider
.
orderDetails
.
billingState
??
"-"
,
provider
.
orderDetails
.
billingDistrict
??
"-"
,
provider
.
orderDetails
.
billingSubLocality
??
"-"
,
provider
.
orderDetails
.
billingPincode
??
"-"
,
provider
.
orderDetails
.
billingAddress
??
"-"
,
"CGST Amount"
,
"SGST Amount"
,
"IGST Amount"
,
provider
.
orderDetails
.
enteredEmpName
??
"-
"
,
"OTP
"
,
provider
.
orderDetails
.
stateName
??
"-"
,
provider
.
orderDetails
.
districtName
??
"-"
,
provider
.
orderDetails
.
subLocationName
??
"-"
,
provider
.
orderDetails
.
dispatchPincode
??
"-"
,
provider
.
orderDetails
.
dispatchAddress
??
"-"
,
"Basic Amount"
,
"Paid Amount"
,
"Balance Amount"
,
"Total Amount"
,
provider
.
orderDetails
.
gstNumber
??
"-"
,
"TPC Applicable"
,
"TPC Agent"
,
"TPC Requested Amount"
,
provider
.
orderDetails
.
unloadingScope
??
"-"
,
provider
.
orderDetails
.
freightScope
??
"-"
,
provider
.
orderDetails
.
erectionScope
??
"-"
,
"TPC Level 1 Approved Amount"
,
"TPC Level 2 Approved Amount"
,
provider
.
orderDetails
.
cgstAmount
??
"-"
,
provider
.
orderDetails
.
sgstAmount
??
"-"
,
provider
.
orderDetails
.
igstAmount
??
"-"
,
"TPC Payment Mode"
,
"TPC Payment Reference No"
,
"TPC Payment Attachment"
,
"TPC Status"
,
"Purchase Order"
,
provider
.
orderDetails
.
otp
??
"-"
,
"Created Datetime"
,
"Note"
,
"Status"
,
];
var
subHeadings2
=
[
provider
.
orderDetails
.
billingState
??
"-"
,
provider
.
orderDetails
.
billingDistrict
??
"-"
,
provider
.
orderDetails
.
billingSubLocality
??
"-"
,
provider
.
orderDetails
.
billingPincode
??
"-"
,
provider
.
orderDetails
.
billingAddress
??
"-"
,
provider
.
orderDetails
.
basicAmount
??
"-"
,
provider
.
orderDetails
.
paidAmount
??
"-"
,
provider
.
orderDetails
.
balanceAmount
??
"-"
,
provider
.
orderDetails
.
totalAmount
??
"-"
,
provider
.
orderDetails
.
enteredEmpName
??
"-"
,
provider
.
orderDetails
.
tpcApplicable
??
"-"
,
provider
.
orderDetails
.
tpcaAgentName
??
"-"
,
provider
.
orderDetails
.
requestedTpcAmount
??
"-"
,
provider
.
orderDetails
.
stateName
??
"-"
,
provider
.
orderDetails
.
districtName
??
"-"
,
provider
.
orderDetails
.
subLocationName
??
"-"
,
provider
.
orderDetails
.
dispatchPincode
??
"-"
,
provider
.
orderDetails
.
dispatchAddress
??
"-"
,
provider
.
orderDetails
.
level1TpcApprovedAmount
??
"-"
,
provider
.
orderDetails
.
level2TpcApprovedAmount
??
"-"
,
provider
.
orderDetails
.
gstNumber
??
"-"
,
provider
.
orderDetails
.
tpcPaymentMode
??
"-"
,
provider
.
orderDetails
.
tpcPaymentReferenceNo
??
"-"
,
provider
.
orderDetails
.
tpcPaymentAttachementViewFileName
??
"-"
,
provider
.
orderDetails
.
tpcStatus
??
"-"
,
provider
.
orderDetails
.
tpcPaymentAttachmentDirFilePath
??
"-"
,
provider
.
orderDetails
.
unloadingScope
??
"-"
,
provider
.
orderDetails
.
freightScope
??
"-"
,
provider
.
orderDetails
.
erectionScope
??
"-"
,
provider
.
orderDetails
.
createdDatetime
??
"-"
,
provider
.
orderDetails
.
note
??
"-"
,
provider
.
orderDetails
.
status
??
"-"
,
];
provider
.
orderDetails
.
cgstAmount
??
"-"
,
provider
.
orderDetails
.
sgstAmount
??
"-"
,
provider
.
orderDetails
.
igstAmount
??
"-"
,
provider
.
orderDetails
.
otp
??
"-"
,
provider
.
orderDetails
.
basicAmount
??
"-"
,
provider
.
orderDetails
.
paidAmount
??
"-"
,
provider
.
orderDetails
.
balanceAmount
??
"-"
,
provider
.
orderDetails
.
totalAmount
??
"-"
,
provider
.
orderDetails
.
tpcApplicable
??
"-"
,
provider
.
orderDetails
.
tpcaAgentName
??
"-"
,
provider
.
orderDetails
.
requestedTpcAmount
??
"-"
,
provider
.
orderDetails
.
level1TpcApprovedAmount
??
"-"
,
provider
.
orderDetails
.
level2TpcApprovedAmount
??
"-"
,
provider
.
orderDetails
.
tpcPaymentMode
??
"-"
,
provider
.
orderDetails
.
tpcPaymentReferenceNo
??
"-"
,
provider
.
orderDetails
.
tpcPaymentAttachementViewFileName
??
"-"
,
provider
.
orderDetails
.
tpcStatus
??
"-"
,
provider
.
orderDetails
.
tpcPaymentAttachmentDirFilePath
??
"-"
,
var
Headings
=
[...
Headings1
];
var
subHeadings
=
[...
subHeadings1
];
provider
.
orderDetails
.
createdDatetime
??
"-"
,
provider
.
orderDetails
.
note
??
"-"
,
provider
.
orderDetails
.
status
??
"-"
,
];
var
Headings
=
[...
Headings1
];
var
subHeadings
=
[...
subHeadings1
];
if
(
provider
.
showMoreDetails
){
Headings
=
[...
Headings1
,...
Headings2
];
subHeadings
=
[...
subHeadings1
,...
subHeadings2
];
}
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
mode
!=
""
?
"Order Details"
:
"Order 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
),
if
(
provider
.
showMoreDetails
)
{
Headings
=
[...
Headings1
,
...
Headings2
];
subHeadings
=
[...
subHeadings1
,
...
subHeadings2
];
}
return
WillPopScope
(
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
mode
!=
""
?
"Order Details"
:
"Order Details (
${widget.mode}
)"
,
provider
.
resetAll
,
InkResponse
(
onTap:
()
{
_showOptionsSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_more.svg"
,
height:
30
,
),
),
margin:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
vertical:
10
,
horizontal:
10
),
child:
Column
(
children:
[
Row
(
),
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
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
orderDetails
.
accountName
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹
${orderDetails.balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
orderDetails
.
status
??
"-"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
),
),
),
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
SizedBox
(
width:
10
),
Expanded
(
child:
Text
(
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
orderDetails
.
accountName
??
"-"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹
${orderDetails.balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
Headings
[
j
]
==
"Purchase Order"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
orderDetails
.
tpcPaymentAttachementViewFileName
!,
fileUrl:
orderDetails
.
tpcPaymentAttachmentDirFilePath
!,
),
),
);
}
},
child:
Text
(
Headings
[
j
]
==
"Purchase Order"
?
"View"
:
subHeadings
[
j
]==
""
?
"-"
:
"
${subHeadings[j]}
"
,
style:
TextStyle
(
fontSize:
14
,
color:
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
Headings
[
j
]
==
"Purchase Order"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
AppColors
.
white
,
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
orderDetails
.
status
??
"-"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
],
),
);
}),
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
,
),
),
],
),
),
),
],
),
),
),
),
bottomNavigationBar:
[
"self"
,
"pending_approval"
].
contains
(
widget
.
mode
)
?
Container
(
height:
0
)
:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
alignment:
Alignment
.
bottomCenter
,
height:
60
,
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
alignment:
Alignment
.
center
,
height:
45
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
,
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelApprovalRejectionSheet
(
context
,
"Reject"
,
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
)),
...
List
.
generate
(
subHeadings
.
length
,
(
j
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
7
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
Headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
child:
Center
(
),
Expanded
(
child:
InkResponse
(
onTap:
()
{
if
(
Headings
[
j
]
==
"Purchase Order"
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Fileviewer
(
fileName:
orderDetails
.
tpcPaymentAttachementViewFileName
!,
fileUrl:
orderDetails
.
tpcPaymentAttachmentDirFilePath
!,
),
),
);
}
},
child:
Text
(
"Reject"
,
Headings
[
j
]
==
"Purchase Order"
?
"View"
:
subHeadings
[
j
]
==
""
?
"-"
:
"
${subHeadings[j]}
"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
fontSize:
14
,
color:
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
Headings
[
j
]
==
"Purchase Order"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
Headings
[
j
]
==
"Purchase Order"
?
AppColors
.
app_blue
:
AppColors
.
white
,
),
),
),
),
)
,
]
,
),
],
SizedBox
(
width:
10
),
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
,
"sales_order_registered"
,
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
_showLevelApprovalRejectionSheet
(
context
,
"Approve"
,
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE7FFE5
),
border:
Border
.
all
(
color:
Color
(
0xFF0D9C00
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Approve"
,
style:
TextStyle
(
color:
Color
(
0xFF0D9C00
),
),
),
);
}),
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
,
),
),
)
,
]
,
),
],
if
([
"admin"
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelDeletionSheet
(
context
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
],
),
),
),
),
bottomNavigationBar:
[
"self"
,
"pending_approval"
].
contains
(
widget
.
mode
)
?
Container
(
height:
0
)
:
Container
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
alignment:
Alignment
.
bottomCenter
,
height:
60
,
child:
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
alignment:
Alignment
.
center
,
height:
45
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
,
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelApprovalRejectionSheet
(
context
,
"Reject"
,
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Reject"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
child:
Center
(
child:
Text
(
"Delete"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
],
SizedBox
(
width:
10
),
if
([
"level_one_approval"
,
"level_two_approval"
,
"level_two_rejected"
,
"sales_order_registered"
,
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
_showLevelApprovalRejectionSheet
(
context
,
"Approve"
,
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFE7FFE5
),
border:
Border
.
all
(
color:
Color
(
0xFF0D9C00
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Approve"
,
style:
TextStyle
(
color:
Color
(
0xFF0D9C00
),
),
),
),
),
),
),
),
),
],
if
(
widget
.
mode
==
"dispatched"
)
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
disProvider
.
initializeForm
(
context
);
disProvider
.
ordersDetailsDispatchOrderViewFunction
(
context
,
widget
.
orderId
);
_showDispatchSheet
(
context
,
"Dispatch"
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
],
if
([
"admin"
].
contains
(
widget
.
mode
))
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
_showLevelDeletionSheet
(
context
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Delete"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
child:
Center
(
child:
Text
(
"Dispatch"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
],
if
(
widget
.
mode
==
"dispatched"
)
...[
Expanded
(
child:
InkResponse
(
onTap:
()
{
disProvider
.
initializeForm
(
context
);
disProvider
.
ordersDetailsDispatchOrderViewFunction
(
context
,
widget
.
orderId
,
);
_showDispatchSheet
(
context
,
"Dispatch"
,
);
},
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFFFEFEF
),
border:
Border
.
all
(
color:
Color
(
0xFFED3424
),
width:
0.5
,
),
),
child:
Center
(
child:
Text
(
"Dispatch"
,
style:
TextStyle
(
color:
Color
(
0xFFED3424
),
),
),
),
),
),
),
)
,
)
,
]
,
]
,
]
,
]
,
)
,
)
,
),
),
),
),
),
),
),
onWillPop:
()
{
return
onBackPressed
(
context
);
onWillPop:
()
{
return
onBackPressed
(
context
);
},
);
},
);
},
);
)
:
NoNetwork
(
context
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
...
...
@@ -890,35 +940,43 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
],
InkWell
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
details
.
id
,
type
==
"Approve"
?
"Approved"
:
"Rejected"
,
details
.
tpcApplicable
,
details
.
tpcApplicable
==
"Yes"
?
(
widget
.
mode
==
"level_one_approval"
?
details
.
level1TpcApprovedAmount
:
details
.
level2TpcApprovedAmount
)
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
invoiceNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
vehicleNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverName
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverMobileNumber
:
""
,
widget
.
mode
==
"dispatched"
?
[]
:
[],
widget
.
mode
,
);
},
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
details
.
id
,
type
==
"Approve"
?
"Approved"
:
"Rejected"
,
details
.
tpcApplicable
,
details
.
tpcApplicable
==
"Yes"
?
(
widget
.
mode
==
"level_one_approval"
?
details
.
level1TpcApprovedAmount
:
details
.
level2TpcApprovedAmount
)
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
invoiceNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
vehicleNumber
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverName
:
""
,
widget
.
mode
==
"dispatched"
?
details
.
driverMobileNumber
:
""
,
widget
.
mode
==
"dispatched"
?
[]
:
[],
widget
.
mode
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
...
...
@@ -934,13 +992,18 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
...
...
@@ -1041,7 +1104,10 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
false
,
null
,
),
errorWidget
(
context
,
disProvider
.
driverMobileNumberError
),
errorWidget
(
context
,
disProvider
.
driverMobileNumberError
,
),
InkResponse
(
onTap:
()
{
disProvider
.
editAddNewRow
();
...
...
@@ -1058,7 +1124,7 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
width:
0.5
,
),
),
child:
Center
(
child:
Center
(
child:
Text
(
"+ Add Product"
,
style:
TextStyle
(
...
...
@@ -1070,21 +1136,30 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
),
if
(
disProvider
.
leadProductsList
.
isNotEmpty
||
disProvider
.
engineNumberControllers
.
isNotEmpty
)...[
disProvider
.
engineNumberControllers
.
isNotEmpty
)
...[
ListView
.
builder
(
itemCount:
disProvider
.
engineNumberControllers
.
length
,
itemCount:
disProvider
.
engineNumberControllers
.
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
),
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
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
TextWidget
(
context
,
"Product"
),
DropdownButtonHideUnderline
(
...
...
@@ -1095,37 +1170,74 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
isExpanded:
true
,
hint:
const
Text
(
'Select Product'
,
style:
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
),
items:
disProvider
.
productsList
.
map
((
ord
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.productName}
)"
,
style:
const
TextStyle
(
fontSize:
14
),
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontSize:
14
,
),
))
.
toList
(),
value:
disProvider
.
selectedProductIds
[
j
]
!=
null
?
disProvider
.
productsList
.
firstWhere
(
(
ord
)
=>
ord
.
id
==
disProvider
.
selectedProductIds
[
j
],
orElse:
()
=>
disProvider
.
productsList
[
0
],
)
:
null
,
overflow:
TextOverflow
.
ellipsis
,
),
items:
disProvider
.
productsList
.
map
(
(
ord
,
)
=>
DropdownMenuItem
<
Products
>(
value:
ord
,
child:
Text
(
"(Product Name:
${ord.productName}
)"
,
style:
const
TextStyle
(
fontSize:
14
,
),
overflow:
TextOverflow
.
ellipsis
,
),
),
)
.
toList
(),
value:
disProvider
.
selectedProductIds
[
j
]
!=
null
?
disProvider
.
productsList
.
firstWhere
(
(
ord
)
=>
ord
.
id
==
disProvider
.
selectedProductIds
[
j
],
orElse:
()
=>
disProvider
.
productsList
[
0
],
)
:
null
,
onChanged:
(
Products
?
value
)
{
if
(
value
!=
null
)
{
disProvider
.
updateSelectedProductIds
(
j
,
value
);
disProvider
.
selectedProductIds
[
j
]
=
value
.
id
?.
toString
()
??
''
;
disProvider
.
updateTotalAmount
(
j
);
disProvider
.
updateSelectedProductIds
(
j
,
value
,
);
disProvider
.
selectedProductIds
[
j
]
=
value
.
id
?.
toString
()
??
''
;
disProvider
.
updateTotalAmount
(
j
);
}
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
],
...
...
@@ -1138,16 +1250,29 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
flex:
2
,
child:
textControllerWidget
(
context
,
disProvider
.
engineNumberControllers
[
j
],
disProvider
.
engineNumberControllers
[
j
],
"Engine Number"
,
"Enter Engine Number"
,
(
p0
)
{
if
(
disProvider
.
engineNumberControllers
[
j
].
text
.
trim
().
isEmpty
){
disProvider
.
pdiIDControllers
[
j
].
clear
();
(
p0
)
{
if
(
disProvider
.
engineNumberControllers
[
j
]
.
text
.
trim
()
.
isEmpty
)
{
disProvider
.
pdiIDControllers
[
j
]
.
clear
();
}
disProvider
.
updateTotalAmount
(
j
);
disProvider
.
ordersPDIIDByEngineNumberFunction
(
context
,
j
);
},
disProvider
.
updateTotalAmount
(
j
,
);
disProvider
.
ordersPDIIDByEngineNumberFunction
(
context
,
j
,
);
},
TextInputType
.
text
,
false
,
null
,
...
...
@@ -1165,7 +1290,8 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
disProvider
.
pdiIDControllers
[
j
],
"PDI ID"
,
"Enter PDI ID"
,
(
value
)
=>
disProvider
.
updateTotalAmount
(
j
),
(
value
)
=>
disProvider
.
updateTotalAmount
(
j
),
TextInputType
.
text
,
true
,
null
,
...
...
@@ -1185,30 +1311,38 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
);
},
),
],
],
InkWell
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
false
;
final
data
=
disProvider
.
getFormData
();
print
(
data
);
disProvider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
details
.
id
,
type
==
"Dispatch"
,
provider
.
approveRejectFeedbackController
.
text
,
details
.
tpcApplicable
,
details
.
tpcApplicable
==
"Yes"
?
(
widget
.
mode
==
"level_one_approval"
?
details
.
level1TpcApprovedAmount
:
details
.
level2TpcApprovedAmount
)
:
""
,
provider
.
saleOrderNumberController
.
text
,
provider
.
editCompanyController
.
text
,
data
,
widget
.
mode
);
},
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
false
;
final
data
=
disProvider
.
getFormData
();
print
(
data
);
disProvider
.
approvalRejectionAPIFunction
(
context
,
details
.
status
,
details
.
id
,
type
==
"Dispatch"
,
provider
.
approveRejectFeedbackController
.
text
,
details
.
tpcApplicable
,
details
.
tpcApplicable
==
"Yes"
?
(
widget
.
mode
==
"level_one_approval"
?
details
.
level1TpcApprovedAmount
:
details
.
level2TpcApprovedAmount
)
:
""
,
provider
.
saleOrderNumberController
.
text
,
provider
.
editCompanyController
.
text
,
data
,
widget
.
mode
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
...
...
@@ -1224,13 +1358,18 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
...
...
@@ -1347,13 +1486,16 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
),
],
InkWell
(
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
delectionAPIFunction
(
context
,
provider
.
orderDetails
.
id
,
);
},
onTap:
provider
.
submitClicked
?
null
:
()
{
provider
.
submitClicked
=
true
;
provider
.
delectionAPIFunction
(
context
,
provider
.
orderDetails
.
id
,
);
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
...
...
@@ -1368,13 +1510,18 @@ class _OrdersdetailsbymodesState extends State<Ordersdetailsbymodes> {
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
child:
Center
(
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
),
):
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
child:
provider
.
submitClicked
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
Colors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
...
...
lib/screens/order/ordersListByModes.dart
View file @
ee178d55
...
...
@@ -13,6 +13,9 @@ import '../../Utils/commonWidgets.dart';
import
'../../Utils/dropdownTheme.dart'
;
import
'../commonDateRangeFilter.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
OrderslistbyModes
extends
StatefulWidget
{
final
mode
;
final
pageTitleName
;
...
...
@@ -29,11 +32,17 @@ class OrderslistbyModes extends StatefulWidget {
class
_OrderslistbyModesState
extends
State
<
OrderslistbyModes
>
{
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
<
Pagesdashboardprovider
>(
context
,
...
...
@@ -45,283 +54,346 @@ class _OrderslistbyModesState extends State<OrderslistbyModes> {
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
ordersList
=
provider
.
ordersList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg"),
// ),
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
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
,
@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"
?
Consumer
<
Pagesdashboardprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
ordersList
=
provider
.
ordersList
;
return
WillPopScope
(
onWillPop:
()
{
provider
.
resetAll
();
return
onBackPressed
(
context
);
},
child:
SafeArea
(
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar2
(
context
,
widget
.
pageTitleName
,
provider
.
resetAll
,
Row
(
children:
[
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg"),
// ),
InkResponse
(
onTap:
()
async
{
_showFilterSheet
(
context
);
},
child:
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
25
,
),
),
)
:
ordersList
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
ordersList
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
ordersList
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
if
(
ordersList
[
index
].
orderNumber
==
"GP20252605448"
)
return
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:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
),
),
],
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
?
Center
(
child:
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
,
),
),
)
:
ordersList
.
isNotEmpty
?
SingleChildScrollView
(
child:
Column
(
children:
[
ListView
.
builder
(
itemCount:
ordersList
.
length
,
shrinkWrap:
true
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
if
(
ordersList
.
isEmpty
)
{
return
SizedBox
(
child:
Center
(
child:
Text
(
"No Data Available"
),
),
);
}
if
(
ordersList
[
index
].
orderNumber
==
"GP20252605448"
)
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
,
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
ordersList
[
index
]
.
accountName
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
child:
Column
(
children:
[
Row
(
children:
[
Expanded
(
flex:
1
,
child:
Container
(
height:
50
,
width:
35
,
padding:
EdgeInsets
.
all
(
8.0
,
),
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFF3CE
),
borderRadius:
BorderRadius
.
circular
(
8
,
),
),
child:
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
),
),
Text
(
"₹"
"
${ordersList[index].balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
SizedBox
(
width:
10
),
Expanded
(
flex:
4
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
ordersList
[
index
]
.
accountName
!,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
"₹"
"
${ordersList[index].balanceAmount}
"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
],
),
),
],
),
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
ordersList
[
index
].
status
!,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
),
),
Expanded
(
flex:
2
,
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
,
),
color:
Color
(
0xFFE3FFE0
),
),
child:
Center
(
child:
Text
(
ordersList
[
index
]
.
status
!,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
Color
(
0xFF0D9C00
,
),
),
),
),
),
),
)
,
]
,
),
),
],
),
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
5
,
(
j
)
{
final
headings
=
[
"Order Number"
,
"Entered Employee"
,
"Sales Person"
,
// "Date",
"Paid Amount"
,
"Balance Amount"
,
];
Divider
(
thickness:
0.5
,
color:
Color
(
0xFFD7D7D7
),
),
...
List
.
generate
(
5
,
(
j
)
{
final
headings
=
[
"Order Number"
,
"Entered Employee"
,
"Sales Person"
,
// "Date",
"Paid Amount"
,
"Balance Amount"
,
];
final
subHeadings
=
[
ordersList
[
index
].
orderNumber
,
ordersList
[
index
].
enteredEmpName
,
ordersList
[
index
].
salesPersonEmpName
,
// ordersList[index].createdDatetime,
ordersList
[
index
].
paidAmount
,
ordersList
[
index
].
balanceAmount
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
final
subHeadings
=
[
ordersList
[
index
].
orderNumber
,
ordersList
[
index
]
.
enteredEmpName
,
ordersList
[
index
]
.
salesPersonEmpName
,
// ordersList[index].createdDatetime,
ordersList
[
index
].
paidAmount
,
ordersList
[
index
].
balanceAmount
,
];
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
subHeadings
[
j
]!,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Expanded
(
child:
Text
(
headings
[
j
],
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
),
Expanded
(
child:
InkResponse
(
child:
Text
(
subHeadings
[
j
]!,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF818181
,
),
decoration:
TextDecoration
.
none
,
decorationColor:
AppColors
.
white
,
),
),
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
,
)
=>
Ordersdetailsbymodes
(
pageTitleName:
widget
.
pageTitleName
,
orderId:
ordersList
[
index
]
.
orderId
,
mode:
widget
.
mode
,
),
),
);
if
(
res
==
true
)
{
provider
.
ordersListByModeFilterAPIFunction
(
context
,
widget
.
mode
,
);
provider
.
ordersListByModeAPIFunction
(
context
,
widget
.
mode
,
""
,
""
,
);
}
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
5
,
),
),
],
),
);
}),
InkResponse
(
onTap:
()
async
{
var
res
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
Ordersdetailsbymodes
(
pageTitleName:
widget
.
pageTitleName
,
orderId:
ordersList
[
index
]
.
orderId
,
mode:
widget
.
mode
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"View Details"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
app_blue
,
),
),
);
if
(
res
==
true
){
provider
.
ordersListByModeFilterAPIFunction
(
context
,
widget
.
mode
);
provider
.
ordersListByModeAPIFunction
(
context
,
widget
.
mode
,
""
,
""
);
}
},
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"
,
),
],
),
),
SizedBox
(
width:
5
),
SvgPicture
.
asset
(
"assets/svg/next_button.svg"
,
),
],
),
),
],
),
),
],
),
);
},
);
},
),
],
),
],
),
)
:
Emptywidget
(
context
),
),
),
);
},
);
)
:
Emptywidget
(
context
),
),
),
);
},
)
:
NoNetwork
(
context
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
...
...
lib/screens/order/paymentDetailsByMode.dart
View file @
ee178d55
...
...
@@ -12,6 +12,8 @@ import '../finance/FileViewer.dart';
import
'editPaymentDetailsByMode.dart'
;
import
'ordersDetailsByModes.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
Paymentdetailsbymode
extends
StatefulWidget
{
final
pageTitleName
;
final
paymentId
;
...
...
@@ -29,10 +31,17 @@ class Paymentdetailsbymode extends StatefulWidget {
}
class
_PaymentdetailsbymodeState
extends
State
<
Paymentdetailsbymode
>
{
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
<
Paymentsprovider
>(
context
,
listen:
false
);
provider
.
paymentsDetailsByModeAPIFunction
(
...
...
@@ -43,9 +52,28 @@ class _PaymentdetailsbymodeState extends State<Paymentdetailsbymode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Paymentsprovider
>(
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"
?
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
paymentDetails
=
provider
.
paymentDetails
;
var
adjustList
=
provider
.
paidLists
;
...
...
@@ -485,7 +513,7 @@ class _PaymentdetailsbymodeState extends State<Paymentdetailsbymode> {
},
);
},
);
):
NoNetwork
(
context
);
}
...
...
lib/screens/order/paymentListsByMode.dart
View file @
ee178d55
...
...
@@ -12,6 +12,8 @@ import '../../Utils/app_colors.dart';
import
'../../Utils/commonWidgets.dart'
;
import
'../../Utils/dropdownTheme.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
Paymentlistsbymode
extends
StatefulWidget
{
final
mode
;
final
pageTitleName
;
...
...
@@ -25,10 +27,17 @@ class Paymentlistsbymode extends StatefulWidget {
class
_PaymentlistsbymodeState
extends
State
<
Paymentlistsbymode
>
{
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
<
Paymentsprovider
>(
context
,
...
...
@@ -39,10 +48,27 @@ class _PaymentlistsbymodeState extends State<Paymentlistsbymode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Paymentsprovider
>(
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"
?
Consumer
<
Paymentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
paymentLists
=
provider
.
paymentsList
;
return
WillPopScope
(
...
...
@@ -296,7 +322,7 @@ class _PaymentlistsbymodeState extends State<Paymentlistsbymode> {
),
);
},
);
):
NoNetwork
(
context
);
}
Future
<
void
>
_showOptionsSheet
(
BuildContext
context
)
{
...
...
lib/screens/order/tpcAgentDetailsByMode.dart
View file @
ee178d55
...
...
@@ -10,6 +10,8 @@ import '../../Utils/commonWidgets.dart';
import
'../finance/FileViewer.dart'
;
import
'ordersDetailsByModes.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
Tpcagentdetailsbymode
extends
StatefulWidget
{
final
tpcAgentId
;
final
pageTitleName
;
...
...
@@ -21,10 +23,18 @@ class Tpcagentdetailsbymode extends StatefulWidget {
}
class
_TpcagentdetailsbymodeState
extends
State
<
Tpcagentdetailsbymode
>
{
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
<
Tpcagentsprovider
>(
context
,
...
...
@@ -35,10 +45,28 @@ class _TpcagentdetailsbymodeState extends State<Tpcagentdetailsbymode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
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"
?
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
var
tpcAgentDetails
=
provider
.
TPCAgentsDetails
;
var
tpcReqAmt
=
provider
.
TPCRequestedAmounts
;
...
...
@@ -303,7 +331,8 @@ class _TpcagentdetailsbymodeState extends State<Tpcagentdetailsbymode> {
},
);
},
);
):
NoNetwork
(
context
);
}
...
...
lib/screens/order/tpcAgentListByMode.dart
View file @
ee178d55
...
...
@@ -10,6 +10,8 @@ import 'package:provider/provider.dart';
import
'../../Utils/app_colors.dart'
;
import
'../../Utils/commonWidgets.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
class
Tpcagentlistbymode
extends
StatefulWidget
{
final
pageTitleName
;
final
mode
;
...
...
@@ -22,10 +24,17 @@ class Tpcagentlistbymode extends StatefulWidget {
}
class
_TpcagentlistbymodeState
extends
State
<
Tpcagentlistbymode
>
{
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
<
Tpcagentsprovider
>(
context
,
...
...
@@ -36,10 +45,30 @@ class _TpcagentlistbymodeState extends State<Tpcagentlistbymode> {
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Consumer
<
Tpcagentsprovider
>(
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"
?
Consumer
<
Tpcagentsprovider
>(
builder:
(
context
,
provider
,
child
)
{
final
tpcAgentsLists
=
provider
.
tpcAgentsList
;
return
WillPopScope
(
...
...
@@ -297,6 +326,6 @@ class _TpcagentlistbymodeState extends State<Tpcagentlistbymode> {
),
);
},
);
):
NoNetwork
(
context
);
}
}
lib/screens/serviceEngineer/PaymentDetails.dart
View file @
ee178d55
...
...
@@ -171,6 +171,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
// To disable selecting this item
child:
InkWell
(
onTap:
()
{
Navigator
.
pop
(
context
);
_addContactSheet
(
context
);
},
child:
Container
(
...
...
@@ -242,6 +243,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
],
),
),
errorWidget
(
context
,
provider
.
selectContactError
),
SizedBox
(
height:
10
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
...
...
@@ -313,6 +315,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
],
),
),
errorWidget
(
context
,
provider
.
selectPaymentError
),
SizedBox
(
height:
10
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
...
...
@@ -335,7 +338,11 @@ class _PaymentdetailsState extends State<Paymentdetails> {
),
child:
TextFormField
(
controller:
provider
.
Amountcontroller
,
keyboardType:
TextInputType
.
text
,
onChanged:
(
value
)
{
provider
.
selectAmountError
=
null
;
},
keyboardType:
TextInputType
.
numberWithOptions
(),
textInputAction:
TextInputAction
.
next
,
decoration:
InputDecoration
(
hintText:
"Enter Amount"
,
hintStyle:
TextStyle
(
...
...
@@ -350,6 +357,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
),
),
),
errorWidget
(
context
,
provider
.
selectAmountError
),
SizedBox
(
height:
10
),
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
5.0
),
...
...
@@ -373,6 +381,9 @@ class _PaymentdetailsState extends State<Paymentdetails> {
child:
TextFormField
(
controller:
provider
.
Referencecontroller
,
keyboardType:
TextInputType
.
text
,
onChanged:
(
value
)
{
provider
.
ReferenceError
=
null
;
},
decoration:
InputDecoration
(
hintText:
"Enter Reference Number"
,
hintStyle:
TextStyle
(
...
...
@@ -387,6 +398,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
),
),
),
errorWidget
(
context
,
provider
.
ReferenceError
),
SizedBox
(
height:
10
),
InkResponse
(
onTap:
()
{
...
...
@@ -425,30 +437,38 @@ class _PaymentdetailsState extends State<Paymentdetails> {
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
Expanded
(
flex:
5
,
child:
Text
(
"
${provider.imagePath}
"
,
style:
TextStyle
(
color:
AppColors
.
semi_black
,
fontSize:
11
,
fontWeight:
FontWeight
.
w600
,
),
),
),
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
provider
.
imagePicked
=
0
;
provider
.
imagePath
=
null
;
provider
.
imageFilePath
=
null
;
},
child:
SvgPicture
.
asset
(
"assets/svg/ic_close.svg"
,
width:
15
,
height:
15
,
),
),
),
],
),
),
],
errorWidget
(
context
,
provider
.
imageError
),
],
),
),
...
...
@@ -458,29 +478,13 @@ class _PaymentdetailsState extends State<Paymentdetails> {
FloatingActionButtonLocation
.
centerFloat
,
floatingActionButton:
InkWell
(
onTap:
()
{
print
(
"clickedw"
);
if
(
provider
.
contactID
==
null
)
{
toast
(
context
,
"Please Select Contact"
);
return
;
}
if
(
provider
.
paymentModeID
==
null
)
{
toast
(
context
,
"Please Select Payment Type"
);
return
;
}
if
(
provider
.
image_picked
==
0
)
{
toast
(
context
,
"Please add attachment"
);
return
;
}
provider
.
PaymentUpdateAPI
(
context
,
provider
.
Referencecontroller
.
text
,
provider
.
Amountcontroller
.
text
,
);
Future
.
delayed
(
Duration
(
microseconds:
200
),
()
{
if
(
provider
.
CollectionId
!=
0
)
{
showOTPSheetSheet
(
context
);
}
});
},
child:
Container
(
alignment:
Alignment
.
center
,
...
...
@@ -849,6 +853,14 @@ class _PaymentdetailsState extends State<Paymentdetails> {
provider
.
telController
,
provider
.
emailController
,
];
final
Errors
=
[
provider
.
nameError
,
provider
.
designationError
,
provider
.
mobError
,
provider
.
altMobError
,
provider
.
telError
,
provider
.
emailError
,
];
return
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
...
...
@@ -904,7 +916,9 @@ class _PaymentdetailsState extends State<Paymentdetails> {
child:
TextFormField
(
controller:
controllers
[
index
],
focusNode:
focusNodes
[
index
],
onChanged:
(
value
)
{
Errors
[
index
]
=
null
;
},
maxLength:
[
"Mobile Number"
,
...
...
@@ -915,6 +929,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
?
10
:
998895646546561356
,
maxLines:
1
,
keyboardType:
[
"Mobile Number"
,
...
...
@@ -944,6 +959,7 @@ class _PaymentdetailsState extends State<Paymentdetails> {
),
),
),
errorWidget
(
context
,
Errors
[
index
])
],
);
}),
...
...
@@ -956,12 +972,9 @@ class _PaymentdetailsState extends State<Paymentdetails> {
widget
.
genId
==
""
?
widget
.
referenceID
:
widget
.
genId
,
provider
.
nameController
.
text
,
provider
.
designationController
.
text
,
provider
.
mobController
.
text
,
provider
.
altMobController
.
text
,
provider
.
telController
.
text
,
provider
.
emailController
.
text
,
widget
.
accountName
,
widget
.
referenceID
,
widget
.
genId
,
);
},
child:
Container
(
...
...
lib/screens/serviceEngineer/serviceEngineerDashboard.dart
View file @
ee178d55
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/ServiceEngineerDashboardProvider.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonServices.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:provider/provider.dart'
;
import
'package:generp/screens/screensExports.dart'
;
...
...
@@ -17,9 +19,17 @@ class Serviceengineerdashboard extends StatefulWidget {
}
class
_ServiceengineerdashboardState
extends
State
<
Serviceengineerdashboard
>
{
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
((
_
)
{
var
serviceProvider
=
Provider
.
of
<
Serviceengineerdashboardprovider
>(
context
,
...
...
@@ -28,15 +38,32 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
serviceProvider
.
LoadTechnicianDashboard
(
context
);
});
}
@override
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
_connectivity
.
disposeStream
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Platform
.
isAndroid
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
);
:
_scaffold
(
context
)
:
NoNetwork
(
context
)
;
}
Widget
_scaffold
(
BuildContext
context
)
{
...
...
Prev
1
2
3
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