route , approval screen & approval detail
This commit is contained in:
200
lib/screen/approval/widget/approval_card_cuti.dart
Normal file
200
lib/screen/approval/widget/approval_card_cuti.dart
Normal file
@@ -0,0 +1,200 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/model/approval_model.dart';
|
||||
import 'package:absensi_sas/screen/approval/widget/approval_card_status_widget.dart';
|
||||
import 'package:absensi_sas/screen/approval/widget/approval_dialog_confirmation.dart';
|
||||
import 'package:absensi_sas/widget/custom_button_approval.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:iconify_flutter/iconify_flutter.dart';
|
||||
import 'package:iconify_flutter/icons/heroicons.dart';
|
||||
|
||||
class ApprovalCardCuti extends StatelessWidget {
|
||||
const ApprovalCardCuti({super.key, required this.data});
|
||||
final ApprovalModel data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant.getActualYPhone(context: context, y: 20)),
|
||||
child: InkWell(
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
splashColor: Constant.bgOrange,
|
||||
overlayColor: MaterialStatePropertyAll(Constant.bgOrange),
|
||||
onTap: () {
|
||||
print("tapped");
|
||||
},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.12),
|
||||
offset: Offset(0.0, 10), //(x,y)
|
||||
blurRadius: 4.0,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
offset: Offset(0.0, 0), //(x,y)
|
||||
blurRadius: 2.0,
|
||||
),
|
||||
], color: Colors.white, borderRadius: BorderRadius.circular(16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualXPhone(context: context, x: 20),
|
||||
vertical:
|
||||
Constant.getActualYPhone(context: context, y: 16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
data.name ?? "",
|
||||
style: Constant.body_16(context: context),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.primaryOrange.withOpacity(0.2)),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 1)),
|
||||
child: Text(
|
||||
data.typename ?? "",
|
||||
style: Constant.body_12(context: context)
|
||||
.copyWith(color: Constant.primaryOrange),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
EvaIcons.calendar,
|
||||
color: Constant.primaryOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.date ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Icon(
|
||||
// ,
|
||||
// color: Constant.primaryOrange,
|
||||
// size: 14,
|
||||
// ),
|
||||
Iconify(
|
||||
Heroicons.chat_bubble_bottom_center_text_solid,
|
||||
color: Constant.primaryOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
|
||||
Flexible(
|
||||
child: Text(
|
||||
"${data.reasonType} ▪️ ${data.reasonDescription}",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: List.generate(
|
||||
1000 ~/ 10,
|
||||
(index) => Expanded(
|
||||
child: Container(
|
||||
color: index % 2 == 0
|
||||
? Colors.transparent
|
||||
: Constant.textLightGrey
|
||||
.withOpacity(0.24),
|
||||
height: 1,
|
||||
),
|
||||
)),
|
||||
),
|
||||
if (data.statusID != "1" && data.statusID != "2")
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
if (data.statusID != "1" && data.statusID != "2")
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomButtonWhite(
|
||||
btnText: "Reject",
|
||||
onPressed: () {
|
||||
ApprovalDialogConfirmation(
|
||||
context: context,
|
||||
confirmFunc: () {},
|
||||
textInformation: "Menolak ",
|
||||
staffName: data.name ?? "",
|
||||
typename: data.typename ?? "");
|
||||
}),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
child: CustomButtonOrange(
|
||||
btnText: "Approve",
|
||||
onPressed: () {
|
||||
ApprovalDialogConfirmation(
|
||||
context: context,
|
||||
confirmFunc: () {},
|
||||
textInformation: "Menyetujui ",
|
||||
staffName: data.name ?? "",
|
||||
typename: data.typename ?? "");
|
||||
}),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
AprrovalCardStatusWidget(
|
||||
statusID: data.statusID ?? "",
|
||||
statusName: data.statusName ?? '',
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
200
lib/screen/approval/widget/approval_card_lembur.dart
Normal file
200
lib/screen/approval/widget/approval_card_lembur.dart
Normal file
@@ -0,0 +1,200 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/model/approval_model.dart';
|
||||
import 'package:absensi_sas/screen/approval/widget/approval_card_status_widget.dart';
|
||||
import 'package:absensi_sas/screen/approval/widget/approval_dialog_confirmation.dart';
|
||||
import 'package:absensi_sas/widget/custom_button_approval.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:iconify_flutter/iconify_flutter.dart';
|
||||
import 'package:iconify_flutter/icons/heroicons.dart';
|
||||
|
||||
class ApprovalCardLembur extends StatelessWidget {
|
||||
const ApprovalCardLembur({super.key, required this.data});
|
||||
final ApprovalModel data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant.getActualYPhone(context: context, y: 20)),
|
||||
child: InkWell(
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
splashColor: Constant.bgOrange,
|
||||
overlayColor: MaterialStatePropertyAll(Constant.bgOrange),
|
||||
onTap: () {
|
||||
print("tapped");
|
||||
},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.12),
|
||||
offset: Offset(0.0, 10), //(x,y)
|
||||
blurRadius: 4.0,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
offset: Offset(0.0, 0), //(x,y)
|
||||
blurRadius: 2.0,
|
||||
),
|
||||
], color: Colors.white, borderRadius: BorderRadius.circular(16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualXPhone(context: context, x: 20),
|
||||
vertical:
|
||||
Constant.getActualYPhone(context: context, y: 16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
data.name ?? "",
|
||||
style: Constant.body_16(context: context),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.bgSecondaryBlue),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 1)),
|
||||
child: Text(
|
||||
data.typename ?? "",
|
||||
style: Constant.body_12(context: context)
|
||||
.copyWith(color: Constant.secondaryBlue),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
EvaIcons.calendar,
|
||||
color: Constant.textOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.date ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Icon(
|
||||
// ,
|
||||
// color: Constant.textOrange,
|
||||
// size: 14,
|
||||
// ),
|
||||
Iconify(
|
||||
Heroicons.chat_bubble_bottom_center_text_solid,
|
||||
color: Constant.textOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.reasonDescription ?? '',
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: List.generate(
|
||||
1000 ~/ 10,
|
||||
(index) => Expanded(
|
||||
child: Container(
|
||||
color: index % 2 == 0
|
||||
? Colors.transparent
|
||||
: Constant.textLightGrey
|
||||
.withOpacity(0.24),
|
||||
height: 1,
|
||||
),
|
||||
)),
|
||||
),
|
||||
if (data.statusID != "1" && data.statusID != "2")
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
if (data.statusID != "1" && data.statusID != "2")
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomButtonWhite(
|
||||
btnText: "Reject",
|
||||
onPressed: () {
|
||||
ApprovalDialogConfirmation(
|
||||
context: context,
|
||||
confirmFunc: () {},
|
||||
textInformation: "Menolak ",
|
||||
staffName: data.name ?? "",
|
||||
typename: data.typename ?? "");
|
||||
}),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
child: CustomButtonOrange(
|
||||
btnText: "Approve",
|
||||
onPressed: () {
|
||||
ApprovalDialogConfirmation(
|
||||
context: context,
|
||||
confirmFunc: () {},
|
||||
textInformation: "Menyetujui ",
|
||||
staffName: data.name ?? "",
|
||||
typename: data.typename ?? "");
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AprrovalCardStatusWidget(
|
||||
statusID: data.statusID ?? "",
|
||||
statusName: data.statusName ?? '',
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
203
lib/screen/approval/widget/approval_card_presensi.dart
Normal file
203
lib/screen/approval/widget/approval_card_presensi.dart
Normal file
@@ -0,0 +1,203 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/model/approval_model.dart';
|
||||
import 'package:absensi_sas/screen/approval/widget/approval_card_status_widget.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ApprovalCardPresensi extends StatelessWidget {
|
||||
const ApprovalCardPresensi(
|
||||
{super.key, required this.data, required this.onTap});
|
||||
final ApprovalModel data;
|
||||
final Function onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: Constant.getActualYPhone(context: context, y: 20)),
|
||||
child: InkWell(
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
splashColor: Constant.bgOrange,
|
||||
// hoverColor: Colors.red,
|
||||
overlayColor: MaterialStatePropertyAll(Constant.bgOrange),
|
||||
|
||||
onTap: () {
|
||||
onTap(data.typeID);
|
||||
},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.12),
|
||||
offset: Offset(0.0, 10), //(x,y)
|
||||
blurRadius: 4.0,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
offset: Offset(0.0, 0), //(x,y)
|
||||
blurRadius: 2.0,
|
||||
),
|
||||
], color: Colors.white, borderRadius: BorderRadius.circular(16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
Constant.getActualXPhone(context: context, x: 20),
|
||||
vertical:
|
||||
Constant.getActualYPhone(context: context, y: 16)),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
data.name ?? "",
|
||||
style: Constant.body_16(context: context),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Constant.bgBlue),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 1)),
|
||||
child: Text(
|
||||
data.typename ?? "",
|
||||
style: Constant.body_12(context: context)
|
||||
.copyWith(color: Constant.primaryBlue),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
EvaIcons.calendar,
|
||||
color: Constant.primaryOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
data.date ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
EvaIcons.clock,
|
||||
color: Constant.primaryOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
data.time ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/finger_tap_orange_botnav.png',
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 14),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
data.presensiTypeName ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 8),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
EvaIcons.pin,
|
||||
color: Constant.primaryOrange,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.address ?? "",
|
||||
style: Constant.titleH2_400_14(context: context)
|
||||
.copyWith(color: Constant.textDarkGrey),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (data.statusID == "1" || data.statusID == "2")
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
if (data.statusID == "1" || data.statusID == "2")
|
||||
Row(
|
||||
children: List.generate(
|
||||
1000 ~/ 10,
|
||||
(index) => Expanded(
|
||||
child: Container(
|
||||
color: index % 2 == 0
|
||||
? Colors.transparent
|
||||
: Constant.textLightGrey
|
||||
.withOpacity(0.24),
|
||||
height: 1,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AprrovalCardStatusWidget(
|
||||
statusID: data.statusID ?? "",
|
||||
statusName: data.statusName ?? "",
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
52
lib/screen/approval/widget/approval_card_status_widget.dart
Normal file
52
lib/screen/approval/widget/approval_card_status_widget.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AprrovalCardStatusWidget extends StatelessWidget {
|
||||
const AprrovalCardStatusWidget(
|
||||
{super.key, required this.statusID, required this.statusName});
|
||||
final String statusID;
|
||||
final String statusName;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
switch (statusID) {
|
||||
case "1":
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Constant.bgGreen,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(16),
|
||||
bottomRight: Radius.circular(16))),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(context: context, x: 20),
|
||||
vertical: Constant.getActualYPhone(context: context, y: 16)),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Text(
|
||||
statusName,
|
||||
style: Constant.body_12(context: context)
|
||||
.copyWith(color: Constant.primaryGreen),
|
||||
),
|
||||
);
|
||||
case "2":
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Constant.bgRed,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(16),
|
||||
bottomRight: Radius.circular(16))),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(context: context, x: 20),
|
||||
vertical: Constant.getActualYPhone(context: context, y: 16)),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Text(
|
||||
statusName,
|
||||
style: Constant.body_12(context: context)
|
||||
.copyWith(color: Constant.primaryRed),
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
}
|
||||
75
lib/screen/approval/widget/approval_dialog_confirmation.dart
Normal file
75
lib/screen/approval/widget/approval_dialog_confirmation.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/widget/custom_button_approval.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Future ApprovalDialogConfirmation(
|
||||
{required BuildContext context,
|
||||
required String typename,
|
||||
required String textInformation,
|
||||
required String staffName,
|
||||
required Function() confirmFunc}) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerRight,
|
||||
end: Alignment.centerLeft,
|
||||
colors: [
|
||||
Color(0xff161C24).withOpacity(0.91),
|
||||
Color(0xff161C24).withOpacity(0.3)
|
||||
])),
|
||||
child: AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
shadowColor: Colors.white,
|
||||
title: Text(
|
||||
'Konfirmasi',
|
||||
style: Constant.titleH1_700_18(context: context),
|
||||
),
|
||||
content: Text.rich(TextSpan(
|
||||
text: "Apakah anda yakin untuk ",
|
||||
style: Constant.body_16(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w400),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: textInformation,
|
||||
style: Constant.body_16(context: context)),
|
||||
TextSpan(
|
||||
text: "${typename} ",
|
||||
style: Constant.body_16(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w400)),
|
||||
TextSpan(
|
||||
text: "${staffName} ?",
|
||||
style: Constant.body_16(context: context))
|
||||
])),
|
||||
actions: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: CustomButtonOrange(
|
||||
btnText: "Yakin",
|
||||
onPressed: confirmFunc,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: CustomButtonWhite(
|
||||
btnText: "Batal",
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
71
lib/screen/approval/widget/approval_filter_chip_widget.dart
Normal file
71
lib/screen/approval/widget/approval_filter_chip_widget.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/model/approval_type_model.dart';
|
||||
import 'package:absensi_sas/provider/approval_filter_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class ApprovalFilterChipWidget extends HookConsumerWidget {
|
||||
const ApprovalFilterChipWidget({
|
||||
super.key,
|
||||
required this.data,
|
||||
});
|
||||
final ApprovalTypeModel data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final currentApprovalFilter = ref.watch(approvalFilterProvider);
|
||||
handleOnTap(String value) {
|
||||
var tmp = currentApprovalFilter.selectedApprovalType.toList();
|
||||
var cek = tmp.contains(value);
|
||||
if (cek) {
|
||||
tmp.remove(value);
|
||||
} else {
|
||||
tmp.add(value);
|
||||
}
|
||||
ref.read(approvalFilterProvider.notifier).state = ApprovalFilterProvider(
|
||||
endDate: currentApprovalFilter.endDate,
|
||||
keyword: currentApprovalFilter.keyword,
|
||||
selectedApprovalType: tmp,
|
||||
startDate: currentApprovalFilter.startDate);
|
||||
}
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
right: Constant.getActualXPhone(context: context, x: 16)),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
handleOnTap(data.value!);
|
||||
},
|
||||
style: ButtonStyle(
|
||||
elevation: MaterialStatePropertyAll(0),
|
||||
shape: MaterialStatePropertyAll(RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: currentApprovalFilter.selectedApprovalType
|
||||
.contains(data.value)
|
||||
? Constant.textOrange
|
||||
: Colors.grey.shade300,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16))),
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
if (currentApprovalFilter.selectedApprovalType
|
||||
.contains(data.value) ==
|
||||
true) {
|
||||
return Constant.textOrange.withOpacity(0.1);
|
||||
}
|
||||
return Colors.white;
|
||||
}),
|
||||
overlayColor:
|
||||
MaterialStatePropertyAll(Constant.textOrange.withOpacity(0.48)),
|
||||
foregroundColor: MaterialStatePropertyAll(Colors.white),
|
||||
shadowColor: MaterialStatePropertyAll(Colors.white),
|
||||
surfaceTintColor: MaterialStatePropertyAll(Colors.white)),
|
||||
child: Text(data.name ?? "",
|
||||
style: Constant.subtitle_600_14(context: context).copyWith(
|
||||
color: currentApprovalFilter.selectedApprovalType
|
||||
.contains(data.value)
|
||||
? Constant.textOrange
|
||||
: Colors.black)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
69
lib/screen/approval/widget/approval_filter_widget.dart
Normal file
69
lib/screen/approval/widget/approval_filter_widget.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
|
||||
import 'package:absensi_sas/screen/approval/widget/filter_bottom_sheet.dart';
|
||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class ApprovalFilterWidget extends HookConsumerWidget {
|
||||
const ApprovalFilterWidget({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
right: Constant.getActualXPhone(context: context, x: 16)),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(32),
|
||||
topRight: Radius.circular(32))),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
enableDrag: true,
|
||||
useSafeArea: true,
|
||||
// useRootNavigator: true,
|
||||
builder: (context) {
|
||||
return FilterBottomSheet();
|
||||
},
|
||||
);
|
||||
},
|
||||
style: ButtonStyle(
|
||||
elevation: MaterialStatePropertyAll(0),
|
||||
shape: MaterialStatePropertyAll(RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors.grey.shade300,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16))),
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
return Colors.white;
|
||||
}),
|
||||
overlayColor:
|
||||
MaterialStatePropertyAll(Constant.textOrange.withOpacity(0.48)),
|
||||
foregroundColor: MaterialStatePropertyAll(Colors.white),
|
||||
shadowColor: MaterialStatePropertyAll(Colors.white),
|
||||
surfaceTintColor: MaterialStatePropertyAll(Colors.white)),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
FluentIcons.options_24_filled,
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Text(
|
||||
"Filter",
|
||||
style: Constant.subtitle_600_14(context: context)
|
||||
.copyWith(color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
534
lib/screen/approval/widget/filter_bottom_sheet.dart
Normal file
534
lib/screen/approval/widget/filter_bottom_sheet.dart
Normal file
@@ -0,0 +1,534 @@
|
||||
import 'package:absensi_sas/app/constant.dart';
|
||||
import 'package:absensi_sas/model/approval_type_model.dart';
|
||||
import 'package:absensi_sas/provider/approval_filter_provider.dart';
|
||||
import 'package:absensi_sas/widget/custom_button_approval.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class FilterBottomSheet extends HookConsumerWidget {
|
||||
const FilterBottomSheet({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final currApprovalTypeState = ref.read(approvalFilterProvider);
|
||||
final approvalTypeList = [
|
||||
ApprovalTypeModel(id: "1", name: "Presensi", isActive: false, value: "p"),
|
||||
ApprovalTypeModel(id: "2", name: "Cuti", isActive: true, value: "c"),
|
||||
ApprovalTypeModel(id: "3", name: "Lembur", isActive: false, value: "l"),
|
||||
];
|
||||
final staffFocuseNode = useFocusNode();
|
||||
final startDateFocusNode = useFocusNode();
|
||||
final endDateFocusNode = useFocusNode();
|
||||
final staffCtr =
|
||||
useTextEditingController(text: currApprovalTypeState.keyword);
|
||||
final startDateCtr = useTextEditingController(
|
||||
text: DateFormat('dd-MM-yyyy').format(currApprovalTypeState.startDate));
|
||||
final startDateState = useState(currApprovalTypeState.startDate);
|
||||
final endDateCtr = useTextEditingController(
|
||||
text: DateFormat('dd-MM-yyyy').format(currApprovalTypeState.endDate));
|
||||
final endDateState = useState(currApprovalTypeState.endDate);
|
||||
final dateKey = useState(0);
|
||||
|
||||
final selectedApprovalTypeState = useState<List<String>>(
|
||||
currApprovalTypeState.selectedApprovalType.toList());
|
||||
final checkboxKey = useState(1000);
|
||||
|
||||
selectApprovalTypeFunction(String value) {
|
||||
var tmp = selectedApprovalTypeState.value;
|
||||
var cek = tmp.contains(value);
|
||||
if (cek) {
|
||||
tmp.remove(value);
|
||||
} else {
|
||||
tmp.add(value);
|
||||
}
|
||||
selectedApprovalTypeState.value = tmp;
|
||||
checkboxKey.value = checkboxKey.value + 1;
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom * 0.75),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(32), topRight: Radius.circular(32))),
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: Constant.getActualXPhone(context: context, x: 24)),
|
||||
height: MediaQuery.of(context).size.height * 0.75,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Filter",
|
||||
style: Constant.titleH1_700(context: context),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: Icon(Icons.close))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.55,
|
||||
// color: Colors.green,
|
||||
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Staff",
|
||||
style: Constant.titleH1_700_18(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 16),
|
||||
),
|
||||
TextFormField(
|
||||
controller: staffCtr,
|
||||
focusNode: staffFocuseNode,
|
||||
style: Constant.titleH1_500_18(context: context),
|
||||
decoration: InputDecoration(
|
||||
focusColor: Constant.textOrange,
|
||||
// hoverColor: Constant.textOrange,
|
||||
suffixIcon: Icon(
|
||||
EvaIcons.searchOutline,
|
||||
color: staffFocuseNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Color(0xff212B36),
|
||||
),
|
||||
label: Text(
|
||||
"Cari Staff",
|
||||
style: Constant.titleH1_500_18(context: context)
|
||||
.copyWith(
|
||||
color: staffFocuseNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Colors.grey.shade400),
|
||||
),
|
||||
hintText: "Cari Staff",
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 16),
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 14)),
|
||||
hintStyle:
|
||||
Constant.titleH1_500_18(context: context),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Constant.textOrange),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade500, width: 1),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey.shade500),
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Tanggal Awal",
|
||||
style: Constant.titleH1_700_18(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 20),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Tanggal Akhir",
|
||||
style: Constant.titleH1_700_18(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
key: ValueKey(dateKey.value),
|
||||
controller: startDateCtr,
|
||||
focusNode: startDateFocusNode,
|
||||
readOnly: true,
|
||||
style: Constant.titleH1_500_18(context: context),
|
||||
decoration: InputDecoration(
|
||||
focusColor: Constant.textOrange,
|
||||
// hoverColor: Constant.textOrange,
|
||||
suffixIcon: Icon(
|
||||
EvaIcons.calendar,
|
||||
color: startDateFocusNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Color(0xff212B36),
|
||||
),
|
||||
label: Text(
|
||||
"Tanggal Awal",
|
||||
style: Constant.titleH1_500_18(
|
||||
context: context)
|
||||
.copyWith(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
color: startDateFocusNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Colors.grey.shade400),
|
||||
),
|
||||
hintText: "Tanggal Awal",
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 16),
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 14)),
|
||||
hintStyle:
|
||||
Constant.titleH1_500_18(context: context)
|
||||
.copyWith(
|
||||
overflow: TextOverflow.ellipsis),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Constant.textOrange),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade500,
|
||||
width: 1),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade500),
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onTap: () async {
|
||||
startDateFocusNode.requestFocus();
|
||||
dateKey.value = dateKey.value + 1;
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
helpText: "Tanggal Awal",
|
||||
// locale: Locale('id', 'ID'),
|
||||
builder: (context, child) {
|
||||
return Theme(
|
||||
data: ThemeData().copyWith(
|
||||
datePickerTheme:
|
||||
DatePickerThemeData(
|
||||
dayBackgroundColor:
|
||||
MaterialStateProperty
|
||||
.resolveWith(
|
||||
(states) {
|
||||
if (states.contains(
|
||||
MaterialState
|
||||
.selected)) {
|
||||
return Constant
|
||||
.textOrange;
|
||||
}
|
||||
return Colors.white;
|
||||
}),
|
||||
todayBackgroundColor:
|
||||
MaterialStateProperty
|
||||
.resolveWith(
|
||||
(states) {
|
||||
if (states.contains(
|
||||
MaterialState
|
||||
.selected)) {
|
||||
return Constant
|
||||
.textOrange;
|
||||
}
|
||||
return Colors.white;
|
||||
}),
|
||||
todayBorder: BorderSide(
|
||||
style:
|
||||
BorderStyle.solid,
|
||||
color: Constant
|
||||
.textOrange,
|
||||
width: 1),
|
||||
headerBackgroundColor:
|
||||
Constant.textOrange,
|
||||
headerForegroundColor:
|
||||
Colors.white,
|
||||
surfaceTintColor:
|
||||
Colors.white,
|
||||
backgroundColor:
|
||||
Colors.white),
|
||||
primaryColor: Constant.textOrange,
|
||||
primaryColorDark:
|
||||
Constant.textOrange,
|
||||
primaryColorLight:
|
||||
Constant.textOrange),
|
||||
child: child!);
|
||||
},
|
||||
confirmText: "OK",
|
||||
cancelText: "Batal",
|
||||
context: context,
|
||||
initialDate: startDateState.value,
|
||||
firstDate: DateTime(1950),
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
lastDate: DateTime(2100));
|
||||
|
||||
if (pickedDate != null) {
|
||||
print(
|
||||
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy')
|
||||
.format(pickedDate);
|
||||
print(
|
||||
formattedDate); //formatted date output using intl package => 2021-03-16
|
||||
startDateCtr.text =
|
||||
formattedDate; //set output date to TextField value.
|
||||
startDateState.value = pickedDate;
|
||||
startDateFocusNode.requestFocus();
|
||||
} else {}
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 20),
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
key: ValueKey(dateKey.value),
|
||||
controller: endDateCtr,
|
||||
focusNode: endDateFocusNode,
|
||||
readOnly: true,
|
||||
style: Constant.titleH1_500_18(context: context),
|
||||
decoration: InputDecoration(
|
||||
focusColor: Constant.textOrange,
|
||||
// hoverColor: Constant.textOrange,
|
||||
suffixIcon: Icon(
|
||||
EvaIcons.calendar,
|
||||
color: endDateFocusNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Color(0xff212B36),
|
||||
),
|
||||
label: Text(
|
||||
"Tanggal Akhir",
|
||||
style: Constant.titleH1_500_18(
|
||||
context: context)
|
||||
.copyWith(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
color: endDateFocusNode.hasFocus
|
||||
? Constant.textOrange
|
||||
: Colors.grey.shade400),
|
||||
),
|
||||
hintText: "Tanggal Akhir",
|
||||
isDense: false,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: Constant.getActualYPhone(
|
||||
context: context, y: 16),
|
||||
horizontal: Constant.getActualXPhone(
|
||||
context: context, x: 14)),
|
||||
hintStyle:
|
||||
Constant.titleH1_500_18(context: context)
|
||||
.copyWith(
|
||||
overflow: TextOverflow.ellipsis),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Constant.textOrange),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade500,
|
||||
width: 1),
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey.shade500),
|
||||
borderRadius: BorderRadius.circular(8))),
|
||||
onTap: () async {
|
||||
endDateFocusNode.requestFocus();
|
||||
dateKey.value = dateKey.value + 1;
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
helpText: "Tanggal Akhir",
|
||||
// locale: Locale('id', 'ID'),
|
||||
builder: (context, child) {
|
||||
return Theme(
|
||||
data: ThemeData().copyWith(
|
||||
datePickerTheme:
|
||||
DatePickerThemeData(
|
||||
dayBackgroundColor:
|
||||
MaterialStateProperty
|
||||
.resolveWith(
|
||||
(states) {
|
||||
if (states.contains(
|
||||
MaterialState
|
||||
.selected)) {
|
||||
return Constant
|
||||
.textOrange;
|
||||
}
|
||||
return Colors.white;
|
||||
}),
|
||||
todayBackgroundColor:
|
||||
MaterialStateProperty
|
||||
.resolveWith(
|
||||
(states) {
|
||||
if (states.contains(
|
||||
MaterialState
|
||||
.selected)) {
|
||||
return Constant
|
||||
.textOrange;
|
||||
}
|
||||
return Colors.white;
|
||||
}),
|
||||
todayBorder: BorderSide(
|
||||
style:
|
||||
BorderStyle.solid,
|
||||
color: Constant
|
||||
.textOrange,
|
||||
width: 1),
|
||||
headerBackgroundColor:
|
||||
Constant.textOrange,
|
||||
headerForegroundColor:
|
||||
Colors.white,
|
||||
surfaceTintColor:
|
||||
Colors.white,
|
||||
backgroundColor:
|
||||
Colors.white),
|
||||
primaryColor: Constant.textOrange,
|
||||
primaryColorDark:
|
||||
Constant.textOrange,
|
||||
primaryColorLight:
|
||||
Constant.textOrange),
|
||||
child: child!);
|
||||
},
|
||||
confirmText: "OK",
|
||||
cancelText: "Batal",
|
||||
context: context,
|
||||
initialDate: startDateState.value,
|
||||
firstDate: DateTime(1950),
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
lastDate: DateTime(2100));
|
||||
|
||||
if (pickedDate != null) {
|
||||
print(
|
||||
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy')
|
||||
.format(pickedDate);
|
||||
print(
|
||||
formattedDate); //formatted date output using intl package => 2021-03-16
|
||||
endDateCtr.text =
|
||||
formattedDate; //set output date to TextField value.
|
||||
endDateState.value = pickedDate;
|
||||
endDateFocusNode.requestFocus();
|
||||
} else {}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 16),
|
||||
),
|
||||
// Text(
|
||||
// ref
|
||||
// .watch(approvalFilterProvider)
|
||||
// .selectedApprovalType
|
||||
// .toString(),
|
||||
// style: Constant.titleH1_700_18(context: context),
|
||||
// ),
|
||||
Text(
|
||||
"Approval",
|
||||
style: Constant.titleH1_700_18(context: context)
|
||||
.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 16),
|
||||
),
|
||||
...approvalTypeList.map(
|
||||
(e) {
|
||||
return Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4)),
|
||||
value: selectedApprovalTypeState.value
|
||||
.contains(e.value),
|
||||
onChanged: (val) {
|
||||
selectApprovalTypeFunction(e.value!);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
e.name ?? "",
|
||||
style: Constant.titleH1_700_18(context: context)
|
||||
.copyWith(fontWeight: FontWeight.normal),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.1,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomButtonWhite(
|
||||
btnText: "Reset",
|
||||
onPressed: () {
|
||||
ref.read(approvalFilterProvider.notifier).state =
|
||||
ApprovalFilterProvider(
|
||||
startDate: DateTime.now(),
|
||||
endDate: DateTime.now(),
|
||||
keyword: "",
|
||||
selectedApprovalType: []);
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
),
|
||||
SizedBox(
|
||||
width: Constant.getActualXPhone(context: context, x: 24),
|
||||
),
|
||||
Expanded(
|
||||
child: CustomButtonOrange(
|
||||
btnText: "Simpan",
|
||||
onPressed: () {
|
||||
ref.read(approvalFilterProvider.notifier).state =
|
||||
ApprovalFilterProvider(
|
||||
endDate: endDateState.value,
|
||||
keyword: staffCtr.text,
|
||||
selectedApprovalType:
|
||||
selectedApprovalTypeState.value,
|
||||
startDate: startDateState.value);
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user