step 16 : add drawer di home screen, sukses msg custom dialog untuk presensi selfie

This commit is contained in:
sindhu
2024-01-27 11:12:03 +07:00
parent a38a983561
commit 79c0729979
8 changed files with 1757 additions and 813 deletions

View File

@@ -0,0 +1,111 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import '../app/constant.dart';
class CustomDialogPresensiSukses extends HookConsumerWidget {
final String messageStatus;
final String isiPesan;
CustomDialogPresensiSukses({
required this.messageStatus,
required this.isiPesan,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
elevation: 0,
backgroundColor: Colors.white,
child: contentBox(context),
);
}
Widget contentBox(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: Constant.getActualYPhone(context: context, y: 24),
),
child: Container(
width: Constant.getActualXPhone(context: context, x: 100),
height: Constant.getActualYPhone(context: context, y: 100),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'images/presensi_selfie_sukses.png'), // Ganti dengan path gambar Anda
),
),
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 36),
),
Text(
messageStatus,
style: Constant.titleH1_700_18(context: context).copyWith(
color: Constant.textOrange,
),
textAlign: TextAlign.center,
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 12),
),
Text(
// 'Pengajuan presensi telah berhasil diajukan, mohon menunggu approval team leader!',
isiPesan,
style: Constant.titleH2_400_14(context: context).copyWith(
color: Constant.textTrueBlack,
),
textAlign: TextAlign.center,
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 36),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith(
(st) => Constant.textOrange),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Constant.textOrange,
),
),
),
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
elevation: MaterialStateProperty.all(4.0),
),
child: Text(
'OK',
style: Constant.titleH2_400_14(context: context).copyWith(
color: Constant.textWhite,
),
),
),
],
),
),
],
);
}
}

View File

@@ -77,22 +77,34 @@ class CustomDrawer extends HookConsumerWidget {
child: Drawer(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(0))),
borderRadius: BorderRadius.all(
Radius.circular(0),
),
),
child: Column(
children: [
Expanded(
child: ListView(
children: [
// Container(
// child: Image(
// image:
// AssetImage('images/logo_sismedika_landscape.png')),
// ),
Padding(
padding: EdgeInsets.only(
top: Constant.getActualYPhone(context: context, y: 50),
bottom: Constant.getActualYPhone(context: context, y: 10),
right: Constant.getActualXPhone(context: context, x: 24),
left: Constant.getActualXPhone(context: context, x: 24),
),
child: Container(
child: Image(
fit: BoxFit.cover,
image: AssetImage(
'images/logo_sismedika_landscape.png',
),
),
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 8),
),
Padding(
padding: EdgeInsets.only(
top: Constant.getActualYPhone(context: context, y: 10),
@@ -104,17 +116,16 @@ class CustomDrawer extends HookConsumerWidget {
width: Constant.getActualXPhone(context: context, x: 300),
),
),
Chip(
backgroundColor: Constant.textLightGrey.withOpacity(0.16),
label: Text(
M_CompanyName.value,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Constant.textLightGrey,
),
),
),
// Chip(
// backgroundColor: Constant.textLightGrey.withOpacity(0.16),
// label: Text(
// M_CompanyName.value,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: Constant.textLightGrey,
// ),
// ),
// ),
ListTile(
leading: Icon(
Icons.home,
@@ -137,26 +148,47 @@ class CustomDrawer extends HookConsumerWidget {
Navigator.of(context).popAndPushNamed(homeRoute);
},
),
ListTile(
leading: Icon(
Icons.logout,
color: Constant.textLightGrey,
Icons.person,
color: (currentMenu == 5)
? Constant.textOrange
: Constant.textLightGrey,
),
title: Text(
'Logout',
style: TextStyle(color: Constant.textLightGrey),
'Profil',
style: TextStyle(
color: (currentMenu == 5)
? Constant.textOrange
: Constant.textLightGrey,
),
),
onTap: () {
// di set ke 0 lagi
ref.read(currentPageProvider.state).update((state) => 0);
// ref.read(logoutProvider.notifier).logout(
// M_UserID: selectedUser?.model.M_UserID ?? "",
// M_UserUsername:
// selectedUser?.model.M_UserUsername ?? "",
// );
// Handle navigation to Home screen
Navigator.pop(context);
ref.read(currentPageProvider.state).update((state) => 5);
// Navigator.of(context).popAndPushNamed(homeRoute);
},
),
// ListTile(
// leading: Icon(
// Icons.logout,
// color: Constant.textLightGrey,
// ),
// title: Text(
// 'Logout',
// style: TextStyle(color: Constant.textLightGrey),
// ),
// onTap: () {
// // di set ke 0 lagi
// ref.read(currentPageProvider.state).update((state) => 0);
// // ref.read(logoutProvider.notifier).logout(
// // M_UserID: selectedUser?.model.M_UserID ?? "",
// // M_UserUsername:
// // selectedUser?.model.M_UserUsername ?? "",
// // );
// },
// ),
],
),
),