step 1 : copy file drawer, history confirm, dialog img, btn excel & pdf
This commit is contained in:
@@ -186,4 +186,33 @@ class TransaksiRepository extends BaseRepository {
|
||||
|
||||
return resp['status'];
|
||||
}
|
||||
|
||||
// confirm transaksi
|
||||
Future<String> confirmTransaksi(
|
||||
String id,
|
||||
String userid,
|
||||
) async {
|
||||
final service =
|
||||
"${Constant.baseUrlDevone}transaction/confirmtransaction/?id=$id&userid=$userid";
|
||||
final resp = await get(
|
||||
// param: {
|
||||
// "": "",
|
||||
// },
|
||||
service: service,
|
||||
);
|
||||
|
||||
print("url confirm transaksi : $service");
|
||||
|
||||
// final result = List<ListCategory>.empty(growable: true);
|
||||
// resp['data'].forEach((e) {
|
||||
// final model = ListCategory.fromJson(e);
|
||||
// result.add(model);
|
||||
// });
|
||||
|
||||
if (resp['status'] != "OK") {
|
||||
return resp['message'];
|
||||
}
|
||||
|
||||
return resp['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,226 +82,207 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Tanggal Awal',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Awal
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAwal,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Awal',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Tanggal Awal',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Awal
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAwal,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAwal = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAwal.value,
|
||||
);
|
||||
|
||||
if (selectedDateAwal != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAwal);
|
||||
// ctrlTglAwal.text =
|
||||
// selectedDateAwal.toString().split(' ')[0];
|
||||
ctrlTglAwal.text = formattedDate;
|
||||
tglAwal.value = selectedDateAwal;
|
||||
tglAwalTmp.value = selectedDateAwal.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAwal == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
|
||||
Text(
|
||||
'Tanggal Akhir',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Akhir
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAkhir,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Akhir',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAkhir = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAkhir.value,
|
||||
);
|
||||
|
||||
if (selectedDateAkhir != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAkhir);
|
||||
// ctrlTglAkhir.text =
|
||||
// selectedDateAkhir.toString().split(' ')[0];
|
||||
ctrlTglAkhir.text = formattedDate;
|
||||
tglAkhir.value = selectedDateAkhir;
|
||||
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAkhir == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Awal',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAwal = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAwal.value,
|
||||
);
|
||||
|
||||
if (selectedDateAwal != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAwal);
|
||||
// ctrlTglAwal.text =
|
||||
// selectedDateAwal.toString().split(' ')[0];
|
||||
ctrlTglAwal.text = formattedDate;
|
||||
tglAwal.value = selectedDateAwal;
|
||||
tglAwalTmp.value = selectedDateAwal.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAwal == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
height: 150,
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
// right: Constant.getActualXPhone(context: context, x: 27),
|
||||
// left: Constant.getActualXPhone(context: context, x: 27),
|
||||
// bottom: Constant.getActualYPhone(context: context, y: 32),
|
||||
// top: Constant.getActualYPhone(context: context, y: 24),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Excel
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
|
||||
Text(
|
||||
'Tanggal Akhir',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Akhir
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAkhir,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Akhir',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAkhir = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAkhir.value,
|
||||
);
|
||||
|
||||
if (selectedDateAkhir != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAkhir);
|
||||
// ctrlTglAkhir.text =
|
||||
// selectedDateAkhir.toString().split(' ')[0];
|
||||
ctrlTglAkhir.text = formattedDate;
|
||||
tglAkhir.value = selectedDateAkhir;
|
||||
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAkhir == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.white),
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => BorderSide(color: Colors.green),
|
||||
// ),
|
||||
|
||||
// backgroundColor: MaterialStateColor.resolveWith(
|
||||
// (st) => Constant.pcBtnBackgroundColor),
|
||||
shape:
|
||||
@@ -333,11 +314,11 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 10),
|
||||
),
|
||||
Text(
|
||||
'Download Report (xls) ',
|
||||
'Excel',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.green,
|
||||
@@ -345,19 +326,41 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () async {
|
||||
M_CompanyID = await getCompanyID();
|
||||
if(M_CompanyID == "0"){
|
||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
||||
return;
|
||||
}
|
||||
// Awal
|
||||
DateTime parsedDateAwal =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAwal);
|
||||
|
||||
// Akhir
|
||||
DateTime parsedDateAkhir =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
||||
|
||||
String url =
|
||||
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=xls&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
|
||||
if (!await launchUrl(Uri.parse(url))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(context, 'Could not launch $url',
|
||||
snackbarType.error);
|
||||
}
|
||||
// https://devone.aplikasi.web.id/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=2023-11-01&PEndDate=2023-12-30&PCompanyID=0&username=adminsas%20&tm=1701327096267
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
|
||||
// PDF
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
// PDF
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.pcBtnBackgroundColor),
|
||||
@@ -390,11 +393,11 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualXPhone(
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (PDF)',
|
||||
'PDF',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.white),
|
||||
@@ -402,7 +405,29 @@ class ReportScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
String url = "https://pub.dev/packages?q=url+launcher";
|
||||
M_CompanyID = await getCompanyID();
|
||||
if(M_CompanyID == "0"){
|
||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
||||
return;
|
||||
}
|
||||
// Awal
|
||||
DateTime parsedDateAwal =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAwal);
|
||||
|
||||
// Akhir
|
||||
DateTime parsedDateAkhir =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
||||
|
||||
String url =
|
||||
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
|
||||
if (!await launchUrl(Uri.parse(url))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(context, 'Could not launch $url',
|
||||
@@ -410,9 +435,9 @@ class ReportScreen extends HookConsumerWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../repository/transaksi_repository.dart';
|
||||
import '../../provider/dio_provider.dart';
|
||||
import '../../repository/base_repository.dart';
|
||||
import 'search_history_transaksi_provider.dart';
|
||||
|
||||
abstract class ConfirmTransaksiState extends Equatable {
|
||||
final DateTime date;
|
||||
const ConfirmTransaksiState(this.date);
|
||||
@override
|
||||
List<Object?> get props => [date];
|
||||
}
|
||||
|
||||
class ConfirmTransaksiStateInit extends ConfirmTransaksiState {
|
||||
ConfirmTransaksiStateInit() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class ConfirmTransaksiStateLoading extends ConfirmTransaksiState {
|
||||
ConfirmTransaksiStateLoading() : super(DateTime.now());
|
||||
}
|
||||
|
||||
class ConfirmTransaksiStateError extends ConfirmTransaksiState {
|
||||
final String message;
|
||||
ConfirmTransaksiStateError({
|
||||
required this.message,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
class ConfirmTransaksiStateDone extends ConfirmTransaksiState {
|
||||
// final List<ListType> model;
|
||||
final String resp;
|
||||
ConfirmTransaksiStateDone({
|
||||
required this.resp,
|
||||
}) : super(DateTime.now());
|
||||
}
|
||||
|
||||
//notifier
|
||||
class ConfirmTransaksiNotifier extends StateNotifier<ConfirmTransaksiState> {
|
||||
final Ref ref;
|
||||
ConfirmTransaksiNotifier({
|
||||
required this.ref,
|
||||
}) : super(ConfirmTransaksiStateInit());
|
||||
|
||||
void confirmTransaksi(
|
||||
String id,
|
||||
String userid,
|
||||
String companyid,
|
||||
String tglAwal,
|
||||
String tglAkhir,
|
||||
String categoryid,
|
||||
) async {
|
||||
try {
|
||||
state = ConfirmTransaksiStateLoading();
|
||||
final dio = ref.read(dioProvider);
|
||||
final resp = await TransaksiRepository(dio: dio).confirmTransaksi(
|
||||
id,
|
||||
userid,
|
||||
);
|
||||
state = ConfirmTransaksiStateDone(resp: resp);
|
||||
|
||||
// search lagi buat get data
|
||||
ref.read(searchHistoryTransaksiProvider.notifier).searchHistoryTransaksi(
|
||||
companyid,
|
||||
tglAwal,
|
||||
tglAkhir,
|
||||
categoryid,
|
||||
);
|
||||
} catch (e) {
|
||||
if (e is BaseRepositoryException) {
|
||||
state = ConfirmTransaksiStateError(message: e.message.toString());
|
||||
} else {
|
||||
state = ConfirmTransaksiStateError(message: e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//provider
|
||||
final confirmTransaksiProvider =
|
||||
StateNotifierProvider<ConfirmTransaksiNotifier, ConfirmTransaksiState>(
|
||||
(ref) => ConfirmTransaksiNotifier(ref: ref),
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -91,248 +91,203 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
|
||||
final currentMenu = ref.read(currentPageProvider);
|
||||
|
||||
return Drawer(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(0))),
|
||||
child: Container(
|
||||
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: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
341
app_petty_cash/lib/widget/custom_drawer_v2.dart
Normal file
341
app_petty_cash/lib/widget/custom_drawer_v2.dart
Normal file
@@ -0,0 +1,341 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../app/route.dart';
|
||||
import '../provider/current_menu_provider.dart';
|
||||
import '../provider/current_user_provider.dart';
|
||||
import '../screen/login/logout_provider.dart';
|
||||
|
||||
class CustomDrawerV2 extends HookConsumerWidget {
|
||||
// final String userCompany;
|
||||
const CustomDrawerV2({
|
||||
Key? key,
|
||||
// required this.userCompany,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selectedUser = ref.read(currentUserProvider);
|
||||
final isLoading = useState(false);
|
||||
final errorMessage = useState("");
|
||||
final successMessage = useState("");
|
||||
final M_CompanyName = useState("-");
|
||||
|
||||
Future<String> getCompanyName() async {
|
||||
final shared = await SharedPreferences.getInstance();
|
||||
String M_CompanyName = "-";
|
||||
|
||||
if (shared != null) {
|
||||
final bearerString = shared.get(Constant.bearerName).toString();
|
||||
final xmodel = jsonDecode(bearerString);
|
||||
if (xmodel != null) {
|
||||
M_CompanyName = xmodel["model"]["M_CompanyName"];
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CompanyName == "0") {
|
||||
// throw BaseRepositoryException(message: 'Invalid Company ID');
|
||||
}
|
||||
|
||||
return M_CompanyName;
|
||||
}
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
||||
if (userID == "0") {
|
||||
//not login
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil(loginRoute, (route) => true);
|
||||
|
||||
// Navigator.popAndPushNamed(context, loginRoute);
|
||||
return;
|
||||
}
|
||||
M_CompanyName.value = await getCompanyName();
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
|
||||
ref.listen(logoutProvider, (prev, next) async {
|
||||
if (next is LogoutStateLoading) {
|
||||
isLoading.value = true;
|
||||
} else if (next is LogoutStateError) {
|
||||
isLoading.value = false;
|
||||
errorMessage.value = next.message;
|
||||
Timer(const Duration(seconds: 3), () {
|
||||
errorMessage.value = "";
|
||||
});
|
||||
} else if (next is LogoutStateDone) {
|
||||
isLoading.value = false;
|
||||
final shared = await SharedPreferences.getInstance();
|
||||
final bearerString = shared.get(Constant.bearerName).toString();
|
||||
// print(bearerString);
|
||||
if (bearerString.isNotEmpty) {
|
||||
shared.remove(bearerString);
|
||||
shared.clear();
|
||||
// Navigator.popAndPushNamed(context, loginRoute);
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil(loginRoute, (route) => false);
|
||||
}
|
||||
Timer(const Duration(seconds: 3), () async {
|
||||
successMessage.value = "";
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
final currentMenu = ref.read(currentPageProvider);
|
||||
|
||||
return Drawer(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(0))),
|
||||
child: Container(
|
||||
child: ListView(
|
||||
// padding: EdgeInsets.only(
|
||||
// top: Constant.getActualYPhone(context: context, y: 10),
|
||||
// ),
|
||||
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')),
|
||||
),
|
||||
|
||||
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),
|
||||
),
|
||||
),
|
||||
|
||||
// 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
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: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user