Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
Crm Attendance
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Crm Attendance
Commits
c71dbe0b
Commit
c71dbe0b
authored
Jan 02, 2026
by
William Goszal
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tambah break_start dan break_end
parent
c21740a1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
538 additions
and
295 deletions
+538
-295
api.dart
lib/api/api.dart
+73
-20
route_args.dart
lib/helper/arguments/route_args.dart
+4
-0
absent_camera.dart
lib/page/absent_camera/absent_camera.dart
+265
-198
absent_success.dart
lib/page/absent_success/absent_success.dart
+15
-5
home.dart
lib/page/home/home.dart
+169
-58
routes.dart
lib/resource/routes.dart
+12
-14
No files found.
lib/api/api.dart
View file @
c71dbe0b
...
...
@@ -29,9 +29,7 @@ class Api {
// dynamic jsonObject = await httpRequest(
// typePost, apiUrl, "getNearestBranch",
// bodies: bodies);
HttpResponseApi
apiResult
=
await
ConstantApi
.
httpRequest
(
typePost
,
apiUrl
,
"getNearestBranch"
,
bodies:
bodies
);
HttpResponseApi
apiResult
=
await
ConstantApi
.
httpRequest
(
typePost
,
apiUrl
,
"getNearestBranch"
,
bodies:
bodies
);
if
(
apiResult
.
succes
==
false
)
{
return
apiResult
.
apiResponse
!;
}
else
{
...
...
@@ -47,12 +45,9 @@ class Api {
),
);
}
ConstantString
.
outletDistance
=
jsonObject
[
'data'
][
'max_distance'
].
toString
();
ConstantString
.
logoUrlHome
=
jsonObject
[
'data'
][
'logo_attendance_home'
];
ConstantString
.
logoUrlCamera
=
jsonObject
[
'data'
][
'logo_attendance_camera'
];
ConstantString
.
outletDistance
=
jsonObject
[
'data'
][
'max_distance'
].
toString
();
ConstantString
.
logoUrlHome
=
jsonObject
[
'data'
][
'logo_attendance_home'
];
ConstantString
.
logoUrlCamera
=
jsonObject
[
'data'
][
'logo_attendance_camera'
];
return
ApiResponse
(
error:
false
,
msg:
Strings
.
succesGetData
,
...
...
@@ -169,8 +164,7 @@ class Api {
}
}
static
Future
<
ApiResponse
>
shiftIn
(
String
branchId
,
String
nik
,
String
shiftId
,
String
photoBase64
,
static
Future
<
ApiResponse
>
shiftIn
(
String
branchId
,
String
nik
,
String
shiftId
,
String
photoBase64
,
{
int
forceSubmit
=
0
})
async
{
String
apiUrl
=
"
$baseUrl${endPoint}
clock_in"
;
// Position position = await Geolocator.getCurrentPosition();
...
...
@@ -212,8 +206,7 @@ class Api {
if
(
jsonObject
[
'status'
]
==
"ok"
)
{
// simpan NIK user
List
<
String
>
listAbsentUser
=
getListAbsentUser
();
int
indexList
=
listAbsentUser
.
indexWhere
((
element
)
=>
element
==
nik
);
int
indexList
=
listAbsentUser
.
indexWhere
((
element
)
=>
element
==
nik
);
if
(
indexList
==
-
1
)
{
listAbsentUser
.
add
(
nik
);
setListAbsentUser
(
listAbsentUser
);
...
...
@@ -243,9 +236,7 @@ class Api {
}
}
static
Future
<
ApiResponse
>
shiftOut
(
String
branchId
,
String
nik
,
String
photoBase64
,
{
int
forceSubmit
=
0
})
async
{
static
Future
<
ApiResponse
>
shiftOut
(
String
branchId
,
String
nik
,
String
photoBase64
,
{
int
forceSubmit
=
0
})
async
{
String
apiUrl
=
"
$baseUrl${endPoint}
clock_out"
;
// Position position = await Geolocator.getCurrentPosition();
...
...
@@ -286,8 +277,72 @@ class Api {
if
(
jsonObject
[
'status'
]
==
"ok"
)
{
// simpan NIK user
List
<
String
>
listAbsentUser
=
getListAbsentUser
();
int
indexList
=
listAbsentUser
.
indexWhere
((
element
)
=>
element
==
nik
);
int
indexList
=
listAbsentUser
.
indexWhere
((
element
)
=>
element
==
nik
);
if
(
indexList
==
-
1
)
{
listAbsentUser
.
add
(
nik
);
setListAbsentUser
(
listAbsentUser
);
}
return
ApiResponse
(
error:
false
,
msg:
Strings
.
succesGetData
,
data:
AbsentSuccessModel
.
json
(
jsonObject
[
'data'
],
),
);
}
else
{
return
ApiResponse
(
error:
true
,
msg:
jsonObject
[
'msg'
],
code:
jsonObject
[
'code'
],
);
}
}
}
catch
(
e
)
{
return
ApiResponse
(
error:
true
,
msg:
"Error:
$e
"
);
}
}
static
Future
<
ApiResponse
>
submitBreak
(
bool
isIn
,
String
branchId
,
String
nik
,
String
photoBase64
,
{
int
forceSubmit
=
0
})
async
{
String
action
=
isIn
?
"break_start"
:
"break_end"
;
String
apiUrl
=
"
$baseUrl$endPoint$action
"
;
IpAddress
ipAddress
=
IpAddress
(
type:
RequestType
.
json
);
dynamic
dataIp
=
await
ipAddress
.
getIpAddress
();
DeviceInfoPlugin
deviceInfo
=
DeviceInfoPlugin
();
String
userAgent
=
""
;
if
(
kIsWeb
)
{
WebBrowserInfo
browser
=
await
deviceInfo
.
webBrowserInfo
;
userAgent
=
browser
.
userAgent
??
""
;
}
try
{
Map
<
String
,
dynamic
>
data
=
{
"branch_id"
:
branchId
,
"brand_code"
:
brandCode
,
"nik"
:
nik
,
"user_lat"
:
getLatitude
(),
"user_long"
:
getLongitude
(),
"photo_base64"
:
photoBase64
,
"ip"
:
dataIp
[
'ip'
],
"user_agent"
:
userAgent
,
"forced_submit"
:
forceSubmit
,
};
String
bodies
=
jsonEncode
(
data
);
HttpResponseApi
apiResult
=
await
ConstantApi
.
httpRequest
(
typePost
,
apiUrl
,
"shiftIn"
,
bodies:
bodies
,
);
if
(
apiResult
.
succes
==
false
)
{
return
ApiResponse
(
error:
true
,
msg:
Strings
.
cantConnectToServer
);
}
else
{
Map
<
String
,
dynamic
>
jsonObject
=
apiResult
.
jsonObject
!;
if
(
jsonObject
[
'status'
]
==
"ok"
)
{
// simpan NIK user
List
<
String
>
listAbsentUser
=
getListAbsentUser
();
int
indexList
=
listAbsentUser
.
indexWhere
((
element
)
=>
element
==
nik
);
if
(
indexList
==
-
1
)
{
listAbsentUser
.
add
(
nik
);
setListAbsentUser
(
listAbsentUser
);
...
...
@@ -369,5 +424,3 @@ int typePost = 2;
// this.code = "",
// });
// }
lib/helper/arguments/route_args.dart
View file @
c71dbe0b
...
...
@@ -4,6 +4,7 @@ import 'package:ravintola_attendance/models/profile.dart';
import
'package:ravintola_attendance/models/shift.dart'
;
class
AbsentCameraArguments
{
final
int
actionType
;
// 1 = Absent, 2 = Break
final
bool
isIn
;
final
BranchModel
branchModel
;
final
ShiftModel
?
shiftModel
;
...
...
@@ -14,6 +15,7 @@ class AbsentCameraArguments {
final
String
shiftEndTime
;
AbsentCameraArguments
({
this
.
actionType
=
1
,
required
this
.
isIn
,
required
this
.
branchModel
,
required
this
.
nik
,
...
...
@@ -39,6 +41,7 @@ class AbsentSuccessArguments {
final
AbsentSuccessModel
absentSuccess
;
final
ProfileModel
profil
;
final
String
nik
;
final
int
actionType
;
final
bool
isIn
;
final
String
shiftStart
;
final
String
shiftEnd
;
...
...
@@ -48,6 +51,7 @@ class AbsentSuccessArguments {
required
this
.
absentSuccess
,
required
this
.
profil
,
required
this
.
nik
,
required
this
.
actionType
,
required
this
.
isIn
,
required
this
.
shiftStart
,
required
this
.
shiftEnd
,
...
...
lib/page/absent_camera/absent_camera.dart
View file @
c71dbe0b
...
...
@@ -30,9 +30,19 @@ import 'package:flutter/material.dart';
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:quiver/async.dart'
;
String
getAbsentText
(
bool
isIn
,
int
actionType
)
{
if
(
actionType
==
1
)
{
return
isIn
?
"Absen Masuk"
:
"Absen Keluar"
;
}
else
if
(
actionType
==
2
)
{
return
isIn
?
"Break Start"
:
"Break End"
;
}
return
"Unknown"
;
}
class
AbsentCameraView
extends
StatefulWidget
{
const
AbsentCameraView
({
super
.
key
,
required
this
.
actionType
,
required
this
.
isIn
,
required
this
.
branchModel
,
required
this
.
nik
,
...
...
@@ -43,6 +53,7 @@ class AbsentCameraView extends StatefulWidget {
required
this
.
shiftEndTime
,
});
final
int
actionType
;
// 1 = Absent, 2 = Break
final
bool
isIn
;
final
BranchModel
branchModel
;
final
ShiftModel
?
shiftModel
;
...
...
@@ -93,6 +104,9 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
}
void
initStateFunc
()
{
print
(
"isIn:
${widget.isIn}
"
);
print
(
"actionType:
${widget.actionType}
"
);
getCameraDescrption
().
then
((
value
)
{
cameras
=
value
;
if
(
debug
)
{
...
...
@@ -139,8 +153,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
Routes
.
errorWidget
,
(
route
)
=>
false
,
arguments:
ErrorWidgetArguments
(
errorMessage:
Strings
.
cameraFrontNotFound
(
cameras
!.
length
.
toString
()),
errorMessage:
Strings
.
cameraFrontNotFound
(
cameras
!.
length
.
toString
()),
),
);
}
...
...
@@ -161,6 +174,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
);
break
;
default
:
// setState(() {
// errorCamera = "$e";
// });
...
...
@@ -355,8 +369,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
Container
(
width:
size
.
width
,
height:
size
.
height
,
padding:
EdgeInsets
.
only
(
top:
AppPadding
.
safeAreaTop
(
context
)
+
40
),
padding:
EdgeInsets
.
only
(
top:
AppPadding
.
safeAreaTop
(
context
)
+
40
),
child:
(
pictureIsTaken
)
?
(
isPhone
)
?
Image
.
file
(
...
...
@@ -374,8 +387,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
Container
(
width:
size
.
width
,
height:
size
.
height
,
padding:
EdgeInsets
.
only
(
top:
AppPadding
.
safeAreaTop
(
context
)
+
40
),
padding:
EdgeInsets
.
only
(
top:
AppPadding
.
safeAreaTop
(
context
)
+
40
),
child:
Image
(
fit:
BoxFit
.
fill
,
image:
AssetImage
(
Assets
.
frameOverlay
),
...
...
@@ -397,8 +409,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
color:
ColorManager
.
primary
,
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
AppPadding
.
p20
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
AppPadding
.
p20
),
margin:
EdgeInsets
.
only
(
top:
AppPadding
.
safeAreaTop
(
context
),
),
...
...
@@ -465,161 +476,247 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
if
(
widget
.
isIn
)
{
ApiResponse
apiResponse
=
await
Api
.
shiftIn
(
widget
.
branchModel
.
id
,
widget
.
nik
,
widget
.
shiftModel
!.
id
,
imageBase64
!,
);
// stopTimer();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
// Start modal dialog konfirmasi kalau dia out of range
if
(
apiResponse
.
code
==
"DISTANCE_OUT_OF_RANGE"
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Konfirmasi"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"YA"
,
tapButtonOk:
()
async
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
ApiResponse
apiResponse
=
await
Api
.
shiftIn
(
widget
.
branchModel
.
id
,
widget
.
nik
,
widget
.
shiftModel
!.
id
,
imageBase64
!,
forceSubmit:
1
,
);
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
)
.
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
if
(
widget
.
actionType
==
1
)
{
if
(
widget
.
isIn
)
{
ApiResponse
apiResponse
=
await
Api
.
shiftIn
(
widget
.
branchModel
.
id
,
widget
.
nik
,
widget
.
shiftModel
!.
id
,
imageBase64
!,
);
// stopTimer();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
// Start modal dialog konfirmasi kalau dia out of range
if
(
apiResponse
.
code
==
"DISTANCE_OUT_OF_RANGE"
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Konfirmasi"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"YA"
,
tapButtonOk:
()
async
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
return
;
}
else
{
Navigator
.
pop
(
context
);
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
isIn:
true
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
ApiResponse
apiResponse
=
await
Api
.
shiftIn
(
widget
.
branchModel
.
id
,
widget
.
nik
,
widget
.
shiftModel
!.
id
,
imageBase64
!,
forceSubmit:
1
,
);
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
else
{
Navigator
.
pop
(
context
);
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
true
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
return
;
}
},
isActiveCancelButton:
true
,
cancelButtonText:
"Tidak"
,
tapButtonCancel:
()
{
// kalau pilih tidak, recall lagi camera suruh foto ulang
return
;
}
},
isActiveCancelButton:
true
,
cancelButtonText:
"Tidak"
,
tapButtonCancel:
()
{
// kalau pilih tidak, recall lagi camera suruh foto ulang
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
// END modal dialog konfirmasi kalau dia out of range
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
// END modal dialog konfirmasi kalau dia out of range
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
recallCamera
();
},
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
true
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
return
;
}
else
{
Api
.
shiftOut
(
widget
.
branchModel
.
id
,
widget
.
nik
,
imageBase64
!,
).
then
((
apiResponse
)
{
// stopTimer();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
// Start modal dialog konfirmasi kalau dia out of range
if
(
apiResponse
.
code
==
"DISTANCE_OUT_OF_RANGE"
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Konfirmasi"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"YA"
,
tapButtonOk:
()
async
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
ApiResponse
apiResponse
=
await
Api
.
shiftOut
(
widget
.
branchModel
.
id
,
widget
.
nik
,
imageBase64
!,
forceSubmit:
1
,
);
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
else
{
Navigator
.
pop
(
context
);
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
false
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
return
;
}
},
isActiveCancelButton:
true
,
cancelButtonText:
"Tidak"
,
tapButtonCancel:
()
{
// kalau pilih tidak, recall lagi camera suruh foto ulang
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
// END modal dialog konfirmasi kalau dia out of range
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
false
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
});
}
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
isIn:
true
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
}
else
{
Api
.
shiftOut
(
}
/** Submit Break, Start and End */
if
(
widget
.
actionType
==
2
)
{
Api
.
submitBreak
(
widget
.
isIn
,
widget
.
branchModel
.
id
,
widget
.
nik
,
imageBase64
!,
).
then
((
apiResponse
)
{
// stopTimer();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
// Start modal dialog konfirmasi kalau dia out of range
if
(
apiResponse
.
code
==
"DISTANCE_OUT_OF_RANGE"
)
{
if
(
apiResponse
.
code
==
"DISTANCE_OUT_OF_RANGE"
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
)
.
size
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Konfirmasi"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"YA"
,
tapButtonOk:
()
async
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
ApiResponse
apiResponse
=
await
Api
.
shiftOut
(
ApiResponse
apiResponse
=
await
Api
.
submitBreak
(
widget
.
isIn
,
widget
.
branchModel
.
id
,
widget
.
nik
,
imageBase64
!,
...
...
@@ -629,46 +726,34 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
)
.
size
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
recallCamera
();
},
);
return
;
}
else
{
Navigator
.
pop
(
context
);
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
(
route
)
=>
false
,
arguments:
AbsentSuccessArguments
(
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
false
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
);
return
;
}
...
...
@@ -676,7 +761,6 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
isActiveCancelButton:
true
,
cancelButtonText:
"Tidak"
,
tapButtonCancel:
()
{
// kalau pilih tidak, recall lagi camera suruh foto ulang
Navigator
.
pop
(
context
);
recallCamera
();
},
...
...
@@ -686,8 +770,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
// END modal dialog konfirmasi kalau dia out of range
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
...
...
@@ -698,9 +781,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
);
return
;
}
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
AbsentSuccessModel
absentSuccess
=
apiResponse
.
data
as
AbsentSuccessModel
;
Navigator
.
pushNamedAndRemoveUntil
(
context
,
Routes
.
absentSuccess
,
...
...
@@ -709,12 +790,11 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
absentSuccess:
absentSuccess
,
profil:
widget
.
profile
,
nik:
widget
.
nik
,
actionType:
widget
.
actionType
,
isIn:
false
,
shiftName:
widget
.
shiftNameSelected
,
shiftName:
widget
.
shiftNameSelected
,
shiftEnd:
widget
.
shiftEndTime
,
shiftStart:
widget
.
shiftStartTime
),
shiftStart:
widget
.
shiftStartTime
),
);
});
}
...
...
@@ -747,17 +827,14 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
await
_initializeControllerFuture
;
// ambil imagenya
XFile
image
=
await
_controller
!
.
takePicture
();
XFile
image
=
await
_controller
!.
takePicture
();
String
?
imageResultPhone
;
Uint8List
?
imageResultWeb
;
if
(
isPhone
)
{
imageResultPhone
=
image
.
path
;
imageResultWeb
=
await
image
.
readAsBytes
();
imageResultWeb
=
await
image
.
readAsBytes
();
}
else
{
imageResultWeb
=
await
image
.
readAsBytes
();
imageResultWeb
=
await
image
.
readAsBytes
();
}
// kalau gak ke ambil gak ngelakuin aksi apa2
...
...
@@ -766,14 +843,12 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
pictureIsTaken
=
true
;
imagePath
=
imageResultWeb
;
imagePathPhone
=
imageResultPhone
;
imageBase64
=
base64Encode
(
imageResultWeb
!);
imageBase64
=
base64Encode
(
imageResultWeb
!);
});
}
catch
(
e
)
{
if
(
debug
)
{
// ignore: avoid_print
print
(
"TERJADI KESALAHAAN SAAT AMBIL GAMBER, ERROR:
$e
"
);
print
(
"TERJADI KESALAHAAN SAAT AMBIL GAMBER, ERROR:
$e
"
);
}
}
},
...
...
@@ -781,8 +856,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
width:
80
,
height:
80
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
100
),
borderRadius:
BorderRadius
.
circular
(
100
),
border:
Border
.
all
(
width:
1.5
,
color:
Colors
.
black
,
...
...
@@ -797,33 +871,26 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
GestureDetector
(
onTap:
()
async
{
if
(
cameras
!.
length
>
1
)
{
_controller
?.
dispose
()
.
then
((
value
)
{
_controller
?.
dispose
().
then
((
value
)
{
setState
(()
{});
CameraDescription
?
switchTo
;
if
(
_cameraDescription
==
cameras
![
0
])
{
_cameraDescription
=
cameras
![
1
];
if
(
_cameraDescription
==
cameras
![
0
])
{
_cameraDescription
=
cameras
![
1
];
switchTo
=
cameras
![
1
];
}
else
{
_cameraDescription
=
cameras
![
0
];
_cameraDescription
=
cameras
![
0
];
switchTo
=
cameras
![
0
];
}
_controller
=
CameraController
(
switchTo
,
ResolutionPreset
.
medium
,
imageFormatGroup:
ImageFormatGroup
.
jpeg
,
imageFormatGroup:
ImageFormatGroup
.
jpeg
,
enableAudio:
false
,
);
initCamera
(
_controller
!);
});
}
else
{
EasyLoading
.
showToast
(
"Kamera lain tidak terdeteksi"
);
EasyLoading
.
showToast
(
"Kamera lain tidak terdeteksi"
);
}
},
child:
Icon
(
...
...
@@ -1045,7 +1112,7 @@ class _InfoUserAttendanceState extends State<InfoUserAttendance> {
top:
AppMargin
.
m10
,
),
child:
Text
(
(
widget
.
widget
.
isIn
)
?
"Absen Masuk"
:
"Absen Keluar"
,
getAbsentText
(
widget
.
widget
.
isIn
,
widget
.
widget
.
actionType
)
,
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
FontSize
.
s16
,
...
...
lib/page/absent_success/absent_success.dart
View file @
c71dbe0b
...
...
@@ -11,11 +11,21 @@ import 'package:ravintola_attendance/resource/size.dart';
import
'package:ravintola_attendance/resource/style.dart'
;
import
'package:flutter/material.dart'
;
String
getAbsentText
(
bool
isIn
,
int
actionType
)
{
if
(
actionType
==
1
)
{
return
isIn
?
"Absen Masuk"
:
"Absen Keluar"
;
}
else
if
(
actionType
==
2
)
{
return
isIn
?
"Break Start"
:
"Break End"
;
}
return
"Unknown"
;
}
class
AbsentSuccessView
extends
StatelessWidget
{
const
AbsentSuccessView
({
super
.
key
,
required
this
.
absentSuccess
,
required
this
.
isIn
,
required
this
.
actionType
,
required
this
.
nik
,
required
this
.
profil
,
required
this
.
shiftStart
,
...
...
@@ -26,6 +36,7 @@ class AbsentSuccessView extends StatelessWidget {
final
AbsentSuccessModel
absentSuccess
;
final
ProfileModel
profil
;
final
String
nik
;
final
int
actionType
;
final
bool
isIn
;
final
String
shiftStart
;
final
String
shiftEnd
;
...
...
@@ -37,6 +48,7 @@ class AbsentSuccessView extends StatelessWidget {
backgroundColor:
ColorManager
.
backgroundColor
,
body:
ScreenResponsive
(
widget:
BodyWidget
(
actionType:
actionType
,
isIn:
isIn
,
profil:
profil
,
nik:
nik
,
...
...
@@ -54,6 +66,7 @@ class AbsentSuccessView extends StatelessWidget {
class
BodyWidget
extends
StatelessWidget
{
const
BodyWidget
({
super
.
key
,
required
this
.
actionType
,
required
this
.
isIn
,
required
this
.
profil
,
required
this
.
nik
,
...
...
@@ -63,6 +76,7 @@ class BodyWidget extends StatelessWidget {
required
this
.
shiftName
,
});
final
int
actionType
;
final
bool
isIn
;
final
ProfileModel
profil
;
final
String
nik
;
...
...
@@ -134,11 +148,7 @@ class BodyWidget extends StatelessWidget {
width:
double
.
infinity
,
child:
Center
(
child:
Text
(
(
isIn
)
?
'''Absen Masuk
Sukses'''
:
'''Absen Keluar
Sukses'''
,
getAbsentText
(
isIn
,
actionType
),
style:
getSemiBoldStyle
(
color:
Colors
.
black
,
fontSize:
FontSize
.
s24
,
...
...
lib/page/home/home.dart
View file @
c71dbe0b
...
...
@@ -25,8 +25,7 @@ import 'package:flutter/material.dart';
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
class
HomeView
extends
StatelessWidget
{
const
HomeView
(
{
super
.
key
,
required
this
.
nearestBranch
,
required
this
.
shiftList
});
const
HomeView
({
super
.
key
,
required
this
.
nearestBranch
,
required
this
.
shiftList
});
final
List
<
BranchModel
>
nearestBranch
;
final
List
<
ShiftModel
>
shiftList
;
...
...
@@ -380,6 +379,7 @@ class _BodyWidgetState extends State<BodyWidget> {
),
child:
Row
(
children:
[
/** Clock In */
Expanded
(
child:
CustomButton
(
text:
"Masuk"
,
...
...
@@ -396,8 +396,7 @@ class _BodyWidgetState extends State<BodyWidget> {
builder:
(
c
)
{
return
WidgetSelectShift
(
shiftList:
widget
.
shiftList
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
nik:
nikController
.
text
,
);
},
...
...
@@ -407,24 +406,165 @@ class _BodyWidgetState extends State<BodyWidget> {
),
),
SizedBox
(
width:
AppMargin
.
m
20
,
width:
AppMargin
.
m
4
,
),
/** Break Start */
Expanded
(
child:
CustomButton
(
text:
"
Keluar
"
,
text:
"
Break Start
"
,
onTap:
()
async
{
if
(
nikController
.
text
.
isEmpty
)
{
EasyLoading
.
showToast
(
"NIK harus diisi"
,
EasyLoading
.
showToast
(
"NIK harus diisi"
);
}
else
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
Api
.
getUserProfile
(
widget
.
nearestBranch
[
selectedOutlet
].
id
,
nikController
.
text
,
).
then
((
apiResponse
)
{
print
(
"user profile received response"
);
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
});
}
else
{
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
if
(
profileUser
.
attendanceIn
==
false
)
{
print
(
"attendance in false"
);
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
Strings
.
outButNotIn
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
});
return
;
}
if
(
profileUser
.
attendanceOut
)
{
/** can user re enter break start again */
}
print
(
"navigating to absent camera"
);
Navigator
.
pushNamed
(
context
,
Routes
.
absentCamera
,
arguments:
AbsentCameraArguments
(
actionType:
2
,
isIn:
true
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
profile:
profileUser
,
nik:
nikController
.
text
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftStartTime:
profileUser
.
shiftStart
,
shiftEndTime:
profileUser
.
shiftEnd
,
),
);
}
});
}
},
),
),
SizedBox
(
width:
AppMargin
.
m4
,
),
/** Break End */
Expanded
(
child:
CustomButton
(
text:
"Break End"
,
onTap:
()
async
{
if
(
nikController
.
text
.
isEmpty
)
{
EasyLoading
.
showToast
(
"NIK harus diisi"
);
}
else
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
Api
.
getUserProfile
(
widget
.
nearestBranch
[
selectedOutlet
].
id
,
nikController
.
text
)
widget
.
nearestBranch
[
selectedOutlet
].
id
,
nikController
.
text
,
).
then
((
apiResponse
)
{
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
});
}
else
{
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
if
(
profileUser
.
attendanceIn
==
false
)
{
print
(
"attendance in false"
);
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
Strings
.
outButNotIn
,
buttonText:
"Ok"
,
tapButtonOk:
()
{
Navigator
.
pop
(
context
);
});
return
;
}
/** can user re enter break start again */
if
(
profileUser
.
attendanceOut
)
{}
/** navigate to absent camera */
Navigator
.
pushNamed
(
context
,
Routes
.
absentCamera
,
arguments:
AbsentCameraArguments
(
actionType:
2
,
isIn:
false
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
profile:
profileUser
,
nik:
nikController
.
text
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftStartTime:
profileUser
.
shiftStart
,
shiftEndTime:
profileUser
.
shiftEnd
,
),
);
}
});
}
},
),
),
SizedBox
(
width:
AppMargin
.
m4
,
),
/** Clock Out */
Expanded
(
child:
CustomButton
(
text:
"Keluar"
,
onTap:
()
async
{
if
(
nikController
.
text
.
isEmpty
)
{
EasyLoading
.
showToast
(
"NIK harus diisi"
);
}
else
{
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
);
Api
.
getUserProfile
(
widget
.
nearestBranch
[
selectedOutlet
].
id
,
nikController
.
text
)
.
then
((
apiResponse
)
{
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
...
...
@@ -438,8 +578,7 @@ class _BodyWidgetState extends State<BodyWidget> {
Navigator
.
pop
(
context
);
});
}
else
{
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
ProfileModel
profileUser
=
apiResponse
.
data
as
ProfileModel
;
if
(
profileUser
.
attendanceIn
==
false
)
{
modalDialogGlobal
(
...
...
@@ -467,14 +606,11 @@ class _BodyWidgetState extends State<BodyWidget> {
Routes
.
absentCamera
,
arguments:
AbsentCameraArguments
(
isIn:
false
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
profile:
profileUser
,
nik:
nikController
.
text
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftStartTime:
profileUser
.
shiftStart
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftStartTime:
profileUser
.
shiftStart
,
shiftEndTime:
profileUser
.
shiftEnd
,
),
);
...
...
@@ -491,12 +627,10 @@ class _BodyWidgetState extends State<BodyWidget> {
Routes
.
absentCamera
,
arguments:
AbsentCameraArguments
(
isIn:
false
,
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
branchModel:
widget
.
nearestBranch
[
selectedOutlet
],
profile:
profileUser
,
nik:
nikController
.
text
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftNameSelected:
profileUser
.
shiftSelectedName
,
shiftStartTime:
profileUser
.
shiftStart
,
shiftEndTime:
profileUser
.
shiftEnd
,
),
...
...
@@ -796,10 +930,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
margin:
EdgeInsets
.
only
(
top:
AppMargin
.
m20
),
child:
Text
(
"Pilih Outlet"
,
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
20
,
fontFamily:
FontConstants
.
poppins
),
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
20
,
fontFamily:
FontConstants
.
poppins
),
),
),
Container
(
...
...
@@ -808,10 +939,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
child:
Center
(
child:
Text
(
"Outlet dalam radius
${ConstantString.outletDistance}
Km"
,
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
16
,
fontFamily:
FontConstants
.
poppins
),
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
16
,
fontFamily:
FontConstants
.
poppins
),
),
),
),
...
...
@@ -846,8 +974,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
});
},
child:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
6
,
vertical:
3
),
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
6
,
vertical:
3
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
AppPadding
.
p10
,
vertical:
AppPadding
.
p14
,
...
...
@@ -870,9 +997,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
child:
Text
(
widget
.
nearestBranch
[
index
].
name
,
style:
getRegularStyle
(
color:
(
selectedOutlet
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
color:
(
selectedOutlet
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
fontSize:
20
,
fontFamily:
FontConstants
.
poppins
,
),
...
...
@@ -886,9 +1011,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
Text
(
"
${widget.nearestBranch[index].distance}
Km"
,
style:
getRegularStyle
(
color:
(
selectedOutlet
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
color:
(
selectedOutlet
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
fontSize:
12
,
fontFamily:
FontConstants
.
poppins
,
),
...
...
@@ -1001,10 +1124,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
margin:
EdgeInsets
.
only
(
top:
AppMargin
.
m20
),
child:
Text
(
"Pilih Shift"
,
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
20
,
fontFamily:
FontConstants
.
poppins
),
style:
getMediumStyle
(
color:
Colors
.
black
,
fontSize:
20
,
fontFamily:
FontConstants
.
poppins
),
),
),
Container
(
...
...
@@ -1064,9 +1184,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
child:
Text
(
widget
.
shiftList
[
index
].
name
,
style:
getRegularStyle
(
color:
(
selectedShift
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
color:
(
selectedShift
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
fontSize:
FontSize
.
s16
,
fontFamily:
FontConstants
.
poppins
,
),
...
...
@@ -1080,9 +1198,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
Text
(
"
${DateFormatCustom.getTimeHourMinuteOnly(widget.shiftList[index].startTime)}
-
${DateFormatCustom.getTimeHourMinuteOnly(widget.shiftList[index].endTime)}
"
,
style:
getRegularStyle
(
color:
(
selectedShift
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
color:
(
selectedShift
==
index
)
?
ColorManager
.
link
:
Colors
.
black
,
fontSize:
FontSize
.
s20
,
fontFamily:
FontConstants
.
openSans
,
),
...
...
@@ -1142,12 +1258,9 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
shiftModel:
widget
.
shiftList
[
selectedShift
!],
profile:
profileUser
,
nik:
widget
.
nik
,
shiftNameSelected:
widget
.
shiftList
[
selectedShift
!].
name
,
shiftStartTime:
widget
.
shiftList
[
selectedShift
!].
startTime
,
shiftEndTime:
widget
.
shiftList
[
selectedShift
!].
endTime
,
shiftNameSelected:
widget
.
shiftList
[
selectedShift
!].
name
,
shiftStartTime:
widget
.
shiftList
[
selectedShift
!].
startTime
,
shiftEndTime:
widget
.
shiftList
[
selectedShift
!].
endTime
,
),
);
},
...
...
@@ -1168,10 +1281,8 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
shiftModel:
widget
.
shiftList
[
selectedShift
!],
profile:
profileUser
,
nik:
widget
.
nik
,
shiftNameSelected:
widget
.
shiftList
[
selectedShift
!].
name
,
shiftStartTime:
widget
.
shiftList
[
selectedShift
!].
startTime
,
shiftNameSelected:
widget
.
shiftList
[
selectedShift
!].
name
,
shiftStartTime:
widget
.
shiftList
[
selectedShift
!].
startTime
,
shiftEndTime:
widget
.
shiftList
[
selectedShift
!].
endTime
,
),
);
...
...
lib/resource/routes.dart
View file @
c71dbe0b
...
...
@@ -23,8 +23,7 @@ class RouteGenerator {
static
Route
<
dynamic
>
getRoute
(
RouteSettings
routeSettings
)
{
switch
(
routeSettings
.
name
)
{
case
Routes
.
onBoarding
:
return
pageRouteCustom
(
const
OnBoardingView
(),
nameRoute:
Routes
.
onBoarding
);
return
pageRouteCustom
(
const
OnBoardingView
(),
nameRoute:
Routes
.
onBoarding
);
case
Routes
.
home
:
HomeArguments
args
=
routeSettings
.
arguments
as
HomeArguments
;
return
pageRouteCustom
(
...
...
@@ -37,10 +36,11 @@ class RouteGenerator {
);
case
Routes
.
absentCamera
:
AbsentCameraArguments
args
=
routeSettings
.
arguments
as
AbsentCameraArguments
;
AbsentCameraArguments
args
=
routeSettings
.
arguments
as
AbsentCameraArguments
;
print
(
"Generating route for AbsentCamera with isIn:
${args.isIn}
, actionType:
${args.actionType}
"
)
;
return
pageRouteCustom
(
AbsentCameraView
(
actionType:
args
.
actionType
,
isIn:
args
.
isIn
,
branchModel:
args
.
branchModel
,
shiftModel:
args
.
shiftModel
,
...
...
@@ -54,13 +54,13 @@ class RouteGenerator {
routeSettings:
routeSettings
,
);
case
Routes
.
absentSuccess
:
AbsentSuccessArguments
args
=
routeSettings
.
arguments
as
AbsentSuccessArguments
;
AbsentSuccessArguments
args
=
routeSettings
.
arguments
as
AbsentSuccessArguments
;
return
pageRouteCustom
(
AbsentSuccessView
(
absentSuccess:
args
.
absentSuccess
,
profil:
args
.
profil
,
nik:
args
.
nik
,
actionType:
args
.
actionType
,
isIn:
args
.
isIn
,
shiftEnd:
args
.
shiftEnd
,
shiftStart:
args
.
shiftStart
,
...
...
@@ -70,8 +70,7 @@ class RouteGenerator {
routeSettings:
routeSettings
,
);
case
Routes
.
errorWidget
:
ErrorWidgetArguments
args
=
routeSettings
.
arguments
as
ErrorWidgetArguments
;
ErrorWidgetArguments
args
=
routeSettings
.
arguments
as
ErrorWidgetArguments
;
return
pageRouteCustom
(
ErrorWidgetView
(
messageError:
args
.
errorMessage
,
...
...
@@ -104,10 +103,10 @@ class RouteGenerator {
})
{
// setTitle(title);
if
(
nameRoute
==
Routes
.
absentCamera
)
{
AbsentCameraArguments
args
=
routeSettings
!.
arguments
as
AbsentCameraArguments
;
AbsentCameraArguments
args
=
routeSettings
!.
arguments
as
AbsentCameraArguments
;
return
PageRouteBuilder
(
pageBuilder:
(
context
,
a
,
b
)
=>
AbsentCameraView
(
actionType:
args
.
actionType
,
isIn:
args
.
isIn
,
branchModel:
args
.
branchModel
,
shiftModel:
args
.
shiftModel
,
...
...
@@ -123,8 +122,7 @@ class RouteGenerator {
// name: nameRoute.replaceFirst("/", ""), arguments: args),
);
}
else
if
(
nameRoute
==
Routes
.
errorWidget
)
{
ErrorWidgetArguments
args
=
routeSettings
!.
arguments
as
ErrorWidgetArguments
;
ErrorWidgetArguments
args
=
routeSettings
!.
arguments
as
ErrorWidgetArguments
;
return
PageRouteBuilder
(
pageBuilder:
(
context
,
a
,
b
)
=>
ErrorWidgetView
(
messageError:
args
.
errorMessage
,
...
...
@@ -147,13 +145,13 @@ class RouteGenerator {
// name: nameRoute.replaceFirst("/", ""), arguments: args),
);
}
else
if
(
nameRoute
==
Routes
.
absentSuccess
)
{
AbsentSuccessArguments
args
=
routeSettings
!.
arguments
as
AbsentSuccessArguments
;
AbsentSuccessArguments
args
=
routeSettings
!.
arguments
as
AbsentSuccessArguments
;
return
PageRouteBuilder
(
pageBuilder:
(
context
,
a
,
b
)
=>
AbsentSuccessView
(
absentSuccess:
args
.
absentSuccess
,
profil:
args
.
profil
,
nik:
args
.
nik
,
actionType:
args
.
actionType
,
isIn:
args
.
isIn
,
shiftEnd:
args
.
shiftEnd
,
shiftStart:
args
.
shiftStart
,
...
...
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