Compare commits
1 Commits
main
...
andy/chang
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b870e7bea |
@@ -1,14 +1,13 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
||||||
<application
|
<application
|
||||||
android:label="PettyCash"
|
android:label="PettyCash"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/launcher_icon"
|
android:icon="@mipmap/launcher_icon"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
>
|
>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<external-path name="external_storage_directory" path="." />
|
<external-path name="external_storage_directory" path="." />
|
||||||
<external-path name="external_files" path="."/>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -13,7 +13,7 @@ class Constant {
|
|||||||
// static String version = "1.00";
|
// static String version = "1.00";
|
||||||
|
|
||||||
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
|
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
|
||||||
static String version = "1.2.0";
|
static String version = "1.0.0";
|
||||||
|
|
||||||
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
|
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:app_petty_cash/screen/camera/coba_camera.dart';
|
|||||||
import 'package:app_petty_cash/screen/camera/example.dart';
|
import 'package:app_petty_cash/screen/camera/example.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../screen/change_password/change_password_screen.dart';
|
|
||||||
import '../screen/home/home_screen.dart';
|
import '../screen/home/home_screen.dart';
|
||||||
import '../screen/transaksi/history_transaksi_screen.dart';
|
import '../screen/transaksi/history_transaksi_screen.dart';
|
||||||
import '../screen/transaksi/transaksi_screen.dart';
|
import '../screen/transaksi/transaksi_screen.dart';
|
||||||
@@ -28,24 +27,8 @@ const cobaCameraRoute = "/cobaCameraRoute";
|
|||||||
// test screen
|
// test screen
|
||||||
const testFilePickerRoute = "/testFilePickerRoute";
|
const testFilePickerRoute = "/testFilePickerRoute";
|
||||||
|
|
||||||
const changePasswordRoute = "/changePasswordRoute";
|
|
||||||
|
|
||||||
class AppRoute {
|
class AppRoute {
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
|
|
||||||
// change password
|
|
||||||
if (settings.name == changePasswordRoute) {
|
|
||||||
return MaterialPageRoute(builder: (context) {
|
|
||||||
return MediaQuery(
|
|
||||||
data: MediaQuery.of(context).copyWith(
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
padding: EdgeInsets.all(0),
|
|
||||||
),
|
|
||||||
child: ChangePasswordScreen(),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// splash screen
|
// splash screen
|
||||||
if (settings.name == splashScreen) {
|
if (settings.name == splashScreen) {
|
||||||
return MaterialPageRoute(builder: (context) {
|
return MaterialPageRoute(builder: (context) {
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
class HistoryTotalModel {
|
|
||||||
String? totalAll;
|
|
||||||
|
|
||||||
HistoryTotalModel({
|
|
||||||
this.totalAll,
|
|
||||||
});
|
|
||||||
|
|
||||||
HistoryTotalModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
totalAll = json['total_all'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
||||||
data['total_all'] = this.totalAll;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,6 @@ class HistoryTransaksiModel {
|
|||||||
String? tanggalconfirm;
|
String? tanggalconfirm;
|
||||||
String? usertransaksi;
|
String? usertransaksi;
|
||||||
String? userconfirm;
|
String? userconfirm;
|
||||||
String? tanggalcreated;
|
|
||||||
|
|
||||||
HistoryTransaksiModel(
|
HistoryTransaksiModel(
|
||||||
{this.id,
|
{this.id,
|
||||||
@@ -27,9 +26,7 @@ class HistoryTransaksiModel {
|
|||||||
this.isconfirm,
|
this.isconfirm,
|
||||||
this.tanggalconfirm,
|
this.tanggalconfirm,
|
||||||
this.usertransaksi,
|
this.usertransaksi,
|
||||||
this.userconfirm,
|
this.userconfirm});
|
||||||
this.tanggalcreated
|
|
||||||
});
|
|
||||||
|
|
||||||
HistoryTransaksiModel.fromJson(Map<String, dynamic> json) {
|
HistoryTransaksiModel.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
@@ -45,7 +42,6 @@ class HistoryTransaksiModel {
|
|||||||
tanggalconfirm = json['tanggalconfirm'];
|
tanggalconfirm = json['tanggalconfirm'];
|
||||||
usertransaksi = json['usertransaksi'];
|
usertransaksi = json['usertransaksi'];
|
||||||
userconfirm = json['userconfirm'];
|
userconfirm = json['userconfirm'];
|
||||||
tanggalcreated = json['tanggalcreated'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@@ -63,7 +59,6 @@ class HistoryTransaksiModel {
|
|||||||
data['tanggalconfirm'] = this.tanggalconfirm;
|
data['tanggalconfirm'] = this.tanggalconfirm;
|
||||||
data['usertransaksi'] = this.usertransaksi;
|
data['usertransaksi'] = this.usertransaksi;
|
||||||
data['userconfirm'] = this.userconfirm;
|
data['userconfirm'] = this.userconfirm;
|
||||||
data['tanggalcreated'] = this.tanggalcreated;
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,24 +12,21 @@ class ListTransaksiHomeModel {
|
|||||||
String? tanggalconfirm;
|
String? tanggalconfirm;
|
||||||
String? usertransaksi;
|
String? usertransaksi;
|
||||||
String? userconfirm;
|
String? userconfirm;
|
||||||
String? tanggalcreated;
|
|
||||||
|
|
||||||
ListTransaksiHomeModel({
|
ListTransaksiHomeModel(
|
||||||
this.id,
|
{this.id,
|
||||||
this.tanggaltransaksi,
|
this.tanggaltransaksi,
|
||||||
this.tipe,
|
this.tipe,
|
||||||
this.kategoriid,
|
this.kategoriid,
|
||||||
this.kategoriname,
|
this.kategoriname,
|
||||||
this.note,
|
this.note,
|
||||||
this.amount,
|
this.amount,
|
||||||
this.sender,
|
this.sender,
|
||||||
this.imgurl,
|
this.imgurl,
|
||||||
this.isconfirm,
|
this.isconfirm,
|
||||||
this.tanggalconfirm,
|
this.tanggalconfirm,
|
||||||
this.usertransaksi,
|
this.usertransaksi,
|
||||||
this.userconfirm,
|
this.userconfirm});
|
||||||
this.tanggalcreated,
|
|
||||||
});
|
|
||||||
|
|
||||||
ListTransaksiHomeModel.fromJson(Map<String, dynamic> json) {
|
ListTransaksiHomeModel.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
@@ -45,7 +42,6 @@ class ListTransaksiHomeModel {
|
|||||||
tanggalconfirm = json['tanggalconfirm'];
|
tanggalconfirm = json['tanggalconfirm'];
|
||||||
usertransaksi = json['usertransaksi'];
|
usertransaksi = json['usertransaksi'];
|
||||||
userconfirm = json['userconfirm'];
|
userconfirm = json['userconfirm'];
|
||||||
tanggalcreated = json['tanggalcreated'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@@ -63,7 +59,6 @@ class ListTransaksiHomeModel {
|
|||||||
data['tanggalconfirm'] = this.tanggalconfirm;
|
data['tanggalconfirm'] = this.tanggalconfirm;
|
||||||
data['usertransaksi'] = this.usertransaksi;
|
data['usertransaksi'] = this.usertransaksi;
|
||||||
data['userconfirm'] = this.userconfirm;
|
data['userconfirm'] = this.userconfirm;
|
||||||
data['tanggalcreated'] = this.tanggalcreated;
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
|
|
||||||
import '../model/history_total_model.dart';
|
|
||||||
|
|
||||||
final currentHistoryTotalProvider = StateProvider<HistoryTotalModel>(
|
|
||||||
((ref) => HistoryTotalModel(
|
|
||||||
totalAll: "0",
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
@@ -95,32 +95,4 @@ class AuthRepository extends BaseRepository {
|
|||||||
return resp['message'];
|
return resp['message'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> changePassword({
|
|
||||||
required String userID,
|
|
||||||
required String token,
|
|
||||||
required String tokenx,
|
|
||||||
required String oldPassword,
|
|
||||||
required String newPassword,
|
|
||||||
required String confirmPassword,
|
|
||||||
}) async {
|
|
||||||
final param = {
|
|
||||||
"tokenx": tokenx,
|
|
||||||
"token": token,
|
|
||||||
"M_UserID": userID,
|
|
||||||
"old_password": oldPassword,
|
|
||||||
"new_password": newPassword,
|
|
||||||
"confirm_password": confirmPassword
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
final service = "${Constant.baseUrlDevone}auth/change_password";
|
|
||||||
final resp = await post(param: param, service: service, token: token);
|
|
||||||
|
|
||||||
if (resp["status"] == "OK") {
|
|
||||||
return resp['message'];
|
|
||||||
} else {
|
|
||||||
return resp['message'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'dart:convert';
|
|||||||
import 'package:app_petty_cash/model/list_type_model.dart';
|
import 'package:app_petty_cash/model/list_type_model.dart';
|
||||||
|
|
||||||
import '../app/constant.dart';
|
import '../app/constant.dart';
|
||||||
import '../model/history_total_model.dart';
|
|
||||||
import '../model/history_transaksi_model.dart';
|
import '../model/history_transaksi_model.dart';
|
||||||
import '../model/list_category_model.dart';
|
import '../model/list_category_model.dart';
|
||||||
import 'base_repository.dart';
|
import 'base_repository.dart';
|
||||||
@@ -101,7 +100,6 @@ class TransaksiRepository extends BaseRepository {
|
|||||||
'userid': userid,
|
'userid': userid,
|
||||||
'sender': sender,
|
'sender': sender,
|
||||||
'companyid': M_CompanyID,
|
'companyid': M_CompanyID,
|
||||||
'base64File': base64file,
|
|
||||||
'fileName': fileName,
|
'fileName': fileName,
|
||||||
'fileSize': fileSize,
|
'fileSize': fileSize,
|
||||||
'fileEkstension': fileExtension
|
'fileEkstension': fileExtension
|
||||||
@@ -141,7 +139,7 @@ class TransaksiRepository extends BaseRepository {
|
|||||||
String categoryid,
|
String categoryid,
|
||||||
) async {
|
) async {
|
||||||
final service =
|
final service =
|
||||||
"${Constant.baseUrlDevone}/history/list_transaction/?companyid=$companyid&startdate=$tglAwal&enddate=$tglAkhir&kategoriid=$categoryid";
|
"${Constant.baseUrlDevone}/homescreen/list_transaction/?companyid=$companyid&startdate=$tglAwal&enddate=$tglAkhir&kategoriid=$categoryid";
|
||||||
// https://devone.aplikasi.web.id/one-api-pettycash/pettycash/history/list_transaction/?companyid=1&startdate=2023-12-01&enddate=2023-12-30&kategoriid=0
|
// https://devone.aplikasi.web.id/one-api-pettycash/pettycash/history/list_transaction/?companyid=1&startdate=2023-12-01&enddate=2023-12-30&kategoriid=0
|
||||||
final resp = await get(
|
final resp = await get(
|
||||||
// param: {
|
// param: {
|
||||||
@@ -188,62 +186,4 @@ class TransaksiRepository extends BaseRepository {
|
|||||||
|
|
||||||
return resp['status'];
|
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'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// total by category di history
|
|
||||||
Future<HistoryTotalModel> getHistoryTotal(
|
|
||||||
String companyid,
|
|
||||||
String tglAwal,
|
|
||||||
String tglAkhir,
|
|
||||||
String categoryid,
|
|
||||||
) async {
|
|
||||||
final service =
|
|
||||||
"${Constant.baseUrlDevone}history/list_total/?companyid=$companyid&startdate=$tglAwal&enddate=$tglAkhir&kategoriid=$categoryid";
|
|
||||||
final resp = await get(
|
|
||||||
// param: {
|
|
||||||
// "": "",
|
|
||||||
// },
|
|
||||||
service: service,
|
|
||||||
);
|
|
||||||
|
|
||||||
print("url total History Transaksi : $service");
|
|
||||||
|
|
||||||
HistoryTotalModel result = HistoryTotalModel(
|
|
||||||
totalAll: "0",
|
|
||||||
);
|
|
||||||
|
|
||||||
// print(resp['data']);
|
|
||||||
|
|
||||||
final model = HistoryTotalModel.fromJson(resp['data']);
|
|
||||||
result = model;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
import 'package:app_petty_cash/model/auth_model.dart';
|
|
||||||
import 'package:app_petty_cash/model/company_model.dart';
|
|
||||||
import 'package:app_petty_cash/repository/auth_repository.dart';
|
|
||||||
import 'package:app_petty_cash/repository/company_repository.dart';
|
|
||||||
|
|
||||||
import '../../model/list_category_model.dart';
|
|
||||||
import '../../repository/transaksi_repository.dart';
|
|
||||||
import 'package:equatable/equatable.dart';
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
|
|
||||||
import '../../provider/dio_provider.dart';
|
|
||||||
import '../../repository/base_repository.dart';
|
|
||||||
|
|
||||||
abstract class ChangePasswordState extends Equatable {
|
|
||||||
final DateTime date;
|
|
||||||
const ChangePasswordState(this.date);
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [date];
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChangePasswordStateInit extends ChangePasswordState {
|
|
||||||
ChangePasswordStateInit() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChangePasswordStateLoading extends ChangePasswordState {
|
|
||||||
ChangePasswordStateLoading() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChangePasswordStateError extends ChangePasswordState {
|
|
||||||
final String message;
|
|
||||||
ChangePasswordStateError({
|
|
||||||
required this.message,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class ChangePasswordStateDone extends ChangePasswordState {
|
|
||||||
final String model;
|
|
||||||
ChangePasswordStateDone({
|
|
||||||
required this.model,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
//notifier
|
|
||||||
class ChangePasswordNotifier extends StateNotifier<ChangePasswordState> {
|
|
||||||
final Ref ref;
|
|
||||||
ChangePasswordNotifier({
|
|
||||||
required this.ref,
|
|
||||||
}) : super(ChangePasswordStateInit());
|
|
||||||
|
|
||||||
void postChangePassword({
|
|
||||||
required String userID,
|
|
||||||
required String userToken,
|
|
||||||
required String userTokenx,
|
|
||||||
required String oldPassword,
|
|
||||||
required String newPassword,
|
|
||||||
required String confirmPassword,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
state = ChangePasswordStateLoading();
|
|
||||||
final dio = ref.read(dioProvider);
|
|
||||||
final resp = await AuthRepository(dio: dio).changePassword(
|
|
||||||
userID: userID,
|
|
||||||
tokenx: userTokenx,
|
|
||||||
token: userToken,
|
|
||||||
oldPassword: oldPassword,
|
|
||||||
newPassword: newPassword,
|
|
||||||
confirmPassword: confirmPassword);
|
|
||||||
state = ChangePasswordStateDone(model: resp);
|
|
||||||
} catch (e) {
|
|
||||||
if (e is BaseRepositoryException) {
|
|
||||||
state = ChangePasswordStateError(message: e.message.toString());
|
|
||||||
} else {
|
|
||||||
state = ChangePasswordStateError(message: e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//provider
|
|
||||||
final ChangePasswordProvider =
|
|
||||||
StateNotifierProvider<ChangePasswordNotifier, ChangePasswordState>(
|
|
||||||
(ref) => ChangePasswordNotifier(ref: ref),
|
|
||||||
);
|
|
||||||
@@ -1,428 +0,0 @@
|
|||||||
import 'package:app_petty_cash/app/constant.dart';
|
|
||||||
import 'package:app_petty_cash/widget/custom_drawer.dart';
|
|
||||||
import 'package:app_petty_cash/widget/sankbar_widget.dart';
|
|
||||||
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/route.dart';
|
|
||||||
import '../../provider/current_user_provider.dart';
|
|
||||||
import 'change_password_provider.dart';
|
|
||||||
|
|
||||||
class ChangePasswordScreen extends HookConsumerWidget {
|
|
||||||
const ChangePasswordScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
final selectedUser = ref.read(currentUserProvider);
|
|
||||||
//menampung user token jika ada
|
|
||||||
final userToken = ref.read(currentUserProvider)?.token ?? "";
|
|
||||||
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
|
||||||
final tokenx = ref.read(currentUserProvider)?.token ?? "";
|
|
||||||
|
|
||||||
final isLoading = useState(false);
|
|
||||||
|
|
||||||
final obscureTextOldPassword = useState<bool>(true);
|
|
||||||
final obscureTextNewPassword = useState<bool>(true);
|
|
||||||
final obscureTextConfirmPassword = useState<bool>(true);
|
|
||||||
|
|
||||||
final ctrlOldPassword = useTextEditingController(text: "");
|
|
||||||
final ctrlNewPassword = useTextEditingController(text: "");
|
|
||||||
final ctrlConfirmPassword = useTextEditingController(text: "");
|
|
||||||
final loading = useState(false);
|
|
||||||
|
|
||||||
// inisialisasi agar bisa cek apakah user sudah login sukses apa belum
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return () {};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// fungsi logout
|
|
||||||
Logout() async {
|
|
||||||
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);
|
|
||||||
ref.read(currentUserProvider.notifier).state = null;
|
|
||||||
Navigator.of(context)
|
|
||||||
.pushNamedAndRemoveUntil(loginRoute, (route) => false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// read provider home
|
|
||||||
ref.listen(
|
|
||||||
ChangePasswordProvider,
|
|
||||||
(previous, next) {
|
|
||||||
if (next is ChangePasswordStateLoading) {
|
|
||||||
loading.value = true;
|
|
||||||
} else if (next is ChangePasswordStateError) {
|
|
||||||
loading.value = false;
|
|
||||||
SanckbarWidget(context, next.message, snackbarType.error);
|
|
||||||
} else if (next is ChangePasswordStateDone) {
|
|
||||||
loading.value = false;
|
|
||||||
SanckbarWidget(
|
|
||||||
context,
|
|
||||||
"Ubah Password Berhasil!\nSilahkan Login dengan password baru",
|
|
||||||
snackbarType.success,
|
|
||||||
);
|
|
||||||
Logout();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 30)),
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
// centerTitle: true,
|
|
||||||
title: Text(
|
|
||||||
'Change Password',
|
|
||||||
style: TextStyle(color: Constant.textWhite),
|
|
||||||
),
|
|
||||||
backgroundColor: Constant.pcBtnBackgroundColor,
|
|
||||||
iconTheme: IconThemeData(
|
|
||||||
color: Constant.textWhite,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
drawer: CustomDrawer(),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(20),
|
|
||||||
child: Container(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 844),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
//Old password
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
// top: Constant.getActualYPhone(context: context, y: 63),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
'Old Password',
|
|
||||||
style: Constant.body1_400_dibulan(context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Constant.textBlack),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 4),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 5),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
obscureText: obscureTextOldPassword.value,
|
|
||||||
controller: ctrlOldPassword,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
obscureTextOldPassword.value
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
obscureTextOldPassword.value = !obscureTextOldPassword.value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
hintStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
labelText: "OldPassword",
|
|
||||||
hintText: 'Old Password',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 40),
|
|
||||||
),
|
|
||||||
//New password
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
// top: Constant.getActualYPhone(context: context, y: 63),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
'New Password',
|
|
||||||
style: Constant.body1_400_dibulan(context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Constant.textBlack),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 4),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 5),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
obscureText: obscureTextNewPassword.value,
|
|
||||||
controller: ctrlNewPassword,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
obscureTextNewPassword.value
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
obscureTextNewPassword.value = !obscureTextNewPassword.value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
hintStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
labelText: "New Password",
|
|
||||||
hintText: 'New Password',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 40),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Confirm password
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
// top: Constant.getActualYPhone(context: context, y: 63),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
'Confirm Password',
|
|
||||||
style: Constant.body1_400_dibulan(context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Constant.textBlack),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 4),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 5),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
obscureText: obscureTextConfirmPassword.value,
|
|
||||||
controller: ctrlConfirmPassword,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
obscureTextConfirmPassword.value
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
obscureTextConfirmPassword.value = !obscureTextConfirmPassword.value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
hintStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
labelText: "Confirm Password",
|
|
||||||
hintText: 'Confirm Password',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
),
|
|
||||||
|
|
||||||
//Button Update Password
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 390),
|
|
||||||
height: Constant.getActualYPhone(context: context, y: 50),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: (loading.value == true)
|
|
||||||
? null
|
|
||||||
: () {
|
|
||||||
if (ctrlNewPassword.text !=
|
|
||||||
ctrlConfirmPassword.text) {
|
|
||||||
SanckbarWidget(
|
|
||||||
context,
|
|
||||||
'New Password dan dan confirm password tidak sama!',
|
|
||||||
snackbarType.warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ctrlOldPassword.text ==
|
|
||||||
ctrlConfirmPassword.text) {
|
|
||||||
SanckbarWidget(
|
|
||||||
context,
|
|
||||||
'Password lama dan baru tidak boleh sama',
|
|
||||||
snackbarType.warning);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ctrlOldPassword.text.isEmpty ||
|
|
||||||
ctrlNewPassword.text.isEmpty ||
|
|
||||||
ctrlConfirmPassword.text.isEmpty) {
|
|
||||||
isLoading.value = true;
|
|
||||||
SanckbarWidget(context, 'Inputan harus diisi',
|
|
||||||
snackbarType.warning);
|
|
||||||
} else {
|
|
||||||
ref
|
|
||||||
.read(ChangePasswordProvider.notifier)
|
|
||||||
.postChangePassword(
|
|
||||||
userTokenx: tokenx,
|
|
||||||
userToken: userToken,
|
|
||||||
userID: userID,
|
|
||||||
oldPassword: ctrlOldPassword.text,
|
|
||||||
newPassword: ctrlNewPassword.text,
|
|
||||||
confirmPassword:
|
|
||||||
ctrlConfirmPassword.text,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
|
||||||
(st) => (loading.value == true)
|
|
||||||
? Constant.textGrey
|
|
||||||
: Constant.pcBtnBackgroundColor),
|
|
||||||
shape:
|
|
||||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
side: BorderSide(
|
|
||||||
color: Constant.pcBtnBackgroundColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
shadowColor:
|
|
||||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
|
||||||
elevation: MaterialStateProperty.all(4.0),
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
(isLoading.value)
|
|
||||||
? SizedBox(
|
|
||||||
width: Constant.getActualXPhone(
|
|
||||||
context: context, x: 24),
|
|
||||||
height: Constant.getActualYPhone(
|
|
||||||
context: context, y: 32),
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
'Submit',
|
|
||||||
style: Constant.titleH3_700(
|
|
||||||
context: context)
|
|
||||||
.copyWith(
|
|
||||||
color: Constant.textLoginColor),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import 'package:app_petty_cash/screen/home/list_transaksi_home_provider.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../app/constant.dart';
|
import '../../app/constant.dart';
|
||||||
@@ -141,25 +140,6 @@ class HomeScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
String formatDateString(String inputDate) {
|
|
||||||
try {
|
|
||||||
// Parsing tanggal dari string input
|
|
||||||
DateTime date =
|
|
||||||
DateFormat('dd-MM-yyyy HH:mm:ss', 'id').parse(inputDate);
|
|
||||||
|
|
||||||
// Format tanggal ke '30 Des 2023'
|
|
||||||
String formattedDate =
|
|
||||||
DateFormat('dd MMM yyyy HH:mm:ss', 'id').format(date);
|
|
||||||
|
|
||||||
return formattedDate;
|
|
||||||
} catch (e) {
|
|
||||||
// Tangkap kesalahan jika format tanggal tidak sesuai
|
|
||||||
print('Error parsing date: $e');
|
|
||||||
// return 'Format Tanggal Salah';
|
|
||||||
return inputDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: Constant.getActualYPhone(context: context, y: 30),
|
top: Constant.getActualYPhone(context: context, y: 30),
|
||||||
@@ -420,85 +400,6 @@ class HomeScreen extends HookConsumerWidget {
|
|||||||
.value[idx].tipe
|
.value[idx].tipe
|
||||||
.toString(),
|
.toString(),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(
|
|
||||||
context: context, y: 10),
|
|
||||||
),
|
|
||||||
|
|
||||||
// catatan
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
listTransaksiHome
|
|
||||||
.value[idx].note
|
|
||||||
.toString(),
|
|
||||||
style: Constant.body1(
|
|
||||||
context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Constant.textBlack,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
height: Constant.getActualYPhone(
|
|
||||||
context: context, y: 10),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Tanggal Created and by align right
|
|
||||||
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'created : ' +
|
|
||||||
formatDateString(
|
|
||||||
listTransaksiHome
|
|
||||||
.value[idx]
|
|
||||||
.tanggalcreated
|
|
||||||
.toString(),
|
|
||||||
),
|
|
||||||
overflow:
|
|
||||||
TextOverflow.ellipsis,
|
|
||||||
style: Constant.body1(
|
|
||||||
context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.normal,
|
|
||||||
fontStyle: FontStyle.italic,
|
|
||||||
color: Constant.textBlack,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
child: Text(
|
|
||||||
' by : ' +
|
|
||||||
listTransaksiHome
|
|
||||||
.value[idx]
|
|
||||||
.usertransaksi
|
|
||||||
.toString(),
|
|
||||||
overflow:
|
|
||||||
TextOverflow.ellipsis,
|
|
||||||
style: Constant.body1(
|
|
||||||
context: context)
|
|
||||||
.copyWith(
|
|
||||||
fontWeight:
|
|
||||||
FontWeight.normal,
|
|
||||||
fontStyle:
|
|
||||||
FontStyle.italic,
|
|
||||||
color: Constant
|
|
||||||
.pcBtnBackgroundColor,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
final tglAkhirTmp = useState<String>("");
|
final tglAkhirTmp = useState<String>("");
|
||||||
String M_CompanyID = "0";
|
String M_CompanyID = "0";
|
||||||
|
|
||||||
String timeStamp = DateFormat('dd-MM-yyyy').format(
|
|
||||||
DateTime.now(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<String> getCompanyID() async {
|
Future<String> getCompanyID() async {
|
||||||
final shared = await SharedPreferences.getInstance();
|
final shared = await SharedPreferences.getInstance();
|
||||||
String M_CompanyID = "0";
|
String M_CompanyID = "0";
|
||||||
@@ -86,207 +82,226 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
drawer: CustomDrawer(),
|
drawer: CustomDrawer(),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.all(20),
|
child: Padding(
|
||||||
child: Column(
|
padding: EdgeInsets.all(20),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(
|
children: [
|
||||||
'Tanggal Awal',
|
Text(
|
||||||
style: Constant.body1(context: context).copyWith(
|
'Tanggal Awal',
|
||||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
style: Constant.body1(context: context).copyWith(
|
||||||
),
|
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||||
SizedBox(
|
),
|
||||||
height: Constant.getActualYPhone(context: context, y: 10),
|
SizedBox(
|
||||||
),
|
height: Constant.getActualYPhone(context: context, y: 10),
|
||||||
// Tanggal Awal
|
),
|
||||||
Row(
|
// Tanggal Awal
|
||||||
children: [
|
Row(
|
||||||
Expanded(
|
children: [
|
||||||
child: TextField(
|
Expanded(
|
||||||
controller: ctrlTglAwal,
|
child: TextField(
|
||||||
decoration: InputDecoration(
|
controller: ctrlTglAwal,
|
||||||
hintStyle:
|
decoration: InputDecoration(
|
||||||
Constant.body2_400(context: context).copyWith(
|
hintStyle:
|
||||||
color: Colors.orange,
|
Constant.body2_400(context: context).copyWith(
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Colors.orange,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
width: 1,
|
|
||||||
),
|
),
|
||||||
),
|
labelStyle:
|
||||||
focusedBorder: OutlineInputBorder(
|
Constant.body2_400(context: context).copyWith(
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
width: 1,
|
|
||||||
),
|
),
|
||||||
|
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,
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
// labelText: "Tanggal Awal",
|
onTap: () async {
|
||||||
hintText: 'Tanggal Awal',
|
final selectedDateAwal = await showDatePicker(
|
||||||
// suffixIcon: isLoadingFilterScope.value
|
// locale: const Locale("en-CA"),
|
||||||
// ? SizedBox(
|
// locale: ,
|
||||||
// width: Constant.getActualXPhone(
|
context: context,
|
||||||
// context: context,
|
initialEntryMode:
|
||||||
// x: 4,
|
DatePickerEntryMode.calendarOnly,
|
||||||
// ),
|
firstDate: DateTime(2000),
|
||||||
// height: Constant.getActualYPhone(
|
lastDate: DateTime(2100),
|
||||||
// context: context,
|
|
||||||
// y: 4,
|
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||||
// ),
|
? DateTime.now()
|
||||||
// child: CircularProgressIndicator(
|
: tglAwal.value,
|
||||||
// color: Constant.textRed,
|
);
|
||||||
// ),
|
|
||||||
// )
|
if (selectedDateAwal != null) {
|
||||||
// : Icon(
|
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||||
// Icons.calendar_month_sharp,
|
.format(selectedDateAwal);
|
||||||
// color: Constant.colorIconDate,
|
// ctrlTglAwal.text =
|
||||||
// ),
|
// selectedDateAwal.toString().split(' ')[0];
|
||||||
|
ctrlTglAwal.text = formattedDate;
|
||||||
|
tglAwal.value = selectedDateAwal;
|
||||||
|
tglAwalTmp.value = selectedDateAwal.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedDateAwal == null) {
|
||||||
|
print('cancel button');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
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(
|
SizedBox(
|
||||||
height: Constant.getActualYPhone(context: context, y: 20),
|
height: Constant.getActualYPhone(context: context, y: 20),
|
||||||
),
|
),
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
'Tanggal Akhir',
|
'Tanggal Akhir',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Constant.getActualYPhone(context: context, y: 10),
|
height: Constant.getActualYPhone(context: context, y: 10),
|
||||||
),
|
),
|
||||||
// Tanggal Akhir
|
// Tanggal Akhir
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: ctrlTglAkhir,
|
controller: ctrlTglAkhir,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintStyle:
|
hintStyle:
|
||||||
Constant.body2_400(context: context).copyWith(
|
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,
|
color: Colors.orange,
|
||||||
width: 1,
|
|
||||||
),
|
),
|
||||||
),
|
labelStyle:
|
||||||
focusedBorder: OutlineInputBorder(
|
Constant.body2_400(context: context).copyWith(
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
width: 1,
|
|
||||||
),
|
),
|
||||||
|
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,
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
// labelText: "Tanggal Awal",
|
onTap: () async {
|
||||||
hintText: 'Tanggal Akhir',
|
final selectedDateAkhir = await showDatePicker(
|
||||||
// suffixIcon: isLoadingFilterScope.value
|
// locale: const Locale("en-CA"),
|
||||||
// ? SizedBox(
|
// locale: ,
|
||||||
// width: Constant.getActualXPhone(
|
context: context,
|
||||||
// context: context,
|
initialEntryMode:
|
||||||
// x: 4,
|
DatePickerEntryMode.calendarOnly,
|
||||||
// ),
|
firstDate: DateTime(2000),
|
||||||
// height: Constant.getActualYPhone(
|
lastDate: DateTime(2100),
|
||||||
// context: context,
|
|
||||||
// y: 4,
|
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||||
// ),
|
? DateTime.now()
|
||||||
// child: CircularProgressIndicator(
|
: tglAkhir.value,
|
||||||
// color: Constant.textRed,
|
);
|
||||||
// ),
|
|
||||||
// )
|
if (selectedDateAkhir != null) {
|
||||||
// : Icon(
|
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||||
// Icons.calendar_month_sharp,
|
.format(selectedDateAkhir);
|
||||||
// color: Constant.colorIconDate,
|
// ctrlTglAkhir.text =
|
||||||
// ),
|
// selectedDateAkhir.toString().split(' ')[0];
|
||||||
|
ctrlTglAkhir.text = formattedDate;
|
||||||
|
tglAkhir.value = selectedDateAkhir;
|
||||||
|
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedDateAkhir == null) {
|
||||||
|
print('cancel button');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
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,
|
bottomNavigationBar: BottomAppBar(
|
||||||
children: [
|
height: 150,
|
||||||
ElevatedButton(
|
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(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(states) => Colors.white),
|
(states) => Colors.white),
|
||||||
// side: MaterialStateBorderSide.resolveWith(
|
// side: MaterialStateBorderSide.resolveWith(
|
||||||
// (states) => BorderSide(color: Colors.green),
|
// (states) => BorderSide(color: Colors.green),
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
// backgroundColor: MaterialStateColor.resolveWith(
|
// backgroundColor: MaterialStateColor.resolveWith(
|
||||||
// (st) => Constant.pcBtnBackgroundColor),
|
// (st) => Constant.pcBtnBackgroundColor),
|
||||||
shape:
|
shape:
|
||||||
@@ -318,11 +333,11 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: Constant.getActualXPhone(
|
height: Constant.getActualXPhone(
|
||||||
context: context, x: 10),
|
context: context, x: 8),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Excel',
|
'Download Report (xls) ',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
@@ -330,42 +345,19 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () {},
|
||||||
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(
|
|
||||||
ctrlTglAkhir.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&tm=$timeStamp";
|
|
||||||
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
|
SizedBox(
|
||||||
ElevatedButton(
|
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(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(st) => Constant.pcBtnBackgroundColor),
|
(st) => Constant.pcBtnBackgroundColor),
|
||||||
@@ -398,11 +390,11 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: Constant.getActualXPhone(
|
height: Constant.getActualXPhone(
|
||||||
context: context, x: 8),
|
context: context, x: 8),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'PDF',
|
'Download Report (PDF)',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Constant.white),
|
color: Constant.white),
|
||||||
@@ -410,32 +402,7 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
M_CompanyID = await getCompanyID();
|
String url = "https://pub.dev/packages?q=url+launcher";
|
||||||
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(
|
|
||||||
ctrlTglAkhir.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&tm=$timeStamp";
|
|
||||||
|
|
||||||
print(url);
|
|
||||||
if (!await launchUrl(Uri.parse(url))) {
|
if (!await launchUrl(Uri.parse(url))) {
|
||||||
// throw Exception('Could not launch $url');
|
// throw Exception('Could not launch $url');
|
||||||
SanckbarWidget(context, 'Could not launch $url',
|
SanckbarWidget(context, 'Could not launch $url',
|
||||||
@@ -443,9 +410,9 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
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,79 +0,0 @@
|
|||||||
import 'package:app_petty_cash/model/history_total_model.dart';
|
|
||||||
import 'package:app_petty_cash/provider/current_info_account_balance_provider.dart';
|
|
||||||
import 'package:app_petty_cash/repository/home_repository.dart';
|
|
||||||
import 'package:app_petty_cash/repository/transaksi_repository.dart';
|
|
||||||
import 'package:equatable/equatable.dart';
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
|
|
||||||
import '../../model/info_account_balance.dart';
|
|
||||||
import '../../provider/dio_provider.dart';
|
|
||||||
import '../../repository/base_repository.dart';
|
|
||||||
|
|
||||||
abstract class HistoryTotalState extends Equatable {
|
|
||||||
final DateTime date;
|
|
||||||
const HistoryTotalState(this.date);
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [date];
|
|
||||||
}
|
|
||||||
|
|
||||||
class HistoryTotalStateInit extends HistoryTotalState {
|
|
||||||
HistoryTotalStateInit() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class HistoryTotalStateLoading extends HistoryTotalState {
|
|
||||||
HistoryTotalStateLoading() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class HistoryTotalStateError extends HistoryTotalState {
|
|
||||||
final String message;
|
|
||||||
HistoryTotalStateError({
|
|
||||||
required this.message,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class HistoryTotalStateDone extends HistoryTotalState {
|
|
||||||
final HistoryTotalModel model;
|
|
||||||
// final String resp;
|
|
||||||
HistoryTotalStateDone({
|
|
||||||
required this.model,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
//notifier
|
|
||||||
class HistoryTotalNotifier extends StateNotifier<HistoryTotalState> {
|
|
||||||
final Ref ref;
|
|
||||||
HistoryTotalNotifier({
|
|
||||||
required this.ref,
|
|
||||||
}) : super(HistoryTotalStateInit());
|
|
||||||
|
|
||||||
void historyTotal(
|
|
||||||
String companyid,
|
|
||||||
String tglAwal,
|
|
||||||
String tglAkhir,
|
|
||||||
String categoryid,
|
|
||||||
) async {
|
|
||||||
try {
|
|
||||||
state = HistoryTotalStateLoading();
|
|
||||||
final dio = ref.read(dioProvider);
|
|
||||||
final resp = await TransaksiRepository(dio: dio).getHistoryTotal(
|
|
||||||
companyid,
|
|
||||||
tglAwal,
|
|
||||||
tglAkhir,
|
|
||||||
categoryid
|
|
||||||
);
|
|
||||||
state = HistoryTotalStateDone(model: resp);
|
|
||||||
} catch (e) {
|
|
||||||
if (e is BaseRepositoryException) {
|
|
||||||
state = HistoryTotalStateError(message: e.message.toString());
|
|
||||||
} else {
|
|
||||||
state = HistoryTotalStateError(message: e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//provider
|
|
||||||
final historyTotalProvider =
|
|
||||||
StateNotifierProvider<HistoryTotalNotifier, HistoryTotalState>(
|
|
||||||
(ref) => HistoryTotalNotifier(ref: ref),
|
|
||||||
);
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@ import '../../model/history_transaksi_model.dart';
|
|||||||
import '../../repository/transaksi_repository.dart';
|
import '../../repository/transaksi_repository.dart';
|
||||||
import '../../provider/dio_provider.dart';
|
import '../../provider/dio_provider.dart';
|
||||||
import '../../repository/base_repository.dart';
|
import '../../repository/base_repository.dart';
|
||||||
import 'history_total_provider.dart';
|
|
||||||
|
|
||||||
abstract class SearchHistoryTransaksiState extends Equatable {
|
abstract class SearchHistoryTransaksiState extends Equatable {
|
||||||
final DateTime date;
|
final DateTime date;
|
||||||
@@ -48,26 +47,18 @@ class SearchHistoryTransaksiNotifier
|
|||||||
String companyid,
|
String companyid,
|
||||||
String tglAwal,
|
String tglAwal,
|
||||||
String tglAkhir,
|
String tglAkhir,
|
||||||
String categoryid,
|
String categoryid,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
state = SearchHistoryTransaksiStateLoading();
|
state = SearchHistoryTransaksiStateLoading();
|
||||||
final dio = ref.read(dioProvider);
|
final dio = ref.read(dioProvider);
|
||||||
final resp = await TransaksiRepository(dio: dio).getListHistoryTransaksi(
|
final resp = await TransaksiRepository(dio: dio).getListHistoryTransaksi(
|
||||||
companyid,
|
companyid,
|
||||||
tglAwal,
|
tglAwal,
|
||||||
tglAkhir,
|
tglAkhir,
|
||||||
categoryid,
|
categoryid,
|
||||||
);
|
);
|
||||||
state = SearchHistoryTransaksiStateDone(model: resp);
|
state = SearchHistoryTransaksiStateDone(model: resp);
|
||||||
|
|
||||||
// panggil provider total transaksi by category for non all
|
|
||||||
ref.read(historyTotalProvider.notifier).historyTotal(
|
|
||||||
companyid,
|
|
||||||
tglAwal,
|
|
||||||
tglAkhir,
|
|
||||||
categoryid,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e is BaseRepositoryException) {
|
if (e is BaseRepositoryException) {
|
||||||
state = SearchHistoryTransaksiStateError(message: e.message.toString());
|
state = SearchHistoryTransaksiStateError(message: e.message.toString());
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ import 'package:intl/intl.dart';
|
|||||||
|
|
||||||
import '../../app/constant.dart';
|
import '../../app/constant.dart';
|
||||||
import '../../model/list_category_model.dart';
|
import '../../model/list_category_model.dart';
|
||||||
import '../../provider/current_menu_provider.dart';
|
|
||||||
import '../../provider/current_user_provider.dart';
|
import '../../provider/current_user_provider.dart';
|
||||||
import '../../widget/custom_drawer.dart';
|
import '../../widget/custom_drawer.dart';
|
||||||
import '../../widget/sankbar_widget.dart';
|
import '../../widget/sankbar_widget.dart';
|
||||||
|
|
||||||
import 'package:image/image.dart' as img;
|
|
||||||
|
|
||||||
class DummyDropdownTipe {
|
class DummyDropdownTipe {
|
||||||
final String options;
|
final String options;
|
||||||
final int id;
|
final int id;
|
||||||
@@ -154,8 +151,6 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
'Data Berhasil Disimpan',
|
'Data Berhasil Disimpan',
|
||||||
snackbarType.success,
|
snackbarType.success,
|
||||||
);
|
);
|
||||||
// diupdate ke menu home jika sukses
|
|
||||||
ref.read(currentPageProvider.notifier).update((state) => 0);
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pushNamed(homeRoute);
|
Navigator.of(context).pushNamed(homeRoute);
|
||||||
}
|
}
|
||||||
@@ -199,23 +194,6 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
final userIDLogin = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
final userIDLogin = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
||||||
|
|
||||||
getBase64_v1() async {
|
|
||||||
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
|
||||||
if (fileData.value != null) {
|
|
||||||
final bytes = io.File(fileData.value!.path).readAsBytesSync();
|
|
||||||
String base64Image = base64Encode(await fileData.value!.readAsBytes());
|
|
||||||
fileDataBase64.value = base64Image;
|
|
||||||
final file = File(fileData.value!.path);
|
|
||||||
print(file.lengthSync() / 1000000);
|
|
||||||
print(await fileData.value!.length());
|
|
||||||
fileSize.value = await fileData.value!.length();
|
|
||||||
|
|
||||||
// await getExternalStorageDirectory();
|
|
||||||
// print(await fileData.value!.saveTo(path));
|
|
||||||
print(fileDataBase64.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getBase64() async {
|
getBase64() async {
|
||||||
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
||||||
if (fileData.value != null) {
|
if (fileData.value != null) {
|
||||||
@@ -223,7 +201,6 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
String base64Image = base64Encode(await fileData.value!.readAsBytes());
|
String base64Image = base64Encode(await fileData.value!.readAsBytes());
|
||||||
fileDataBase64.value = base64Image;
|
fileDataBase64.value = base64Image;
|
||||||
final file = File(fileData.value!.path);
|
final file = File(fileData.value!.path);
|
||||||
|
|
||||||
print(file.lengthSync() / 1000000);
|
print(file.lengthSync() / 1000000);
|
||||||
print(await fileData.value!.length());
|
print(await fileData.value!.length());
|
||||||
fileSize.value = await fileData.value!.length();
|
fileSize.value = await fileData.value!.length();
|
||||||
@@ -237,11 +214,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
final ImagePicker _picker = ImagePicker();
|
final ImagePicker _picker = ImagePicker();
|
||||||
pickImage() async {
|
pickImage() async {
|
||||||
final XFile? pickedFile = await _picker.pickImage(
|
final XFile? pickedFile = await _picker.pickImage(
|
||||||
source: ImageSource.camera,
|
source: ImageSource.camera,
|
||||||
// maxWidth set untuk width image
|
);
|
||||||
maxWidth: 640,
|
|
||||||
// maxHeight set untuk width image
|
|
||||||
maxHeight: 480);
|
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
final tmpFile = FilePickerResult([
|
final tmpFile = FilePickerResult([
|
||||||
PlatformFile(
|
PlatformFile(
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class TransaksiSelectKategoriWidget extends StatelessWidget {
|
|||||||
value: option,
|
value: option,
|
||||||
child: Text(
|
child: Text(
|
||||||
option.categoryname ?? "",
|
option.categoryname ?? "",
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
color: Constant.textBlack, fontWeight: FontWeight.w400),
|
color: Constant.textBlack, fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -91,247 +91,248 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
|
|
||||||
final currentMenu = ref.read(currentPageProvider);
|
final currentMenu = ref.read(currentPageProvider);
|
||||||
|
|
||||||
return Container(
|
return Drawer(
|
||||||
width: Constant.getActualXPhone(context: context, x: 300),
|
elevation: 0,
|
||||||
height: Constant.getActualYPhone(context: context, y: 844),
|
shape: RoundedRectangleBorder(
|
||||||
child: Drawer(
|
borderRadius: BorderRadius.all(Radius.circular(0))),
|
||||||
elevation: 0,
|
child: Container(
|
||||||
shape: RoundedRectangleBorder(
|
child: ListView(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(0))),
|
// padding: EdgeInsets.only(
|
||||||
child: Column(
|
// top: Constant.getActualYPhone(context: context, y: 10),
|
||||||
|
// ),
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Container(
|
||||||
child: ListView(
|
// decoration: BoxDecoration(
|
||||||
children: [
|
// border: Border(bottom: BorderSide(color: Colors.transparent)) // <--- use the global theme to change the dividerColor property
|
||||||
Container(
|
// ),
|
||||||
child: Image(
|
child: Image(
|
||||||
image:
|
image: AssetImage('images/logo_sismedika_landscape.png')),
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 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.account_balance,
|
|
||||||
color: (currentMenu == 4)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'Change Company',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 4)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to Transaksi screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 4);
|
|
||||||
Navigator.pushNamed(context, changeCompanyRoute);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(
|
|
||||||
Icons.lock_reset,
|
|
||||||
color: (currentMenu == 5)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'Change Password',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 5)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to Transaksi screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 5);
|
|
||||||
Navigator.pushNamed(context, changePasswordRoute);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
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
|
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 8),
|
||||||
|
),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
top: Constant.getActualYPhone(context: context, y: 10),
|
||||||
bottom: 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: Align(
|
child: Container(
|
||||||
alignment: Alignment.bottomRight,
|
width: Constant.getActualXPhone(context: context, x: 300),
|
||||||
child: Text(
|
),
|
||||||
'Versi ${Constant.version}',
|
),
|
||||||
style: Constant.titleH4Login(context: context)
|
|
||||||
.copyWith(color: Constant.textGrey),
|
// 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: () {},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,341 +0,0 @@
|
|||||||
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: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -211,6 +211,71 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
Radius.circular(8.0),
|
Radius.circular(8.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// child: Text('s'),
|
||||||
|
// child: FutureBuilder<Widget>(
|
||||||
|
// future: checkFileExistence(
|
||||||
|
// 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg',
|
||||||
|
// ),
|
||||||
|
// builder: (context, snapshot) {
|
||||||
|
// // if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
// // // return CircularProgressIndicator();
|
||||||
|
// // return Text('');
|
||||||
|
// // } else if (snapshot.hasError) {
|
||||||
|
// // return Icon(
|
||||||
|
// // Icons.error,
|
||||||
|
// // color: Colors.red,
|
||||||
|
// // );
|
||||||
|
// // } else {
|
||||||
|
// // return snapshot.data ?? Container();
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
// return snapshot.data ?? Container();
|
||||||
|
// } else if (snapshot.hasError) {
|
||||||
|
// return Icon(
|
||||||
|
// Icons.error,
|
||||||
|
// color: Colors.red,
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// return Text('');
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// child: Consumer(
|
||||||
|
// builder: (context, watch, child) {
|
||||||
|
// String iconUrl =
|
||||||
|
// 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg';
|
||||||
|
// final iconAsyncValue = ref.read(
|
||||||
|
// iconProvider(
|
||||||
|
// iconUrl,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// return iconAsyncValue.when(
|
||||||
|
// loading: () {
|
||||||
|
// print('loading iconurl : $iconUrl');
|
||||||
|
// return CircularProgressIndicator();
|
||||||
|
// },
|
||||||
|
// error: (error, stackTrace) {
|
||||||
|
// print('error iconurl : $iconUrl');
|
||||||
|
// return Icon(
|
||||||
|
// Icons.error,
|
||||||
|
// color: Colors.red,
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// data: (iconWidget) {
|
||||||
|
// print('data iconurl : $iconUrl');
|
||||||
|
// return iconWidget ?? Container();
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// child: SvgPicture.network(
|
||||||
|
// 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg',
|
||||||
|
// semanticsLabel: 'Icon pizza',
|
||||||
|
// ),
|
||||||
|
|
||||||
child: getIconUrl(icon_category_id),
|
child: getIconUrl(icon_category_id),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.1"
|
version: "1.18.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -278,14 +278,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.4"
|
||||||
flutter_share:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_share
|
|
||||||
sha256: ae12c1cea13b35926a109824ffac601531e40cb94ad53eeae58625eceb3eaaaa
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.0"
|
|
||||||
flutter_svg:
|
flutter_svg:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -337,7 +329,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
image:
|
image:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
||||||
@@ -444,26 +436,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
|
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.15"
|
version: "0.12.16"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.5.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.10.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -697,18 +689,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.10.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.0"
|
version: "1.11.1"
|
||||||
state_notifier:
|
state_notifier:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -721,10 +713,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -745,10 +737,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
|
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.1"
|
version: "0.6.1"
|
||||||
top_snackbar_flutter:
|
top_snackbar_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -901,14 +893,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.17"
|
version: "2.0.17"
|
||||||
whatsapp_share:
|
web:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: whatsapp_share
|
name: web
|
||||||
sha256: d1884f302a52d9f400bc3d7d4274b77aad83424e08f425351cea8d13b4cb8649
|
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "0.3.0"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -942,5 +934,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.0.6 <4.0.0"
|
dart: ">=3.2.0-194.0.dev <4.0.0"
|
||||||
flutter: ">=3.10.0"
|
flutter: ">=3.10.0"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.2.0
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.6 <4.0.0'
|
sdk: '>=3.0.6 <4.0.0'
|
||||||
@@ -58,9 +58,6 @@ dependencies:
|
|||||||
photo_view: ^0.14.0
|
photo_view: ^0.14.0
|
||||||
mime: ^1.0.4
|
mime: ^1.0.4
|
||||||
path_provider: ^2.1.2
|
path_provider: ^2.1.2
|
||||||
flutter_share: ^2.0.0
|
|
||||||
whatsapp_share: ^2.0.2
|
|
||||||
image: ^4.1.4
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user