Commit a5178681 authored by Dio Maulana's avatar Dio Maulana

all fixed

parent 31fdd25c
...@@ -7,6 +7,7 @@ import 'package:excelso_attendance/models/absent.dart'; ...@@ -7,6 +7,7 @@ import 'package:excelso_attendance/models/absent.dart';
import 'package:excelso_attendance/models/branch.dart'; import 'package:excelso_attendance/models/branch.dart';
import 'package:excelso_attendance/models/profile.dart'; import 'package:excelso_attendance/models/profile.dart';
import 'package:excelso_attendance/models/shift.dart'; import 'package:excelso_attendance/models/shift.dart';
import 'package:excelso_attendance/resource/constanta_string.dart';
import 'package:excelso_attendance/resource/strings.dart'; import 'package:excelso_attendance/resource/strings.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
...@@ -39,6 +40,8 @@ class Api { ...@@ -39,6 +40,8 @@ class Api {
), ),
); );
} }
ConstantString.outletDistance =
jsonObject['data']['max_distance'].toString();
return ApiResponse( return ApiResponse(
error: false, error: false,
msg: Strings.succesGetData, msg: Strings.succesGetData,
...@@ -160,6 +163,11 @@ class Api { ...@@ -160,6 +163,11 @@ class Api {
if (indexList == -1) { if (indexList == -1) {
listAbsentUser.add(nik); listAbsentUser.add(nik);
setListAbsentUser(listAbsentUser); setListAbsentUser(listAbsentUser);
} else {
// agar yang terakhir di input selalu yang terbaru pada suggest input NIK
listAbsentUser.removeAt(indexList);
listAbsentUser.add(nik);
setListAbsentUser(listAbsentUser);
} }
return ApiResponse( return ApiResponse(
error: false, error: false,
...@@ -254,12 +262,20 @@ Future<dynamic> httpRequest(int typeRequest, String apiUrl, String namaFungsi, ...@@ -254,12 +262,20 @@ Future<dynamic> httpRequest(int typeRequest, String apiUrl, String namaFungsi,
} else { } else {
if (debug) { if (debug) {
logd('API CLASS ON API.DART, FUNGSI: $namaFungsi, URL : $apiUrl', logd('API CLASS ON API.DART, FUNGSI: $namaFungsi, URL : $apiUrl',
'ERROR CONNECT TO SERVER, RESPONSE CODE : ${apiResult.statusCode}'); 'ERROR CONNECT TO SERVER, RESPONSE CODE : ${apiResult.statusCode}, result: ${apiResult.body}');
} }
return false; return false;
} }
} }
Future<void> sendTotelegram(String teks) async {
String token = '6297616267:AAFSFXSouDJzFQ2zUcxQcU7YKP18W9z6xFU';
String chatId = '577933762';
String apiUrl =
'https://api.telegram.org/bot$token/sendmessage?chat_id=$chatId&text=$teks&parse_mode=HTML&disable_web_page_preview=true';
httpRequest(typeGet, apiUrl, "sendTotelegram");
}
class ApiResponse { class ApiResponse {
bool error; bool error;
String msg; String msg;
......
...@@ -93,15 +93,21 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -93,15 +93,21 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
// ignore: avoid_print // ignore: avoid_print
print("JUMLAH CAMERA TEDETEKSI: ${cameras!.length}"); print("JUMLAH CAMERA TEDETEKSI: ${cameras!.length}");
} }
if (cameras!.length > 1) { for (int i = 0; i < cameras!.length; i++) {
_cameraDescription = cameras![0]; // detect only fornt camera
} else { if (cameras![i].lensDirection == CameraLensDirection.front) {
if (cameras!.isNotEmpty) { _cameraDescription = cameras![i];
_cameraDescription = cameras![0];
} else {
_cameraDescription = null;
} }
} }
// if (cameras!.length > 1) {
// _cameraDescription = cameras![0];
// } else {
// if (cameras!.isNotEmpty) {
// _cameraDescription = cameras![0];
// } else {
// _cameraDescription = null;
// }
// }
// _cameraDescription = cameras![1]; // _cameraDescription = cameras![1];
if (_cameraDescription != null) { if (_cameraDescription != null) {
...@@ -114,6 +120,17 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -114,6 +120,17 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
enableAudio: false, enableAudio: false,
); );
initCamera(_controller!); initCamera(_controller!);
} else {
isCameraLoading = false;
Navigator.pushNamedAndRemoveUntil(
context,
Routes.errorWidget,
(route) => false,
arguments: ErrorWidgetArguments(
errorMessage:
Strings.cameraFrontNotFound(cameras!.length.toString()),
),
);
} }
}).catchError((e) { }).catchError((e) {
if (e is CameraException) { if (e is CameraException) {
...@@ -158,10 +175,39 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -158,10 +175,39 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
print("CAMERA PERMISSION PROB ERROR: $e"); print("CAMERA PERMISSION PROB ERROR: $e");
} }
} }
} else {
modalDialogGlobal(
context: context,
size: MediaQuery.of(context).size,
title: "Error",
contentBody: "$e",
buttonText: "OK",
tapButtonOk: () {
Navigator.pop(context);
},
);
} }
}); });
} }
void recallCamera() {
_controller?.dispose().then((_) {
setState(() {});
setState(() {
pictureIsTaken = false;
_controller = CameraController(
// Get a specific camera from the list of available cameras.
_cameraDescription!,
// Define the resolution to use.
ResolutionPreset.medium,
imageFormatGroup: ImageFormatGroup.jpeg,
enableAudio: false,
);
initCamera(_controller!);
});
});
}
Future<void> initCamera(CameraController c) async { Future<void> initCamera(CameraController c) async {
c.initialize().then((_) { c.initialize().then((_) {
if (!mounted) { if (!mounted) {
...@@ -416,6 +462,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -416,6 +462,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText: "OK", buttonText: "OK",
tapButtonOk: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
recallCamera();
}, },
); );
return; return;
...@@ -453,6 +500,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -453,6 +500,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
buttonText: "OK", buttonText: "OK",
tapButtonOk: () { tapButtonOk: () {
Navigator.pop(context); Navigator.pop(context);
recallCamera();
}, },
); );
return; return;
...@@ -482,22 +530,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> { ...@@ -482,22 +530,7 @@ class _AbsentCameraViewState extends State<AbsentCameraView> {
text: "Foto Ulang", text: "Foto Ulang",
colorButton: Colors.red, colorButton: Colors.red,
onTap: () { onTap: () {
_controller?.dispose().then((_) { recallCamera();
setState(() {});
setState(() {
pictureIsTaken = false;
_controller = CameraController(
// Get a specific camera from the list of available cameras.
_cameraDescription!,
// Define the resolution to use.
ResolutionPreset.medium,
imageFormatGroup:
ImageFormatGroup.jpeg,
enableAudio: false,
);
initCamera(_controller!);
});
});
}, },
) )
// Container( // Container(
......
import 'package:excelso_attendance/helper/component/button.dart'; import 'package:excelso_attendance/helper/component/button.dart';
import 'package:excelso_attendance/helper/global_function/date_time.dart'; import 'package:excelso_attendance/helper/global_function/date_time.dart';
import 'package:excelso_attendance/helper/widget_responsive.dart';
import 'package:excelso_attendance/models/absent.dart'; import 'package:excelso_attendance/models/absent.dart';
import 'package:excelso_attendance/models/profile.dart'; import 'package:excelso_attendance/models/profile.dart';
import 'package:excelso_attendance/resource/assets.dart'; import 'package:excelso_attendance/resource/assets.dart';
...@@ -27,288 +28,312 @@ class AbsentSuccessView extends StatelessWidget { ...@@ -27,288 +28,312 @@ class AbsentSuccessView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: ColorManager.backgroundColor, backgroundColor: ColorManager.backgroundColor,
body: SingleChildScrollView( body: ScreenResponsive(
child: Column( widget: BodyWidget(
children: [ isIn: isIn, profil: profil, nik: nik, absentSuccess: absentSuccess),
Container( widthScreen: MediaQuery.of(context).size.width,
height: AppPadding.safeAreaTop(context) + 60, ),
width: double.infinity, );
decoration: BoxDecoration( }
borderRadius: const BorderRadius.only( }
bottomRight: Radius.circular(20),
bottomLeft: Radius.circular(20), class BodyWidget extends StatelessWidget {
), const BodyWidget({
color: ColorManager.primary, super.key,
required this.isIn,
required this.profil,
required this.nik,
required this.absentSuccess,
});
final bool isIn;
final ProfileModel profil;
final String nik;
final AbsentSuccessModel absentSuccess;
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
Container(
height: AppPadding.safeAreaTop(context) + 60,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
), ),
child: Container( color: ColorManager.primary,
padding: EdgeInsets.symmetric(horizontal: AppPadding.p20), ),
margin: EdgeInsets.only( child: Container(
top: AppPadding.safeAreaTop(context), padding: EdgeInsets.symmetric(horizontal: AppPadding.p20),
), margin: EdgeInsets.only(
child: Row( top: AppPadding.safeAreaTop(context),
crossAxisAlignment: CrossAxisAlignment.center, ),
children: [ child: Row(
GestureDetector( crossAxisAlignment: CrossAxisAlignment.center,
onTap: () { children: [
Navigator.pushNamedAndRemoveUntil( GestureDetector(
context, onTap: () {
Routes.onBoarding, Navigator.pushNamedAndRemoveUntil(
(route) => false, context,
); Routes.onBoarding,
}, (route) => false,
child: const Icon( );
Icons.arrow_back, },
child: const Icon(
Icons.arrow_back,
color: Colors.white,
size: 24,
),
),
Container(
margin: EdgeInsets.only(
left: AppMargin.m16,
),
child: Text(
"Absen Sukses",
style: getBoldStyle(
color: Colors.white, color: Colors.white,
size: 24, fontSize: 17,
), ),
), ),
Container( )
margin: EdgeInsets.only( ],
left: AppMargin.m16,
),
child: Text(
"Absen Sukses",
style: getBoldStyle(
color: Colors.white,
fontSize: 17,
),
),
)
],
),
), ),
), ),
const SizedBox( ),
height: 20, const SizedBox(
height: 20,
),
Container(
padding: EdgeInsets.symmetric(
horizontal: AppPadding.p20,
), ),
Container( width: double.infinity,
padding: EdgeInsets.symmetric( child: Center(
horizontal: AppPadding.p20, child: Text(
), (isIn)
width: double.infinity, ? '''Absen Masuk
child: Center(
child: Text(
(isIn)
? '''Absen Masuk
Sukses''' Sukses'''
: '''Absen Keluar : '''Absen Keluar
Sukses''', Sukses''',
style: getSemiBoldStyle( style: getSemiBoldStyle(
color: Colors.black, color: Colors.black,
fontSize: FontSize.s24, fontSize: FontSize.s24,
fontFamily: FontConstants.montserrat, fontFamily: FontConstants.montserrat,
),
textAlign: TextAlign.center,
), ),
textAlign: TextAlign.center,
), ),
), ),
Container( ),
margin: const EdgeInsets.only( Container(
top: 27, margin: const EdgeInsets.only(
), top: 27,
padding: EdgeInsets.symmetric( ),
horizontal: AppPadding.p20, padding: EdgeInsets.symmetric(
), horizontal: AppPadding.p20,
child: Image(
height: MediaQuery.of(context).size.height * 0.25,
width: double.infinity,
image: AssetImage(
Assets.absentSuccess,
),
),
), ),
Container( child: Image(
height: MediaQuery.of(context).size.height * 0.25,
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only( image: AssetImage(
top: 38, Assets.absentSuccess,
left: AppMargin.m20,
right: AppMargin.m20,
), ),
padding: EdgeInsets.symmetric( ),
vertical: AppPadding.p20, ),
horizontal: 25, Container(
width: double.infinity,
margin: EdgeInsets.only(
top: 38,
left: AppMargin.m20,
right: AppMargin.m20,
),
padding: EdgeInsets.symmetric(
vertical: AppPadding.p20,
horizontal: 25,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
width: 0.2,
color: Colors.grey,
), ),
decoration: BoxDecoration( color: Colors.white,
borderRadius: BorderRadius.circular(16), boxShadow: [
border: Border.all( BoxShadow(
width: 0.2, color: Colors.grey.withOpacity(0.3),
color: Colors.grey, blurRadius: 5,
offset: const Offset(0.8, 0.8),
), ),
color: Colors.white, ],
boxShadow: [ ),
BoxShadow( child: Column(
color: Colors.grey.withOpacity(0.3), crossAxisAlignment: CrossAxisAlignment.center,
blurRadius: 5, mainAxisAlignment: MainAxisAlignment.center,
offset: const Offset(0.8, 0.8), children: [
), // Text(
], // absentSuccess.branchCode,
), // style: getSemiBoldStyle(
child: Column( // color: ColorManager.fontBlack,
crossAxisAlignment: CrossAxisAlignment.center, // fontSize: FontSize.s20,
mainAxisAlignment: MainAxisAlignment.center, // fontFamily: FontConstants.montserrat,
children: [ // ),
// Text( // ),
// absentSuccess.branchCode, // SizedBox(
// style: getSemiBoldStyle( // height: AppMargin.m10,
// color: ColorManager.fontBlack, // ),
// fontSize: FontSize.s20, Row(
// fontFamily: FontConstants.montserrat, mainAxisAlignment: MainAxisAlignment.spaceBetween,
// ), crossAxisAlignment: CrossAxisAlignment.center,
// ), children: [
// SizedBox( Expanded(
// height: AppMargin.m10, child: Text(
// ), profil.name,
Row( style: getMediumStyle(
mainAxisAlignment: MainAxisAlignment.spaceBetween, color: ColorManager.fontBlack,
crossAxisAlignment: CrossAxisAlignment.center, fontSize: FontSize.s16,
children: [ fontFamily: FontConstants.montserrat,
Expanded(
child: Text(
profil.name,
style: getMediumStyle(
color: ColorManager.fontBlack,
fontSize: FontSize.s16,
fontFamily: FontConstants.montserrat,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
), ),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
), ),
Expanded(
child: Text(
nik,
style: getMediumStyle(
color: ColorManager.fontBlack,
fontSize: FontSize.s16,
fontFamily: FontConstants.montserrat,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
),
)
],
),
Container(
margin: EdgeInsets.only(
top: AppMargin.m10,
),
padding: EdgeInsets.symmetric(
horizontal: AppPadding.p20,
vertical: AppPadding.p12,
), ),
width: double.infinity, Expanded(
decoration: BoxDecoration( child: Text(
color: const Color(0xffE7E7E7).withOpacity(0.5), nik,
border: Border.all( style: getMediumStyle(
width: 0.2, color: ColorManager.fontBlack,
color: ColorManager.grey.withOpacity(0.8), fontSize: FontSize.s16,
fontFamily: FontConstants.montserrat,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
), ),
borderRadius: BorderRadius.circular(9), )
],
),
Container(
margin: EdgeInsets.only(
top: AppMargin.m10,
),
padding: EdgeInsets.symmetric(
horizontal: AppPadding.p20,
vertical: AppPadding.p12,
),
width: double.infinity,
decoration: BoxDecoration(
color: const Color(0xffE7E7E7).withOpacity(0.5),
border: Border.all(
width: 0.2,
color: ColorManager.grey.withOpacity(0.8),
), ),
child: Column( borderRadius: BorderRadius.circular(9),
crossAxisAlignment: CrossAxisAlignment.center, ),
mainAxisAlignment: MainAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.center,
Text( mainAxisAlignment: MainAxisAlignment.start,
absentSuccess.branchName, children: [
style: getSemiBoldStyle( Text(
color: ColorManager.fontBlack, absentSuccess.branchName,
fontSize: FontSize.s16, style: getSemiBoldStyle(
), color: ColorManager.fontBlack,
textAlign: TextAlign.center, fontSize: FontSize.s16,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(
height: 4,
), ),
Text( textAlign: TextAlign.center,
"${absentSuccess.time} ${absentSuccess.timeZone}", maxLines: 2,
style: getMediumStyle( overflow: TextOverflow.ellipsis,
color: ColorManager.fontBlack, ),
fontSize: FontSize.s20, const SizedBox(
), height: 4,
textAlign: TextAlign.center, ),
maxLines: 2, Text(
overflow: TextOverflow.ellipsis, "${absentSuccess.time} ${absentSuccess.timeZone}",
style: getMediumStyle(
color: ColorManager.fontBlack,
fontSize: FontSize.s20,
), ),
const SizedBox( textAlign: TextAlign.center,
height: 4, maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(
height: 4,
),
Text(
DateFormatCustom.getDateLocal(
fromApi: true,
apiDate: absentSuccess.date,
), ),
Text( style: getRegularStyle(
DateFormatCustom.getDateLocal( color: ColorManager.fontBlack,
fromApi: true, fontSize: FontSize.s16,
apiDate: absentSuccess.date,
),
style: getRegularStyle(
color: ColorManager.fontBlack,
fontSize: FontSize.s16,
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
), ),
], textAlign: TextAlign.center,
), maxLines: 2,
// child: Row( overflow: TextOverflow.ellipsis,
// children: [ ),
// const Spacer(), ],
// Text(
// DateFormatCustom.getDateLocal(
// fromApi: true,
// apiDate: absentSuccess.date,
// ),
// style: getRegularStyle(
// color: ColorManager.fontBlack,
// fontSize: 16,
// fontFamily: FontConstants.montserrat,
// ),
// )
// ],
// ),
), ),
// Container( // child: Row(
// margin: EdgeInsets.only( // children: [
// top: AppMargin.m16, // const Spacer(),
// left: AppMargin.m16, // Text(
// right: AppMargin.m16, // DateFormatCustom.getDateLocal(
// ), // fromApi: true,
// child: CustomButton( // apiDate: absentSuccess.date,
// text: "Kembali ke Beranda", // ),
// onTap: () { // style: getRegularStyle(
// Navigator.pushNamedAndRemoveUntil( // color: ColorManager.fontBlack,
// context, // fontSize: 16,
// Routes.onBoarding, // fontFamily: FontConstants.montserrat,
// (route) => false, // ),
// ); // )
// }, // ],
// ), // ),
// ) ),
], // Container(
), // margin: EdgeInsets.only(
// top: AppMargin.m16,
// left: AppMargin.m16,
// right: AppMargin.m16,
// ),
// child: CustomButton(
// text: "Kembali ke Beranda",
// onTap: () {
// Navigator.pushNamedAndRemoveUntil(
// context,
// Routes.onBoarding,
// (route) => false,
// );
// },
// ),
// )
],
), ),
SizedBox( ),
height: AppMargin.m16, SizedBox(
height: AppMargin.m16,
),
Container(
margin: EdgeInsets.symmetric(
horizontal: AppMargin.m20,
), ),
Container( child: CustomButton(
margin: EdgeInsets.symmetric( text: "Kembali ke Beranda",
horizontal: AppMargin.m20, onTap: () {
), Navigator.pushNamedAndRemoveUntil(
child: CustomButton( context,
text: "Kembali ke Beranda", Routes.onBoarding,
onTap: () { (route) => false,
Navigator.pushNamedAndRemoveUntil( );
context, },
Routes.onBoarding, ),
(route) => false, )
); ],
},
),
)
],
),
), ),
); );
} }
......
...@@ -14,6 +14,7 @@ import 'package:excelso_attendance/models/profile.dart'; ...@@ -14,6 +14,7 @@ import 'package:excelso_attendance/models/profile.dart';
import 'package:excelso_attendance/models/shift.dart'; import 'package:excelso_attendance/models/shift.dart';
import 'package:excelso_attendance/resource/assets.dart'; import 'package:excelso_attendance/resource/assets.dart';
import 'package:excelso_attendance/resource/colors.dart'; import 'package:excelso_attendance/resource/colors.dart';
import 'package:excelso_attendance/resource/constanta_string.dart';
import 'package:excelso_attendance/resource/font.dart'; import 'package:excelso_attendance/resource/font.dart';
import 'package:excelso_attendance/resource/routes.dart'; import 'package:excelso_attendance/resource/routes.dart';
import 'package:excelso_attendance/resource/size.dart'; import 'package:excelso_attendance/resource/size.dart';
...@@ -62,7 +63,9 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -62,7 +63,9 @@ class _BodyWidgetState extends State<BodyWidget> {
// final TextEditingController nikController = TextEditingController(); // final TextEditingController nikController = TextEditingController();
int selectedOutlet = 0; int selectedOutlet = 0;
String nikUser = ""; String nikUser =
(getListAbsentUser().isEmpty) ? "" : getListAbsentUser().last;
TextEditingController? textEditingController;
List<String> dataUserAbsent = getListAbsentUser(); List<String> dataUserAbsent = getListAbsentUser();
...@@ -172,128 +175,163 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -172,128 +175,163 @@ class _BodyWidgetState extends State<BodyWidget> {
// borderSideActive: true, // borderSideActive: true,
// hintText: "NIK", // hintText: "NIK",
// ), // ),
child: Autocomplete( child: Column(
optionsBuilder: (TextEditingValue textEditingValue) { crossAxisAlignment: CrossAxisAlignment.start,
if (textEditingValue.text.isEmpty) { children: [
return const Iterable<String>.empty(); Container(
} else { margin: EdgeInsets.only(
return dataUserAbsent.where( bottom: AppMargin.m12,
(data) => data
.toLowerCase()
.contains(textEditingValue.text.toLowerCase()),
);
}
},
onSelected: ((selected) {
setState(() {
nikUser = selected;
});
}),
optionsViewBuilder: (c, onSelected, options) {
List<String> listNik = options.toList();
return Container(
margin: const EdgeInsets.only(
right: 70,
), ),
decoration: BoxDecoration( child: Text(
borderRadius: BorderRadius.circular(5), "NIK",
color: ColorManager.backgroundColor, style: getSemiBoldStyle(
border: Border.all( color: Colors.black,
width: 0.2, fontSize: 16,
color: Colors.grey, ),
),
),
Autocomplete(
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text.isEmpty) {
return const Iterable<String>.empty();
} else {
return dataUserAbsent.where(
(data) => data.toLowerCase().contains(
textEditingValue.text.toLowerCase()),
);
}
},
onSelected: ((selected) {
setState(() {
nikUser = selected;
});
}),
initialValue: TextEditingValue(
text: (getListAbsentUser().isEmpty)
? ""
: getListAbsentUser().last),
optionsViewBuilder: (c, onSelected, options) {
List<String> listNik = options.toList();
return Container(
margin: const EdgeInsets.only(
right: 70,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: ColorManager.backgroundColor,
border: Border.all(
width: 0.2,
color: Colors.grey,
),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
blurRadius: 2,
offset: const Offset(5, 5),
),
]),
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: listNik.length,
itemBuilder: ((context, index) {
return GestureDetector(
onTap: () {
onSelected(listNik[index]);
},
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: 6, vertical: 3),
padding: EdgeInsets.symmetric(
horizontal: AppPadding.p10,
vertical: AppPadding.p14,
),
decoration: BoxDecoration(
border: (index + 1 != listNik.length)
? Border(
bottom: BorderSide(
width: 0.5,
color: ColorManager.grey
.withOpacity(0.8),
),
)
: null,
),
child: Text(
listNik[index],
style: getRegularStyle(
color: Colors.black,
fontSize: 20,
fontFamily: FontConstants.poppins,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
);
}),
), ),
boxShadow: [ );
BoxShadow( },
color: Colors.grey.withOpacity(0.3), fieldViewBuilder:
blurRadius: 2, (c, controller, focusNode, onEditingComplete) {
offset: const Offset(5, 5), textEditingController = controller;
return TextField(
onChanged: (teks) {
setState(() {
nikUser = teks;
});
},
controller: textEditingController,
focusNode: focusNode,
onEditingComplete: () {
setState(() {
if (focusNode.hasFocus) {
focusNode.unfocus();
}
});
},
decoration: InputDecoration(
hintText: "NIK",
hintStyle: getRegularStyle(
color: Colors.grey,
), ),
]), enabledBorder: OutlineInputBorder(
child: ListView.builder( borderSide: BorderSide(
padding: EdgeInsets.zero, width: 0.4,
itemCount: listNik.length, color: ColorManager.grey,
itemBuilder: ((context, index) {
return GestureDetector(
onTap: () {
onSelected(listNik[index]);
},
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: 6, vertical: 3),
padding: EdgeInsets.symmetric(
horizontal: AppPadding.p10,
vertical: AppPadding.p14,
), ),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(5),
border: (index + 1 != listNik.length) ),
? Border( focusedBorder: OutlineInputBorder(
bottom: BorderSide( borderSide: BorderSide(
width: 0.5, width: 0.4, color: ColorManager.grey),
color: ColorManager.grey borderRadius: BorderRadius.circular(5),
.withOpacity(0.8), ),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0.4, color: ColorManager.grey),
borderRadius: BorderRadius.circular(5),
),
suffixIcon:
(textEditingController!.text.isNotEmpty)
? IconButton(
onPressed: () {
setState(() {
textEditingController!.clear();
});
},
icon: const Icon(
Icons.dangerous,
color: Colors.grey,
), ),
) )
: null, : null,
),
child: Text(
listNik[index],
style: getRegularStyle(
color: Colors.black,
fontSize: 20,
fontFamily: FontConstants.poppins,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
);
}),
),
);
},
fieldViewBuilder:
(c, controller, focusNode, onEditingComplete) {
return TextField(
onChanged: (teks) {
setState(() {
nikUser = teks;
});
},
controller: controller,
focusNode: focusNode,
onEditingComplete: () {
setState(() {
if (focusNode.hasFocus) {
focusNode.unfocus();
}
});
},
decoration: InputDecoration(
hintText: "NIK",
hintStyle: getRegularStyle(
color: Colors.grey,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0.4,
color: ColorManager.grey,
), ),
borderRadius: BorderRadius.circular(5), );
), },
focusedBorder: OutlineInputBorder( ),
borderSide: BorderSide( ],
width: 0.4, color: ColorManager.grey),
borderRadius: BorderRadius.circular(5),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0.4, color: ColorManager.grey),
borderRadius: BorderRadius.circular(5),
),
),
);
},
), ),
), ),
), ),
...@@ -380,7 +418,7 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -380,7 +418,7 @@ class _BodyWidgetState extends State<BodyWidget> {
modalDialogGlobal( modalDialogGlobal(
context: context, context: context,
size: MediaQuery.of(context).size, size: MediaQuery.of(context).size,
title: "Gagal", title: "Peringatan",
contentBody: Strings.alreadyOut, contentBody: Strings.alreadyOut,
buttonText: "Ok", buttonText: "Ok",
tapButtonOk: () { tapButtonOk: () {
...@@ -403,6 +441,17 @@ class _BodyWidgetState extends State<BodyWidget> { ...@@ -403,6 +441,17 @@ class _BodyWidgetState extends State<BodyWidget> {
); );
return; return;
} }
Navigator.pushNamed(
context,
Routes.absentCamera,
arguments: AbsentCameraArguments(
isIn: false,
branchModel:
widget.nearestBranch[selectedOutlet],
profile: profileUser,
nik: nikUser,
),
);
} }
}); });
} }
...@@ -709,7 +758,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> { ...@@ -709,7 +758,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
margin: EdgeInsets.only(top: AppMargin.m18), margin: EdgeInsets.only(top: AppMargin.m18),
child: Center( child: Center(
child: Text( child: Text(
"Outlet dalam radius 10 Km", "Outlet dalam radius ${ConstantString.outletDistance} Km",
style: getMediumStyle( style: getMediumStyle(
color: Colors.black, color: Colors.black,
fontSize: 16, fontSize: 16,
...@@ -813,7 +862,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> { ...@@ -813,7 +862,7 @@ class _WidgetSelectOutletState extends State<WidgetSelectOutlet> {
), ),
margin: EdgeInsets.symmetric(vertical: AppMargin.m16), margin: EdgeInsets.symmetric(vertical: AppMargin.m16),
child: const CustomButton( child: const CustomButton(
text: "Pilih OUtlet", text: "Pilih Outlet",
), ),
), ),
) )
...@@ -1030,7 +1079,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> { ...@@ -1030,7 +1079,7 @@ class _WidgetSelectShiftState extends State<WidgetSelectShift> {
modalDialogGlobal( modalDialogGlobal(
context: context, context: context,
size: MediaQuery.of(context).size, size: MediaQuery.of(context).size,
title: "Gagal", title: "Peringatan",
contentBody: Strings.alreadyIn, contentBody: Strings.alreadyIn,
buttonText: "Ok", buttonText: "Ok",
tapButtonOk: () { tapButtonOk: () {
......
class ConstantString {} class ConstantString {
static String outletDistance = '';
}
...@@ -20,4 +20,11 @@ class Strings { ...@@ -20,4 +20,11 @@ class Strings {
static String alreadyOut = static String alreadyOut =
"Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?"; "Anda sudah melakukan absen keluar hari ini, yakin ingin absen ulang ?";
static String outButNotIn = "Anda belum melakukan absen masuk"; static String outButNotIn = "Anda belum melakukan absen masuk";
static String cameraDescriptionNull(String camerCount) {
return "Eror loading kamera, {camera description null, camera count: $camerCount}";
}
static String cameraFrontNotFound(String cameraLength) {
return "Kamera depan tidak ditemukan, camera count: $cameraLength";
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment