diff --git a/app_petty_cash/lib/widget/custom_drawer.dart b/app_petty_cash/lib/widget/custom_drawer.dart index 6a6bd17..78f86a7 100644 --- a/app_petty_cash/lib/widget/custom_drawer.dart +++ b/app_petty_cash/lib/widget/custom_drawer.dart @@ -91,249 +91,204 @@ class CustomDrawer extends HookConsumerWidget { final currentMenu = ref.read(currentPageProvider); - return Drawer( - elevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(0))), - child: Container( - height: Constant.getActualYPhone(context: context, y: 844), - child: ListView( - // padding: EdgeInsets.only( - // top: Constant.getActualYPhone(context: context, y: 10), - // ), + return Container( + width: Constant.getActualXPhone(context: context, x: 300), + height: Constant.getActualYPhone(context: context, y: 844), + child: Drawer( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(0))), + child: Column( children: [ - Container( - // decoration: BoxDecoration( - // border: Border(bottom: BorderSide(color: Colors.transparent)) // <--- use the global theme to change the dividerColor property - // ), - child: Image( - image: AssetImage('images/logo_sismedika_landscape.png')), - ), + Expanded( + child: ListView( + children: [ + Container( + child: Image( + image: + AssetImage('images/logo_sismedika_landscape.png')), + ), - SizedBox( - height: Constant.getActualYPhone(context: context, y: 8), - ), + SizedBox( + height: Constant.getActualYPhone(context: context, y: 8), + ), + Padding( + padding: EdgeInsets.only( + top: Constant.getActualYPhone(context: context, y: 10), + bottom: Constant.getActualYPhone(context: context, y: 10), + right: Constant.getActualXPhone(context: context, x: 24), + left: Constant.getActualXPhone(context: context, x: 24), + ), + child: Container( + width: Constant.getActualXPhone(context: context, x: 300), + ), + ), + + // child: Padding( + // padding: EdgeInsets.only( + // left: Constant.getActualXPhone(context: context, x: 24), + // right: Constant.getActualXPhone(context: context, x: 71), + // ), + // child: Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(6), + // color: Constant.textGrey.withOpacity(0.16), + // ), + // child: Padding( + // padding: EdgeInsets.only( + // left: Constant.getActualXPhone(context: context, x: 8), + // right: Constant.getActualXPhone(context: context, x: 8), + // ), + // child: Text( + // M_CompanyName.value, + // style: Constant.body3(context: context).copyWith( + // fontWeight: FontWeight.w700, + // color: Constant.textGreyv2, + // backgroundColor: Constant.textGrey.withOpacity(0.16), + // ), + // ), + // ), + // ), + // ), + // ), + + Chip( + backgroundColor: Constant.textGrey.withOpacity(0.16), + label: Text( + M_CompanyName.value, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Constant.textGreyv2, + ), + ), + ), + + ListTile( + leading: Icon( + Icons.home, + color: (currentMenu == 0) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + title: Text( + 'Home', + style: TextStyle( + color: (currentMenu == 0) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + ), + onTap: () { + // Handle navigation to Home screen + Navigator.pop(context); + ref.read(currentPageProvider.state).update((state) => 0); + Navigator.pushNamed(context, homeRoute); + }, + ), + ListTile( + leading: Icon( + Icons.money, + color: (currentMenu == 1) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + title: Text( + 'Transaksi', + style: TextStyle( + color: (currentMenu == 1) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + ), + onTap: () { + // Handle navigation to Transaksi screen + Navigator.pop(context); + ref.read(currentPageProvider.state).update((state) => 1); + Navigator.pushNamed(context, transaksiRoute); + }, + ), + ListTile( + leading: Icon( + Icons.history, + color: (currentMenu == 2) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + title: Text( + 'History Transaksi', + style: TextStyle( + color: (currentMenu == 2) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + ), + onTap: () { + // Handle navigation to User screen + Navigator.pop(context); + ref.read(currentPageProvider.state).update((state) => 2); + Navigator.pushNamed(context, historyTransaksiRoute); + }, + ), + ListTile( + leading: Icon( + Icons.feed, + color: (currentMenu == 3) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + title: Text( + 'Report', + style: TextStyle( + color: (currentMenu == 3) + ? Constant.pcBtnBackgroundColor + : Constant.textGreyv2, + ), + ), + onTap: () { + // Handle navigation to Transaksi screen + Navigator.pop(context); + ref.read(currentPageProvider.state).update((state) => 3); + Navigator.pushNamed(context, reportRoute); + }, + ), + ListTile( + leading: Icon( + Icons.logout, + color: Constant.textGreyv2, + ), + title: Text( + 'Logout', + style: TextStyle(color: Constant.textGreyv2), + ), + 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 ?? "", + ); + }, + ), + ], + ), + ), + // Versi Aplikasi Padding( padding: EdgeInsets.only( - top: Constant.getActualYPhone(context: context, y: 10), + right: Constant.getActualXPhone(context: context, x: 20), bottom: Constant.getActualYPhone(context: context, y: 10), - right: Constant.getActualXPhone(context: context, x: 24), - left: Constant.getActualXPhone(context: context, x: 24), ), - child: Container( - width: Constant.getActualXPhone(context: context, x: 300), - ), - ), - - // Expanded( - // child: Padding( - // padding: EdgeInsets.only( - // left: Constant.getActualXPhone(context: context, x: 24), - // right: Constant.getActualXPhone(context: context, x: 71), - // ), - // child: Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(6), - // color: Constant.textGrey.withOpacity(0.16), - // ), - // child: Padding( - // padding: EdgeInsets.only( - // left: Constant.getActualXPhone(context: context, x: 8), - // right: Constant.getActualXPhone(context: context, x: 8), - // ), - // child: Text( - // M_CompanyName.value, - // style: Constant.body3(context: context).copyWith( - // fontWeight: FontWeight.w700, - // color: Constant.textGreyv2, - // backgroundColor: Constant.textGrey.withOpacity(0.16), - // ), - // ), - // ), - // ), - // ), - // ), - - Chip( - backgroundColor: Constant.textGrey.withOpacity(0.16), - label: Text( - M_CompanyName.value, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Constant.textGreyv2, + child: Align( + alignment: Alignment.bottomRight, + child: Text( + 'Versi ${Constant.version}', + style: Constant.titleH4Login(context: context) + .copyWith(color: Constant.textGrey), ), ), ), - - ListTile( - leading: Icon( - Icons.home, - color: (currentMenu == 0) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - title: Text( - 'Home', - style: TextStyle( - color: (currentMenu == 0) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - ), - // tileColor: (currentMenu == 0) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - onTap: () { - // Handle navigation to Home screen - Navigator.pop(context); - ref.read(currentPageProvider.state).update((state) => 0); - Navigator.pushNamed(context, homeRoute); - }, - ), - ListTile( - leading: Icon( - Icons.money, - color: (currentMenu == 1) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - title: Text( - 'Transaksi', - style: TextStyle( - color: (currentMenu == 1) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - ), - // tileColor: (currentMenu == 1) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - onTap: () { - // Handle navigation to Transaksi screen - Navigator.pop(context); - ref.read(currentPageProvider.state).update((state) => 1); - Navigator.pushNamed(context, transaksiRoute); - }, - ), - ListTile( - leading: Icon( - Icons.history, - color: (currentMenu == 2) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - title: Text( - 'History Transaksi', - style: TextStyle( - color: (currentMenu == 2) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - ), - // tileColor: (currentMenu == 2) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - onTap: () { - // Handle navigation to User screen - Navigator.pop(context); - ref.read(currentPageProvider.state).update((state) => 2); - Navigator.pushNamed(context, historyTransaksiRoute); - }, - ), - ListTile( - leading: Icon( - Icons.feed, - color: (currentMenu == 3) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - title: Text( - 'Report', - style: TextStyle( - color: (currentMenu == 3) - ? Constant.pcBtnBackgroundColor - : Constant.textGreyv2, - ), - ), - // tileColor: (currentMenu == 3) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - onTap: () { - // Handle navigation to Transaksi screen - Navigator.pop(context); - ref.read(currentPageProvider.state).update((state) => 3); - Navigator.pushNamed(context, reportRoute); - }, - ), - // ListTile( - // title: Text( - // 'User', - // style: TextStyle( - // color: (currentMenu == 4) - // ? Constant.textWhite - // : Constant.textBlack, - // ), - // ), - // tileColor: (currentMenu == 4) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - // onTap: () { - // // Handle navigation to User screen - // Navigator.pop(context); - // ref.read(currentPageProvider.state).update((state) => 4); - // Navigator.pushNamed(context, userRoute); - // }, - // ), - // ListTile( - // title: Text( - // 'Change Company', - // style: TextStyle( - // color: (currentMenu == 5) - // ? Constant.textWhite - // : Constant.textBlack, - // ), - // ), - // tileColor: (currentMenu == 5) - // ? Constant.pcBtnBackgroundColor - // : Colors.transparent, - // onTap: () { - // // Handle navigation to User screen - // Navigator.pop(context); - // ref.read(currentPageProvider.state).update((state) => 5); - // Navigator.pushNamed(context, changeCompanyRoute); - // }, - // ), - ListTile( - leading: Icon( - Icons.logout, - color: Constant.textGreyv2, - ), - title: Text( - 'Logout', - style: TextStyle(color: Constant.textGreyv2), - ), - 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 ?? "", - ); - }, - ), - - Spacer(), - - // Versi Aplikasi - ListTile( - title: Text( - 'Versi ${Constant.version}', - style: Constant.titleH4Login(context: context) - .copyWith(color: Constant.textGrey), - ), - onTap: () {}, - ), ], ), ),