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,7 +82,6 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
@@ -149,8 +148,7 @@ class ReportScreen extends HookConsumerWidget {
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
@@ -244,8 +242,7 @@ class ReportScreen extends HookConsumerWidget {
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
@@ -273,35 +270,19 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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(
|
||||
|
||||
Spacer(),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Excel
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
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);
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
// 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
|
||||
},
|
||||
),
|
||||
|
||||
// PDF
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
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),
|
||||
);
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:app_petty_cash/screen/transaksi/confirm_transaksi_provider.dart';
|
||||
import 'package:app_petty_cash/screen/transaksi/delete_transaksi_provider.dart';
|
||||
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
@@ -9,6 +10,7 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../app/route.dart';
|
||||
@@ -161,6 +163,27 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
);
|
||||
|
||||
// confirm transaksi
|
||||
ref.listen(
|
||||
confirmTransaksiProvider,
|
||||
(previous, next) {
|
||||
if (next is ConfirmTransaksiStateLoading) {
|
||||
searchHistoryIsLoading.value = true;
|
||||
} else if (next is ConfirmTransaksiStateError) {
|
||||
// print(next.message);
|
||||
searchHistoryIsLoading.value = false;
|
||||
SanckbarWidget(context, next.message, snackbarType.error);
|
||||
} else if (next is ConfirmTransaksiStateDone) {
|
||||
// print(jsonEncode(next.model));
|
||||
// print(next.model.length);
|
||||
// listSearchHistory.value = next.model;
|
||||
SanckbarWidget(
|
||||
context, 'Data Berhasil Diconfirm', snackbarType.success);
|
||||
searchHistoryIsLoading.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Future<String> getCompanyID() async {
|
||||
final shared = await SharedPreferences.getInstance();
|
||||
String M_CompanyID = "0";
|
||||
@@ -306,6 +329,131 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// confirm dialog
|
||||
Future<void> showConfirmDialog(
|
||||
BuildContext context,
|
||||
String id,
|
||||
String userid,
|
||||
String companyid,
|
||||
String tglAwal,
|
||||
String tglAkhir,
|
||||
String categoryid,
|
||||
) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Konfirmasi Proses Confirm'),
|
||||
content: Text('Apakah anda yakin mengconfirm data ini?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Tutup dialog
|
||||
},
|
||||
child: Text('Batal'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
print('confirm id $id , userid $userid');
|
||||
DateTime parsedDate = DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDate);
|
||||
|
||||
DateTime parsedDateAkhir = DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAkhir.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
||||
ref.read(confirmTransaksiProvider.notifier).confirmTransaksi(
|
||||
id,
|
||||
userid,
|
||||
companyid,
|
||||
formattedDateAwal,
|
||||
formattedDateAkhir,
|
||||
categoryid,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
'Confirm Data',
|
||||
style: Constant.body1_600(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textWhite,
|
||||
),
|
||||
),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.textGreen),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Constant.textGreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
elevation: MaterialStateProperty.all(4.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// dialog image
|
||||
Future<void> showImageDialog(
|
||||
BuildContext context,
|
||||
String url,
|
||||
) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('Attachment File'),
|
||||
content: Column(
|
||||
children: [
|
||||
Image.network(
|
||||
Constant.baseUrlFile + url,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
// height: MediaQuery.of(context).size.height * 0.5,
|
||||
loadingBuilder: (BuildContext context, Widget child,
|
||||
ImageChunkEvent? loadingProgress) {
|
||||
if (loadingProgress == null) {
|
||||
return child;
|
||||
} else {
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: CircularProgressIndicator(
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded /
|
||||
(loadingProgress.expectedTotalBytes ?? 1)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Tutup dialog
|
||||
},
|
||||
child: Text('Tutup'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _closeKeyboard() {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
}
|
||||
@@ -316,7 +464,9 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
final FocusNode focusNodetglAkhir = useFocusNode();
|
||||
final tglAkhirHasFocus = useState(false);
|
||||
|
||||
return Padding(
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 30),
|
||||
),
|
||||
@@ -357,15 +507,16 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
child: TextField(
|
||||
enableInteractiveSelection: false,
|
||||
showCursor: (tglAwalHasFocus.value) ? true : false,
|
||||
showCursor:
|
||||
(tglAwalHasFocus.value) ? true : false,
|
||||
controller: ctrlTglAwal,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
hintStyle: Constant.body2_400(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
labelStyle: Constant.body2_400(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
@@ -417,13 +568,15 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
if (selectedDateAwal != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAwal);
|
||||
// ctrlTglAwal.text =
|
||||
// selectedDateAwal.toString().split(' ')[0];
|
||||
ctrlTglAwal.text = formattedDate;
|
||||
tglAwal.value = selectedDateAwal;
|
||||
tglAwalTmp.value = selectedDateAwal.toString();
|
||||
tglAwalTmp.value =
|
||||
selectedDateAwal.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAwal == null) {
|
||||
@@ -451,15 +604,16 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
child: TextField(
|
||||
enableInteractiveSelection: false,
|
||||
showCursor: (tglAwalHasFocus.value) ? true : false,
|
||||
showCursor:
|
||||
(tglAwalHasFocus.value) ? true : false,
|
||||
controller: ctrlTglAkhir,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
hintStyle: Constant.body2_400(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
labelStyle: Constant.body2_400(context: context)
|
||||
.copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
@@ -511,7 +665,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
);
|
||||
|
||||
if (selectedDateAkhir != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
String formattedDate =
|
||||
DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAkhir);
|
||||
// ctrlTglAkhir.text =
|
||||
// selectedDateAkhir.toString().split(' ')[0];
|
||||
@@ -547,10 +702,10 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
// Dropdown kategori
|
||||
(listCategoryLoading.value)
|
||||
? SizedBox(
|
||||
width:
|
||||
Constant.getActualXPhone(context: context, x: 24),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 32),
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 24),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 32),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
@@ -685,8 +840,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.pcBtnBackgroundColor),
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
shape: MaterialStateProperty.all<
|
||||
RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
@@ -854,6 +1009,9 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
child: ListView.builder(
|
||||
itemCount: listSearchHistory.value.length,
|
||||
itemBuilder: (context, idx) {
|
||||
String imgUrl = listSearchHistory
|
||||
.value[idx].imgurl
|
||||
.toString();
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: Constant.getActualYPhone(
|
||||
@@ -874,7 +1032,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
icon_category_id: listSearchHistory
|
||||
.value[idx].kategoriid
|
||||
.toString(),
|
||||
icon_category_name: listSearchHistory
|
||||
icon_category_name:
|
||||
listSearchHistory
|
||||
.value[idx].kategoriname
|
||||
.toString(),
|
||||
amount: listSearchHistory
|
||||
@@ -891,34 +1050,34 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
|
||||
// bawah
|
||||
|
||||
if (listSearchHistory
|
||||
.value[idx].isconfirm ==
|
||||
"Y")
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
Chip(
|
||||
label: Text(
|
||||
'Confirmed',
|
||||
style: TextStyle(
|
||||
color: Constant.textWhite,
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Constant
|
||||
.bgTextChipConfirmed),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
50,
|
||||
),
|
||||
),
|
||||
backgroundColor: Constant
|
||||
.bgTextChipConfirmed,
|
||||
),
|
||||
],
|
||||
),
|
||||
// if (listSearchHistory
|
||||
// .value[idx].isconfirm ==
|
||||
// "Y")
|
||||
// Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.end,
|
||||
// children: [
|
||||
// Chip(
|
||||
// label: Text(
|
||||
// 'Confirmed',
|
||||
// style: TextStyle(
|
||||
// color: Constant.textWhite,
|
||||
// ),
|
||||
// ),
|
||||
// shape: RoundedRectangleBorder(
|
||||
// side: BorderSide(
|
||||
// color: Constant
|
||||
// .bgTextChipConfirmed),
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(
|
||||
// 50,
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Constant
|
||||
// .bgTextChipConfirmed,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 6),
|
||||
@@ -929,7 +1088,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
"N")
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@@ -947,7 +1107,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
.toString(),
|
||||
userID,
|
||||
M_CompanyID.value,
|
||||
ctrlTglAwal.text.toString(),
|
||||
ctrlTglAwal.text
|
||||
.toString(),
|
||||
ctrlTglAkhir.text
|
||||
.toString(),
|
||||
selectedListCategory
|
||||
@@ -957,24 +1118,194 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
child: Chip(
|
||||
label: Text(
|
||||
'Deleted',
|
||||
'Delete',
|
||||
style: TextStyle(
|
||||
color: Constant.textWhite,
|
||||
color:
|
||||
Constant.textWhite,
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Constant
|
||||
.bgTextChipDelete),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
50,
|
||||
10,
|
||||
),
|
||||
),
|
||||
backgroundColor:
|
||||
Constant.bgTextDelete,
|
||||
),
|
||||
),
|
||||
if (imgUrl != "")
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
String fileExtension =
|
||||
imgUrl
|
||||
.split('.')
|
||||
.last
|
||||
.toLowerCase();
|
||||
if (fileExtension == 'png' ||
|
||||
fileExtension ==
|
||||
'jpg' ||
|
||||
fileExtension ==
|
||||
'jpeg') {
|
||||
showImageDialog(
|
||||
context,
|
||||
imgUrl,
|
||||
);
|
||||
} else {
|
||||
if (!await launchUrl(
|
||||
Uri.parse(
|
||||
Constant.baseUrlFile +
|
||||
imgUrl,
|
||||
),
|
||||
)) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(
|
||||
context,
|
||||
'Could not launch ${Constant.baseUrlFile + imgUrl}',
|
||||
snackbarType
|
||||
.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
Icons.attach_file,
|
||||
color: Constant
|
||||
.pcBtnBackgroundColor,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
final userID = ref
|
||||
.read(
|
||||
currentUserProvider)
|
||||
?.model
|
||||
.M_UserID ??
|
||||
"0";
|
||||
showConfirmDialog(
|
||||
context,
|
||||
listSearchHistory
|
||||
.value[idx].id
|
||||
.toString(),
|
||||
userID,
|
||||
M_CompanyID.value,
|
||||
ctrlTglAwal.text
|
||||
.toString(),
|
||||
ctrlTglAkhir.text
|
||||
.toString(),
|
||||
selectedListCategory
|
||||
.value.categoryid
|
||||
.toString(),
|
||||
);
|
||||
},
|
||||
child: Chip(
|
||||
label: Text(
|
||||
'Confirm',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Constant.textWhite,
|
||||
),
|
||||
),
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color:
|
||||
Constant.green_600,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
10),
|
||||
),
|
||||
backgroundColor:
|
||||
Constant.green_600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Confirmed
|
||||
if (listSearchHistory
|
||||
.value[idx].isconfirm ==
|
||||
"Y")
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Chip(
|
||||
label: Text(
|
||||
'Confirmed',
|
||||
style: TextStyle(
|
||||
color: Constant.green_600,
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Constant.green_600,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
50),
|
||||
),
|
||||
backgroundColor:
|
||||
Constant.textWhite,
|
||||
),
|
||||
if (imgUrl != "")
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
String fileExtension =
|
||||
imgUrl
|
||||
.split('.')
|
||||
.last
|
||||
.toLowerCase();
|
||||
if (fileExtension == 'png' ||
|
||||
fileExtension ==
|
||||
'jpg' ||
|
||||
fileExtension ==
|
||||
'jpeg') {
|
||||
showImageDialog(
|
||||
context,
|
||||
imgUrl,
|
||||
);
|
||||
} else {
|
||||
if (!await launchUrl(
|
||||
Uri.parse(
|
||||
imgUrl))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(
|
||||
context,
|
||||
'Could not launch $imgUrl',
|
||||
snackbarType.error,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
Icons.attach_file,
|
||||
color: Constant
|
||||
.pcBtnBackgroundColor,
|
||||
),
|
||||
),
|
||||
Chip(
|
||||
label: Text(
|
||||
'Confirm',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
10),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
// Row(
|
||||
@@ -1055,6 +1386,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,22 +91,22 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
|
||||
final currentMenu = ref.read(currentPageProvider);
|
||||
|
||||
return Drawer(
|
||||
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: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
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')),
|
||||
image:
|
||||
AssetImage('images/logo_sismedika_landscape.png')),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
@@ -125,7 +125,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.only(
|
||||
// left: Constant.getActualXPhone(context: context, x: 24),
|
||||
@@ -153,7 +152,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Chip(
|
||||
backgroundColor: Constant.textGrey.withOpacity(0.16),
|
||||
label: Text(
|
||||
@@ -180,9 +178,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
: Constant.textGreyv2,
|
||||
),
|
||||
),
|
||||
// tileColor: (currentMenu == 0)
|
||||
// ? Constant.pcBtnBackgroundColor
|
||||
// : Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to Home screen
|
||||
Navigator.pop(context);
|
||||
@@ -205,9 +200,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
: Constant.textGreyv2,
|
||||
),
|
||||
),
|
||||
// tileColor: (currentMenu == 1)
|
||||
// ? Constant.pcBtnBackgroundColor
|
||||
// : Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to Transaksi screen
|
||||
Navigator.pop(context);
|
||||
@@ -230,9 +222,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
: Constant.textGreyv2,
|
||||
),
|
||||
),
|
||||
// tileColor: (currentMenu == 2)
|
||||
// ? Constant.pcBtnBackgroundColor
|
||||
// : Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to User screen
|
||||
Navigator.pop(context);
|
||||
@@ -255,9 +244,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
: Constant.textGreyv2,
|
||||
),
|
||||
),
|
||||
// tileColor: (currentMenu == 3)
|
||||
// ? Constant.pcBtnBackgroundColor
|
||||
// : Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to Transaksi screen
|
||||
Navigator.pop(context);
|
||||
@@ -265,44 +251,6 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
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,
|
||||
@@ -317,21 +265,28 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
ref.read(currentPageProvider.state).update((state) => 0);
|
||||
ref.read(logoutProvider.notifier).logout(
|
||||
M_UserID: selectedUser?.model.M_UserID ?? "",
|
||||
M_UserUsername: selectedUser?.model.M_UserUsername ?? "",
|
||||
M_UserUsername:
|
||||
selectedUser?.model.M_UserUsername ?? "",
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
// Versi Aplikasi
|
||||
ListTile(
|
||||
title: Text(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
right: Constant.getActualXPhone(context: context, x: 20),
|
||||
bottom: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: 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