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
7210793a
Commit
7210793a
authored
Sep 17, 2025
by
Sai Srinivas
Browse files
17-09
parent
185e0896
Changes
256
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
256 of 256+
files are displayed.
Plain diff
Email patch
lib/Notifiers/splashVersionNotifier.dart
View file @
7210793a
...
@@ -53,7 +53,6 @@ class SplashVersionNotifier extends ChangeNotifier {
...
@@ -53,7 +53,6 @@ class SplashVersionNotifier extends ChangeNotifier {
final
data
=
await
ApiCalling
.
checkAppVersionApi
();
final
data
=
await
ApiCalling
.
checkAppVersionApi
();
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
if
(
kDebugMode
)
{
if
(
kDebugMode
)
{
print
(
"Current Build:
$currentBuild
"
);
print
(
"Current Build:
$currentBuild
"
);
print
(
"Server Response:
$data
"
);
print
(
"Server Response:
$data
"
);
...
@@ -99,22 +98,28 @@ class SplashVersionNotifier extends ChangeNotifier {
...
@@ -99,22 +98,28 @@ class SplashVersionNotifier extends ChangeNotifier {
if
(
data
.
updatePasswordRequired
==
0
)
{
if
(
data
.
updatePasswordRequired
==
0
)
{
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
MyHomePage
(),
MaterialPageRoute
(
settings:
RouteSettings
(
name:
"MyHomePage"
)),
builder:
(
context
)
=>
MyHomePage
(),
settings:
RouteSettings
(
name:
"MyHomePage"
),
),
);
);
}
else
if
(
data
.
updatePasswordRequired
==
1
)
{
}
else
if
(
data
.
updatePasswordRequired
==
1
)
{
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
UpdatePassword
(),
MaterialPageRoute
(
settings:
RouteSettings
(
name:
"UpdatePassword"
)),
builder:
(
context
)
=>
UpdatePassword
(),
settings:
RouteSettings
(
name:
"UpdatePassword"
),
),
);
);
}
}
}
else
{
}
else
{
// print("goes here");
// print("goes here");
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LoginScreen
(),
MaterialPageRoute
(
settings:
RouteSettings
(
name:
"LoginScreen"
)),
builder:
(
context
)
=>
LoginScreen
(),
settings:
RouteSettings
(
name:
"LoginScreen"
),
),
);
);
// toast(context,
// toast(context,
// "Your Session has been expired, Please Login Again");
// "Your Session has been expired, Please Login Again");
...
@@ -142,8 +147,8 @@ class SplashVersionNotifier extends ChangeNotifier {
...
@@ -142,8 +147,8 @@ class SplashVersionNotifier extends ChangeNotifier {
const
SizedBox
(
height:
16
),
const
SizedBox
(
height:
16
),
TextButton
(
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
Material
StateProperty
.
all
(
Colors
.
white
),
backgroundColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Material
StateProperty
.
all
(
Colors
.
white70
),
overlayColor:
Widget
StateProperty
.
all
(
Colors
.
white70
),
),
),
onPressed:
()
async
{
onPressed:
()
async
{
if
(
await
canLaunchUrl
(
Uri
.
parse
(
apkurl
)))
{
if
(
await
canLaunchUrl
(
Uri
.
parse
(
apkurl
)))
{
...
...
lib/main.dart
View file @
7210793a
...
@@ -226,7 +226,9 @@ class MyApp extends StatelessWidget {
...
@@ -226,7 +226,9 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider
(
create:
(
_
)
=>
Dispatchorderprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Dispatchorderprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
followUpUpdateProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
followUpUpdateProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Appointmentcalendarprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Appointmentcalendarprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Addnewleadsandprospectsprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Addnewleadsandprospectsprovider
(),
),
ChangeNotifierProvider
(
create:
(
_
)
=>
HrmAccessiblePagesProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
HrmAccessiblePagesProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Attendancelistprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
Attendancelistprovider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
AttendanceDetailsProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
AttendanceDetailsProvider
()),
...
@@ -240,7 +242,7 @@ class MyApp extends StatelessWidget {
...
@@ -240,7 +242,7 @@ class MyApp extends StatelessWidget {
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
MaterialApp
(
return
MaterialApp
(
scrollBehavior:
const
MaterialScrollBehavior
().
copyWith
(
scrollBehavior:
const
MaterialScrollBehavior
().
copyWith
(
dragDevices:
{
PointerDeviceKind
.
touch
,
PointerDeviceKind
.
mouse
},
dragDevices:
{
PointerDeviceKind
.
touch
,
PointerDeviceKind
.
mouse
},
),
),
navigatorObservers:
[
MyNavigatorObserver
()],
navigatorObservers:
[
MyNavigatorObserver
()],
...
@@ -259,7 +261,6 @@ class MyApp extends StatelessWidget {
...
@@ -259,7 +261,6 @@ class MyApp extends StatelessWidget {
highlightColor:
Colors
.
transparent
,
highlightColor:
Colors
.
transparent
,
hoverColor:
Colors
.
transparent
,
hoverColor:
Colors
.
transparent
,
scaffoldBackgroundColor:
Colors
.
white
,
scaffoldBackgroundColor:
Colors
.
white
,
dialogBackgroundColor:
Colors
.
white
,
cardColor:
Colors
.
white
,
cardColor:
Colors
.
white
,
shadowColor:
Colors
.
white54
,
shadowColor:
Colors
.
white54
,
searchBarTheme:
const
SearchBarThemeData
(),
searchBarTheme:
const
SearchBarThemeData
(),
...
@@ -303,8 +304,8 @@ class MyApp extends StatelessWidget {
...
@@ -303,8 +304,8 @@ class MyApp extends StatelessWidget {
dragHandleSize:
Size
(
60.0
,
6.0
),
dragHandleSize:
Size
(
60.0
,
6.0
),
),
),
colorScheme:
const
ColorScheme
.
light
(
colorScheme:
const
ColorScheme
.
light
(
background
:
Colors
.
white
,
surface
:
Colors
.
white
,
).
copyWith
(
background
:
Colors
.
white
),
).
copyWith
(
surface
:
Colors
.
white
),
scrollbarTheme:
ScrollbarThemeData
(
scrollbarTheme:
ScrollbarThemeData
(
minThumbLength:
20
,
minThumbLength:
20
,
interactive:
true
,
interactive:
true
,
...
@@ -315,10 +316,8 @@ class MyApp extends StatelessWidget {
...
@@ -315,10 +316,8 @@ class MyApp extends StatelessWidget {
),
),
),
),
checkboxTheme:
CheckboxThemeData
(
checkboxTheme:
CheckboxThemeData
(
side:
BorderSide
(
width:
0.5
),
side:
BorderSide
(
width:
0.5
),
checkColor:
WidgetStatePropertyAll
(
AppColors
.
white
),
checkColor:
WidgetStatePropertyAll
(
AppColors
.
white
),
),
),
useMaterial3:
true
,
useMaterial3:
true
,
// inputDecorationTheme: InputDecorationTheme(
// inputDecorationTheme: InputDecorationTheme(
...
...
lib/screens/AttendanceScreen.dart
View file @
7210793a
...
@@ -20,7 +20,6 @@ class AttendanceScreen extends StatefulWidget {
...
@@ -20,7 +20,6 @@ class AttendanceScreen extends StatefulWidget {
}
}
class
_AttendanceScreenState
extends
State
<
AttendanceScreen
>
{
class
_AttendanceScreenState
extends
State
<
AttendanceScreen
>
{
// var homeProvider;
// var homeProvider;
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
...
@@ -32,11 +31,17 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -32,11 +31,17 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
_connectivity
.
myStream
.
listen
((
source
)
{
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
});
});
final
homeProvider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
);
final
homeProvider
=
Provider
.
of
<
HomescreenNotifier
>(
context
,
listen:
false
,
);
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
att_provider
=
Provider
.
of
<
AttendanceNotifier
>(
context
,
listen:
false
);
final
attProvider
=
Provider
.
of
<
AttendanceNotifier
>(
att_provider
.
getAttendanceList
(
context
);
context
,
att_provider
.
init
(
context
);
listen:
false
,
);
attProvider
.
getAttendanceList
(
context
);
attProvider
.
init
(
context
);
});
});
}
}
...
@@ -146,7 +151,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -146,7 +151,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
resizeToAvoidBottomInset:
true
,
resizeToAvoidBottomInset:
true
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
appBar:
appbarNew
(
context
,
"Attendance"
,
0xFFFFFFFF
),
appBar:
appbarNew
(
context
,
"Attendance"
,
0xFFFFFFFF
),
body:
SingleChildScrollView
(
body:
SingleChildScrollView
(
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
...
@@ -189,12 +194,20 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -189,12 +194,20 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
final
times
=
[
formattedTime
,
formattedTime2
];
final
times
=
[
formattedTime
,
formattedTime2
];
final
periods
=
[
period
,
period2
];
final
periods
=
[
period
,
period2
];
final
locations
=
[
final
locations
=
[
attendance
.
attendanceHistory
.
isNotEmpty
?
attendance
attendance
.
attendanceHistory
.
isNotEmpty
.
attendanceHistory
?
attendance
.
first
[
'check_in_location'
].
toString
()??
"-"
:
"-"
,
.
attendanceHistory
attendance
.
attendanceHistory
.
isNotEmpty
?
attendance
.
first
[
'check_in_location'
]
.
attendanceHistory
.
toString
()
??
.
first
[
'check_out_location'
].
toString
()??
"-"
:
"-"
,
"-"
:
"-"
,
attendance
.
attendanceHistory
.
isNotEmpty
?
attendance
.
attendanceHistory
.
first
[
'check_out_location'
]
.
toString
()
??
"-"
:
"-"
,
];
];
return
Expanded
(
return
Expanded
(
child:
Container
(
child:
Container
(
...
@@ -325,8 +338,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -325,8 +338,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
borderRadius:
BorderRadius
.
circular
(
20
),
borderRadius:
BorderRadius
.
circular
(
20
),
),
),
child:
Column
(
child:
Column
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Text
(
Text
(
...
@@ -372,10 +384,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -372,10 +384,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
///calendar
///calendar
Container
(
Container
(
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
10
),
horizontal:
15
,
vertical:
10
,
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
16
),
borderRadius:
BorderRadius
.
circular
(
16
),
color:
Colors
.
white
,
color:
Colors
.
white
,
...
@@ -386,16 +395,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -386,16 +395,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
padding:
const
EdgeInsets
.
fromLTRB
(
30
,
10
,
30
,
0
),
padding:
const
EdgeInsets
.
fromLTRB
(
30
,
10
,
30
,
0
),
child:
Container
(
child:
Container
(
child:
Row
(
child:
Row
(
mainAxisAlignment:
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
SizedBox
(
SizedBox
(
child:
Row
(
child:
Row
(
children:
[
children:
[
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
attendance
.
setPreviousMonth
(
attendance
.
setPreviousMonth
(
context
);
context
,
);
},
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
...
@@ -405,7 +412,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -405,7 +412,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
),
),
),
Padding
(
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
5.0
,
),
child:
Text
(
child:
Text
(
monthLabel
,
monthLabel
,
style:
TextStyle
(
style:
TextStyle
(
...
@@ -417,11 +426,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -417,11 +426,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
),
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
attendance
.
setNextMonth
(
attendance
.
setNextMonth
(
context
);
context
,
);
},
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
4.0
),
padding:
const
EdgeInsets
.
all
(
4.0
),
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
"assets/svg/crm/calendar_right.svg"
,
"assets/svg/crm/calendar_right.svg"
,
...
@@ -568,9 +575,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -568,9 +575,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
}
}
attendance
.
selectedDate
=
attendance
.
selectedDate
=
currentDay
.
toString
();
currentDay
.
toString
();
_showAttDetailsBottomSheet
(
_showAttDetailsBottomSheet
(
context
);
context
,
);
},
},
child:
Card
(
child:
Card
(
elevation:
0
,
elevation:
0
,
...
@@ -635,8 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -635,8 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
fontWeight:
FontWeight
.
w400
,
fontWeight:
FontWeight
.
w400
,
color:
color:
isFutureDate
isFutureDate
?
AppColors
?
AppColors
.
semi_black
.
semi_black
:
(
isCurrentDay
||
:
(
isCurrentDay
||
(
selectedIndex
==
(
selectedIndex
==
index
))
index
))
...
@@ -651,8 +655,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -651,8 +655,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
?
Color
(
0xFF6B3A02
)
?
Color
(
0xFF6B3A02
)
:
dateColor
==
'y'
:
dateColor
==
'y'
?
Color
(
0xFF605C00
)
?
Color
(
0xFF605C00
)
:
Colors
:
Colors
.
transparent
,
.
transparent
,
),
),
),
),
),
),
...
@@ -695,14 +698,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -695,14 +698,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
),
);
);
if
(
res
==
true
)
{
if
(
res
==
true
)
{
attendance
.
getAttendanceList
(
attendance
.
getAttendanceList
(
context
);
context
,
attendance
.
init
(
context
);
);
attendance
.
loadAttendanceDetails
(
context
);
attendance
.
init
(
context
);
attendance
.
loadAttendanceDetails
(
context
,
);
}
}
var
f
=
FocusScope
.
of
(
context
);
var
f
=
FocusScope
.
of
(
context
);
...
@@ -806,14 +804,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -806,14 +804,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
Color
(
0xFFFFE8D0
),
Color
(
0xFFFFE8D0
),
Color
(
0xFFFFF9B2
),
Color
(
0xFFFFF9B2
),
];
];
final
text
_c
olors
=
[
final
text
C
olors
=
[
Color
(
0xFF493272
),
Color
(
0xFF493272
),
Color
(
0xFF0D9C00
),
Color
(
0xFF0D9C00
),
Color
(
0xFFFF0000
),
Color
(
0xFFFF0000
),
Color
(
0xFF6B3A02
),
Color
(
0xFF6B3A02
),
Color
(
0xFF605C00
),
Color
(
0xFF605C00
),
];
];
final
text
_s
ubs
=
[
"24"
,
"7"
,
"13"
,
"17"
,
"2"
];
final
text
S
ubs
=
[
"24"
,
"7"
,
"13"
,
"17"
,
"2"
];
final
text
=
[
final
text
=
[
"Holiday"
,
"Holiday"
,
"Present"
,
"Present"
,
...
@@ -835,9 +833,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
...
@@ -835,9 +833,9 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
),
child:
Center
(
child:
Center
(
child:
Text
(
child:
Text
(
text
_s
ubs
[
index
],
text
S
ubs
[
index
],
style:
TextStyle
(
style:
TextStyle
(
color:
text
_c
olors
[
index
],
color:
text
C
olors
[
index
],
fontSize:
10
,
fontSize:
10
,
),
),
),
),
...
...
lib/screens/CheckInScreen.dart
View file @
7210793a
...
@@ -6,7 +6,6 @@ import 'package:flutter_image_compress/flutter_image_compress.dart';
...
@@ -6,7 +6,6 @@ import 'package:flutter_image_compress/flutter_image_compress.dart';
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/app_colors.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:generp/Utils/commonWidgets.dart'
;
import
'package:google_maps_flutter/google_maps_flutter.dart'
;
import
'package:google_maps_flutter/google_maps_flutter.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'../Notifiers/CheckInProvider.dart'
;
import
'../Notifiers/CheckInProvider.dart'
;
...
@@ -15,7 +14,7 @@ import 'FrontCameraCapture.dart';
...
@@ -15,7 +14,7 @@ import 'FrontCameraCapture.dart';
class
CheckInOutScreen
extends
StatefulWidget
{
class
CheckInOutScreen
extends
StatefulWidget
{
final
int
getAttendanceStatus
;
final
int
getAttendanceStatus
;
const
CheckInOutScreen
({
super
.
key
,
required
this
.
getAttendanceStatus
});
const
CheckInOutScreen
({
super
.
key
,
required
this
.
getAttendanceStatus
});
@override
@override
State
<
CheckInOutScreen
>
createState
()
=>
_CheckInOutScreenState
();
State
<
CheckInOutScreen
>
createState
()
=>
_CheckInOutScreenState
();
...
@@ -31,7 +30,7 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
...
@@ -31,7 +30,7 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
_connectivity
.
initialise
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
}
,
);
});
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
var
prov
=
Provider
.
of
<
CheckInOutProvider
>(
context
,
listen:
false
);
var
prov
=
Provider
.
of
<
CheckInOutProvider
>(
context
,
listen:
false
);
prov
.
getLocationPermission
(
context
);
prov
.
getLocationPermission
(
context
);
...
@@ -46,8 +45,6 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
...
@@ -46,8 +45,6 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
_connectivity
.
disposeStream
();
_connectivity
.
disposeStream
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
@@ -64,244 +61,271 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
...
@@ -64,244 +61,271 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
Size
size
=
MediaQuery
.
of
(
context
).
size
;
Size
size
=
MediaQuery
.
of
(
context
).
size
;
double
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
double
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
return
(
connection
==
'Online'
)?
Consumer
<
CheckInOutProvider
>(
return
(
connection
==
'Online'
)
builder:
(
context
,
provider
,
child
)
{
?
Consumer
<
CheckInOutProvider
>(
return
WillPopScope
(
builder:
(
context
,
provider
,
child
)
{
onWillPop:
()
{
return
WillPopScope
(
provider
.
dispose
();
onWillPop:
()
{
return
onBackPressed
(
context
);},
provider
.
dispose
();
child:
SafeArea
(
return
onBackPressed
(
context
);
top:
false
,
},
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
SafeArea
(
child:
Scaffold
(
top:
false
,
resizeToAvoidBottomInset:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
appBar:
appbar2
(
context
,
widget
.
getAttendanceStatus
==
0
?
"Check In"
:
"Check Out"
,
provider
.
dispose
,
SizedBox
(
width:
0
,)),
child:
Scaffold
(
body:
Container
(
resizeToAvoidBottomInset:
true
,
child:
SafeArea
(
appBar:
appbar2
(
child:
Column
(
context
,
children:
[
widget
.
getAttendanceStatus
==
0
?
"Check In"
:
"Check Out"
,
Expanded
(
provider
.
dispose
,
child:
Stack
(
SizedBox
(
width:
0
),
children:
[
),
GoogleMap
(
body:
Container
(
myLocationEnabled:
true
,
child:
SafeArea
(
zoomGesturesEnabled:
true
,
child:
Column
(
scrollGesturesEnabled:
false
,
children:
[
initialCameraPosition:
CameraPosition
(
Expanded
(
target:
provider
.
currentLocationLatLng
??
child:
Stack
(
provider
.
startLocation
,
children:
[
zoom:
20.0
,
GoogleMap
(
),
myLocationEnabled:
true
,
markers:
provider
.
markers
.
toSet
(),
zoomGesturesEnabled:
true
,
myLocationButtonEnabled:
true
,
scrollGesturesEnabled:
false
,
mapType:
MapType
.
normal
,
initialCameraPosition:
CameraPosition
(
onMapCreated:
(
controller
)
{
target:
provider
.
mapController
=
controller
;
provider
.
currentLocationLatLng
??
provider
.
getCurrentLocation
();
provider
.
startLocation
,
provider
.
getLocationPermission
(
context
);
zoom:
20.0
,
},
onCameraMove:
(
position
)
{
provider
.
onCameraMove
(
position
,
context
);
},
),
Positioned
(
left:
0
,
right:
0
,
bottom:
0
,
child:
Container
(
height:
size
.
height
*
0.3
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
30.0
),
topRight:
Radius
.
circular
(
30.0
),
),
),
markers:
provider
.
markers
.
toSet
(),
myLocationButtonEnabled:
true
,
mapType:
MapType
.
normal
,
onMapCreated:
(
controller
)
{
provider
.
mapController
=
controller
;
provider
.
getCurrentLocation
();
provider
.
getLocationPermission
(
context
);
},
onCameraMove:
(
position
)
{
provider
.
onCameraMove
(
position
,
context
);
},
),
),
child:
Column
(
Positioned
(
crossAxisAlignment:
left:
0
,
CrossAxisAlignment
.
start
,
right:
0
,
children:
[
bottom:
0
,
SizedBox
(
height:
25
),
child:
Container
(
height:
size
.
height
*
0.3
,
Padding
(
decoration:
BoxDecoration
(
padding:
const
EdgeInsets
.
symmetric
(
color:
Colors
.
white
,
horizontal:
20.0
),
borderRadius:
BorderRadius
.
only
(
child:
Column
(
topLeft:
Radius
.
circular
(
30.0
),
crossAxisAlignment:
CrossAxisAlignment
.
start
,
topRight:
Radius
.
circular
(
30.0
),
children:
[
Text
(
"Share Your Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaSemiBold"
),
),
SizedBox
(
height:
10
,),
Text
(
"Location"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
semi_black
,
),
),
],
),
),
),
),
SizedBox
(
height:
5
),
child:
Column
(
Padding
(
crossAxisAlignment:
padding:
const
EdgeInsets
.
symmetric
(
CrossAxisAlignment
.
start
,
horizontal:
20.0
),
children:
[
child:
Container
(
SizedBox
(
height:
25
),
height:
50
,
alignment:
Alignment
.
center
,
Padding
(
decoration:
BoxDecoration
(
padding:
const
EdgeInsets
.
symmetric
(
color:
AppColors
.
text_field_color
,
horizontal:
20.0
,
borderRadius:
),
BorderRadius
.
circular
(
14
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
"Share Your Details"
,
style:
TextStyle
(
color:
AppColors
.
app_blue
,
fontFamily:
"JakartaSemiBold"
,
),
),
SizedBox
(
height:
10
),
Text
(
"Location"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
color:
AppColors
.
semi_black
,
),
),
],
),
),
),
child:
Padding
(
SizedBox
(
height:
5
),
padding:
Padding
(
const
EdgeInsets
.
fromLTRB
(
padding:
const
EdgeInsets
.
symmetric
(
10.0
,
0.0
,
10
,
0
),
horizontal:
20.0
,
child:
TextFormField
(
),
controller:
child:
Container
(
provider
.
locationController
,
height:
50
,
keyboardType:
TextInputType
.
text
,
onChanged:
(
value
)
{
provider
.
validateLocation
=
""
;
provider
.
notifyListeners
();
},
decoration:
InputDecoration
(
hintText:
alignment:
Alignment
.
center
,
"Enter Check
${widget.getAttendanceStatus==0?"In":"Out"}
Location"
,
decoration:
BoxDecoration
(
hintStyle:
TextStyle
(
color:
AppColors
.
text_field_color
,
fontWeight:
FontWeight
.
w400
,
borderRadius:
fontSize:
14
,
BorderRadius
.
circular
(
14
),
color:
Color
(
0xFF818181
)
),
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
controller:
provider
.
locationController
,
keyboardType:
TextInputType
.
text
,
onChanged:
(
value
)
{
provider
.
validateLocation
=
""
;
provider
.
notifyListeners
();
},
decoration:
InputDecoration
(
hintText:
"Enter Check
${widget.getAttendanceStatus == 0 ? "In" : "Out"}
Location"
,
hintStyle:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
fontSize:
14
,
color:
Color
(
0xFF818181
),
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
enabledBorder:
InputBorder
.
none
,
focusedBorder:
InputBorder
.
none
,
),
),
),
),
),
),
),
if
(
provider
.
validateLocation
!=
null
)
),
Padding
(
if
(
provider
.
validateLocation
!=
null
)
padding:
const
EdgeInsets
.
symmetric
(
Padding
(
horizontal:
20.0
,
padding:
),
const
EdgeInsets
.
symmetric
(
child:
Container
(
horizontal:
20.0
),
alignment:
Alignment
.
topLeft
,
child:
Container
(
margin:
EdgeInsets
.
only
(
alignment:
Alignment
.
topLeft
,
top:
2.5
,
margin:
EdgeInsets
.
only
(
bottom:
2.5
,
top:
2.5
,
left:
25
,
bottom:
2.5
,
),
left:
25
),
child:
Text
(
child:
Text
(
provider
.
validateLocation
!,
provider
.
validateLocation
!,
textAlign:
TextAlign
.
start
,
textAlign:
TextAlign
.
start
,
style:
TextStyle
(
style:
TextStyle
(
color:
Colors
.
red
,
color:
Colors
.
red
,
),
),
),
),
)
else
SizedBox
(
height:
5.0
),
SizedBox
(
height:
20
),
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20.0
,
),
),
),
child:
InkWell
(
)
onTap:
()
async
{
else
if
(
provider
SizedBox
(
height:
5.0
),
.
locationController
SizedBox
(
height:
20
),
.
text
Padding
(
.
isEmpty
)
{
padding:
const
EdgeInsets
.
symmetric
(
provider
.
validateLocation
=
horizontal:
20.0
),
"Please Enter location"
;
child:
InkWell
(
provider
.
notifyListeners
();
onTap:
()
async
{
}
else
{
if
(
provider
provider
.
validateLocation
=
""
;
.
locationController
if
(
Platform
.
isAndroid
)
{
.
text
provider
.
isEmpty
)
{
.
image
=
await
Navigator
.
push
(
provider
.
validateLocation
=
context
,
"Please Enter location"
;
MaterialPageRoute
(
provider
.
notifyListeners
();
builder:
}
else
{
(
context
)
=>
provider
.
validateLocation
=
""
;
FrontCameraCapture
(),
if
(
Platform
.
isAndroid
)
{
),
provider
.
image
=
await
Navigator
.
push
(
);
context
,
print
(
"
${provider.image}
"
);
MaterialPageRoute
(
if
(
provider
.
image
!=
null
)
{
builder:
(
context
)
=>
provider
.
imagePicked
=
1
;
FrontCameraCapture
()));
}
print
(
"
${provider.image}
"
);
var
file
=
if
(
provider
.
image
!=
null
){
await
FlutterImageCompress
.
compressWithFile
(
provider
.
imagePicked
=
1
;
provider
.
image
!.
path
,
}
);
var
file
=
await
FlutterImageCompress
.
compressWithFile
(
if
(
file
!=
null
)
{
provider
.
image
!.
path
,
if
(
widget
);
.
getAttendanceStatus
==
if
(
file
!=
null
)
{
0
)
{
if
(
widget
.
getAttendanceStatus
==
0
)
{
provider
.
checkIn
(
context
);
provider
.
checkIn
(
context
);
}
else
if
(
widget
}
else
if
(
widget
.
getAttendanceStatus
==
1
)
{
.
getAttendanceStatus
==
provider
.
checkOut
(
context
);
1
)
{
provider
.
checkOut
(
context
,
);
}
}
}
else
if
(
Platform
.
isIOS
)
{
// BackgroundLocation.stopLocationService();
provider
.
imgFromCamera
(
context
,
widget
.
getAttendanceStatus
,
);
// setState(() {
// isLoading = true;
// image_picked = 0;
// CheckIn();
// });
}
}
}
}
},
child:
Container
(
alignment:
Alignment
.
center
,
height:
45
,
width:
screenWidth
,
}
else
if
(
Platform
.
isIOS
)
{
decoration:
BoxDecoration
(
// BackgroundLocation.stopLocationService();
color:
AppColors
.
app_blue
,
provider
.
imgFromCamera
(
borderRadius:
context
,
widget
.
getAttendanceStatus
);
BorderRadius
.
circular
(
15.0
),
// setState(() {
),
// isLoading = true;
child:
Text
(
// image_picked = 0;
widget
.
getAttendanceStatus
==
0
// CheckIn();
?
"Check In"
// });
:
"Check Out"
,
}
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
16
,
}
color:
Colors
.
white
,
},
),
child:
Container
(
),
alignment:
Alignment
.
center
,
height:
45
,
width:
screenWidth
,
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15.0
),
),
child:
Text
(
widget
.
getAttendanceStatus
==
0
?
"Check In"
:
"Check Out"
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
16
,
color:
Colors
.
white
),
),
),
),
),
),
)
,
]
,
),
),
]
,
)
,
),
),
)
,
]
,
),
),
]
,
)
,
)
,
]
,
),
),
]
,
)
,
),
),
),
),
),
),
),
);
),
},
);
)
},
:
NoNetwork
(
context
);
):
NoNetwork
(
context
);
}
}
}
}
lib/screens/CommonFilter2.dart
View file @
7210793a
...
@@ -75,15 +75,14 @@ class CommonFilter2 {
...
@@ -75,15 +75,14 @@ class CommonFilter2 {
// Get formatted date range as a list of strings
// Get formatted date range as a list of strings
List
<
String
>
getFormattedDateRange
(
DateTimeRange
?
dateRange
)
{
List
<
String
>
getFormattedDateRange
(
DateTimeRange
?
dateRange
)
{
if
(
dateRange
!=
null
)
{
if
(
dateRange
!=
null
)
{
return
[
return
[
formatDate
(
dateRange
.
start
),
formatDate
(
dateRange
.
end
)];
formatDate
(
dateRange
.
start
),
formatDate
(
dateRange
.
end
),
];
}
}
return
[];
return
[];
}
}
Future
<
Map
<
String
,
dynamic
>?>
showFilterBottomSheet
(
BuildContext
context
)
async
{
Future
<
Map
<
String
,
dynamic
>?>
showFilterBottomSheet
(
BuildContext
context
,
)
async
{
String
?
tempSelectedValue
=
selectedValue
;
String
?
tempSelectedValue
=
selectedValue
;
DateTimeRange
?
tempSelectedDateRange
=
selectedDateRange
;
DateTimeRange
?
tempSelectedDateRange
=
selectedDateRange
;
DateTime
?
tempStartDate
;
DateTime
?
tempStartDate
;
...
@@ -93,8 +92,16 @@ class CommonFilter2 {
...
@@ -93,8 +92,16 @@ class CommonFilter2 {
String
?
tempSelectedType
=
selectedType
??
"All"
;
String
?
tempSelectedType
=
selectedType
??
"All"
;
Widget
buildCalendar
(
StateSetter
setState
)
{
Widget
buildCalendar
(
StateSetter
setState
)
{
final
firstDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
1
);
final
firstDayOfMonth
=
DateTime
(
final
lastDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
,
0
);
displayedMonth
.
year
,
displayedMonth
.
month
,
1
,
);
final
lastDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
,
0
,
);
final
firstDayOfWeek
=
firstDayOfMonth
.
weekday
;
final
firstDayOfWeek
=
firstDayOfMonth
.
weekday
;
final
daysInMonth
=
lastDayOfMonth
.
day
;
final
daysInMonth
=
lastDayOfMonth
.
day
;
final
daysBefore
=
(
firstDayOfWeek
-
1
)
%
7
;
final
daysBefore
=
(
firstDayOfWeek
-
1
)
%
7
;
...
@@ -102,32 +109,43 @@ class CommonFilter2 {
...
@@ -102,32 +109,43 @@ class CommonFilter2 {
List
<
Widget
>
dayWidgets
=
[];
List
<
Widget
>
dayWidgets
=
[];
final
weekdays
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
];
final
weekdays
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
];
dayWidgets
.
addAll
(
weekdays
.
map
((
day
)
=>
Center
(
dayWidgets
.
addAll
(
child:
Text
(
weekdays
.
map
(
day
,
(
day
)
=>
Center
(
style:
TextStyle
(
child:
Text
(
fontSize:
14
,
day
,
fontWeight:
FontWeight
.
w600
,
style:
TextStyle
(
color:
Colors
.
grey
[
700
],
fontSize:
14
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
grey
[
700
],
),
),
),
),
),
),
))
);
);
for
(
int
i
=
0
;
i
<
daysBefore
;
i
++)
{
for
(
int
i
=
0
;
i
<
daysBefore
;
i
++)
{
dayWidgets
.
add
(
Container
());
dayWidgets
.
add
(
Container
());
}
}
for
(
int
day
=
1
;
day
<=
daysInMonth
;
day
++)
{
for
(
int
day
=
1
;
day
<=
daysInMonth
;
day
++)
{
final
currentDate
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
day
);
final
currentDate
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
day
,
);
bool
isSelected
=
false
;
bool
isSelected
=
false
;
bool
isInRange
=
false
;
bool
isInRange
=
false
;
bool
isOutsideRange
=
bool
isOutsideRange
=
currentDate
.
isBefore
(
DateTime
(
2020
))
||
currentDate
.
isAfter
(
DateTime
(
2100
));
currentDate
.
isBefore
(
DateTime
(
2020
))
||
currentDate
.
isAfter
(
DateTime
(
2100
));
if
(
tempStartDate
!=
null
&&
tempEndDate
!=
null
)
{
if
(
tempStartDate
!=
null
&&
tempEndDate
!=
null
)
{
isSelected
=
currentDate
.
isAtSameMomentAs
(
tempStartDate
!)
||
isSelected
=
currentDate
.
isAtSameMomentAs
(
tempStartDate
!)
||
currentDate
.
isAtSameMomentAs
(
tempEndDate
!);
currentDate
.
isAtSameMomentAs
(
tempEndDate
!);
isInRange
=
currentDate
.
isAfter
(
tempStartDate
!)
&&
isInRange
=
currentDate
.
isAfter
(
tempStartDate
!)
&&
currentDate
.
isBefore
(
tempEndDate
!)
&&
currentDate
.
isBefore
(
tempEndDate
!)
&&
!
isSelected
;
!
isSelected
;
}
else
if
(
tempStartDate
!=
null
)
{
}
else
if
(
tempStartDate
!=
null
)
{
...
@@ -136,49 +154,55 @@ class CommonFilter2 {
...
@@ -136,49 +154,55 @@ class CommonFilter2 {
dayWidgets
.
add
(
dayWidgets
.
add
(
GestureDetector
(
GestureDetector
(
onTap:
isOutsideRange
onTap:
?
null
isOutsideRange
:
()
{
?
null
setState
(()
{
:
()
{
if
(
tempStartDate
==
null
)
{
setState
(()
{
tempStartDate
=
currentDate
;
if
(
tempStartDate
==
null
)
{
tempSelectedDateRange
=
null
;
tempStartDate
=
currentDate
;
}
else
if
(
tempEndDate
==
null
)
{
tempSelectedDateRange
=
null
;
if
(
currentDate
.
isBefore
(
tempStartDate
!))
{
}
else
if
(
tempEndDate
==
null
)
{
tempEndDate
=
tempStartDate
;
if
(
currentDate
.
isBefore
(
tempStartDate
!))
{
tempStartDate
=
currentDate
;
tempEndDate
=
tempStartDate
;
}
else
{
tempStartDate
=
currentDate
;
tempEndDate
=
currentDate
;
}
else
{
}
tempEndDate
=
currentDate
;
tempSelectedDateRange
=
}
DateTimeRange
(
start:
tempStartDate
!,
end:
tempEndDate
!);
tempSelectedDateRange
=
DateTimeRange
(
}
else
{
start:
tempStartDate
!,
tempStartDate
=
currentDate
;
end:
tempEndDate
!,
tempEndDate
=
null
;
);
tempSelectedDateRange
=
null
;
}
else
{
}
tempStartDate
=
currentDate
;
});
tempEndDate
=
null
;
},
tempSelectedDateRange
=
null
;
}
});
},
child:
Container
(
child:
Container
(
margin:
const
EdgeInsets
.
all
(
2
),
margin:
const
EdgeInsets
.
all
(
2
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
isSelected
color:
?
Colors
.
blue
[
600
]
isSelected
:
isInRange
?
Colors
.
blue
[
600
]
?
Colors
.
blue
[
100
]
:
isInRange
:
null
,
?
Colors
.
blue
[
100
]
:
null
,
shape:
BoxShape
.
circle
,
shape:
BoxShape
.
circle
,
),
),
child:
Center
(
child:
Center
(
child:
Text
(
child:
Text
(
'
$day
'
,
'
$day
'
,
style:
TextStyle
(
style:
TextStyle
(
color:
isOutsideRange
color:
?
Colors
.
grey
[
400
]
isOutsideRange
:
isSelected
?
Colors
.
grey
[
400
]
?
Colors
.
white
:
isSelected
:
Colors
.
black
,
?
Colors
.
white
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
:
Colors
.
black
,
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
),
),
),
),
),
...
@@ -193,29 +217,38 @@ class CommonFilter2 {
...
@@ -193,29 +217,38 @@ class CommonFilter2 {
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
GestureDetector
(
GestureDetector
(
onTap:
displayedMonth
.
isAfter
(
DateTime
(
2020
))
onTap:
?
()
{
displayedMonth
.
isAfter
(
DateTime
(
2020
))
setState
(()
{
?
()
{
displayedMonth
=
setState
(()
{
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
-
1
);
displayedMonth
=
DateTime
(
});
displayedMonth
.
year
,
}
displayedMonth
.
month
-
1
,
:
null
,
);
});
}
:
null
,
child:
SvgPicture
.
asset
(
"assets/svg/arrow_left.svg"
),
child:
SvgPicture
.
asset
(
"assets/svg/arrow_left.svg"
),
),
),
Text
(
Text
(
'
${_monthName(displayedMonth.month)}
${displayedMonth.year}
'
,
'
${_monthName(displayedMonth.month)}
${displayedMonth.year}
'
,
style:
const
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w600
),
style:
const
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w600
,
),
),
),
GestureDetector
(
GestureDetector
(
onTap:
displayedMonth
.
isBefore
(
DateTime
(
2100
))
onTap:
?
()
{
displayedMonth
.
isBefore
(
DateTime
(
2100
))
setState
(()
{
?
()
{
displayedMonth
=
setState
(()
{
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
);
displayedMonth
=
DateTime
(
});
displayedMonth
.
year
,
}
displayedMonth
.
month
+
1
,
:
null
,
);
});
}
:
null
,
child:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
),
child:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
),
),
),
],
],
...
@@ -225,8 +258,8 @@ class CommonFilter2 {
...
@@ -225,8 +258,8 @@ class CommonFilter2 {
child:
GridView
.
count
(
child:
GridView
.
count
(
crossAxisCount:
7
,
crossAxisCount:
7
,
childAspectRatio:
1.2
,
childAspectRatio:
1.2
,
children:
dayWidgets
,
physics:
const
NeverScrollableScrollPhysics
(),
physics:
const
NeverScrollableScrollPhysics
(),
children:
dayWidgets
,
),
),
),
),
],
],
...
@@ -265,8 +298,13 @@ class CommonFilter2 {
...
@@ -265,8 +298,13 @@ class CommonFilter2 {
const
SizedBox
(
height:
20
),
const
SizedBox
(
height:
20
),
/// Type filter
/// Type filter
const
Text
(
"Type"
,
const
Text
(
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
)),
"Type"
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
,
),
),
const
SizedBox
(
height:
8
),
const
SizedBox
(
height:
8
),
DropdownButtonHideUnderline
(
DropdownButtonHideUnderline
(
child:
Row
(
child:
Row
(
...
@@ -275,10 +313,15 @@ class CommonFilter2 {
...
@@ -275,10 +313,15 @@ class CommonFilter2 {
child:
DropdownButton2
<
String
>(
child:
DropdownButton2
<
String
>(
isExpanded:
true
,
isExpanded:
true
,
value:
tempSelectedType
,
value:
tempSelectedType
,
items:
typeItems
items:
.
map
((
type
)
=>
typeItems
DropdownMenuItem
<
String
>(
value:
type
,
child:
Text
(
type
)))
.
map
(
.
toList
(),
(
type
)
=>
DropdownMenuItem
<
String
>(
value:
type
,
child:
Text
(
type
),
),
)
.
toList
(),
onChanged:
(
value
)
{
onChanged:
(
value
)
{
setState
(()
{
setState
(()
{
tempSelectedType
=
value
;
tempSelectedType
=
value
;
...
@@ -296,8 +339,13 @@ class CommonFilter2 {
...
@@ -296,8 +339,13 @@ class CommonFilter2 {
const
SizedBox
(
height:
20
),
const
SizedBox
(
height:
20
),
/// Date range filter
/// Date range filter
const
Text
(
"Date Range"
,
const
Text
(
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
)),
"Date Range"
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w500
,
),
),
const
SizedBox
(
height:
8
),
const
SizedBox
(
height:
8
),
DropdownButtonHideUnderline
(
DropdownButtonHideUnderline
(
child:
Row
(
child:
Row
(
...
@@ -313,27 +361,32 @@ class CommonFilter2 {
...
@@ -313,27 +361,32 @@ class CommonFilter2 {
color:
Colors
.
black
,
color:
Colors
.
black
,
),
),
),
),
items:
filterItems
items:
.
map
((
String
item
)
=>
filterItems
DropdownMenuItem
<
String
>(
.
map
(
value:
item
,
child:
Text
(
(
String
item
)
=>
item
,
DropdownMenuItem
<
String
>(
style:
TextStyle
(
value:
item
,
fontSize:
14
,
child:
Text
(
fontWeight:
FontWeight
.
w400
,
item
,
color:
Colors
.
black
,
style:
TextStyle
(
),
fontSize:
14
,
)
fontWeight:
FontWeight
.
w400
,
)
color:
Colors
.
black
,
)
),
.
toList
(),
),
),
)
.
toList
(),
value:
tempSelectedValue
,
value:
tempSelectedValue
,
onChanged:
(
String
?
value
)
{
onChanged:
(
String
?
value
)
{
if
(
value
==
null
)
return
;
if
(
value
==
null
)
return
;
setState
(()
{
setState
(()
{
tempSelectedValue
=
value
;
tempSelectedValue
=
value
;
if
(
value
!=
'Custom'
)
{
if
(
value
!=
'Custom'
)
{
tempSelectedDateRange
=
getDateRange
(
value
);
tempSelectedDateRange
=
getDateRange
(
value
,
);
tempStartDate
=
null
;
tempStartDate
=
null
;
tempEndDate
=
null
;
tempEndDate
=
null
;
}
else
{
}
else
{
...
@@ -353,47 +406,56 @@ class CommonFilter2 {
...
@@ -353,47 +406,56 @@ class CommonFilter2 {
),
),
),
),
if
(
tempSelectedValue
==
'Custom'
)
...[
const
SizedBox
(
height:
16
),
Container
(
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
grey
[
300
]!),
borderRadius:
BorderRadius
.
circular
(
12
),
),
padding:
const
EdgeInsets
.
all
(
12
),
child:
buildCalendar
(
setState
),
),
if
(
tempSelectedDateRange
!=
null
)
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
12.0
),
child:
Text
(
'Selected:
${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)}
to
${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}
'
,
style:
TextStyle
(
fontSize:
14
,
color:
Colors
.
grey
[
600
],
),
),
),
],
if
(
tempSelectedValue
==
'Custom'
)
...[
const
SizedBox
(
height:
20
),
const
SizedBox
(
height:
16
),
Container
(
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
grey
[
300
]!),
borderRadius:
BorderRadius
.
circular
(
12
),
),
padding:
const
EdgeInsets
.
all
(
12
),
child:
buildCalendar
(
setState
),
),
if
(
tempSelectedDateRange
!=
null
)
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
12.0
),
child:
Text
(
'Selected:
${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)}
to
${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}
'
,
style:
TextStyle
(
fontSize:
14
,
color:
Colors
.
grey
[
600
]),
),
),
],
const
SizedBox
(
height:
20
),
Row
(
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
children:
[
TextButton
(
TextButton
(
onPressed:
()
=>
Navigator
.
pop
(
context
),
onPressed:
()
=>
Navigator
.
pop
(
context
),
child:
Text
(
'Cancel'
,
child:
Text
(
style:
TextStyle
(
color:
Colors
.
grey
[
600
])),
'Cancel'
,
style:
TextStyle
(
color:
Colors
.
grey
[
600
]),
),
),
),
const
SizedBox
(
width:
8
),
const
SizedBox
(
width:
8
),
ElevatedButton
(
ElevatedButton
(
onPressed:
()
{
onPressed:
()
{
Navigator
.
pop
(
context
,
{
Navigator
.
pop
(
context
,
{
'type'
:
tempSelectedType
,
// if you store type separately
'type'
:
'selectedValue'
:
tempSelectedValue
,
// could be null
tempSelectedType
,
// if you store type separately
'dateRange'
:
tempSelectedDateRange
,
// could be null
'selectedValue'
:
'formatted'
:
tempSelectedDateRange
!=
null
tempSelectedValue
,
// could be null
?
getFormattedDateRange
(
tempSelectedDateRange
)
'dateRange'
:
:
null
,
tempSelectedDateRange
,
// could be null
'formatted'
:
tempSelectedDateRange
!=
null
?
getFormattedDateRange
(
tempSelectedDateRange
,
)
:
null
,
});
});
},
},
style:
ElevatedButton
.
styleFrom
(
style:
ElevatedButton
.
styleFrom
(
...
@@ -405,7 +467,6 @@ class CommonFilter2 {
...
@@ -405,7 +467,6 @@ class CommonFilter2 {
),
),
child:
const
Text
(
'Apply'
),
child:
const
Text
(
'Apply'
),
),
),
],
],
),
),
],
],
...
@@ -432,7 +493,7 @@ class CommonFilter2 {
...
@@ -432,7 +493,7 @@ class CommonFilter2 {
'September'
,
'September'
,
'October'
,
'October'
,
'November'
,
'November'
,
'December'
'December'
,
];
];
return
months
[
month
-
1
];
return
months
[
month
-
1
];
}
}
...
...
lib/screens/FrontCameraCapture.dart
View file @
7210793a
...
@@ -11,7 +11,7 @@ import 'package:permission_handler/permission_handler.dart';
...
@@ -11,7 +11,7 @@ import 'package:permission_handler/permission_handler.dart';
import
'../Utils/commonServices.dart'
;
import
'../Utils/commonServices.dart'
;
class
FrontCameraCapture
extends
StatefulWidget
{
class
FrontCameraCapture
extends
StatefulWidget
{
const
FrontCameraCapture
({
Key
?
key
})
:
super
(
key:
key
);
const
FrontCameraCapture
({
super
.
key
}
);
@override
@override
State
<
FrontCameraCapture
>
createState
()
=>
_CheckOutScreenState
();
State
<
FrontCameraCapture
>
createState
()
=>
_CheckOutScreenState
();
...
@@ -56,7 +56,7 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
...
@@ -56,7 +56,7 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
(
camera
)
=>
camera
.
lensDirection
==
CameraLensDirection
.
front
,
(
camera
)
=>
camera
.
lensDirection
==
CameraLensDirection
.
front
,
);
);
// final frontCamera = CameraLensDirection.front;
// final frontCamera = CameraLensDirection.front;
cam_controller
=
CameraController
(
frontCamera
,
ResolutionPreset
.
max
,
);
cam_controller
=
CameraController
(
frontCamera
,
ResolutionPreset
.
max
);
await
cam_controller
.
initialize
();
await
cam_controller
.
initialize
();
...
@@ -82,59 +82,63 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
...
@@ -82,59 +82,63 @@ class _CheckOutScreenState extends State<FrontCameraCapture> {
return
SafeArea
(
return
SafeArea
(
top:
false
,
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
child:
Scaffold
(
// appBar: AppBar(automaticallyImplyLeading: false),
// appBar: AppBar(automaticallyImplyLeading: false),
body:
isLoading
body:
?
Center
(
child:
CircularProgressIndicator
())
isLoading
:
Row
(
?
Center
(
child:
CircularProgressIndicator
())
children:
[
:
Row
(
Expanded
(
children:
[
child:
SizedBox
(
Expanded
(
height:
double
.
infinity
,
child:
SizedBox
(
child:
height:
double
.
infinity
,
cam_controller
.
value
.
isInitialized
child:
?
Transform
(
cam_controller
.
value
.
isInitialized
alignment:
Alignment
.
center
,
?
Transform
(
transform:
Matrix4
.
rotationY
(
math
.
pi
),
alignment:
Alignment
.
center
,
child:
CameraPreview
(
transform:
Matrix4
.
rotationY
(
math
.
pi
),
cam_controller
,
child:
CameraPreview
(
child:
Align
(
cam_controller
,
alignment:
Alignment
.
bottomCenter
,
child:
Align
(
child:
GestureDetector
(
alignment:
Alignment
.
bottomCenter
,
onTap:
()
async
{
child:
GestureDetector
(
if
(!
cam_controller
onTap:
()
async
{
.
value
if
(!
cam_controller
.
isInitialized
)
.
value
return
;
.
isInitialized
)
{
final
image
=
return
;
await
cam_controller
}
.
takePicture
();
final
image
=
_image
=
File
(
image
.
path
);
await
cam_controller
Navigator
.
pop
(
context
,
_image
);
.
takePicture
();
_image
=
File
(
image
.
path
);
},
Navigator
.
pop
(
context
,
_image
);
child:
Container
(
},
height:
100
,
child:
Container
(
width:
double
.
infinity
,
height:
100
,
padding:
EdgeInsets
.
all
(
10
),
width:
double
.
infinity
,
decoration:
BoxDecoration
(
padding:
EdgeInsets
.
all
(
10
),
color:
Colors
.
black26
decoration:
BoxDecoration
(
),
color:
Colors
.
black26
,
child:
Center
(
),
child:
SvgPicture
.
asset
(
"assets/svg/check_in_cam.svg"
,
width:
50
,
height:
50
,)
child:
Center
(
child:
SvgPicture
.
asset
(
"assets/svg/check_in_cam.svg"
,
width:
50
,
height:
50
,
),
),
),
),
),
),
),
),
),
)
,
)
),
:
Center
(
child:
Text
(
"Camera not ready"
)
),
)
)
,
:
Center
(
child:
Text
(
"Camera not ready"
)
),
),
)
,
]
,
),
),
],
),
),
),
);
);
}
}
...
...
lib/screens/JobDescription.dart
View file @
7210793a
...
@@ -9,17 +9,16 @@ class JobDescriptionScreen extends StatefulWidget {
...
@@ -9,17 +9,16 @@ class JobDescriptionScreen extends StatefulWidget {
final
String
designation
;
final
String
designation
;
const
JobDescriptionScreen
({
const
JobDescriptionScreen
({
Key
?
key
,
super
.
key
,
required
this
.
htmlData
,
required
this
.
htmlData
,
this
.
title
=
"Job Description"
,
this
.
title
=
"Job Description"
,
required
this
.
designation
,
required
this
.
designation
,
})
:
super
(
key:
key
)
;
});
@override
@override
State
<
JobDescriptionScreen
>
createState
()
=>
_JobDescriptionScreenState
();
State
<
JobDescriptionScreen
>
createState
()
=>
_JobDescriptionScreenState
();
}
}
class
_JobDescriptionScreenState
extends
State
<
JobDescriptionScreen
>
{
class
_JobDescriptionScreenState
extends
State
<
JobDescriptionScreen
>
{
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
lib/screens/LoginScreen.dart
View file @
7210793a
...
@@ -42,7 +42,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -42,7 +42,7 @@ class _LoginScreenState extends State<LoginScreen>
late
FocusNode
_passwordFocusNode
;
late
FocusNode
_passwordFocusNode
;
bool
_isTextFieldFocused
=
false
;
bool
_isTextFieldFocused
=
false
;
KeyboardVisibilityController
_keyboardVisibilityController
=
final
KeyboardVisibilityController
_keyboardVisibilityController
=
KeyboardVisibilityController
();
KeyboardVisibilityController
();
@override
@override
...
@@ -118,8 +118,8 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -118,8 +118,8 @@ class _LoginScreenState extends State<LoginScreen>
actions:
[
actions:
[
TextButton
(
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
Material
StateProperty
.
all
(
Colors
.
white
),
backgroundColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Material
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
),
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
false
),
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
false
),
child:
Text
(
child:
Text
(
...
@@ -130,8 +130,8 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -130,8 +130,8 @@ class _LoginScreenState extends State<LoginScreen>
const
SizedBox
(
height:
16
),
const
SizedBox
(
height:
16
),
TextButton
(
TextButton
(
style:
ButtonStyle
(
style:
ButtonStyle
(
backgroundColor:
Material
StateProperty
.
all
(
Colors
.
white
),
backgroundColor:
Widget
StateProperty
.
all
(
Colors
.
white
),
overlayColor:
Material
StateProperty
.
all
(
Colors
.
white70
),
overlayColor:
Widget
StateProperty
.
all
(
Colors
.
white70
),
),
),
onPressed:
onPressed:
()
=>
SystemChannels
.
platform
.
invokeMethod
(
()
=>
SystemChannels
.
platform
.
invokeMethod
(
...
@@ -259,7 +259,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -259,7 +259,7 @@ class _LoginScreenState extends State<LoginScreen>
)
)
:
Column
(
:
Column
(
children:
[
children:
[
Container
(
SizedBox
(
width:
180
,
width:
180
,
height:
120
,
height:
120
,
child:
Image
.
asset
(
child:
Image
.
asset
(
...
@@ -363,7 +363,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -363,7 +363,7 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
),
),
),
if
(
loginProv
.
emailError
!=
null
)
...[
...[
Container
(
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -374,11 +374,12 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -374,11 +374,12 @@ class _LoginScreenState extends State<LoginScreen>
child:
Text
(
child:
Text
(
loginProv
.
emailError
,
loginProv
.
emailError
,
textAlign:
TextAlign
.
start
,
textAlign:
TextAlign
.
start
,
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
,),
style:
TextStyle
(
color:
Colors
.
red
,
fontSize:
10
,
),
),
),
),
),
]
else
...[
SizedBox
(
height:
10.0
),
],
],
Container
(
Container
(
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
...
@@ -486,7 +487,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -486,7 +487,7 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
),
),
),
if
(
loginProv
.
passwordError
!=
null
)
...[
...[
Container
(
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -503,10 +504,8 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -503,10 +504,8 @@ class _LoginScreenState extends State<LoginScreen>
),
),
),
),
),
),
]
else
...[
SizedBox
(
height:
15.0
),
],
],
SizedBox
(
height:
10
,
),
SizedBox
(
height:
10
),
InkWell
(
InkWell
(
onTap:
onTap:
loginProv
.
isLoading
loginProv
.
isLoading
...
@@ -519,9 +518,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -519,9 +518,7 @@ class _LoginScreenState extends State<LoginScreen>
email
.
text
,
email
.
text
,
password
.
text
,
password
.
text
,
);
);
var
f
=
FocusScope
.
of
(
var
f
=
FocusScope
.
of
(
context
);
context
,
);
if
(!
f
.
hasPrimaryFocus
)
{
if
(!
f
.
hasPrimaryFocus
)
{
f
.
unfocus
();
f
.
unfocus
();
...
@@ -550,9 +547,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -550,9 +547,7 @@ class _LoginScreenState extends State<LoginScreen>
child:
child:
loginProv
.
isLoading
loginProv
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
?
CircularProgressIndicator
.
adaptive
(
padding:
EdgeInsets
.
all
(
padding:
EdgeInsets
.
all
(
5
),
5
,
),
valueColor:
valueColor:
AlwaysStoppedAnimation
(
AlwaysStoppedAnimation
(
Colors
.
white
,
Colors
.
white
,
...
@@ -560,8 +555,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -560,8 +555,7 @@ class _LoginScreenState extends State<LoginScreen>
)
)
:
Text
(
:
Text
(
"Login"
,
"Login"
,
textAlign:
textAlign:
TextAlign
.
center
,
TextAlign
.
center
,
style:
TextStyle
(
style:
TextStyle
(
color:
Colors
.
white
,
color:
Colors
.
white
,
fontFamily:
fontFamily:
...
@@ -609,7 +603,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -609,7 +603,7 @@ class _LoginScreenState extends State<LoginScreen>
),
),
touchThroughAreaShape:
ClipAreaShape
.
rectangle
,
touchThroughAreaShape:
ClipAreaShape
.
rectangle
,
touchThroughAreaCornerRadius:
30
,
touchThroughAreaCornerRadius:
30
,
content:
Container
(
content:
SizedBox
(
height:
100
,
height:
100
,
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
@@ -652,7 +646,7 @@ class _LoginScreenState extends State<LoginScreen>
...
@@ -652,7 +646,7 @@ class _LoginScreenState extends State<LoginScreen>
BorderRadius
.
circular
(
10.0
),
BorderRadius
.
circular
(
10.0
),
),
),
child:
Text
(
child:
Text
(
'
${
loginProv.deviceId
}
'
,
loginProv
.
deviceId
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
16
,
fontSize:
16
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
...
...
lib/screens/ScannerLogin.dart
View file @
7210793a
...
@@ -26,7 +26,6 @@ class _ScannerloginState extends State<Scannerlogin> {
...
@@ -26,7 +26,6 @@ class _ScannerloginState extends State<Scannerlogin> {
// TODO: implement initState
// TODO: implement initState
_connectivity
.
initialise
();
_connectivity
.
initialise
();
_connectivity
.
myStream
.
listen
((
source
)
{
_connectivity
.
myStream
.
listen
((
source
)
{
setState
(()
=>
_source
=
source
);
setState
(()
=>
_source
=
source
);
});
});
...
@@ -70,7 +69,7 @@ class _ScannerloginState extends State<Scannerlogin> {
...
@@ -70,7 +69,7 @@ class _ScannerloginState extends State<Scannerlogin> {
child:
Column
(
child:
Column
(
children:
[
children:
[
Spacer
(),
Spacer
(),
Container
(
SizedBox
(
height:
250
,
height:
250
,
child:
QRView
(
child:
QRView
(
...
...
lib/screens/UpdatePasswordScreen.dart
View file @
7210793a
import
'dart:io'
;
import
'dart:io'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:generp/Notifiers/UpdatePasswordProvider.dart'
;
import
'package:generp/Notifiers/UpdatePasswordProvider.dart'
;
...
@@ -19,7 +18,7 @@ class UpdatePassword extends StatelessWidget {
...
@@ -19,7 +18,7 @@ class UpdatePassword extends StatelessWidget {
onWillPop:
()
=>
onBackPressed
(
context
),
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
child:
SafeArea
(
top:
false
,
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Update Password"
),
appBar:
appbar
(
context
,
"Update Password"
),
...
@@ -49,90 +48,97 @@ class UpdatePassword extends StatelessWidget {
...
@@ -49,90 +48,97 @@ class UpdatePassword extends StatelessWidget {
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
Container
(
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"New Password"
,
style:
TextStyle
(
child:
Text
(
color:
AppColors
.
semi_black
"New Password"
,
),)),
style:
TextStyle
(
color:
AppColors
.
semi_black
),
),
),
SizedBox
(
height:
5
),
SizedBox
(
height:
5
),
_buildTextField
(
_buildTextField
(
controller:
provider
.
password
,
controller:
provider
.
password
,
hintText:
"New Password*"
,
hintText:
"New Password*"
,
errorText:
provider
.
passwordError
,
errorText:
provider
.
passwordError
,
obscureText:
!
provider
.
pwdVisible
,
obscureText:
!
provider
.
pwdVisible
,
suffixIcon:
IconButton
(
suffixIcon:
IconButton
(
icon:
icon:
provider
.
pwdVisible
provider
.
pwdVisible
?
SvgPicture
.
asset
(
?
SvgPicture
.
asset
(
width:
35
,
width:
35
,
height:
35
,
height:
35
,
"assets/svg/password_visible.svg"
,
"assets/svg/password_visible.svg"
,
)
)
:
SvgPicture
.
asset
(
:
SvgPicture
.
asset
(
width:
35
,
width:
35
,
height:
35
,
height:
35
,
"assets/svg/password_invisible.svg"
,
"assets/svg/password_invisible.svg"
,
),
),
onPressed:
()
{
onPressed:
()
{
provider
.
pwdVisibility
();
provider
.
pwdVisibility
();
},
},
),
),
onChanged:
provider
.
onChangePassword
onChanged:
provider
.
onChangePassword
,
),
),
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
Container
(
Container
(
alignment:
Alignment
.
topLeft
,
alignment:
Alignment
.
topLeft
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
),
child:
Text
(
"Confirm Password"
,
style:
TextStyle
(
child:
Text
(
color:
AppColors
.
semi_black
"Confirm Password"
,
),)),
style:
TextStyle
(
color:
AppColors
.
semi_black
),
),
),
SizedBox
(
height:
5
),
SizedBox
(
height:
5
),
_buildTextField
(
_buildTextField
(
controller:
provider
.
confPassword
,
controller:
provider
.
confPassword
,
hintText:
"Confirm New Password*"
,
hintText:
"Confirm New Password*"
,
errorText:
provider
.
confirmPasswordError
,
errorText:
provider
.
confirmPasswordError
,
obscureText:
!
provider
.
confPwdVisible
,
obscureText:
!
provider
.
confPwdVisible
,
suffixIcon:
IconButton
(
suffixIcon:
IconButton
(
iconSize:
30
,
iconSize:
30
,
icon:
provider
.
confPwdVisible
?
SvgPicture
.
asset
(
icon:
width:
35
,
provider
.
confPwdVisible
height:
35
,
?
SvgPicture
.
asset
(
"assets/svg/password_visible.svg"
,
width:
35
,
)
height:
35
,
:
SvgPicture
.
asset
(
"assets/svg/password_visible.svg"
,
width:
35
,
)
height:
35
,
:
SvgPicture
.
asset
(
"assets/svg/password_invisible.svg"
,
width:
35
,
),
height:
35
,
onPressed:
()
{
"assets/svg/password_invisible.svg"
,
provider
.
confPwdVisibility
();
),
},
onPressed:
()
{
),
provider
.
confPwdVisibility
();
onChanged:
provider
.
onChangeConfPassword
},
),
onChanged:
provider
.
onChangeConfPassword
,
),
),
Spacer
(),
Spacer
(),
InkWell
(
InkWell
(
onTap:
()
=>
provider
.
updatePassword
(
context
),
onTap:
()
=>
provider
.
updatePassword
(
context
),
child:
Container
(
child:
Container
(
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
height:
45
,
height:
45
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
15
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
color:
AppColors
.
app_blue
,
borderRadius:
BorderRadius
.
circular
(
15.0
),
borderRadius:
BorderRadius
.
circular
(
15.0
),
),
),
child:
provider
.
isLoading
child:
provider
.
isLoading
?
CircularProgressIndicator
(
?
CircularProgressIndicator
(
color:
Colors
.
white
,
color:
Colors
.
white
,
padding:
EdgeInsets
.
all
(
7.5
),
padding:
EdgeInsets
.
all
(
7.5
),
)
)
:
Text
(
:
Text
(
"Update"
,
"Update"
,
style:
TextStyle
(
color:
Colors
.
white
),
style:
TextStyle
(
),
color:
Colors
.
white
,
),
),
),
),
),
),
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
],
],
),
),
...
@@ -175,12 +181,10 @@ class UpdatePassword extends StatelessWidget {
...
@@ -175,12 +181,10 @@ class UpdatePassword extends StatelessWidget {
obscureText:
obscureText
,
obscureText:
obscureText
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
hintText:
hintText
,
hintText:
hintText
,
hintStyle:
TextStyle
(
color:
Color
(
0xFF818181
),
hintStyle:
TextStyle
(
color:
Color
(
0xFF818181
),
fontSize:
14
),
fontSize:
14
),
border:
InputBorder
.
none
,
border:
InputBorder
.
none
,
suffixIcon:
suffixIcon
,
suffixIcon:
suffixIcon
,
),
),
),
),
),
),
),
),
...
...
lib/screens/WebERPScreen.dart
View file @
7210793a
...
@@ -34,7 +34,6 @@ Future runErpScreenApp() async {
...
@@ -34,7 +34,6 @@ Future runErpScreenApp() async {
class
WebErpScreen
extends
StatefulWidget
{
class
WebErpScreen
extends
StatefulWidget
{
final
String
erp_url
;
final
String
erp_url
;
const
WebErpScreen
({
super
.
key
,
required
this
.
erp_url
});
const
WebErpScreen
({
super
.
key
,
required
this
.
erp_url
});
@override
@override
...
@@ -42,7 +41,6 @@ class WebErpScreen extends StatefulWidget {
...
@@ -42,7 +41,6 @@ class WebErpScreen extends StatefulWidget {
}
}
class
_WebErpScreenState
extends
State
<
WebErpScreen
>
{
class
_WebErpScreenState
extends
State
<
WebErpScreen
>
{
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
Map
_source
=
{
ConnectivityResult
.
mobile
:
true
};
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
final
MyConnectivity
_connectivity
=
MyConnectivity
.
instance
;
...
@@ -141,266 +139,282 @@ class _WebErpScreenState extends State<WebErpScreen> {
...
@@ -141,266 +139,282 @@ class _WebErpScreenState extends State<WebErpScreen> {
}
}
return
true
;
// Allow default back button behavior
return
true
;
// Allow default back button behavior
},
},
child:
connection
==
"Online"
?
SafeArea
(
child:
top:
false
,
connection
==
"Online"
bottom:
Platform
.
isIOS
?
false
:
true
,
?
SafeArea
(
child:
Scaffold
(
top:
false
,
resizeToAvoidBottomInset:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
appBar:
appbar
(
context
,
"ERP"
),
child:
Scaffold
(
body:
Container
(
resizeToAvoidBottomInset:
true
,
child:
Column
(
appBar:
appbar
(
context
,
"ERP"
),
children:
<
Widget
>[
body:
Container
(
Expanded
(
child:
Column
(
child:
Stack
(
children:
<
Widget
>[
children:
[
Expanded
(
InAppWebView
(
child:
Stack
(
initialUrlRequest:
URLRequest
(
children:
[
url:
WebUri
(
widget
.
erp_url
),
InAppWebView
(
allowsCellularAccess:
true
,
initialUrlRequest:
URLRequest
(
allowsConstrainedNetworkAccess:
true
,
url:
WebUri
(
widget
.
erp_url
),
allowsExpensiveNetworkAccess:
true
,
allowsCellularAccess:
true
,
),
allowsConstrainedNetworkAccess:
true
,
androidOnGeolocationPermissionsShowPrompt:
(
allowsExpensiveNetworkAccess:
true
,
InAppWebViewController
controller
,
),
String
origin
,
androidOnGeolocationPermissionsShowPrompt:
(
)
async
{
InAppWebViewController
controller
,
return
GeolocationPermissionShowPromptResponse
(
String
origin
,
origin:
origin
,
)
async
{
allow:
true
,
return
GeolocationPermissionShowPromptResponse
(
retain:
true
,
origin:
origin
,
);
allow:
true
,
},
retain:
true
,
initialOptions:
InAppWebViewGroupOptions
(
);
android:
AndroidInAppWebViewOptions
(
},
useWideViewPort:
true
,
initialOptions:
InAppWebViewGroupOptions
(
loadWithOverviewMode:
true
,
android:
AndroidInAppWebViewOptions
(
allowContentAccess:
true
,
useWideViewPort:
true
,
geolocationEnabled:
true
,
loadWithOverviewMode:
true
,
allowFileAccess:
true
,
allowContentAccess:
true
,
databaseEnabled:
true
,
geolocationEnabled:
true
,
// Enables the WebView database
allowFileAccess:
true
,
domStorageEnabled:
true
,
databaseEnabled:
true
,
// Enables DOM storage
// Enables the WebView database
builtInZoomControls:
true
,
domStorageEnabled:
true
,
// Enables the built-in zoom controls
// Enables DOM storage
displayZoomControls:
false
,
builtInZoomControls:
true
,
// Disables displaying zoom controls
// Enables the built-in zoom controls
safeBrowsingEnabled:
true
,
displayZoomControls:
false
,
// Enables Safe Browsing
// Disables displaying zoom controls
clearSessionCache:
true
,
safeBrowsingEnabled:
true
,
loadsImagesAutomatically:
true
,
// Enables Safe Browsing
thirdPartyCookiesEnabled:
true
,
clearSessionCache:
true
,
blockNetworkImage:
false
,
loadsImagesAutomatically:
true
,
supportMultipleWindows:
true
,
thirdPartyCookiesEnabled:
true
,
blockNetworkLoads:
false
,
blockNetworkImage:
false
,
networkAvailable:
true
,
supportMultipleWindows:
true
,
useShouldInterceptRequest:
true
,
blockNetworkLoads:
false
,
hardwareAcceleration:
true
,
networkAvailable:
true
,
useShouldInterceptRequest:
true
,
// Enable camera access
hardwareAcceleration:
true
,
),
ios:
IOSInAppWebViewOptions
(
// Enable camera access
allowsInlineMediaPlayback:
true
,
),
allowsLinkPreview:
true
,
ios:
IOSInAppWebViewOptions
(
allowsBackForwardNavigationGestures:
true
,
allowsInlineMediaPlayback:
true
,
),
allowsLinkPreview:
true
,
crossPlatform:
InAppWebViewOptions
(
allowsBackForwardNavigationGestures:
true
,
javaScriptEnabled:
true
,
),
useOnDownloadStart:
true
,
crossPlatform:
InAppWebViewOptions
(
allowFileAccessFromFileURLs:
true
,
javaScriptEnabled:
true
,
allowUniversalAccessFromFileURLs:
true
,
useOnDownloadStart:
true
,
mediaPlaybackRequiresUserGesture:
true
,
allowFileAccessFromFileURLs:
true
,
),
allowUniversalAccessFromFileURLs:
true
,
),
mediaPlaybackRequiresUserGesture:
true
,
),
),
androidOnPermissionRequest:
(
androidOnPermissionRequest:
(
InAppWebViewController
controller
,
InAppWebViewController
controller
,
String
origin
,
String
origin
,
List
<
String
>
resources
,
List
<
String
>
resources
,
)
async
{
)
async
{
return
PermissionRequestResponse
(
return
PermissionRequestResponse
(
resources:
resources
,
resources:
resources
,
action:
PermissionRequestResponseAction
.
GRANT
,
action:
);
PermissionRequestResponseAction
.
GRANT
,
},
);
onPermissionRequest:
(
controller
,
request
)
async
{
},
return
PermissionResponse
(
onPermissionRequest:
(
resources:
request
.
resources
,
controller
,
action:
PermissionResponseAction
.
GRANT
,
request
,
);
)
async
{
},
return
PermissionResponse
(
keepAlive:
InAppWebViewKeepAlive
(),
resources:
request
.
resources
,
action:
PermissionResponseAction
.
GRANT
,
onWebViewCreated:
(
controller
)
{
);
_webViewController
=
controller
;
},
_controller
.
complete
(
controller
);
keepAlive:
InAppWebViewKeepAlive
(),
// _webViewController!.addJavaScriptHandler(
onWebViewCreated:
(
controller
)
{
// handlerName: 'downloadBlobHandler',
_webViewController
=
controller
;
// callback: (args) async {
_controller
.
complete
(
controller
);
// String base64Data = args[0];
// String mimeType = args[1];
// _webViewController!.addJavaScriptHandler(
// String filename = args[2];
// handlerName: 'downloadBlobHandler',
//
// callback: (args) async {
// // Save the file
// String base64Data = args[0];
// await saveBase64File(base64Data, filename, mimeType);
// String mimeType = args[1];
// },
// String filename = args[2];
// );
//
_webViewController
!.
addJavaScriptHandler
(
// // Save the file
handlerName:
'MobileAppJavascriptInterface'
,
// await saveBase64File(base64Data, filename, mimeType);
callback:
(
args
)
{
// },
print
(
// );
"JavaScript called MobileAppJavascriptInterface with args:
$args
"
,
_webViewController
!.
addJavaScriptHandler
(
);
handlerName:
'MobileAppJavascriptInterface'
,
return
{
'status'
:
'success'
};
callback:
(
args
)
{
},
print
(
);
"JavaScript called MobileAppJavascriptInterface with args:
$args
"
,
_webViewController
!.
addJavaScriptHandler
(
);
handlerName:
'downloadFile'
,
return
{
'status'
:
'success'
};
callback:
(
args
)
async
{
},
if
(
Platform
.
isAndroid
)
{
);
final
url
=
args
[
0
]
as
String
;
_webViewController
!.
addJavaScriptHandler
(
await
_handleDownload
(
handlerName:
'downloadFile'
,
url
,
callback:
(
args
)
async
{
''
,
if
(
Platform
.
isAndroid
)
{
'application/octet-stream'
,
final
url
=
args
[
0
]
as
String
;
''
,
await
_handleDownload
(
// controller,context
url
,
);
''
,
}
'application/octet-stream'
,
},
''
,
);
// controller,context
},
);
pullToRefreshController:
pullToRefreshController
,
}
onLoadStart:
(
controller
,
url
)
{
},
return
setState
(()
{
);
isLoading
=
true
;
},
});
pullToRefreshController:
},
pullToRefreshController
,
initialSettings:
InAppWebViewSettings
(
onLoadStart:
(
controller
,
url
)
{
allowUniversalAccessFromFileURLs:
true
,
return
setState
(()
{
allowFileAccessFromFileURLs:
true
,
isLoading
=
true
;
allowFileAccess:
true
,
});
allowsInlineMediaPlayback:
true
,
},
allowsPictureInPictureMediaPlayback:
true
,
initialSettings:
InAppWebViewSettings
(
allowsBackForwardNavigationGestures:
true
,
allowUniversalAccessFromFileURLs:
true
,
iframeAllow:
"camera;microphone;files;media;"
,
allowFileAccessFromFileURLs:
true
,
domStorageEnabled:
true
,
allowFileAccess:
true
,
allowContentAccess:
true
,
allowsInlineMediaPlayback:
true
,
javaScriptEnabled:
true
,
allowsPictureInPictureMediaPlayback:
true
,
supportZoom:
true
,
allowsBackForwardNavigationGestures:
true
,
builtInZoomControls:
true
,
iframeAllow:
"camera;microphone;files;media;"
,
displayZoomControls:
false
,
domStorageEnabled:
true
,
textZoom:
125
,
allowContentAccess:
true
,
blockNetworkImage:
false
,
javaScriptEnabled:
true
,
loadsImagesAutomatically:
true
,
supportZoom:
true
,
safeBrowsingEnabled:
true
,
builtInZoomControls:
true
,
useWideViewPort:
true
,
displayZoomControls:
false
,
loadWithOverviewMode:
true
,
textZoom:
125
,
javaScriptCanOpenWindowsAutomatically:
true
,
blockNetworkImage:
false
,
mediaPlaybackRequiresUserGesture:
false
,
loadsImagesAutomatically:
true
,
geolocationEnabled:
true
,
safeBrowsingEnabled:
true
,
useOnDownloadStart:
true
,
useWideViewPort:
true
,
allowsLinkPreview:
true
,
loadWithOverviewMode:
true
,
databaseEnabled:
true
,
javaScriptCanOpenWindowsAutomatically:
true
,
// Enables the WebView database
mediaPlaybackRequiresUserGesture:
false
,
clearSessionCache:
true
,
geolocationEnabled:
true
,
mediaType:
"image/*,application/pdf"
,
useOnDownloadStart:
true
,
useShouldInterceptRequest:
true
,
allowsLinkPreview:
true
,
hardwareAcceleration:
true
,
databaseEnabled:
true
,
),
// Enables the WebView database
shouldInterceptRequest:
(
controller
,
request
)
async
{
clearSessionCache:
true
,
final
url
=
request
.
url
.
toString
();
mediaType:
"image/*,application/pdf"
,
print
(
useShouldInterceptRequest:
true
,
'Intercepting request:
$url
, Headers:
${request.headers}
'
,
hardwareAcceleration:
true
,
);
),
if
(
url
.
endsWith
(
'.pdf'
))
{
shouldInterceptRequest:
(
final
response
=
await
http
.
get
(
controller
,
Uri
.
parse
(
url
),
request
,
headers:
{
'Accept'
:
'application/pdf'
},
)
async
{
);
final
url
=
request
.
url
.
toString
();
if
(
response
.
statusCode
==
200
&&
print
(
response
.
headers
[
'content-type'
]?.
contains
(
'Intercepting request:
$url
, Headers:
${request.headers}
'
,
'application/pdf'
,
);
)
==
if
(
url
.
endsWith
(
'.pdf'
))
{
true
)
{
final
response
=
await
http
.
get
(
return
WebResourceResponse
(
Uri
.
parse
(
url
),
contentType:
'application/pdf'
,
headers:
{
'Accept'
:
'application/pdf'
},
data:
response
.
bodyBytes
,
);
);
if
(
response
.
statusCode
==
200
&&
}
else
{
response
.
headers
[
'content-type'
]
print
(
?.
contains
(
'application/pdf'
)
==
'Failed to load PDF: Status
${response.statusCode}
, Content-Type:
${response.headers['content-type']}
'
,
true
)
{
);
return
WebResourceResponse
(
}
contentType:
'application/pdf'
,
}
data:
response
.
bodyBytes
,
return
null
;
);
},
}
else
{
shouldOverrideUrlLoading:
(
print
(
controller
,
'Failed to load PDF: Status
${response.statusCode}
, Content-Type:
${response.headers['content-type']}
'
,
navigationAction
,
);
)
async
{
}
var
uri
=
navigationAction
.
request
.
url
!;
}
print
(
"urib scgefes"
);
return
null
;
print
(
uri
);
},
print
(
uri
.
scheme
);
shouldOverrideUrlLoading:
(
if
(
uri
.
toString
().
contains
(
controller
,
'file_viewer_name.php'
,
navigationAction
,
)
&&
)
async
{
uri
.
toString
().
contains
(
'.pdf'
))
{
var
uri
=
navigationAction
.
request
.
url
!;
final
pdfPath
=
print
(
"urib scgefes"
);
Uri
.
parse
(
print
(
uri
);
uri
.
toString
(),
print
(
uri
.
scheme
);
).
queryParameters
[
'file_path'
];
if
(
uri
.
toString
().
contains
(
if
(
pdfPath
!=
null
)
{
'file_viewer_name.php'
,
final
pdfUrl
=
'https://erp.gengroup.in/
$pdfPath
'
;
)
&&
await
controller
.
loadUrl
(
uri
.
toString
().
contains
(
'.pdf'
))
{
urlRequest:
URLRequest
(
url:
WebUri
(
pdfUrl
)),
final
pdfPath
=
);
Uri
.
parse
(
return
NavigationActionPolicy
.
CANCEL
;
uri
.
toString
(),
}
).
queryParameters
[
'file_path'
];
}
if
(
pdfPath
!=
null
)
{
if
(
uri
.
scheme
==
"tel"
)
{
final
pdfUrl
=
// Launch the phone dialer app with the specified phone number
'https://erp.gengroup.in/
$pdfPath
'
;
if
(
await
canLaunch
(
uri
.
toString
()))
{
await
controller
.
loadUrl
(
await
launch
(
uri
.
toString
());
urlRequest:
URLRequest
(
return
NavigationActionPolicy
.
CANCEL
;
url:
WebUri
(
pdfUrl
),
}
),
}
else
if
(
uri
.
scheme
==
"mailto"
)
{
);
if
(
await
canLaunch
(
uri
.
toString
()))
{
return
NavigationActionPolicy
.
CANCEL
;
await
launch
(
uri
.
toString
());
}
return
NavigationActionPolicy
.
CANCEL
;
}
}
if
(
uri
.
scheme
==
"tel"
)
{
}
else
if
(
uri
.
scheme
==
"whatsapp"
)
{
// Launch the phone dialer app with the specified phone number
// Launch WhatsApp with the specified chat or phone number
if
(
await
canLaunch
(
uri
.
toString
()))
{
if
(
await
canLaunch
(
uri
.
toString
()))
{
await
launch
(
uri
.
toString
());
await
launch
(
uri
.
toString
());
return
NavigationActionPolicy
.
CANCEL
;
return
NavigationActionPolicy
.
CANCEL
;
}
}
}
else
if
(
uri
.
scheme
==
"mailto"
)
{
}
if
(
await
canLaunch
(
uri
.
toString
()))
{
// // Check if the URL is trying to access the camera for image upload
await
launch
(
uri
.
toString
());
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
return
NavigationActionPolicy
.
CANCEL
;
// // Handle camera image upload here
}
// // You might want to display a custom UI for image selection or directly trigger the camera
}
else
if
(
uri
.
scheme
==
"whatsapp"
)
{
// // You can use platform-specific plugins like image_picker for this purpose
// Launch WhatsApp with the specified chat or phone number
// // Once the image is selected, you can pass it to the web view using JavaScript injection
if
(
await
canLaunch
(
uri
.
toString
()))
{
// if (await canLaunch(uri.toString())) {
await
launch
(
uri
.
toString
());
// await launch(uri.toString());
return
NavigationActionPolicy
.
CANCEL
;
// return NavigationActionPolicy.CANCEL;
}
// }
}
// }
// // Check if the URL is trying to access the camera for image upload
return
NavigationActionPolicy
.
ALLOW
;
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
},
// // Handle camera image upload here
// // You might want to display a custom UI for image selection or directly trigger the camera
onLoadStop:
(
controller
,
url
)
async
{
// // You can use platform-specific plugins like image_picker for this purpose
if
(
url
.
toString
().
contains
(
'file_viewer_name.php'
)
&&
// // Once the image is selected, you can pass it to the web view using JavaScript injection
url
.
toString
().
contains
(
'.pdf'
))
{
// if (await canLaunch(uri.toString())) {
final
uri
=
Uri
.
parse
(
url
.
toString
());
// await launch(uri.toString());
final
pdfPath
=
uri
.
queryParameters
[
'file_path'
];
// return NavigationActionPolicy.CANCEL;
if
(
pdfPath
!=
null
)
{
// }
final
pdfUrl
=
'https://erp.gengroup.in/
$pdfPath
'
;
// }
await
controller
.
evaluateJavascript
(
return
NavigationActionPolicy
.
ALLOW
;
source
:
'''
},
onLoadStop:
(
controller
,
url
)
async
{
if
(
url
.
toString
().
contains
(
'file_viewer_name.php'
,
)
&&
url
.
toString
().
contains
(
'.pdf'
))
{
final
uri
=
Uri
.
parse
(
url
.
toString
());
final
pdfPath
=
uri
.
queryParameters
[
'file_path'
];
if
(
pdfPath
!=
null
)
{
final
pdfUrl
=
'https://erp.gengroup.in/
$pdfPath
'
;
await
controller
.
evaluateJavascript
(
source
:
'''
var pdfjsLib = window.pdfjsLib || document.createElement('
script
');
var pdfjsLib = window.pdfjsLib || document.createElement('
script
');
pdfjsLib.src = '
https:
//mozilla.github.io/pdf.js/build/pdf.js';
pdfjsLib.src = '
https:
//mozilla.github.io/pdf.js/build/pdf.js';
document
.
head
.
appendChild
(
pdfjsLib
);
document
.
head
.
appendChild
(
pdfjsLib
);
...
@@ -423,110 +437,113 @@ class _WebErpScreenState extends State<WebErpScreen> {
...
@@ -423,110 +437,113 @@ class _WebErpScreenState extends State<WebErpScreen> {
});
});
};
};
''',
''',
);
);
}
}
}
}
pullToRefreshController?.endRefreshing();
pullToRefreshController?.endRefreshing();
return setState(() {
return setState(() {
isLoading = false;
isLoading = false;
});
});
},
},
onReceivedError: (controller, request, error) {
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
pullToRefreshController?.endRefreshing();
return setState(() {
return setState(() {
isLoading = false;
isLoading = false;
});
});
},
},
onProgressChanged: (controller, progress) {
onProgressChanged: (controller, progress) {
if (progress == 100) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
pullToRefreshController?.endRefreshing();
}
}
},
},
onConsoleMessage: (controller, consoleMessage) {
onConsoleMessage: (controller, consoleMessage) {
if (kDebugMode) {
if (kDebugMode) {
debugPrint("consoleMessage
${consoleMessage}
");
debugPrint("consoleMessage
$consoleMessage
");
}
}
debugPrint(
debugPrint(
"JavaScript console message:
${consoleMessage.message}
",
"JavaScript console message:
${consoleMessage.message}
",
);
);
},
},
// onDownloadStartRequest: (controller, url) async {
// await ApiCalling.download_files(
// onDownloadStartRequest: (controller, url) async {
// empId, sessionId, "
${url.url}
", context)
// await ApiCalling.download_files(
// .then((data) => {debugPrint(data)});
// empId, sessionId, "
${url.url}
", context)
//
// .then((data) => {debugPrint(data)});
// },
//
// },
onDownloadStartRequest: (
onDownloadStartRequest: (
controller,
controller,
downloadStartRequest,
downloadStartRequest,
) async {
) async {
// String url = downloadStartRequest.url.toString();
// String url = downloadStartRequest.url.toString();
//
//
// // Use url_launcher or another plugin to handle the download externally
// // Use url_launcher or another plugin to handle the download externally
// if (await canLaunchUrl(Uri.parse(url))) {
// if (await canLaunchUrl(Uri.parse(url))) {
// await launchUrl(
// await launchUrl(
// Uri.parse(url),
// Uri.parse(url),
// mode: LaunchMode.externalApplication,
// mode: LaunchMode.externalApplication,
// );
// );
// } else {
// } else {
// print("Could not launch
$url
");
// print("Could not launch
$url
");
// }
// }
if (Platform.isAndroid) {
if (Platform.isAndroid) {
await _handleDownload(
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType!,
downloadStartRequest.mimeType!,
downloadStartRequest.suggestedFilename ??
downloadStartRequest.suggestedFilename ?? '',
'',
// controller,context
// controller,context
);
);
}
}
},
},
),
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
),
const SizedBox(height: 15),
if (isLoading) ...[
SizedBox(
Container(
width: 200,
color: Colors.white.withOpacity(0.7),
child: Text(
child: Column(
"Please wait.......",
crossAxisAlignment:
textAlign: TextAlign.center,
CrossAxisAlignment.center,
style: TextStyle(
mainAxisAlignment: MainAxisAlignment.center,
decorationThickness: 0,
children: [
fontSize: 15,
SpinKitRing(
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
),
),
),
],
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
],
),
),
),
),
],
],
]
,
)
,
),
),
),
),
],
)
),
: NoNetwork(context),
),
),
):NoNetwork(context),
);
);
}
}
// Future<void> saveBase64File(String base64Data, String filename, String mimeType) async {
// Future<void> saveBase64File(String base64Data, String filename, String mimeType) async {
// // Ask for permission
// // Ask for permission
// if (await Permission.storage.request().isGranted) {
// if (await Permission.storage.request().isGranted) {
...
@@ -663,6 +680,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
...
@@ -663,6 +680,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
_webViewController?.evaluateJavascript(source: js);
_webViewController?.evaluateJavascript(source: js);
}
}
Future<void> _handleDownload(
Future<void> _handleDownload(
String url,
String url,
String contentDisposition,
String contentDisposition,
...
@@ -804,13 +822,13 @@ class _WebErpScreenState extends State<WebErpScreen> {
...
@@ -804,13 +822,13 @@ class _WebErpScreenState extends State<WebErpScreen> {
class SpinKitRing extends StatefulWidget {
class SpinKitRing extends StatefulWidget {
const SpinKitRing({
const SpinKitRing({
Key?
key,
super.
key,
required this.color,
required this.color,
this.lineWidth = 7.0,
this.lineWidth = 7.0,
this.size = 50.0,
this.size = 50.0,
this.duration = const Duration(milliseconds: 1200),
this.duration = const Duration(milliseconds: 1200),
this.controller,
this.controller,
})
: super(key: key)
;
});
final Color color;
final Color color;
final double size;
final double size;
...
...
lib/screens/commom/accountLedger.dart
View file @
7210793a
...
@@ -160,7 +160,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -160,7 +160,7 @@ class _AccountledgerState extends State<Accountledger> {
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
),
SvgPicture
.
asset
(
"assets/svg/fin_ic.svg"
,
height:
12
),
SizedBox
(
width:
5
),
SizedBox
(
width:
5
),
Text
(
Text
(
"
${
provider.balanceDetails.balance.toString()
}
"
??
"-"
,
provider
.
balanceDetails
.
balance
.
toString
()
??
"-"
,
style:
TextStyle
(
fontSize:
12
),
style:
TextStyle
(
fontSize:
12
),
),
),
],
],
...
@@ -204,8 +204,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -204,8 +204,7 @@ class _AccountledgerState extends State<Accountledger> {
Padding
(
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
child:
Text
(
"
${provider.selectedAcVal ?? ""}
"
+
(
provider
.
selectedAcVal
??
""
)
" "
+
" "
+
"Account Ledger List"
,
"Account Ledger List"
,
),
),
),
),
...
@@ -346,7 +345,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -346,7 +345,7 @@ class _AccountledgerState extends State<Accountledger> {
children:
[
children:
[
Expanded
(
Expanded
(
child:
Text
(
child:
Text
(
"
${
totalHeadings[index]
}
"
,
totalHeadings
[
index
],
style:
TextStyle
(
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontFamily:
"JakartaMedium"
,
),
),
...
@@ -429,7 +428,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -429,7 +428,7 @@ class _AccountledgerState extends State<Accountledger> {
),
),
),
),
...
items
.
map
((
item
)
{
...
items
.
map
((
item
)
{
double
running
_b
alance
=
0
;
double
running
B
alance
=
0
;
int
currentIndex
=
provider
.
ledgerList
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
item
);
.
indexOf
(
item
);
for
(
for
(
...
@@ -451,7 +450,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -451,7 +450,7 @@ class _AccountledgerState extends State<Accountledger> {
.
toString
(),
.
toString
(),
)
??
)
??
0
;
0
;
running
_b
alance
+=
(
debit
-
credit
);
running
B
alance
+=
(
debit
-
credit
);
}
}
return
Container
(
return
Container
(
...
@@ -651,7 +650,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -651,7 +650,7 @@ class _AccountledgerState extends State<Accountledger> {
],
],
),
),
);
);
})
.toList()
,
}),
],
],
),
),
);
);
...
@@ -760,9 +759,7 @@ class _AccountledgerState extends State<Accountledger> {
...
@@ -760,9 +759,7 @@ class _AccountledgerState extends State<Accountledger> {
provider.selectedAcId = value.id!;
provider.selectedAcId = value.id!;
provider.selectedAcVal = value.name!;
provider.selectedAcVal = value.name!;
print(
print(
"
hfjkshfg
" +
"
hfjkshfg
$
{
provider
.
selectedAcId
}
",
provider.selectedAcId
.toString(),
);
);
provider.ledgerlistAPI(context);
provider.ledgerlistAPI(context);
...
...
lib/screens/commom/accountsList.dart
View file @
7210793a
...
@@ -39,8 +39,10 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -39,8 +39,10 @@ class _AccountslistState extends State<Accountslist> {
// fetch first page once
// fetch first page once
Future
.
microtask
(()
{
Future
.
microtask
(()
{
final
provider
=
final
provider
=
Provider
.
of
<
Accountslistprovider
>(
Provider
.
of
<
Accountslistprovider
>(
context
,
listen:
false
);
context
,
listen:
false
,
);
provider
.
commonAccountListAPIFunction
(
context
);
provider
.
commonAccountListAPIFunction
(
context
);
});
});
}
}
...
@@ -70,21 +72,24 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -70,21 +72,24 @@ class _AccountslistState extends State<Accountslist> {
_currentPage
++;
_currentPage
++;
});
});
provider
.
commonAccountListAPIFunction
(
context
,
append:
true
).
then
((
_
)
{
provider
setState
(()
{
.
commonAccountListAPIFunction
(
context
,
append:
true
)
_isLoadingMore
=
false
;
.
then
((
_
)
{
final
newItems
=
provider
.
accountsList
;
setState
(()
{
if
(
newItems
.
length
<
_currentPage
*
15
)
{
_isLoadingMore
=
false
;
//api gives 15 records
final
newItems
=
provider
.
accountsList
;
_hasMoreItems
=
false
;
if
(
newItems
.
length
<
_currentPage
*
15
)
{
}
//api gives 15 records
});
_hasMoreItems
=
false
;
}).
catchError
((
_
)
{
}
setState
(()
{
});
_isLoadingMore
=
false
;
})
_currentPage
--;
// rollback
.
catchError
((
_
)
{
});
setState
(()
{
});
_isLoadingMore
=
false
;
_currentPage
--;
// rollback
});
});
}
}
void
_refreshList
(
BuildContext
context
)
{
void
_refreshList
(
BuildContext
context
)
{
...
@@ -111,15 +116,15 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -111,15 +116,15 @@ class _AccountslistState extends State<Accountslist> {
return
(
connection
==
"Online"
)
return
(
connection
==
"Online"
)
?
Platform
.
isAndroid
?
Platform
.
isAndroid
?
WillPopScope
(
?
WillPopScope
(
onWillPop:
()
=>
onBackPressed
(
context
),
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
child:
SafeArea
(
top:
false
,
top:
false
,
bottom:
true
,
bottom:
true
,
child:
_scaffold
(
context
),
child:
_scaffold
(
context
),
),
),
)
)
:
_scaffold
(
context
)
:
_scaffold
(
context
)
:
NoNetwork
(
context
);
:
NoNetwork
(
context
);
}
}
...
@@ -152,8 +157,10 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -152,8 +157,10 @@ class _AccountslistState extends State<Accountslist> {
},
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
child:
SvgPicture
.
asset
(
SvgPicture
.
asset
(
"assets/svg/filter_ic.svg"
,
height:
18
),
"assets/svg/filter_ic.svg"
,
height:
18
,
),
),
),
),
),
),
),
...
@@ -171,13 +178,14 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -171,13 +178,14 @@ class _AccountslistState extends State<Accountslist> {
return
Padding
(
return
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16
),
child:
Center
(
child:
Center
(
child:
_isLoadingMore
child:
?
const
CircularProgressIndicator
(
_isLoadingMore
color:
Colors
.
blue
,
?
const
CircularProgressIndicator
(
)
color:
Colors
.
blue
,
:
!
_hasMoreItems
)
?
const
Text
(
"No more accounts to load"
)
:
!
_hasMoreItems
:
const
SizedBox
.
shrink
(),
?
const
Text
(
"No more accounts to load"
)
:
const
SizedBox
.
shrink
(),
),
),
);
);
}
}
...
@@ -185,31 +193,20 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -185,31 +193,20 @@ class _AccountslistState extends State<Accountslist> {
final
account
=
accountList
[
index
];
final
account
=
accountList
[
index
];
return
InkResponse
(
return
InkResponse
(
onTap:
()
async
{
onTap:
()
async
{
print
(
print
(
"length,
${accountList.length}
"
);
"length,
${accountList.length}
"
,
);
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
builder:
(
context
)
=>
(
context
)
=>
Accountslistdetails
(
Accountslistdetails
(
accountID:
accountList
[
index
].
id
,
accountID:
accountList
[
index
]
.
id
,
),
),
),
),
);
);
},
},
child:
Container
(
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
5
,
vertical:
5
),
horizontal:
5
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
),
vertical:
5
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
),
borderRadius:
BorderRadius
.
circular
(
16
),
...
@@ -234,7 +231,7 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -234,7 +231,7 @@ class _AccountslistState extends State<Accountslist> {
// ),
// ),
Expanded
(
Expanded
(
flex:
1
,
flex:
1
,
child:
Container
(
child:
SizedBox
(
height:
50
,
height:
50
,
width:
35
,
width:
35
,
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
...
@@ -247,29 +244,23 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -247,29 +244,23 @@ class _AccountslistState extends State<Accountslist> {
flex:
7
,
flex:
7
,
child:
SizedBox
(
child:
SizedBox
(
child:
Column
(
child:
Column
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
children:
[
Text
(
Text
(
accountList
[
index
].
name
!,
accountList
[
index
].
name
!,
maxLines:
1
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
style:
TextStyle
(
fontFamily:
fontFamily:
"JakartaRegular"
,
"JakartaRegular"
,
fontSize:
14
,
fontSize:
14
,
color:
color:
AppColors
.
semi_black
,
AppColors
.
semi_black
,
),
),
),
),
Text
(
Text
(
accountList
[
index
]
accountList
[
index
].
type
??
"-"
,
.
type
??
"-"
,
maxLines:
1
,
maxLines:
1
,
style:
TextStyle
(
style:
TextStyle
(
fontFamily:
fontFamily:
"JakartaRegular"
,
"JakartaRegular"
,
fontSize:
12
,
fontSize:
12
,
color:
AppColors
.
grey_semi
,
color:
AppColors
.
grey_semi
,
),
),
...
@@ -289,10 +280,11 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -289,10 +280,11 @@ class _AccountslistState extends State<Accountslist> {
},
},
);
);
}
}
Future
<
void
>
_showFilterSheet1
(
BuildContext
context
)
{
Future
<
void
>
_showFilterSheet1
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
List
<
bool
>
isSelected
=
List
.
generate
(
2
,
2
,
(
index
)
=>
index
==
0
?
true
:
false
,
(
index
)
=>
index
==
0
?
true
:
false
,
);
);
return
showModalBottomSheet
(
return
showModalBottomSheet
(
...
@@ -314,22 +306,16 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -314,22 +306,16 @@ class _AccountslistState extends State<Accountslist> {
child:
Consumer
<
Accountslistprovider
>(
child:
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
builder:
(
context
,
provider
,
child
)
{
int
selectedIndex
=
isSelected
.
indexWhere
(
int
selectedIndex
=
isSelected
.
indexWhere
(
(
element
)
=>
element
==
true
,
(
element
)
=>
element
==
true
,
);
);
List
<
String
>
headings
=
[
List
<
String
>
headings
=
[
"Account Name"
,
"Mobile Number"
];
"Account Name"
,
"Mobile Number"
,
];
return
Container
(
return
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.3
,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.3
,
child:
Column
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Padding
(
Padding
(
padding:
EdgeInsets
.
only
(
left:
15
),
padding:
EdgeInsets
.
only
(
left:
15
),
child:
Text
(
child:
Text
(
...
@@ -343,11 +329,13 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -343,11 +329,13 @@ class _AccountslistState extends State<Accountslist> {
),
),
const
SizedBox
(
height:
20
),
const
SizedBox
(
height:
20
),
Expanded
(
Expanded
(
flex:
4
,
flex:
4
,
child:
Container
(
child:
Container
(
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
border:
Border
(
border:
Border
(
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
)),
top:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
),
bottom:
BorderSide
(
bottom:
BorderSide
(
color:
const
Color
(
0xFFA5DAF9
),
color:
const
Color
(
0xFFA5DAF9
),
),
),
...
@@ -359,8 +347,9 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -359,8 +347,9 @@ class _AccountslistState extends State<Accountslist> {
Expanded
(
Expanded
(
flex:
3
,
flex:
3
,
child:
Column
(
child:
Column
(
children:
List
.
generate
(
headings
.
length
,
(
jj
)
{
children:
List
.
generate
(
headings
.
length
,
(
jj
,
)
{
return
Expanded
(
return
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
()
{
onTap:
()
{
...
@@ -368,46 +357,45 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -368,46 +357,45 @@ class _AccountslistState extends State<Accountslist> {
// Reset all to false
// Reset all to false
isSelected
=
List
.
generate
(
isSelected
=
List
.
generate
(
headings
.
length
,
headings
.
length
,
(
index
)
=>
false
,
(
index
)
=>
false
,
);
);
// Set the clicked item to true
// Set the clicked item to true
isSelected
[
jj
]
=
true
;
isSelected
[
jj
]
=
true
;
});
});
},
},
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
padding:
vertical:
7.5
,
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
7.5
,
),
horizontal:
10
,
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
border:
Border
(
border:
Border
(
left:
left:
isSelected
[
jj
]
isSelected
[
jj
]
?
BorderSide
(
?
BorderSide
(
color:
color:
AppColors
AppColors
.
app_blue
,
.
app_blue
,
width:
5.0
,
width:
5.0
,
)
:
const
BorderSide
(
)
color:
:
const
BorderSide
(
Colors
color:
.
transparent
,
Colors
),
.
transparent
,
),
bottom:
bottom:
jj
==
headings
.
length
-
1
jj
==
headings
.
length
-
1
?
const
BorderSide
(
?
const
BorderSide
(
color:
color:
Colors
Colors
.
transparent
,
.
transparent
,
)
)
:
const
BorderSide
(
:
const
BorderSide
(
color:
Color
(
color:
Color
(
0xFFA5DAF9
,
0xFFA5DAF9
,
),
),
),
),
),
),
color:
const
Color
(
0xFFE6F6FF
),
color:
const
Color
(
0xFFE6F6FF
),
),
),
...
@@ -417,7 +405,8 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -417,7 +405,8 @@ class _AccountslistState extends State<Accountslist> {
textAlign:
TextAlign
.
center
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
14
,
fontSize:
14
,
fontFamily:
"JakartaRegular"
,
fontFamily:
"JakartaRegular"
,
color:
AppColors
.
semi_black
,
color:
AppColors
.
semi_black
,
),
),
),
),
...
@@ -437,12 +426,13 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -437,12 +426,13 @@ class _AccountslistState extends State<Accountslist> {
),
),
child:
Column
(
child:
Column
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
center
,
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
children:
[
children:
[
if
(
selectedIndex
==
0
)
...[
if
(
selectedIndex
==
0
)
...[
SizedBox
(
height:
10
,
),
SizedBox
(
height:
10
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
companyNameController
,
provider
.
companyNameController
,
...
@@ -453,9 +443,8 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -453,9 +443,8 @@ class _AccountslistState extends State<Accountslist> {
false
,
false
,
null
,
null
,
),
),
]
]
else
if
(
selectedIndex
==
1
)
...[
else
if
(
selectedIndex
==
1
)
...[
SizedBox
(
height:
10
),
SizedBox
(
height:
10
,),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
mobileNumberController
,
provider
.
mobileNumberController
,
...
@@ -467,10 +456,7 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -467,10 +456,7 @@ class _AccountslistState extends State<Accountslist> {
FilteringTextInputFormatter
FilteringTextInputFormatter
.
digitsOnly
,
.
digitsOnly
,
),
),
]
],
],
],
),
),
),
),
...
@@ -522,7 +508,6 @@ class _AccountslistState extends State<Accountslist> {
...
@@ -522,7 +508,6 @@ class _AccountslistState extends State<Accountslist> {
}
}
}
}
// Divider(
// Divider(
// thickness: 0.5,
// thickness: 0.5,
// color: Color(0xFFD7D7D7),
// color: Color(0xFFD7D7D7),
...
...
lib/screens/commom/accountsListDetails.dart
View file @
7210793a
...
@@ -165,7 +165,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -165,7 +165,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
children:
[
children:
[
Expanded
(
Expanded
(
flex:
1
,
flex:
1
,
child:
Container
(
child:
SizedBox
(
height:
50
,
height:
50
,
width:
35
,
width:
35
,
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
...
@@ -584,7 +584,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -584,7 +584,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
shrinkWrap:
true
,
shrinkWrap:
true
,
itemCount:
provider
.
ledgerList
.
length
,
itemCount:
provider
.
ledgerList
.
length
,
itemBuilder:
(
context
,
index
)
{
itemBuilder:
(
context
,
index
)
{
double
running
_b
alance
=
0
;
double
running
B
alance
=
0
;
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
int
currentIndex
=
provider
.
ledgerList
.
indexOf
(
provider
.
ledgerList
[
index
],
provider
.
ledgerList
[
index
],
);
);
...
@@ -600,7 +600,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -600,7 +600,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
ledgerItem
.
debitAmount
.
toString
(),
ledgerItem
.
debitAmount
.
toString
(),
)
??
)
??
0
;
0
;
running
_b
alance
+=
(
debit
-
credit
);
running
B
alance
+=
(
debit
-
credit
);
}
}
return
InkResponse
(
return
InkResponse
(
onTap:
()
async
{
onTap:
()
async
{
...
@@ -658,7 +658,8 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -658,7 +658,8 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
child:
Column
(
child:
Column
(
children:
[
children:
[
Row
(
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Expanded
(
Expanded
(
flex:
5
,
flex:
5
,
...
@@ -701,8 +702,12 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -701,8 +702,12 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
.
ledgerList
[
index
]
.
ledgerList
[
index
]
.
type
==
.
type
==
"Credit"
"Credit"
?
Color
(
0xFFEF3739
)
?
Color
(
:
Color
(
0xFF0D9C00
),
0xFFEF3739
,
)
:
Color
(
0xFF0D9C00
,
),
fontSize:
14
,
fontSize:
14
,
fontFamily:
fontFamily:
"JakartaRegular"
,
"JakartaRegular"
,
...
@@ -712,12 +717,17 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -712,12 +717,17 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
text:
text:
"₹
${provider.ledgerList[index].type == "Credit" ? "${provider.ledgerList[index].creditAmount}
"
:
"
${provider.ledgerList[index].debitAmount}
"
}
",
"₹
${provider.ledgerList[index].type == "Credit" ? "${provider.ledgerList[index].creditAmount}
"
:
"
${provider.ledgerList[index].debitAmount}
"
}
",
style: TextStyle(
style: TextStyle(
color: provider
color:
.ledgerList[index]
provider
.type ==
.ledgerList[index]
"
Credit
"
.type ==
? Color(0xFFEF3739)
"
Credit
"
: Color(0xFF0D9C00),
? Color(
0xFFEF3739,
)
: Color(
0xFF0D9C00,
),
fontSize: 14,
fontSize: 14,
fontFamily:
fontFamily:
"
JakartaRegular
",
"
JakartaRegular
",
...
@@ -730,7 +740,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -730,7 +740,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
),
),
],
],
),
),
SizedBox(height: 7
,
),
SizedBox(height: 7),
Row(
Row(
children: [
children: [
Expanded(
Expanded(
...
@@ -773,7 +783,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
...
@@ -773,7 +783,7 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
),
),
),
),
TextSpan(
TextSpan(
text: "
₹
$running
_b
alance
",
text: "
₹
$running
B
alance
",
style: TextStyle(
style: TextStyle(
color:
color:
AppColors.grey_semi,
AppColors.grey_semi,
...
...
lib/screens/commom/addCommonPayment.dart
View file @
7210793a
...
@@ -75,13 +75,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -75,13 +75,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
);
);
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
focusNodes
.
map
((
e
)
=>
e
.
dispose
());
super
.
dispose
();
super
.
dispose
();
_connectivity
.
disposeStream
();
_connectivity
.
disposeStream
();
}
}
Future
<
bool
>
onBackPressed
(
BuildContext
context
)
async
{
Future
<
bool
>
onBackPressed
(
BuildContext
context
)
async
{
if
(
_currentStep
>
0
)
{
if
(
_currentStep
>
0
)
{
_previousStep
();
_previousStep
();
...
@@ -90,6 +90,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -90,6 +90,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
return
true
;
return
true
;
}
}
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
@@ -127,7 +128,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -127,7 +128,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
"Add Account"
,
"Add Account"
,
provider
.
resetValues
,
provider
.
resetValues
,
SizedBox
.
shrink
(),
SizedBox
.
shrink
(),
0xFFFFFFFF
0xFFFFFFFF
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
Form
(
body:
Form
(
...
@@ -161,9 +162,9 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -161,9 +162,9 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
return
CircleAvatar
(
return
CircleAvatar
(
radius:
12
,
radius:
12
,
backgroundColor:
backgroundColor:
stepIndex
<=
_currentStep
stepIndex
<=
_currentStep
?
AppColors
.
app_blue
?
AppColors
.
app_blue
:
Colors
.
grey
[
300
],
:
Colors
.
grey
[
300
],
);
);
},
},
steps:
[
steps:
[
...
@@ -171,11 +172,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -171,11 +172,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label:
Text
(
"Step 1"
,
style:
TextStyle
(
fontSize:
12
)),
label:
Text
(
"Step 1"
,
style:
TextStyle
(
fontSize:
12
)),
title:
const
Text
(
''
),
title:
const
Text
(
''
),
isActive:
_currentStep
>=
0
,
isActive:
_currentStep
>=
0
,
content:
Column
(
content:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
5
),
margin:
EdgeInsets
.
only
(
bottom:
5
),
child:
Text
(
child:
Text
(
"Account Details"
,
"Account Details"
,
style:
TextStyle
(
style:
TextStyle
(
...
@@ -186,7 +187,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -186,7 +187,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
),
),
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
10
,
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
...
@@ -195,7 +199,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -195,7 +199,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
SizedBox
(
height:
10
),
SizedBox
(
height:
10
),
Text
(
"Account"
),
Text
(
"Account"
),
DropdownButtonHideUnderline
(
DropdownButtonHideUnderline
(
...
@@ -216,27 +219,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -216,27 +219,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
],
],
),
),
items:
items:
provider
.
accountTypes
provider
.
accountTypes
.
map
(
.
map
(
(
act
)
=>
DropdownMenuItem
<
String
>(
(
act
)
=>
value:
act
,
DropdownMenuItem
<
String
>(
child:
Text
(
value:
act
,
act
,
child:
Text
(
style:
const
TextStyle
(
act
,
fontSize:
14
,
style:
const
TextStyle
(
),
fontSize:
14
,
overflow:
TextOverflow
.
ellipsis
,
),
),
overflow:
),
TextOverflow
)
.
ellipsis
,
.
toList
(),
),
),
)
.
toList
(),
// value: provider.selectedAccountType,
// value: provider.selectedAccountType,
value:
value:
provider
.
accountTypes
.
contains
(
provider
.
accountTypes
.
contains
(
provider
.
selectedAccountType
,
provider
.
selectedAccountType
,
)
)
?
provider
.
selectedAccountType
?
provider
.
selectedAccountType
:
null
,
:
null
,
onChanged:
(
value
)
{
onChanged:
(
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
provider
.
selectedAccountType
=
value
;
provider
.
selectedAccountType
=
value
;
...
@@ -247,8 +253,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -247,8 +253,10 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
},
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
menuItemStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
),
),
],
],
...
@@ -260,7 +268,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -260,7 +268,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider
.
nameController
,
provider
.
nameController
,
"Company Name"
,
"Company Name"
,
"Enter Company Name"
,
"Enter Company Name"
,
(
p0
)
{
(
p0
)
{
provider
.
updateName
(
p0
);
provider
.
updateName
(
p0
);
provider
.
checkInputsAPI
(
provider
.
checkInputsAPI
(
context
,
context
,
...
@@ -281,7 +289,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -281,7 +289,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider
.
mobileController
,
provider
.
mobileController
,
"Mobile Number"
,
"Mobile Number"
,
"Enter Mobile"
,
"Enter Mobile"
,
(
p0
)
{
(
p0
)
{
provider
.
updateMobile
(
p0
);
provider
.
updateMobile
(
p0
);
provider
.
checkInputsAPI
(
provider
.
checkInputsAPI
(
context
,
context
,
...
@@ -322,11 +330,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -322,11 +330,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label:
Text
(
"Step 2"
,
style:
TextStyle
(
fontSize:
12
)),
label:
Text
(
"Step 2"
,
style:
TextStyle
(
fontSize:
12
)),
title:
const
Text
(
''
),
title:
const
Text
(
''
),
isActive:
_currentStep
>=
1
,
isActive:
_currentStep
>=
1
,
content:
Column
(
content:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
margin:
EdgeInsets
.
only
(
bottom:
10
),
child:
Text
(
child:
Text
(
"Address Details"
,
"Address Details"
,
style:
TextStyle
(
style:
TextStyle
(
...
@@ -337,7 +345,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -337,7 +345,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
),
),
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
10
,
vertical:
10
,
...
@@ -349,7 +356,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -349,7 +356,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Text
(
"State"
),
Text
(
"State"
),
DropdownButtonHideUnderline
(
DropdownButtonHideUnderline
(
child:
Row
(
child:
Row
(
...
@@ -358,9 +364,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -358,9 +364,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child:
DropdownButton2
<
States
>(
child:
DropdownButton2
<
States
>(
focusNode:
focusNodes
[
2
],
focusNode:
focusNodes
[
2
],
autofocus:
autofocus:
focusNodes
[
2
].
hasFocus
focusNodes
[
2
].
hasFocus
?
true
:
false
,
?
true
:
false
,
isExpanded:
true
,
isExpanded:
true
,
hint:
Text
(
hint:
Text
(
'Select State'
,
'Select State'
,
...
@@ -368,60 +372,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -368,60 +372,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
),
),
items:
items:
provider
.
states
provider
.
states
.
map
(
.
map
(
(
(
states
)
=>
states
,
DropdownMenuItem
<
States
>(
)
=>
DropdownMenuItem
<
value:
states
,
States
child:
Text
(
>(
states
.
name
??
''
,
value:
states
,
style:
const
TextStyle
(
child:
Text
(
fontSize:
14
,
states
.
name
??
''
,
),
style:
overflow:
const
TextStyle
(
TextOverflow
fontSize:
14
,
.
ellipsis
,
),
),
overflow:
),
TextOverflow
)
.
ellipsis
,
.
toList
(),
),
),
)
.
toList
(),
value:
value:
provider
.
states
.
contains
(
provider
.
states
.
contains
(
provider
.
selectedState
,
provider
.
selectedState
,
)
)
?
provider
.
selectedState
?
provider
.
selectedState
:
null
,
:
null
,
// value: provider.selectedState,
// value: provider.selectedState,
onChanged:
(
States
?
value
)
{
onChanged:
(
States
?
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
if
(
provider
if
(
provider
.
states
.
isNotEmpty
)
{
.
states
provider
.
selectedState
=
value
;
.
isNotEmpty
)
{
provider
.
selectedState
=
value
;
print
(
print
(
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
"Selected Complaint Type:
${value.name}
, ID:
${value.id}
"
,
);
);
provider
.
selectedStateID
=
provider
.
selectedStateID
=
value
.
id
!;
value
.
id
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedStateID}
"
,
provider
.
selectedStateID
.
toString
(),
);
);
if
(
provider
if
(
provider
.
selectedDistricts
!=
.
selectedDistricts
!=
null
)
{
null
)
{
provider
.
districts
.
clear
();
provider
.
districts
.
clear
();
// provider.selectedDistricts = null;
// provider.selectedDistricts = null;
provider
.
selectedDistrictId
=
provider
.
selectedDistrictId
=
null
;
null
;
provider
.
selectedDistrictValue
=
provider
.
selectedDistrictValue
=
null
;
null
;
}
}
provider
.
getDistrictAPI
(
provider
.
getDistrictAPI
(
...
@@ -435,44 +429,33 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -435,44 +429,33 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData:
DropdownSearchData
(
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchInnerWidgetHeight:
50
,
searchController:
searchController:
provider
provider
.
stateSearchController
,
.
stateSearchController
,
searchInnerWidget:
Padding
(
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
padding:
const
EdgeInsets
.
all
(
8
),
8
,
),
child:
TextFormField
(
child:
TextFormField
(
controller:
controller:
provider
provider
.
stateSearchController
,
.
stateSearchController
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
isDense:
true
,
isDense:
true
,
contentPadding:
contentPadding:
const
EdgeInsets
.
symmetric
(
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
8
,
vertical:
8
,
),
),
hintText:
hintText:
'Search States...'
,
'Search States...'
,
border:
OutlineInputBorder
(
border:
OutlineInputBorder
(
borderRadius:
borderRadius:
BorderRadius
.
circular
(
BorderRadius
.
circular
(
8
),
8
,
),
),
),
),
),
),
),
),
),
searchMatchFn:
(
searchMatchFn:
(
item
,
searchValue
)
{
item
,
searchValue
,
)
{
return
item
.
value
?.
name
return
item
.
value
?.
name
?.
toLowerCase
()
?.
toLowerCase
()
.
contains
(
.
contains
(
searchValue
searchValue
.
toLowerCase
(),
.
toLowerCase
(),
)
??
)
??
false
;
false
;
},
},
),
),
...
@@ -482,14 +465,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -482,14 +465,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.
clear
();
.
clear
();
}
}
},
},
buttonStyleData:
buttonStyleData:
ddtheme
.
buttonStyleData
,
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
ddtheme
.
dropdownStyleData
,
),
),
),
),
],
],
...
@@ -510,65 +491,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -510,65 +491,50 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
),
),
items:
items:
provider
.
districts
provider
.
districts
.
map
(
.
map
(
(
(
dist
)
=>
dist
,
DropdownMenuItem
<
Districts
>(
)
=>
DropdownMenuItem
<
value:
dist
,
Districts
child:
Text
(
>(
dist
.
district
??
''
,
value:
dist
,
style:
const
TextStyle
(
child:
Text
(
fontSize:
14
,
dist
.
district
??
''
,
),
style:
overflow:
const
TextStyle
(
TextOverflow
fontSize:
14
,
.
ellipsis
,
),
),
overflow:
),
TextOverflow
)
.
ellipsis
,
.
toList
(),
),
),
)
.
toList
(),
value:
value:
provider
.
districts
.
contains
(
provider
.
districts
.
contains
(
provider
provider
.
selectedDistricts
,
.
selectedDistricts
,
)
)
?
provider
.
selectedDistricts
?
provider
.
selectedDistricts
:
null
,
:
null
,
// value: provider.selectedDistricts,
// value: provider.selectedDistricts,
onChanged:
(
Districts
?
value
)
{
onChanged:
(
Districts
?
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
if
(
provider
if
(
provider
.
districts
.
isNotEmpty
)
{
.
districts
provider
.
selectedDistricts
=
value
;
.
isNotEmpty
)
{
print
(
"Selected ID:
${value.id}
"
);
provider
.
selectedDistricts
=
value
;
print
(
"Selected ID:
${value.id}
"
,
);
provider
.
selectedDistrictId
=
provider
.
selectedDistrictId
=
value
.
id
!;
value
.
id
!;
provider
.
selectedDistrictValue
=
provider
.
selectedDistrictValue
=
value
.
district
!;
value
.
district
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedDistrictId}
"
,
provider
.
selectedDistrictId
.
toString
(),
);
);
if
(
provider
if
(
provider
.
selectedSubLocations
!=
.
selectedSubLocations
!=
null
)
{
null
)
{
provider
.
subLocations
.
clear
();
provider
.
subLocations
.
clear
();
// provider.selectedSubLocations =
// provider.selectedSubLocations =
// null;
// null;
provider
.
selectedSubLocID
=
provider
.
selectedSubLocID
=
null
;
null
;
provider
.
selectedSubLocValue
=
provider
.
selectedSubLocValue
=
null
;
null
;
}
}
provider
.
getSubLocationAPI
(
provider
.
getSubLocationAPI
(
context
,
context
,
...
@@ -580,62 +546,49 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -580,62 +546,49 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData:
DropdownSearchData
(
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchInnerWidgetHeight:
50
,
searchController:
searchController:
provider
provider
.
districtSearchController
,
.
districtSearchController
,
searchInnerWidget:
Padding
(
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
padding:
const
EdgeInsets
.
all
(
8
),
8
,
),
child:
TextFormField
(
child:
TextFormField
(
controller:
controller:
provider
provider
.
districtSearchController
,
.
districtSearchController
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
isDense:
true
,
isDense:
true
,
contentPadding:
contentPadding:
const
EdgeInsets
.
symmetric
(
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
8
,
vertical:
8
,
),
),
hintText:
hintText:
'Search Districts...'
,
'Search Districts...'
,
border:
OutlineInputBorder
(
border:
OutlineInputBorder
(
borderRadius:
borderRadius:
BorderRadius
.
circular
(
BorderRadius
.
circular
(
8
),
8
,
),
),
),
),
),
),
),
),
),
searchMatchFn:
(
searchMatchFn:
(
item
,
searchValue
)
{
item
,
searchValue
,
)
{
return
item
.
value
?.
district
return
item
.
value
?.
district
?.
toLowerCase
()
?.
toLowerCase
()
.
contains
(
.
contains
(
searchValue
searchValue
.
toLowerCase
(),
.
toLowerCase
(),
)
??
)
??
false
;
false
;
},
},
),
),
onMenuStateChange:
(
isOpen
)
{
onMenuStateChange:
(
isOpen
)
{
if
(!
isOpen
)
{
if
(!
isOpen
)
{
provider
provider
.
districtSearchController
.
districtSearchController
.
clear
();
.
clear
();
}
}
},
},
buttonStyleData:
buttonStyleData:
ddtheme
.
buttonStyleData
,
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
ddtheme
.
dropdownStyleData
,
),
),
),
),
],
],
...
@@ -656,37 +609,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -656,37 +609,30 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
),
),
items:
items:
provider
.
subLocations
provider
.
subLocations
.
map
(
.
map
(
(
(
subloc
)
=>
DropdownMenuItem
<
subloc
,
SubLocations
)
=>
DropdownMenuItem
<
>(
SubLocations
value:
subloc
,
>(
child:
Text
(
value:
subloc
,
subloc
.
subLocality
??
''
,
child:
Text
(
style:
const
TextStyle
(
subloc
.
subLocality
??
fontSize:
14
,
''
,
),
style:
overflow:
const
TextStyle
(
TextOverflow
.
ellipsis
,
fontSize:
14
,
),
),
),
overflow:
)
TextOverflow
.
toList
(),
.
ellipsis
,
),
),
)
.
toList
(),
// value: provider.selectedSubLocations,
// value: provider.selectedSubLocations,
value:
value:
provider
.
subLocations
.
contains
(
provider
.
subLocations
.
contains
(
provider
provider
.
selectedSubLocations
,
.
selectedSubLocations
,
)
)
?
provider
.
selectedSubLocations
?
provider
:
null
,
.
selectedSubLocations
:
null
,
onChanged:
(
SubLocations
?
value
)
{
onChanged:
(
SubLocations
?
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
if
(
provider
if
(
provider
...
@@ -694,18 +640,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -694,18 +640,13 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.
isNotEmpty
)
{
.
isNotEmpty
)
{
provider
.
selectedSubLocations
=
provider
.
selectedSubLocations
=
value
;
value
;
print
(
print
(
"Selected ID:
${value.id}
"
);
"Selected ID:
${value.id}
"
,
);
provider
.
selectedSubLocID
=
provider
.
selectedSubLocID
=
value
.
id
!;
value
.
id
!;
provider
.
selectedSubLocValue
=
provider
.
selectedSubLocValue
=
value
.
subLocality
!;
value
.
subLocality
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedSubLocID}
"
,
provider
.
selectedSubLocID
.
toString
(),
);
);
}
}
}
}
...
@@ -713,44 +654,34 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -713,44 +654,34 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
dropdownSearchData:
DropdownSearchData
(
dropdownSearchData:
DropdownSearchData
(
searchInnerWidgetHeight:
50
,
searchInnerWidgetHeight:
50
,
searchController:
searchController:
provider
provider
.
subLocSearchController
,
.
subLocSearchController
,
searchInnerWidget:
Padding
(
searchInnerWidget:
Padding
(
padding:
const
EdgeInsets
.
all
(
padding:
const
EdgeInsets
.
all
(
8
),
8
,
),
child:
TextFormField
(
child:
TextFormField
(
controller:
controller:
provider
provider
.
subLocSearchController
,
.
subLocSearchController
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
isDense:
true
,
isDense:
true
,
contentPadding:
contentPadding:
const
EdgeInsets
.
symmetric
(
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
8
,
vertical:
8
,
),
),
hintText:
hintText:
'Search Sub Locality...'
,
'Search Sub Locality...'
,
border:
OutlineInputBorder
(
border:
OutlineInputBorder
(
borderRadius:
borderRadius:
BorderRadius
.
circular
(
BorderRadius
.
circular
(
8
),
8
,
),
),
),
),
),
),
),
),
),
searchMatchFn:
(
searchMatchFn:
(
item
,
searchValue
)
{
item
,
searchValue
,
)
{
return
item
.
value
?.
subLocality
return
item
.
value
?.
subLocality
?.
toLowerCase
()
?.
toLowerCase
()
.
contains
(
.
contains
(
searchValue
searchValue
.
toLowerCase
(),
.
toLowerCase
(),
)
??
)
??
false
;
false
;
},
},
),
),
...
@@ -760,14 +691,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -760,14 +691,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
.
clear
();
.
clear
();
}
}
},
},
buttonStyleData:
buttonStyleData:
ddtheme
.
buttonStyleData
,
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
ddtheme
.
dropdownStyleData
,
),
),
),
),
],
],
...
@@ -788,7 +717,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -788,7 +717,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
TextInputAction
.
done
,
TextInputAction
.
done
,
),
),
errorWidget
(
context
,
provider
.
addressError
),
errorWidget
(
context
,
provider
.
addressError
),
],
],
),
),
),
),
...
@@ -799,11 +727,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -799,11 +727,12 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label:
Text
(
"Step 3"
,
style:
TextStyle
(
fontSize:
12
)),
label:
Text
(
"Step 3"
,
style:
TextStyle
(
fontSize:
12
)),
title:
const
Text
(
''
),
title:
const
Text
(
''
),
isActive:
_currentStep
>=
1
,
isActive:
_currentStep
>=
1
,
content:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
content:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
margin:
EdgeInsets
.
only
(
bottom:
10
),
child:
Text
(
child:
Text
(
"Bank Details"
,
"Bank Details"
,
style:
TextStyle
(
style:
TextStyle
(
...
@@ -814,7 +743,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -814,7 +743,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
),
),
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
10
,
vertical:
10
,
...
@@ -826,8 +754,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -826,8 +754,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
bankNameController
,
provider
.
bankNameController
,
...
@@ -855,10 +781,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -855,10 +781,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes
[
8
],
focusNodes
[
8
],
TextInputAction
.
next
,
TextInputAction
.
next
,
),
),
errorWidget
(
errorWidget
(
context
,
provider
.
bankBranchError
),
context
,
provider
.
bankBranchError
,
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
bankIfscCotroller
,
provider
.
bankIfscCotroller
,
...
@@ -886,10 +809,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -886,10 +809,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes
[
10
],
focusNodes
[
10
],
TextInputAction
.
next
,
TextInputAction
.
next
,
),
),
errorWidget
(
errorWidget
(
context
,
provider
.
bankHolderNameError
),
context
,
provider
.
bankHolderNameError
,
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
bankAcNumberController
,
provider
.
bankAcNumberController
,
...
@@ -903,10 +823,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -903,10 +823,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes
[
11
],
focusNodes
[
11
],
TextInputAction
.
next
,
TextInputAction
.
next
,
),
),
errorWidget
(
errorWidget
(
context
,
provider
.
bankAcNumberError
),
context
,
provider
.
bankAcNumberError
,
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
bankUpiController
,
provider
.
bankUpiController
,
...
@@ -931,11 +848,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -931,11 +848,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
label:
Text
(
"Step 4"
,
style:
TextStyle
(
fontSize:
12
)),
label:
Text
(
"Step 4"
,
style:
TextStyle
(
fontSize:
12
)),
title:
const
Text
(
''
),
title:
const
Text
(
''
),
isActive:
_currentStep
>=
2
,
isActive:
_currentStep
>=
2
,
content:
Column
(
content:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
Container
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
10
),
margin:
EdgeInsets
.
only
(
bottom:
10
),
child:
Text
(
child:
Text
(
"Contact Details"
,
"Contact Details"
,
style:
TextStyle
(
style:
TextStyle
(
...
@@ -946,7 +863,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -946,7 +863,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
),
),
Container
(
Container
(
padding:
EdgeInsets
.
symmetric
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
horizontal:
10
,
vertical:
10
,
vertical:
10
,
...
@@ -958,7 +874,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -958,7 +874,6 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
contectPersonDesignationController
,
provider
.
contectPersonDesignationController
,
...
@@ -972,23 +887,18 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -972,23 +887,18 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
focusNodes
[
14
],
focusNodes
[
14
],
TextInputAction
.
next
,
TextInputAction
.
next
,
),
),
errorWidget
(
errorWidget
(
context
,
provider
.
desigantionError
),
context
,
provider
.
desigantionError
,
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
provider
.
contectPersonAltMobController
,
provider
.
contectPersonAltMobController
,
"Alternative Mobile Number"
,
"Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
"Enter Alternative Mobile Number"
,
(
p0
)
{
(
p0
)
{
provider
.
updateAltMobile
(
p0
);
provider
.
updateAltMobile
(
p0
);
provider
.
checkInputsAPI
(
provider
.
checkInputsAPI
(
context
,
context
,
"mob2"
,
"mob2"
,
provider
provider
.
contectPersonAltMobController
.
text
,
.
contectPersonAltMobController
.
text
,
);
);
},
},
TextInputType
.
number
,
TextInputType
.
number
,
...
@@ -1036,21 +946,24 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1036,21 +946,24 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
),
),
],
],
controlsBuilder:
(
context
,
details
)
{
controlsBuilder:
(
context
,
details
)
{
return
Column
(
return
Column
(
children:
[
children:
[
if
(
_currentStep
==
3
)
...[
if
(
_currentStep
==
3
)
...[
InkResponse
(
InkResponse
(
onTap:
provider
.
submitClickced
onTap:
?
null
:
()
{
provider
.
submitClickced
if
(
provider
.
validateStep4
())
{
?
null
provider
.
submitClickced
=
true
;
:
()
{
provider
.
submitCommonAccountsAPI
(
context
,
widget
.
from
);
if
(
provider
.
validateStep4
())
{
provider
.
submitClickced
=
true
;
}
provider
.
submitCommonAccountsAPI
(
context
,
widget
.
from
,
);
}
details
.
onStepContinue
;
details
.
onStepContinue
;
},
},
child:
Container
(
child:
Container
(
height:
45
,
height:
45
,
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
...
@@ -1088,12 +1001,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1088,12 +1001,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
if
(
provider
.
validateStep2
())
{
if
(
provider
.
validateStep2
())
{
_currentStep
=
2
;
_currentStep
=
2
;
}
}
}
else
if
(
_currentStep
==
2
)
{
}
else
if
(
_currentStep
==
2
)
{
if
(
provider
.
validateStep3
())
{
if
(
provider
.
validateStep3
())
{
_currentStep
=
3
;
_currentStep
=
3
;
}
}
}
}
else
{
else
{
_currentStep
=
0
;
_currentStep
=
0
;
}
}
});
});
...
@@ -1157,12 +1069,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1157,12 +1069,11 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
},
},
),
),
),
),
);
);
},
},
);
);
}
}
Widget
_scaffold1
(
BuildContext
context
)
{
Widget
_scaffold1
(
BuildContext
context
)
{
return
Consumer
<
Accountslistprovider
>(
return
Consumer
<
Accountslistprovider
>(
builder:
(
context
,
provider
,
child
)
{
builder:
(
context
,
provider
,
child
)
{
...
@@ -1431,9 +1342,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1431,9 +1342,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider
.
selectedStateID
=
provider
.
selectedStateID
=
value
.
id
!;
value
.
id
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedStateID}
"
,
provider
.
selectedStateID
.
toString
(),
);
);
if
(
provider
if
(
provider
.
selectedDistricts
!=
.
selectedDistricts
!=
...
@@ -1576,10 +1485,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1576,10 +1485,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider
.
selectedDistrictValue
=
provider
.
selectedDistrictValue
=
value
.
district
!;
value
.
district
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedDistrictId}
"
,
provider
.
selectedDistrictId
.
toString
(),
);
);
if
(
provider
if
(
provider
.
selectedSubLocations
!=
.
selectedSubLocations
!=
...
@@ -1723,10 +1629,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
...
@@ -1723,10 +1629,7 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
provider
.
selectedSubLocValue
=
provider
.
selectedSubLocValue
=
value
.
subLocality
!;
value
.
subLocality
!;
print
(
print
(
"hfjkshfg"
+
"hfjkshfg
${provider.selectedSubLocID}
"
,
provider
.
selectedSubLocID
.
toString
(),
);
);
}
}
}
}
...
...
lib/screens/commonDateRangeFilter.dart
View file @
7210793a
...
@@ -63,15 +63,14 @@ class Commondaterangefilter {
...
@@ -63,15 +63,14 @@ class Commondaterangefilter {
// Get formatted date range as a list of strings
// Get formatted date range as a list of strings
List
<
String
>
getFormattedDateRange
(
DateTimeRange
?
dateRange
)
{
List
<
String
>
getFormattedDateRange
(
DateTimeRange
?
dateRange
)
{
if
(
dateRange
!=
null
)
{
if
(
dateRange
!=
null
)
{
return
[
return
[
formatDate
(
dateRange
.
start
),
formatDate
(
dateRange
.
end
)];
formatDate
(
dateRange
.
start
),
formatDate
(
dateRange
.
end
),
];
}
}
return
[];
return
[];
}
}
Future
<
Map
<
String
,
dynamic
>?>
showFilterBottomSheet
(
BuildContext
context
)
async
{
Future
<
Map
<
String
,
dynamic
>?>
showFilterBottomSheet
(
BuildContext
context
,
)
async
{
String
?
tempSelectedValue
=
selectedValue
;
String
?
tempSelectedValue
=
selectedValue
;
DateTimeRange
?
tempSelectedDateRange
=
selectedDateRange
;
DateTimeRange
?
tempSelectedDateRange
=
selectedDateRange
;
DateTime
?
tempStartDate
;
DateTime
?
tempStartDate
;
...
@@ -257,25 +256,45 @@ class Commondaterangefilter {
...
@@ -257,25 +256,45 @@ class Commondaterangefilter {
// );
// );
// }
// }
Widget
buildCalendar
()
{
Widget
buildCalendar
()
{
final
firstDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
1
);
final
firstDayOfMonth
=
DateTime
(
final
lastDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
,
0
);
displayedMonth
.
year
,
displayedMonth
.
month
,
1
,
);
final
lastDayOfMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
,
0
,
);
final
firstDayOfWeek
=
firstDayOfMonth
.
weekday
;
final
firstDayOfWeek
=
firstDayOfMonth
.
weekday
;
final
daysInMonth
=
lastDayOfMonth
.
day
;
final
daysInMonth
=
lastDayOfMonth
.
day
;
final
daysBefore
=
(
firstDayOfWeek
-
1
)
%
7
;
final
daysBefore
=
(
firstDayOfWeek
-
1
)
%
7
;
List
<
Widget
>
dayWidgets
=
[];
List
<
Widget
>
dayWidgets
=
[];
// Weekday headers
// Weekday headers
final
weekdays
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
];
final
weekdays
=
[
dayWidgets
.
addAll
(
weekdays
.
map
((
day
)
=>
Center
(
'Mon'
,
child:
Text
(
'Tue'
,
day
,
'Wed'
,
style:
TextStyle
(
'Thu'
,
fontSize:
14
,
'Fri'
,
fontWeight:
FontWeight
.
w600
,
'Sat'
,
color:
Colors
.
grey
[
700
],
'Sun'
,
];
dayWidgets
.
addAll
(
weekdays
.
map
(
(
day
)
=>
Center
(
child:
Text
(
day
,
style:
TextStyle
(
fontSize:
14
,
fontWeight:
FontWeight
.
w600
,
color:
Colors
.
grey
[
700
],
),
),
),
),
),
),
))
);
);
// Empty cells before the first day
// Empty cells before the first day
for
(
int
i
=
0
;
i
<
daysBefore
;
i
++)
{
for
(
int
i
=
0
;
i
<
daysBefore
;
i
++)
{
...
@@ -284,16 +303,23 @@ class Commondaterangefilter {
...
@@ -284,16 +303,23 @@ class Commondaterangefilter {
// Days of the month
// Days of the month
for
(
int
day
=
1
;
day
<=
daysInMonth
;
day
++)
{
for
(
int
day
=
1
;
day
<=
daysInMonth
;
day
++)
{
final
currentDate
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
day
);
final
currentDate
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
,
day
,
);
bool
isSelected
=
false
;
bool
isSelected
=
false
;
bool
isInRange
=
false
;
bool
isInRange
=
false
;
bool
isOutsideRange
=
currentDate
.
isBefore
(
DateTime
(
2020
))
||
bool
isOutsideRange
=
currentDate
.
isBefore
(
DateTime
(
2020
))
||
currentDate
.
isAfter
(
DateTime
(
2100
));
currentDate
.
isAfter
(
DateTime
(
2100
));
if
(
tempStartDate
!=
null
&&
tempEndDate
!=
null
)
{
if
(
tempStartDate
!=
null
&&
tempEndDate
!=
null
)
{
isSelected
=
currentDate
.
isAtSameMomentAs
(
tempStartDate
!)
||
isSelected
=
currentDate
.
isAtSameMomentAs
(
tempStartDate
!)
||
currentDate
.
isAtSameMomentAs
(
tempEndDate
!);
currentDate
.
isAtSameMomentAs
(
tempEndDate
!);
isInRange
=
currentDate
.
isAfter
(
tempStartDate
!)
&&
isInRange
=
currentDate
.
isAfter
(
tempStartDate
!)
&&
currentDate
.
isBefore
(
tempEndDate
!)
&&
currentDate
.
isBefore
(
tempEndDate
!)
&&
!
isSelected
;
!
isSelected
;
}
else
if
(
tempStartDate
!=
null
)
{
}
else
if
(
tempStartDate
!=
null
)
{
...
@@ -302,55 +328,61 @@ class Commondaterangefilter {
...
@@ -302,55 +328,61 @@ class Commondaterangefilter {
dayWidgets
.
add
(
dayWidgets
.
add
(
GestureDetector
(
GestureDetector
(
onTap:
isOutsideRange
onTap:
?
null
isOutsideRange
:
()
{
?
null
setState
(()
{
:
()
{
if
(
tempStartDate
==
null
)
{
setState
(()
{
// No start date selected, set it
if
(
tempStartDate
==
null
)
{
tempStartDate
=
currentDate
;
// No start date selected, set it
tempSelectedDateRange
=
null
;
tempStartDate
=
currentDate
;
}
else
if
(
tempEndDate
==
null
)
{
tempSelectedDateRange
=
null
;
// Start date selected, set end date
}
else
if
(
tempEndDate
==
null
)
{
if
(
currentDate
.
isBefore
(
tempStartDate
!))
{
// Start date selected, set end date
// If the new date is before start date, swap them
if
(
currentDate
.
isBefore
(
tempStartDate
!))
{
tempEndDate
=
tempStartDate
;
// If the new date is before start date, swap them
tempStartDate
=
currentDate
;
tempEndDate
=
tempStartDate
;
}
else
{
tempStartDate
=
currentDate
;
tempEndDate
=
currentDate
;
}
else
{
}
tempEndDate
=
currentDate
;
tempSelectedDateRange
=
DateTimeRange
(
}
start:
tempStartDate
!,
tempSelectedDateRange
=
DateTimeRange
(
end:
tempEndDate
!,
start:
tempStartDate
!,
);
end:
tempEndDate
!,
}
else
{
);
// Both dates selected, reset to start a new range
}
else
{
tempStartDate
=
currentDate
;
// Both dates selected, reset to start a new range
tempEndDate
=
null
;
tempStartDate
=
currentDate
;
tempSelectedDateRange
=
null
;
tempEndDate
=
null
;
}
tempSelectedDateRange
=
null
;
});
}
},
});
},
child:
Container
(
child:
Container
(
margin:
EdgeInsets
.
all
(
2
),
margin:
EdgeInsets
.
all
(
2
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
isSelected
color:
?
Colors
.
blue
[
600
]
isSelected
:
isInRange
?
Colors
.
blue
[
600
]
?
Colors
.
blue
[
100
]
:
isInRange
:
null
,
?
Colors
.
blue
[
100
]
:
null
,
shape:
BoxShape
.
circle
,
shape:
BoxShape
.
circle
,
),
),
child:
Center
(
child:
Center
(
child:
Text
(
child:
Text
(
'
$day
'
,
'
$day
'
,
style:
TextStyle
(
style:
TextStyle
(
color:
isOutsideRange
color:
?
Colors
.
grey
[
400
]
isOutsideRange
:
isSelected
?
Colors
.
grey
[
400
]
?
Colors
.
white
:
isSelected
:
Colors
.
black
,
?
Colors
.
white
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
:
Colors
.
black
,
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
),
),
),
),
),
...
@@ -365,47 +397,57 @@ class Commondaterangefilter {
...
@@ -365,47 +397,57 @@ class Commondaterangefilter {
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
GestureDetector
(
GestureDetector
(
onTap:
displayedMonth
.
isAfter
(
DateTime
(
2020
))
onTap:
?
()
{
displayedMonth
.
isAfter
(
DateTime
(
2020
))
setState
(()
{
?
()
{
displayedMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
-
1
);
setState
(()
{
});
displayedMonth
=
DateTime
(
}
displayedMonth
.
year
,
:
null
,
displayedMonth
.
month
-
1
,
child:
SvgPicture
.
asset
(
);
"assets/svg/arrow_left.svg"
,
});
),
}
:
null
,
child:
SvgPicture
.
asset
(
"assets/svg/arrow_left.svg"
),
),
),
Text
(
Text
(
'
${_monthName(displayedMonth.month)}
${displayedMonth.year}
'
,
'
${_monthName(displayedMonth.month)}
${displayedMonth.year}
'
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w600
),
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
w600
,
),
),
),
GestureDetector
(
GestureDetector
(
onTap:
displayedMonth
.
isBefore
(
DateTime
(
2100
))
onTap:
?
()
{
displayedMonth
.
isBefore
(
DateTime
(
2100
))
setState
(()
{
?
()
{
displayedMonth
=
DateTime
(
displayedMonth
.
year
,
displayedMonth
.
month
+
1
);
setState
(()
{
});
displayedMonth
=
DateTime
(
}
displayedMonth
.
year
,
:
null
,
displayedMonth
.
month
+
1
,
);
});
}
:
null
,
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
"assets/svg/arrow_right_new.svg"
,
"assets/svg/arrow_right_new.svg"
,
),
),
),
),
],
],
),
),
Container
(
SizedBox
(
height:
280
,
height:
280
,
child:
GridView
.
count
(
child:
GridView
.
count
(
crossAxisCount:
7
,
crossAxisCount:
7
,
childAspectRatio:
1.2
,
childAspectRatio:
1.2
,
children:
dayWidgets
,
physics:
NeverScrollableScrollPhysics
(),
physics:
NeverScrollableScrollPhysics
(),
children:
dayWidgets
,
),
),
),
),
],
],
);
);
}
}
return
SafeArea
(
return
SafeArea
(
child:
Padding
(
child:
Padding
(
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
...
@@ -421,7 +463,10 @@ class Commondaterangefilter {
...
@@ -421,7 +463,10 @@ class Commondaterangefilter {
children:
[
children:
[
Text
(
Text
(
'Select Date Range'
,
'Select Date Range'
,
style:
TextStyle
(
fontSize:
18
,
fontWeight:
FontWeight
.
bold
),
style:
TextStyle
(
fontSize:
18
,
fontWeight:
FontWeight
.
bold
,
),
),
),
SizedBox
(
height:
16
),
SizedBox
(
height:
16
),
DropdownButtonHideUnderline
(
DropdownButtonHideUnderline
(
...
@@ -438,26 +483,29 @@ class Commondaterangefilter {
...
@@ -438,26 +483,29 @@ class Commondaterangefilter {
color:
Colors
.
black
,
color:
Colors
.
black
,
),
),
),
),
items:
filterItems
.
map
((
String
item
)
{
items:
return
DropdownMenuItem
<
String
>(
filterItems
.
map
((
String
item
)
{
value:
item
,
return
DropdownMenuItem
<
String
>(
child:
Text
(
value:
item
,
item
,
child:
Text
(
style:
TextStyle
(
item
,
fontSize:
14
,
style:
TextStyle
(
fontWeight:
FontWeight
.
w400
,
fontSize:
14
,
color:
Colors
.
black
,
fontWeight:
FontWeight
.
w400
,
),
color:
Colors
.
black
,
),
),
);
),
}).
toList
(),
);
}).
toList
(),
value:
tempSelectedValue
,
value:
tempSelectedValue
,
onChanged:
(
String
?
value
)
{
onChanged:
(
String
?
value
)
{
if
(
value
==
null
)
return
;
if
(
value
==
null
)
return
;
setState
(()
{
setState
(()
{
tempSelectedValue
=
value
;
tempSelectedValue
=
value
;
if
(
value
!=
'Custom'
)
{
if
(
value
!=
'Custom'
)
{
tempSelectedDateRange
=
getDateRange
(
value
);
tempSelectedDateRange
=
getDateRange
(
value
,
);
tempStartDate
=
null
;
tempStartDate
=
null
;
tempEndDate
=
null
;
tempEndDate
=
null
;
}
else
{
}
else
{
...
@@ -491,7 +539,10 @@ class Commondaterangefilter {
...
@@ -491,7 +539,10 @@ class Commondaterangefilter {
padding:
const
EdgeInsets
.
only
(
top:
12.0
),
padding:
const
EdgeInsets
.
only
(
top:
12.0
),
child:
Text
(
child:
Text
(
'Selected:
${formatDate(tempSelectedDateRange!.start)}
to
${formatDate(tempSelectedDateRange!.end)}
'
,
'Selected:
${formatDate(tempSelectedDateRange!.start)}
to
${formatDate(tempSelectedDateRange!.end)}
'
,
style:
TextStyle
(
fontSize:
14
,
color:
Colors
.
grey
[
600
]),
style:
TextStyle
(
fontSize:
14
,
color:
Colors
.
grey
[
600
],
),
),
),
),
),
],
],
...
@@ -508,17 +559,21 @@ class Commondaterangefilter {
...
@@ -508,17 +559,21 @@ class Commondaterangefilter {
),
),
SizedBox
(
width:
8
),
SizedBox
(
width:
8
),
ElevatedButton
(
ElevatedButton
(
onPressed:
tempSelectedDateRange
!=
null
&&
tempSelectedValue
!=
null
onPressed:
?
()
{
tempSelectedDateRange
!=
null
&&
selectedValue
=
tempSelectedValue
;
tempSelectedValue
!=
null
selectedDateRange
=
tempSelectedDateRange
;
?
()
{
Navigator
.
pop
(
context
,
{
selectedValue
=
tempSelectedValue
;
'selectedValue'
:
tempSelectedValue
,
selectedDateRange
=
tempSelectedDateRange
;
'dateRange'
:
tempSelectedDateRange
,
Navigator
.
pop
(
context
,
{
'formatted'
:
getFormattedDateRange
(
tempSelectedDateRange
),
'selectedValue'
:
tempSelectedValue
,
});
'dateRange'
:
tempSelectedDateRange
,
}
'formatted'
:
getFormattedDateRange
(
:
null
,
tempSelectedDateRange
,
),
});
}
:
null
,
style:
ElevatedButton
.
styleFrom
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Colors
.
blue
[
600
],
backgroundColor:
Colors
.
blue
[
600
],
foregroundColor:
Colors
.
white
,
foregroundColor:
Colors
.
white
,
...
@@ -530,7 +585,9 @@ class Commondaterangefilter {
...
@@ -530,7 +585,9 @@ class Commondaterangefilter {
),
),
],
],
),
),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
),
SizedBox
(
height:
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
,
),
],
],
),
),
),
),
...
@@ -556,7 +613,7 @@ class Commondaterangefilter {
...
@@ -556,7 +613,7 @@ class Commondaterangefilter {
'September'
,
'September'
,
'October'
,
'October'
,
'November'
,
'November'
,
'December'
'December'
,
];
];
return
months
[
month
-
1
];
return
months
[
month
-
1
];
}
}
...
@@ -596,4 +653,4 @@ class Commondaterangefilter {
...
@@ -596,4 +653,4 @@ class Commondaterangefilter {
// ),
// ),
// );
// );
// }
// }
// }
// }
\ No newline at end of file
lib/screens/crm/AppointmentDetails.dart
View file @
7210793a
...
@@ -2,7 +2,6 @@ import 'dart:io';
...
@@ -2,7 +2,6 @@ import 'dart:io';
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:dropdown_button2/dropdown_button2.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:generp/Utils/dropdownTheme.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
...
@@ -19,7 +18,7 @@ class AppointmentDetails extends StatefulWidget {
...
@@ -19,7 +18,7 @@ class AppointmentDetails extends StatefulWidget {
}
}
class
_AppointmentDetailsState
extends
State
<
AppointmentDetails
>
{
class
_AppointmentDetailsState
extends
State
<
AppointmentDetails
>
{
Dropdowntheme
ddtheme
=
Dropdowntheme
();
Dropdowntheme
ddtheme
=
Dropdowntheme
();
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -30,7 +29,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -30,7 +29,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
onWillPop:
()
=>
onBackPressed
(
context
),
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
child:
SafeArea
(
top:
false
,
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Appointment Details"
),
appBar:
appbar
(
context
,
"Appointment Details"
),
...
@@ -61,7 +60,6 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -61,7 +60,6 @@ Dropdowntheme ddtheme = Dropdowntheme();
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
...
List
.
generate
(
5
,
(
j
)
{
...
List
.
generate
(
5
,
(
j
)
{
final
textheads
=
[
final
textheads
=
[
"Employee Name"
,
"Employee Name"
,
...
@@ -86,7 +84,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -86,7 +84,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
),
),
child:
Row
(
child:
Row
(
crossAxisAlignment:
crossAxisAlignment:
CrossAxisAlignment
.
start
,
CrossAxisAlignment
.
start
,
children:
[
children:
[
Expanded
(
Expanded
(
child:
Text
(
child:
Text
(
...
@@ -101,10 +99,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -101,10 +99,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
maxLines:
2
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
style:
TextStyle
(
color:
textSubheads
[
j
]==
"View File"
?
AppColors
.
app_blue
:
color:
Color
(
0xFF818181
),
textSubheads
[
j
]
==
"View File"
decoration:
textSubheads
[
j
]==
"View File"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
?
AppColors
.
app_blue
decorationColor:
AppColors
.
app_blue
:
Color
(
0xFF818181
),
decoration:
textSubheads
[
j
]
==
"View File"
?
TextDecoration
.
underline
:
TextDecoration
.
none
,
decorationColor:
AppColors
.
app_blue
,
),
),
),
),
),
),
...
@@ -132,10 +136,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -132,10 +136,7 @@ Dropdowntheme ddtheme = Dropdowntheme();
child:
Container
(
child:
Container
(
alignment:
Alignment
.
bottomCenter
,
alignment:
Alignment
.
bottomCenter
,
height:
45
,
height:
45
,
width:
MediaQuery
width:
MediaQuery
.
of
(
context
).
size
.
width
,
.
of
(
context
)
.
size
.
width
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
AppColors
.
app_blue
,
color:
AppColors
.
app_blue
,
...
@@ -155,13 +156,14 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -155,13 +156,14 @@ Dropdowntheme ddtheme = Dropdowntheme();
),
),
),
),
floatingActionButtonLocation:
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerFloat
,
FloatingActionButtonLocation
.
centerFloat
,
),
),
),
),
);
);
},
},
);
);
}
}
Future
<
void
>
_showAddAppointmentSheet
(
BuildContext
context
)
{
Future
<
void
>
_showAddAppointmentSheet
(
BuildContext
context
)
{
return
showModalBottomSheet
(
return
showModalBottomSheet
(
useSafeArea:
true
,
useSafeArea:
true
,
...
@@ -207,31 +209,32 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -207,31 +209,32 @@ Dropdowntheme ddtheme = Dropdowntheme();
GestureDetector
(
GestureDetector
(
onTap:
()
{
onTap:
()
{
provider
.
showDatePickerDialog
(
context
);
provider
.
showDatePickerDialog
(
context
);
},
},
child:
Row
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
children:
[
Expanded
(
Expanded
(
child:
Container
(
child:
Container
(
height:
50
,
height:
50
,
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
AppColors
.
text_field_color
,
color:
AppColors
.
text_field_color
,
borderRadius:
BorderRadius
.
circular
(
14
),
borderRadius:
BorderRadius
.
circular
(
14
),
),
),
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
),
padding:
const
EdgeInsets
.
fromLTRB
(
10.0
,
0.0
,
10
,
0
,
),
child:
TextFormField
(
child:
TextFormField
(
controller:
provider
.
dateController
,
controller:
provider
.
dateController
,
keyboardType:
TextInputType
.
text
,
keyboardType:
TextInputType
.
text
,
enabled:
false
,
enabled:
false
,
maxLines:
1
,
maxLines:
1
,
readOnly:
true
,
readOnly:
true
,
onChanged:
(
value
)
{
onChanged:
(
value
)
{},
},
decoration:
InputDecoration
(
decoration:
InputDecoration
(
hintText:
"Enter Date"
,
hintText:
"Enter Date"
,
hintStyle:
TextStyle
(
hintStyle:
TextStyle
(
...
@@ -271,20 +274,21 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -271,20 +274,21 @@ Dropdowntheme ddtheme = Dropdowntheme();
],
],
),
),
items:
items:
provider
.
visitTypes
provider
.
visitTypes
.
map
(
.
map
(
(
vt
)
=>
DropdownMenuItem
<
String
>(
(
vt
)
=>
DropdownMenuItem
<
String
>(
value:
vt
,
value:
vt
,
child:
Text
(
child:
Text
(
vt
,
vt
,
style:
const
TextStyle
(
style:
const
TextStyle
(
fontSize:
14
,
fontSize:
14
,
),
),
overflow:
TextOverflow
.
ellipsis
,
overflow:
),
TextOverflow
.
ellipsis
,
),
),
)
),
.
toList
(),
)
.
toList
(),
value:
provider
.
selectedVisitType
,
value:
provider
.
selectedVisitType
,
onChanged:
(
value
)
{
onChanged:
(
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
...
@@ -296,14 +300,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -296,14 +300,16 @@ Dropdowntheme ddtheme = Dropdowntheme();
},
},
buttonStyleData:
ddtheme
.
buttonStyleData
,
buttonStyleData:
ddtheme
.
buttonStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
iconStyleData:
ddtheme
.
iconStyleData
,
menuItemStyleData:
ddtheme
.
menuItemStyleData
,
menuItemStyleData:
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
ddtheme
.
menuItemStyleData
,
dropdownStyleData:
ddtheme
.
dropdownStyleData
,
),
),
),
),
],
],
),
),
),
),
errorWidget
(
context
,
provider
.
visitTypeError
),
errorWidget
(
context
,
provider
.
visitTypeError
),
textControllerWidget
(
textControllerWidget
(
context
,
context
,
...
@@ -318,11 +324,20 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -318,11 +324,20 @@ Dropdowntheme ddtheme = Dropdowntheme();
errorWidget
(
context
,
provider
.
noteError
),
errorWidget
(
context
,
provider
.
noteError
),
InkWell
(
InkWell
(
onTap:
provider
.
isLoading
?
null
:(){
onTap:
provider
.
isLoading
=
true
;
provider
.
isLoading
provider
.
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
widget
.
leadID
,
provider
.
formattedDateToSend
,
provider
.
selectedVisitType
,
provider
.
noteController
.
text
);
?
null
:
()
{
},
provider
.
isLoading
=
true
;
provider
.
crmLeadDetailsAddAppointmentAPIFunction
(
context
,
widget
.
leadID
,
provider
.
formattedDateToSend
,
provider
.
selectedVisitType
,
provider
.
noteController
.
text
,
);
},
child:
Container
(
child:
Container
(
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
height:
45
,
height:
45
,
...
@@ -337,11 +352,18 @@ Dropdowntheme ddtheme = Dropdowntheme();
...
@@ -337,11 +352,18 @@ Dropdowntheme ddtheme = Dropdowntheme();
borderRadius:
BorderRadius
.
circular
(
14.0
),
borderRadius:
BorderRadius
.
circular
(
14.0
),
),
),
child:
Center
(
child:
Center
(
child:
provider
.
isLoading
?
CircularProgressIndicator
.
adaptive
(
valueColor:
AlwaysStoppedAnimation
(
AppColors
.
white
),):
Text
(
child:
"Submit"
,
provider
.
isLoading
textAlign:
TextAlign
.
center
,
?
CircularProgressIndicator
.
adaptive
(
style:
TextStyle
(
color:
Colors
.
white
),
valueColor:
AlwaysStoppedAnimation
(
),
AppColors
.
white
,
),
)
:
Text
(
"Submit"
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
color:
Colors
.
white
),
),
),
),
),
),
),
),
...
...
lib/screens/crm/FollowUpDetails.dart
View file @
7210793a
import
'dart:io'
;
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_svg/svg.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'../../Notifiers/crmProvider/crmLeadDetailsProvider.dart'
;
import
'../../Notifiers/crmProvider/crmLeadDetailsProvider.dart'
;
...
@@ -25,7 +24,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
...
@@ -25,7 +24,7 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
onWillPop:
()
=>
onBackPressed
(
context
),
onWillPop:
()
=>
onBackPressed
(
context
),
child:
SafeArea
(
child:
SafeArea
(
top:
false
,
top:
false
,
bottom:
Platform
.
isIOS
?
false
:
true
,
bottom:
Platform
.
isIOS
?
false
:
true
,
child:
Scaffold
(
child:
Scaffold
(
resizeToAvoidBottomInset:
true
,
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"Followup Details"
),
appBar:
appbar
(
context
,
"Followup Details"
),
...
@@ -56,7 +55,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
...
@@ -56,7 +55,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
...
List
.
generate
(
4
,
(
j
)
{
...
List
.
generate
(
4
,
(
j
)
{
final
textheads
=
[
final
textheads
=
[
"Employee Name"
,
"Employee Name"
,
...
@@ -111,7 +109,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
...
@@ -111,7 +109,6 @@ class _FollowUpDetailsState extends State<FollowUpDetails> {
),
),
),
),
),
),
),
),
),
),
);
);
...
...
lib/screens/crm/LeadDetailsByMode.dart
View file @
7210793a
...
@@ -253,7 +253,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -253,7 +253,7 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
children:
[
children:
[
Expanded
(
Expanded
(
flex:
1
,
flex:
1
,
child:
Container
(
child:
SizedBox
(
height:
50
,
height:
50
,
width:
35
,
width:
35
,
child:
SvgPicture
.
asset
(
child:
SvgPicture
.
asset
(
...
@@ -752,22 +752,30 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -752,22 +752,30 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if
(
productsNotEmpty
)
...[
if
(
productsNotEmpty
)
...[
Expanded
(
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
editProvider
.
editProductDetailsClicked
?
null
:
()
async
{
onTap:
HapticFeedback
.
selectionClick
();
editProvider
editProvider
.
editProductDetailsClicked
=
true
;
.
editProductDetailsClicked
editProvider
.
resetForm
();
?
null
await
editProvider
:
()
async
{
.
crmLeadDetailsEditProductsViewAPIFunction
(
HapticFeedback
.
selectionClick
();
context
,
editProvider
provider
.
leadDetails
.
id
!,
.
editProductDetailsClicked
=
);
true
;
_showAddEditProductsSheet
(
editProvider
.
resetForm
();
context
,
await
editProvider
widget
.
mode
,
.
crmLeadDetailsEditProductsViewAPIFunction
(
"add"
,
context
,
""
,
provider
);
.
leadDetails
},
.
id
!,
);
_showAddEditProductsSheet
(
context
,
widget
.
mode
,
"add"
,
""
,
);
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
child:
Text
(
...
@@ -801,66 +809,68 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -801,66 +809,68 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount:
provider
.
leadProducts
.
length
,
itemCount:
provider
.
leadProducts
.
length
,
itemBuilder:
(
context
,
lp
)
{
itemBuilder:
(
context
,
lp
)
{
return
InkResponse
(
return
InkResponse
(
onTap:
onTap:
editProvider
.
editProductDetailsClicked
editProvider
.
editProductDetailsClicked
?
null
:
()
async
{
?
null
:
()
async
{
// var res = await Navigator.push(
// var res = await Navigator.push(
// context,
// context,
// MaterialPageRoute(
// MaterialPageRoute(
// builder:
// builder:
// (context) => EditProductsList(
// (context) => EditProductsList(
// leadID: provider.leadDetails.id ?? "",
// leadID: provider.leadDetails.id ?? "",
// ),
// ),
// ),
// ),
// );
// );
editProvider
.
editProductDetailsClicked
=
true
;
editProvider
await
editProvider
.
editProductDetailsClicked
=
.
crmLeadDetailsEditProductsViewAPIFunction
(
true
;
context
,
await
editProvider
provider
.
leadDetails
.
id
!,
.
crmLeadDetailsEditProductsViewAPIFunction
(
);
context
,
editProvider
provider
.
leadDetails
.
id
!,
.
addEditProductPriceController
);
.
text
=
editProvider
provider
.
leadProducts
[
lp
].
price
!;
.
addEditProductPriceController
editProvider
.
text
=
provider
.
addEditQuantityController
.
leadProducts
[
lp
]
.
text
=
.
price
!;
provider
.
leadProducts
[
lp
].
qty
!;
editProvider
editProvider
.
addEditQuantityController
.
addEditTotalAmountController
.
text
=
provider
.
text
=
provider
.
leadProducts
[
lp
]
.
leadProducts
[
lp
]
.
qty
!;
.
prodTotalPrice
!;
editProvider
editProvider
.
addEditTotalAmountController
.
selectedProducts
=
editProvider
.
text
=
provider
.
productsList
.
leadProducts
[
lp
]
.
firstWhere
(
.
prodTotalPrice
!;
(
product
)
=>
editProvider
.
selectedProducts
=
product
.
id
==
editProvider
.
productsList
provider
.
firstWhere
(
.
leadProducts
[
lp
]
(
product
)
=>
.
productId
,
product
.
id
==
);
provider
editProvider
.
selectedAddEditProductId
=
.
leadProducts
[
lp
]
provider
.
productId
,
.
leadProducts
[
lp
]
);
.
productId
!;
editProvider
editProvider
.
selectedAddEditProductId
=
.
selectedAddEditProductName
=
provider
provider
.
leadProducts
[
lp
]
.
leadProducts
[
lp
]
.
productId
!;
.
productName
!;
editProvider
_showAddEditProductsSheet
(
.
selectedAddEditProductName
=
context
,
provider
widget
.
mode
,
.
leadProducts
[
lp
]
"edit"
,
.
productName
!;
provider
.
leadProducts
[
lp
].
id
,
_showAddEditProductsSheet
(
);
context
,
},
widget
.
mode
,
"edit"
,
provider
.
leadProducts
[
lp
].
id
,
);
},
child:
Container
(
child:
Container
(
height:
130
,
height:
130
,
width:
width:
...
@@ -991,22 +1001,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -991,22 +1001,26 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
]
else
...[
]
else
...[
InkResponse
(
InkResponse
(
onTap:
editProvider
.
editProductDetailsClicked
?
null
:
()
async
{
onTap:
HapticFeedback
.
selectionClick
();
editProvider
.
editProductDetailsClicked
editProvider
.
editProductDetailsClicked
=
true
;
?
null
editProvider
.
resetForm
();
:
()
async
{
await
editProvider
HapticFeedback
.
selectionClick
();
.
crmLeadDetailsEditProductsViewAPIFunction
(
editProvider
context
,
.
editProductDetailsClicked
=
true
;
provider
.
leadDetails
.
id
!,
editProvider
.
resetForm
();
);
await
editProvider
_showAddEditProductsSheet
(
.
crmLeadDetailsEditProductsViewAPIFunction
(
context
,
context
,
widget
.
mode
,
provider
.
leadDetails
.
id
!,
"add"
,
);
""
,
_showAddEditProductsSheet
(
);
context
,
},
widget
.
mode
,
"add"
,
""
,
);
},
child:
Container
(
child:
Container
(
height:
50
,
height:
50
,
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
...
@@ -1055,10 +1069,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1055,10 +1069,17 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if
(
contactsNotEmpty
)
...[
if
(
contactsNotEmpty
)
...[
Expanded
(
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
editProvider
.
editContactDetailsClicked
?
null
:
()
{
HapticFeedback
.
selectionClick
();
onTap:
editProvider
.
editContactDetailsClicked
=
true
;
editProvider
_showAddContactSheet
(
context
);
.
editContactDetailsClicked
},
?
null
:
()
{
HapticFeedback
.
selectionClick
();
editProvider
.
editContactDetailsClicked
=
true
;
_showAddContactSheet
(
context
);
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
child:
Text
(
...
@@ -1088,31 +1109,54 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1088,31 +1109,54 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
itemCount:
provider
.
contactDetails
.
length
,
itemCount:
provider
.
contactDetails
.
length
,
itemBuilder:
(
context
,
lp
)
{
itemBuilder:
(
context
,
lp
)
{
return
InkResponse
(
return
InkResponse
(
onTap:
editProvider
.
editContactDetailsClicked
?
null
:
()
async
{
HapticFeedback
.
selectionClick
();
onTap:
editProvider
.
editContactDetailsClicked
=
true
;
editProvider
.
editContactDetailsClicked
provider
.
editNameController
.
text
=
?
null
provider
.
contactDetails
[
lp
].
name
??
:
()
async
{
""
;
HapticFeedback
.
selectionClick
();
provider
.
editDesignationController
.
text
=
editProvider
provider
.
editContactDetailsClicked
=
.
contactDetails
[
lp
]
true
;
.
designation
??
provider
.
editNameController
.
text
=
""
;
provider
provider
.
editMobileNumberController
.
text
=
.
contactDetails
[
lp
]
provider
.
contactDetails
[
lp
].
mob1
??
.
name
??
""
;
""
;
provider
provider
.
editAlternativeMobileController
.
editDesignationController
.
text
=
.
text
=
provider
provider
.
contactDetails
[
lp
].
mob2
??
.
contactDetails
[
lp
]
""
;
.
designation
??
provider
.
editTelephoneController
.
text
=
""
;
provider
.
contactDetails
[
lp
].
tel
??
""
;
provider
provider
.
editEmailController
.
text
=
.
editMobileNumberController
provider
.
contactDetails
[
lp
].
email
??
.
text
=
provider
""
;
.
contactDetails
[
lp
]
_showEditContactSheet
(
context
,
lp
);
.
mob1
??
},
""
;
provider
.
editAlternativeMobileController
.
text
=
provider
.
contactDetails
[
lp
]
.
mob2
??
""
;
provider
.
editTelephoneController
.
text
=
provider
.
contactDetails
[
lp
]
.
tel
??
""
;
provider
.
editEmailController
.
text
=
provider
.
contactDetails
[
lp
]
.
email
??
""
;
_showEditContactSheet
(
context
,
lp
,
);
},
child:
Container
(
child:
Container
(
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
Colors
.
white
,
...
@@ -1169,7 +1213,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1169,7 +1213,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
Expanded
(
Expanded
(
flex:
2
,
flex:
2
,
child:
InkResponse
(
child:
InkResponse
(
onTap:
()
{
HapticFeedback
.
selectionClick
();
onTap:
()
{
HapticFeedback
.
selectionClick
();
launch
(
launch
(
'tel://
${provider.contactDetails[lp].mob1}
'
,
'tel://
${provider.contactDetails[lp].mob1}
'
,
);
);
...
@@ -1177,7 +1222,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1177,7 +1222,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
child:
Text
(
child:
Text
(
textAlign:
textAlign:
TextAlign
.
right
,
TextAlign
.
right
,
"
${provider.contactDetails[lp].mob1 ?? "-"}
"
,
provider
.
contactDetails
[
lp
]
.
mob1
??
"-"
,
style:
TextStyle
(
style:
TextStyle
(
height:
1
,
height:
1
,
decorationColor:
decorationColor:
...
@@ -1202,7 +1250,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1202,7 +1250,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
],
],
),
),
Text
(
Text
(
"
${provider.contactDetails[lp].email ?? "-"}
"
,
provider
.
contactDetails
[
lp
]
.
email
??
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
...
@@ -1223,10 +1274,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1223,10 +1274,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
]
else
...[
]
else
...[
InkResponse
(
InkResponse
(
onTap:
editProvider
.
editContactDetailsClicked
?
null
:
()
async
{
HapticFeedback
.
selectionClick
();
onTap:
editProvider
.
editContactDetailsClicked
=
true
;
editProvider
.
editContactDetailsClicked
_showAddContactSheet
(
context
);
?
null
},
:
()
async
{
HapticFeedback
.
selectionClick
();
editProvider
.
editContactDetailsClicked
=
true
;
_showAddContactSheet
(
context
);
},
child:
Container
(
child:
Container
(
height:
50
,
height:
50
,
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
...
@@ -1275,7 +1331,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1275,7 +1331,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if
(
followupNotEmpty
)
...[
if
(
followupNotEmpty
)
...[
Expanded
(
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
var
res
=
await
Navigator
.
push
(
var
res
=
await
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
...
@@ -1436,7 +1493,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1436,7 +1493,10 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
textAlign:
textAlign:
TextAlign
TextAlign
.
right
,
.
right
,
"
${provider.followupDetails[lp].fstatus ?? "-"}
"
,
provider
.
followupDetails
[
lp
]
.
fstatus
??
"-"
,
style:
TextStyle
(
style:
TextStyle
(
fontFamily:
fontFamily:
"JakartaMedium"
,
"JakartaMedium"
,
...
@@ -1629,7 +1689,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1629,7 +1689,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
]
else
...[
]
else
...[
InkResponse
(
InkResponse
(
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
var
res
=
await
Navigator
.
push
(
var
res
=
await
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
...
@@ -1692,10 +1753,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -1692,10 +1753,19 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
if
(
appointmentNotEmpty
)
...[
if
(
appointmentNotEmpty
)
...[
Expanded
(
Expanded
(
child:
InkResponse
(
child:
InkResponse
(
onTap:
editProvider
.
appointmentDetailsClicked
?
null
:
()
{
HapticFeedback
.
selectionClick
();
onTap:
editProvider
.
appointmentDetailsClicked
=
true
;
editProvider
_showAddAppointmentSheet
(
context
);
.
appointmentDetailsClicked
},
?
null
:
()
{
HapticFeedback
.
selectionClick
();
editProvider
.
appointmentDetailsClicked
=
true
;
_showAddAppointmentSheet
(
context
,
);
},
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
child:
Text
(
...
@@ -2025,10 +2095,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2025,10 +2095,15 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
]
else
...[
]
else
...[
InkResponse
(
InkResponse
(
onTap:
editProvider
.
appointmentDetailsClicked
?
null
:()
{
HapticFeedback
.
selectionClick
();
onTap:
editProvider
.
appointmentDetailsClicked
=
true
;
editProvider
.
appointmentDetailsClicked
_showAddAppointmentSheet
(
context
);
?
null
},
:
()
{
HapticFeedback
.
selectionClick
();
editProvider
.
appointmentDetailsClicked
=
true
;
_showAddAppointmentSheet
(
context
);
},
child:
Container
(
child:
Container
(
height:
50
,
height:
50
,
margin:
EdgeInsets
.
symmetric
(
margin:
EdgeInsets
.
symmetric
(
...
@@ -2355,7 +2430,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2355,7 +2430,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
]
else
...[
]
else
...[
InkResponse
(
InkResponse
(
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
var
res
=
await
Navigator
.
push
(
var
res
=
await
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
...
@@ -2421,8 +2497,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2421,8 +2497,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return
StatefulBuilder
(
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
builder:
(
context
,
setState
)
{
return
SafeArea
(
return
SafeArea
(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
builder:
(
context
,
provider
,
editProvider
,
child
)
{
builder:
(
context
,
provider
,
editProvider
,
child
)
{
editProvider
.
appointmentDetailsClicked
=
false
;
editProvider
.
appointmentDetailsClicked
=
false
;
return
Container
(
return
Container
(
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -2452,7 +2528,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2452,7 +2528,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
),
),
TextWidget
(
context
,
"Appointment Date"
),
TextWidget
(
context
,
"Appointment Date"
),
GestureDetector
(
GestureDetector
(
onTap:
()
{
HapticFeedback
.
selectionClick
();
onTap:
()
{
HapticFeedback
.
selectionClick
();
provider
.
showDatePickerDialog
(
context
);
provider
.
showDatePickerDialog
(
context
);
},
},
child:
Row
(
child:
Row
(
...
@@ -2572,7 +2649,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2572,7 +2649,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
onTap:
provider
.
isLoading
provider
.
isLoading
?
null
?
null
:
()
{
HapticFeedback
.
selectionClick
();
:
()
{
HapticFeedback
.
selectionClick
();
provider
.
isLoading
=
true
;
provider
.
isLoading
=
true
;
provider
provider
.
crmLeadDetailsAddAppointmentAPIFunction
(
.
crmLeadDetailsAddAppointmentAPIFunction
(
...
@@ -2645,8 +2723,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2645,8 +2723,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
return
StatefulBuilder
(
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
builder:
(
context
,
setState
)
{
return
SafeArea
(
return
SafeArea
(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
builder:
(
context
,
provider
,
editProvider
,
child
)
{
builder:
(
context
,
provider
,
editProvider
,
child
)
{
editProvider
.
editContactDetailsClicked
=
false
;
editProvider
.
editContactDetailsClicked
=
false
;
return
Container
(
return
Container
(
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -2775,7 +2853,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2775,7 +2853,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
onTap:
provider
.
isLoading
provider
.
isLoading
?
null
?
null
:
()
{
HapticFeedback
.
selectionClick
();
:
()
{
HapticFeedback
.
selectionClick
();
provider
.
isLoading
=
true
;
provider
.
isLoading
=
true
;
provider
provider
.
crmLeadDetailsAddContactAPIFunction
(
.
crmLeadDetailsAddContactAPIFunction
(
...
@@ -2850,10 +2929,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2850,10 +2929,9 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
builder:
(
context
)
{
builder:
(
context
)
{
return
StatefulBuilder
(
return
StatefulBuilder
(
builder:
(
context
,
setState
)
{
builder:
(
context
,
setState
)
{
return
SafeArea
(
return
SafeArea
(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
child:
Consumer2
<
crmLeadDetailsProvider
,
Editproductlistprovider
>(
builder:
(
context
,
provider
,
editProvider
,
child
)
{
builder:
(
context
,
provider
,
editProvider
,
child
)
{
editProvider
.
editContactDetailsClicked
=
false
;
editProvider
.
editContactDetailsClicked
=
false
;
return
Container
(
return
Container
(
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -2984,7 +3062,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -2984,7 +3062,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
onTap:
onTap:
provider
.
isLoading
provider
.
isLoading
?
null
?
null
:
()
{
HapticFeedback
.
selectionClick
();
:
()
{
HapticFeedback
.
selectionClick
();
provider
.
isLoading
=
true
;
provider
.
isLoading
=
true
;
provider
provider
.
crmLeadDetailsEditContactAPIFunction
(
.
crmLeadDetailsEditContactAPIFunction
(
...
@@ -3097,7 +3176,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
@@ -3097,7 +3176,8 @@ class _LeadDetailsByModeState extends State<LeadDetailsByMode> {
...
List
.
generate
(
assetnames
.
length
,
(
index
)
{
...
List
.
generate
(
assetnames
.
length
,
(
index
)
{
return
ListTile
(
return
ListTile
(
onTap:
()
{
HapticFeedback
.
selectionClick
();
onTap:
()
{
HapticFeedback
.
selectionClick
();
Navigator
.
pop
(
context
,
true
);
Navigator
.
pop
(
context
,
true
);
switch
(
index
)
{
switch
(
index
)
{
case
0
:
case
0
:
...
...
lib/screens/crm/LeadListByMode.dart
View file @
7210793a
...
@@ -108,6 +108,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -108,6 +108,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
_connectivity
.
disposeStream
();
_connectivity
.
disposeStream
();
super
.
dispose
();
super
.
dispose
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
switch
(
_source
.
keys
.
toList
()[
0
])
{
...
@@ -162,142 +163,143 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -162,142 +163,143 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
0xFFFFFFFF
,
0xFFFFFFFF
,
),
),
backgroundColor:
AppColors
.
scaffold_bg_color
,
backgroundColor:
AppColors
.
scaffold_bg_color
,
body:
provider
.
isLoading
body:
?
Center
(
provider
.
isLoading
child:
CircularProgressIndicator
.
adaptive
(
?
Center
(
valueColor:
child:
CircularProgressIndicator
.
adaptive
(
AlwaysStoppedAnimation
<
Color
>(
AppColors
.
app_blue
),
valueColor:
AlwaysStoppedAnimation
<
Color
>(
),
AppColors
.
app_blue
,
)
:
crmLists
.
isNotEmpty
?
Scrollbar
(
controller:
_scrollController
,
child:
ListView
.
builder
(
controller:
_scrollController
,
itemCount:
crmLists
.
length
+
(
provider
.
hasMoreData
?
1
:
0
),
itemBuilder:
(
context
,
index
)
{
if
(
index
==
crmLists
.
length
)
{
return
provider
.
isLoadingMore
?
const
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
Center
(
child:
CircularProgressIndicator
()),
)
:
const
SizedBox
.
shrink
();
}
final
lead
=
crmLists
[
index
];
return
InkResponse
(
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
pageTitleName:
widget
.
pageTitleName
,
mode:
widget
.
mode
,
leadId:
provider
.
crmLeadList
[
index
].
leadid
,
),
),
),
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
),
decoration:
BoxDecoration
(
)
color:
Colors
.
white
,
:
crmLists
.
isNotEmpty
borderRadius:
BorderRadius
.
circular
(
16
),
?
Scrollbar
(
)
,
controller:
_scrollController
,
child:
Column
(
child:
ListView
.
builder
(
c
hildren:
[
c
ontroller:
_scrollController
,
Row
(
itemCount:
c
hildren:
[
c
rmLists
.
length
+
(
provider
.
hasMoreData
?
1
:
0
),
Expanded
(
itemBuilder:
(
context
,
index
)
{
flex:
1
,
if
(
index
==
crmLists
.
length
)
{
child:
Container
(
return
provider
.
isLoadingMore
height:
50
,
?
const
Padding
(
width:
35
,
padding:
EdgeInsets
.
all
(
16
)
,
child:
SvgPicture
.
asset
(
child:
Center
(
"assets/svg/crm/lead_details_list_ic.svg"
,
child:
CircularProgressIndicator
()
,
),
),
)
:
const
SizedBox
.
shrink
();
}
final
lead
=
crmLists
[
index
];
return
InkResponse
(
onTap:
()
async
{
HapticFeedback
.
selectionClick
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LeadDetailsByMode
(
pageTitleName:
widget
.
pageTitleName
,
mode:
widget
.
mode
,
leadId:
provider
.
crmLeadList
[
index
].
leadid
,
),
),
),
);
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
5
,
),
),
SizedBox
(
width:
10
),
margin:
EdgeInsets
.
symmetric
(
Expanded
(
horizontal:
10
,
flex:
6
,
vertical:
5
,
child:
SizedBox
(
),
child:
Column
(
decoration:
BoxDecoration
(
crossAxisAlignment:
color:
Colors
.
white
,
CrossAxisAlignment
.
start
,
borderRadius:
BorderRadius
.
circular
(
16
),
),
child:
Column
(
children:
[
Row
(
children:
[
children:
[
Text
(
Expanded
(
crmLists
[
index
].
company
!,
flex:
1
,
maxLines:
1
,
child:
SizedBox
(
overflow:
TextOverflow
.
ellipsis
,
height:
50
,
style:
TextStyle
(
width:
35
,
fontFamily:
"JakartaMedium"
,
child:
SvgPicture
.
asset
(
fontSize:
14
,
"assets/svg/crm/lead_details_list_ic.svg"
,
color:
AppColors
.
semi_black
,
),
),
),
SizedBox
(
width:
10
),
Expanded
(
flex:
6
,
child:
SizedBox
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
crmLists
[
index
].
company
!,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
14
,
color:
AppColors
.
semi_black
,
),
),
Text
(
crmLists
[
index
].
product
??
"-"
,
maxLines:
1
,
style:
TextStyle
(
fontFamily:
"JakartaMedium"
,
fontSize:
12
,
color:
AppColors
.
grey_semi
,
),
),
],
),
),
),
),
),
Text
(
SizedBox
(
width:
10
),
crmLists
[
index
].
product
??
"-"
,
Expanded
(
maxLines:
1
,
flex:
1
,
style:
TextStyle
(
child:
InkResponse
(
fontFamily:
"JakartaMedium"
,
onTap:
()
{
fontSize:
12
,
HapticFeedback
.
selectionClick
();
color:
AppColors
.
grey_semi
,
launch
(
'tel://
${crmLists[index].mob1}
'
,
);
},
child:
SizedBox
(
height:
35
,
width:
35
,
child:
SvgPicture
.
asset
(
"assets/svg/crm/lead_list_call_ic.svg"
,
),
),
),
),
),
),
],
],
),
),
),
],
),
SizedBox
(
width:
10
),
Expanded
(
flex:
1
,
child:
InkResponse
(
onTap:
()
{
HapticFeedback
.
selectionClick
();
launch
(
'tel://
${crmLists[index].mob1}
'
,
);
},
child:
SizedBox
(
height:
35
,
width:
35
,
child:
SvgPicture
.
asset
(
"assets/svg/crm/lead_list_call_ic.svg"
,
),
),
),
),
),
]
,
)
,
)
,
)
;
]
,
}
,
),
),
),
)
);
:
Emptywidget
(
context
),
},
),
)
:
Emptywidget
(
context
),
);
);
},
},
);
);
}
}
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
Future
<
void
>
_showFilterSheetNew
(
BuildContext
context
)
{
List
<
bool
>
isSelected
=
List
.
generate
(
List
<
bool
>
isSelected
=
List
.
generate
(
9
,
9
,
...
@@ -338,7 +340,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -338,7 +340,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
if
(
widget
.
mode
!=
"executive"
)
{
if
(
widget
.
mode
!=
"executive"
)
{
headings
.
add
(
"Employee"
);
headings
.
add
(
"Employee"
);
}
}
return
Container
(
return
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
height:
MediaQuery
.
of
(
context
).
size
.
height
*
0.7
,
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
@@ -515,7 +517,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -515,7 +517,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
]
else
if
(
selectedIndex
==
1
)
...[
]
else
if
(
selectedIndex
==
1
)
...[
...
provider
.
openStatusList
.
map
((
...
provider
.
openStatusList
.
map
((
status
,
status
,
...
@@ -555,7 +557,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -555,7 +557,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
]
else
if
(
selectedIndex
==
2
)
...[
]
else
if
(
selectedIndex
==
2
)
...[
textControllerWidget
(
textControllerWidget
(
context
,
context
,
...
@@ -589,10 +591,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -589,10 +591,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
provider
.
sourcesList
.
map
((
...
provider
.
sourcesList
.
map
((
source
,
source
,
)
{
)
{
if
(
source
==
null
||
if
(
source
.
id
==
null
||
source
.
id
==
null
||
source
.
name
==
null
)
{
source
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
.
shrink
();
}
return
SizedBox
(
return
SizedBox
(
height:
35
,
height:
35
,
child:
CheckboxListTile
(
child:
CheckboxListTile
(
...
@@ -646,7 +648,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -646,7 +648,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
]
else
if
(
selectedIndex
==
5
)
...[
]
else
if
(
selectedIndex
==
5
)
...[
if
(
provider
if
(
provider
.
referencesList
.
referencesList
...
@@ -659,10 +661,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -659,10 +661,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
provider
.
referencesList
.
map
((
...
provider
.
referencesList
.
map
((
reference
,
reference
,
)
{
)
{
if
(
reference
==
null
||
if
(
reference
.
id
==
null
||
reference
.
id
==
null
||
reference
.
name
==
null
)
{
reference
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
.
shrink
();
}
return
SizedBox
(
return
SizedBox
(
height:
35
,
height:
35
,
child:
CheckboxListTile
(
child:
CheckboxListTile
(
...
@@ -698,7 +700,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -698,7 +700,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
],
],
]
else
if
(
selectedIndex
==
6
)
...[
]
else
if
(
selectedIndex
==
6
)
...[
if
(
provider
.
teamsList
.
isEmpty
)
if
(
provider
.
teamsList
.
isEmpty
)
...
@@ -708,10 +710,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -708,10 +710,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
)
)
else
else
...
provider
.
teamsList
.
map
((
team
)
{
...
provider
.
teamsList
.
map
((
team
)
{
if
(
team
==
null
||
if
(
team
.
id
==
null
||
team
.
id
==
null
||
team
.
name
==
null
)
{
team
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
.
shrink
();
}
return
SizedBox
(
return
SizedBox
(
height:
35
,
height:
35
,
child:
CheckboxListTile
(
child:
CheckboxListTile
(
...
@@ -764,7 +766,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -764,7 +766,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
]
else
if
(
selectedIndex
==
7
)
...[
]
else
if
(
selectedIndex
==
7
)
...[
if
(
provider
if
(
provider
.
segmentsList
.
segmentsList
...
@@ -777,10 +779,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -777,10 +779,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
provider
.
segmentsList
.
map
((
...
provider
.
segmentsList
.
map
((
segment
,
segment
,
)
{
)
{
if
(
segment
==
null
||
if
(
segment
.
id
==
null
||
segment
.
id
==
null
||
segment
.
name
==
null
)
{
segment
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
.
shrink
();
}
return
SizedBox
(
return
SizedBox
(
height:
35
,
height:
35
,
child:
CheckboxListTile
(
child:
CheckboxListTile
(
...
@@ -816,7 +818,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -816,7 +818,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
],
],
]
else
if
(
widget
.
mode
!=
]
else
if
(
widget
.
mode
!=
"executive"
)
...[
"executive"
)
...[
...
@@ -829,10 +831,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -829,10 +831,10 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
provider
.
employeesList
.
map
((
...
provider
.
employeesList
.
map
((
employee
,
employee
,
)
{
)
{
if
(
employee
==
null
||
if
(
employee
.
id
==
null
||
employee
.
id
==
null
||
employee
.
name
==
null
)
{
employee
.
name
==
null
)
return
SizedBox
.
shrink
();
return
SizedBox
.
shrink
();
}
return
SizedBox
(
return
SizedBox
(
height:
35
,
height:
35
,
child:
CheckboxListTile
(
child:
CheckboxListTile
(
...
@@ -868,7 +870,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
...
@@ -868,7 +870,7 @@ class _LeadlistbymodeState extends State<Leadlistbymode> {
EdgeInsets
.
zero
,
EdgeInsets
.
zero
,
),
),
);
);
})
.
toList
()
,
}),
],
],
],
],
),
),
...
...
Prev
1
…
6
7
8
9
10
11
12
13
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