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
14275ca8
Commit
14275ca8
authored
Jun 09, 2023
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toast jadiin modal dialog
parent
83dab250
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
33 deletions
+67
-33
absent_camera.dart
lib/page/absent_camera/absent_camera.dart
+64
-30
absent_success.dart
lib/page/absent_success/absent_success.dart
+3
-3
No files found.
lib/page/absent_camera/absent_camera.dart
View file @
14275ca8
...
...
@@ -28,7 +28,7 @@ import 'package:excelso_attendance/resource/size.dart';
import
'package:excelso_attendance/resource/style.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
//
import 'package:quiver/async.dart';
import
'package:quiver/async.dart'
;
class
AbsentCameraView
extends
StatefulWidget
{
const
AbsentCameraView
({
...
...
@@ -130,6 +130,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
errorMessage:
Strings
.
cameraNotActive
,
),
);
break
;
default
:
// setState(() {
// errorCamera = "$e";
...
...
@@ -195,6 +196,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
errorMessage:
Strings
.
cameraNotActive
,
),
);
break
;
default
:
// setState(() {
// errorCamera = "$e";
...
...
@@ -232,30 +234,45 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
}
// untuk mengetahui lama proses taking foto sampai response sukses
// final int _start = 10000;
// int _longTime = 0;
// CountdownTimer? countDownTimer;
final
int
_start
=
10000
;
// ignore: unused_field
int
_longTime
=
0
;
CountdownTimer
?
countDownTimer
;
//
void startTimer() {
//
print("START TIMER");
//
countDownTimer = CountdownTimer(
//
Duration(milliseconds: _start),
//
const Duration(milliseconds: 1),
//
);
void
startTimer
()
{
//
print("START TIMER");
countDownTimer
=
CountdownTimer
(
Duration
(
milliseconds:
_start
),
const
Duration
(
milliseconds:
1
),
);
//
var sub = countDownTimer!.listen(null);
//
sub.onData((duration) {
//
setState(() {
//
_longTime = duration.elapsed.inMilliseconds;
//
});
//
});
//
}
var
sub
=
countDownTimer
!.
listen
(
null
);
sub
.
onData
((
duration
)
{
setState
(()
{
_longTime
=
duration
.
elapsed
.
inMilliseconds
;
});
});
}
// void stopTimer() {
// print("TIMER STOP");
// print("LAMA PROSES $_longTime miliseconds");
// countDownTimer!.cancel();
// }
void
stopTimer
()
async
{
// const filename = 'processAttendace.txt';
// String typeAbsen;
// if (widget.isIn) {
// typeAbsen = "Masuk";
// } else {
// typeAbsen = 'Keluar';
// }
// String content = '''User Name: ${widget.profile.name}
// Lama proses absen $typeAbsen : $_longTime ms
// ''';
// print("TIMER STOP");
// print("LAMA PROSES $_longTime miliseconds");
countDownTimer
!.
cancel
();
// await File(filename).writeAsString(content, mode: FileMode.append);
// sendTotelegram(content);
}
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -345,7 +362,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
left:
AppMargin
.
m16
,
),
child:
Text
(
"Verifikasi Wajah
(
${cameras!.length}
)
"
,
"Verifikasi Wajah"
,
style:
getBoldStyle
(
color:
Colors
.
white
,
fontSize:
17
,
...
...
@@ -375,7 +392,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
CustomButton
(
text:
"Submit"
,
onTap:
()
async
{
//
startTimer();
startTimer
();
await
EasyLoading
.
show
(
status:
Strings
.
pleaseWait
,
maskType:
EasyLoadingMaskType
.
none
,
...
...
@@ -387,11 +404,20 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
widget
.
shiftModel
!.
id
,
imageBase64
!,
).
then
((
apiResponse
)
{
//
stopTimer();
stopTimer
();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
EasyLoading
.
showToast
(
apiResponse
.
msg
);
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
},
);
return
;
}
AbsentSuccessModel
absentSuccess
=
...
...
@@ -415,11 +441,19 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
widget
.
nik
,
imageBase64
!,
).
then
((
apiResponse
)
{
//
stopTimer();
stopTimer
();
EasyLoading
.
dismiss
();
if
(
apiResponse
.
error
)
{
EasyLoading
.
showToast
(
apiResponse
.
msg
,
modalDialogGlobal
(
context:
context
,
size:
MediaQuery
.
of
(
context
).
size
,
title:
"Gagal"
,
contentBody:
apiResponse
.
msg
,
buttonText:
"OK"
,
tapButton:
()
{
Navigator
.
pop
(
context
);
},
);
return
;
}
...
...
lib/page/absent_success/absent_success.dart
View file @
14275ca8
...
...
@@ -138,8 +138,8 @@ Sukses''',
boxShadow:
[
BoxShadow
(
color:
Colors
.
grey
.
withOpacity
(
0.3
),
blurRadius:
2
,
offset:
const
Offset
(
5
,
5
),
blurRadius:
5
,
offset:
const
Offset
(
0.8
,
0.8
),
),
],
),
...
...
@@ -212,7 +212,7 @@ Sukses''',
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
Text
(
"[
${absentSuccess.branchCode}
]
${absentSuccess.branchName}
"
,
absentSuccess
.
branchName
,
style:
getSemiBoldStyle
(
color:
ColorManager
.
fontBlack
,
fontSize:
FontSize
.
s16
,
...
...
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