6 Commits

Author SHA1 Message Date
Stephen
d3e455c371 [Change Pass] 4. revisi pemberian token ke BE 2024-01-21 13:05:58 +07:00
Stephen
6b28794577 Merge branch 'main' into add_change_password 2024-01-19 15:11:39 +07:00
Stephen
81733ec865 [Change Pass] 3. mengubah styling password input 2024-01-19 15:07:58 +07:00
Stephen
9d9db9eeb4 [Change Pass] 2. merge with main 2024-01-19 14:45:31 +07:00
Stephen
acc42c2d8f Merge branch 'main' into add_change_password 2024-01-19 14:44:33 +07:00
Stephen
f03266674a [Change Pass] 1. add Change Password Fiture 2024-01-19 14:44:20 +07:00
15 changed files with 68 additions and 364 deletions

View File

@@ -13,7 +13,7 @@ class Constant {
// static String version = "1.00";
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
static String version = "1.2.0";
static String version = "1.1.5";
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";

View File

@@ -1,9 +1,10 @@
import 'package:app_petty_cash/screen/change_pasword/change_password_screen.dart';
import '../screen/change_company/change_company.dart';
import 'package:app_petty_cash/screen/camera/coba_camera.dart';
import 'package:app_petty_cash/screen/camera/example.dart';
import 'package:flutter/material.dart';
import '../screen/change_password/change_password_screen.dart';
import '../screen/home/home_screen.dart';
import '../screen/transaksi/history_transaksi_screen.dart';
import '../screen/transaksi/transaksi_screen.dart';
@@ -21,6 +22,7 @@ const transaksiRoute = "/transaksiRoute";
const userRoute = "/userRoute";
const reportRoute = "/reportRoute";
const changeCompanyRoute = "/changeCompanyRoute";
const changePasswordRoute = "/changePasswordRoute";
const historyTransaksiRoute = "/historyTransaksiRoute";
const cameraExampleRoute = "/cameraExampleRoute";
const cobaCameraRoute = "/cobaCameraRoute";
@@ -28,24 +30,8 @@ const cobaCameraRoute = "/cobaCameraRoute";
// test screen
const testFilePickerRoute = "/testFilePickerRoute";
const changePasswordRoute = "/changePasswordRoute";
class AppRoute {
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
if (settings.name == splashScreen) {
return MaterialPageRoute(builder: (context) {
@@ -136,6 +122,18 @@ class AppRoute {
);
});
}
// transaksi screen
if (settings.name == changePasswordRoute) {
return MaterialPageRoute(builder: (context) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 1.0,
padding: EdgeInsets.all(0),
),
child: ChangePasswordScreen(),
);
});
}
// test file picker screen
if (settings.name == testFilePickerRoute) {

View File

@@ -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;
}
}

View File

@@ -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",
)),
);

View File

@@ -59,43 +59,6 @@ class AuthRepository extends BaseRepository {
}
}
Future<String> change_password({
required String token,
required String M_UserID,
required String username,
required String doctor_id,
required String new_password,
required String confirm_password,
}) async {
final param = {
"token": token,
"M_UserID": M_UserID,
"username": username,
"doctor_id": doctor_id,
"new_password": new_password,
"confirm_password": confirm_password
// "username": "alhadad",
// "doctor_id": "3101210841",
// "password": "riau123"
};
final service = "${Constant.baseUrlDevone}auth/change_password";
final resp = await post(param: param, service: service);
// final result = AuthModel(
// token: resp["data"]["token"],
// model: AuthDoctorModel.fromJson(resp["data"]["user"]),
// );
// return result;
if (resp["status"] == "OK") {
return resp['message'];
} else {
return resp['message'];
}
}
Future<String> changePassword({
required String userID,
required String token,

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:app_petty_cash/model/list_type_model.dart';
import '../app/constant.dart';
import '../model/history_total_model.dart';
import '../model/history_transaksi_model.dart';
import '../model/list_category_model.dart';
import 'base_repository.dart';
@@ -217,33 +216,4 @@ class TransaksiRepository extends BaseRepository {
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;
}
}

View File

@@ -1,4 +1,9 @@
import 'dart:async';
import 'package:app_petty_cash/app/constant.dart';
import 'package:app_petty_cash/provider/current_menu_provider.dart';
import 'package:app_petty_cash/screen/change_pasword/change_password_provider.dart';
import 'package:app_petty_cash/screen/login/logout_provider.dart';
import 'package:app_petty_cash/widget/custom_drawer.dart';
import 'package:app_petty_cash/widget/sankbar_widget.dart';
import 'package:flutter/material.dart';
@@ -8,7 +13,6 @@ 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});
@@ -22,11 +26,7 @@ class ChangePasswordScreen extends HookConsumerWidget {
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 obscureText = useState<bool>(true);
final ctrlOldPassword = useTextEditingController(text: "");
final ctrlNewPassword = useTextEditingController(text: "");
final ctrlConfirmPassword = useTextEditingController(text: "");
@@ -47,8 +47,6 @@ class ChangePasswordScreen extends HookConsumerWidget {
});
return () {};
}, []);
// fungsi logout
Logout() async {
final shared = await SharedPreferences.getInstance();
final bearerString = shared.get(Constant.bearerName).toString();
@@ -136,18 +134,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20),
),
child: TextField(
obscureText: obscureTextOldPassword.value,
obscureText: obscureText.value,
controller: ctrlOldPassword,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(
obscureTextOldPassword.value
obscureText.value
? Icons.visibility
: Icons.visibility_off,
color: Constant.textGreyv2,
),
onPressed: () {
obscureTextOldPassword.value = !obscureTextOldPassword.value;
obscureText.value = !obscureText.value;
},
),
hintStyle:
@@ -206,18 +204,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20),
),
child: TextField(
obscureText: obscureTextNewPassword.value,
obscureText: obscureText.value,
controller: ctrlNewPassword,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(
obscureTextNewPassword.value
obscureText.value
? Icons.visibility
: Icons.visibility_off,
color: Constant.textGreyv2,
),
onPressed: () {
obscureTextNewPassword.value = !obscureTextNewPassword.value;
obscureText.value = !obscureText.value;
},
),
hintStyle:
@@ -278,18 +276,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20),
),
child: TextField(
obscureText: obscureTextConfirmPassword.value,
obscureText: obscureText.value,
controller: ctrlConfirmPassword,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(
obscureTextConfirmPassword.value
obscureText.value
? Icons.visibility
: Icons.visibility_off,
color: Constant.textGreyv2,
),
onPressed: () {
obscureTextConfirmPassword.value = !obscureTextConfirmPassword.value;
obscureText.value = !obscureText.value;
},
),
hintStyle:
@@ -425,4 +423,4 @@ class ChangePasswordScreen extends HookConsumerWidget {
),
);
}
}
}

View File

@@ -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),
);

View File

@@ -1,9 +1,7 @@
import 'dart:convert';
import 'package:app_petty_cash/model/history_total_model.dart';
import 'package:app_petty_cash/screen/transaksi/confirm_transaksi_provider.dart';
import 'package:app_petty_cash/screen/transaksi/delete_transaksi_provider.dart';
import 'package:app_petty_cash/screen/transaksi/history_total_provider.dart';
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
@@ -19,7 +17,6 @@ import '../../app/route.dart';
import '../../model/history_transaksi_model.dart';
import '../../model/list_category_model.dart';
import '../../model/list_type_model.dart';
import '../../provider/current_total_history_provider.dart';
import '../../provider/current_user_provider.dart';
import '../../widget/custom_drawer.dart';
import '../../widget/field_row_history_transaksi.dart';
@@ -67,8 +64,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
),
);
final historyTotalLoading = useState(false);
// A. LISTEN PROVIDER
// type
@@ -147,29 +142,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
},
);
// read provider info account balance
ref.listen(
historyTotalProvider,
(previous, next) {
if (next is HistoryTotalStateLoading) {
historyTotalLoading.value = true;
} else if (next is HistoryTotalStateError) {
// print(next.message);
historyTotalLoading.value = false;
SanckbarWidget(context, next.message, snackbarType.error);
} else if (next is HistoryTotalStateDone) {
// print(jsonEncode(next.model));
// print(next.model.length);
// infoAccountBalanceObject.value = next.model;
ref.read(currentHistoryTotalProvider.notifier).state =
HistoryTotalModel(
totalAll: next.model.totalAll,
);
historyTotalLoading.value = false;
}
},
);
// delete transaksi
ref.listen(
deleteTransaksiProvider,
@@ -1063,70 +1035,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
// ),
// ),
// Total by Filter Category
if (historyTotalLoading.value)
Center(
child: CircularProgressIndicator(),
),
(selectedListCategory.value.categoryid != "ALL" &&
historyTotalLoading.value == false)
? Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'Kategori Total',
style:
Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Constant.textBlack,
),
),
SizedBox(
width: Constant.getActualXPhone(
context: context,
x: 4,
),
),
Text(
':',
style:
Constant.body1(context: context).copyWith(
fontWeight: FontWeight.w600,
color: Constant.textBlack,
),
),
SizedBox(
width: Constant.getActualXPhone(
context: context,
x: 4,
),
),
Text(
ref
.read(currentHistoryTotalProvider
.notifier)
.state
.totalAll
.toString(),
style: Constant.body1(context: context)
.copyWith(
fontWeight: FontWeight.w600,
color: Constant.pcBtnBackgroundColor,
),
)
],
),
)
: SizedBox.shrink(),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 20),
),
(searchHistoryIsLoading.value)
? Center(
child: CircularProgressIndicator(),

View File

@@ -5,7 +5,6 @@ import '../../model/history_transaksi_model.dart';
import '../../repository/transaksi_repository.dart';
import '../../provider/dio_provider.dart';
import '../../repository/base_repository.dart';
import 'history_total_provider.dart';
abstract class SearchHistoryTransaksiState extends Equatable {
final DateTime date;
@@ -48,26 +47,18 @@ class SearchHistoryTransaksiNotifier
String companyid,
String tglAwal,
String tglAkhir,
String categoryid,
String categoryid,
) async {
try {
state = SearchHistoryTransaksiStateLoading();
final dio = ref.read(dioProvider);
final resp = await TransaksiRepository(dio: dio).getListHistoryTransaksi(
companyid,
tglAwal,
tglAkhir,
categoryid,
companyid,
tglAwal,
tglAkhir,
categoryid,
);
state = SearchHistoryTransaksiStateDone(model: resp);
// panggil provider total transaksi by category for non all
ref.read(historyTotalProvider.notifier).historyTotal(
companyid,
tglAwal,
tglAkhir,
categoryid,
);
} catch (e) {
if (e is BaseRepositoryException) {
state = SearchHistoryTransaksiStateError(message: e.message.toString());

View File

@@ -20,13 +20,10 @@ import 'package:intl/intl.dart';
import '../../app/constant.dart';
import '../../model/list_category_model.dart';
import '../../provider/current_menu_provider.dart';
import '../../provider/current_user_provider.dart';
import '../../widget/custom_drawer.dart';
import '../../widget/sankbar_widget.dart';
import 'package:image/image.dart' as img;
class DummyDropdownTipe {
final String options;
final int id;
@@ -154,8 +151,6 @@ class TransaksiScreen extends HookConsumerWidget {
'Data Berhasil Disimpan',
snackbarType.success,
);
// diupdate ke menu home jika sukses
ref.read(currentPageProvider.notifier).update((state) => 0);
Navigator.of(context).pop();
Navigator.of(context).pushNamed(homeRoute);
}
@@ -199,23 +194,6 @@ class TransaksiScreen extends HookConsumerWidget {
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 {
// List<int> imageBytes = await fileData.value?.readAsBytes();
if (fileData.value != null) {
@@ -223,7 +201,6 @@ class TransaksiScreen extends HookConsumerWidget {
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();
@@ -237,11 +214,8 @@ class TransaksiScreen extends HookConsumerWidget {
final ImagePicker _picker = ImagePicker();
pickImage() async {
final XFile? pickedFile = await _picker.pickImage(
source: ImageSource.camera,
// maxWidth set untuk width image
maxWidth: 640,
// maxHeight set untuk width image
maxHeight: 480);
source: ImageSource.camera,
);
if (pickedFile != null) {
final tmpFile = FilePickerResult([
PlatformFile(

View File

@@ -251,7 +251,7 @@ class CustomDrawer extends HookConsumerWidget {
Navigator.pushNamed(context, reportRoute);
},
),
ListTile(
ListTile(
leading: Icon(
Icons.account_balance,
color: (currentMenu == 4)
@@ -273,7 +273,7 @@ class CustomDrawer extends HookConsumerWidget {
Navigator.pushNamed(context, changeCompanyRoute);
},
),
ListTile(
ListTile(
leading: Icon(
Icons.lock_reset,
color: (currentMenu == 5)

View File

@@ -85,10 +85,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.1"
version: "1.18.0"
convert:
dependency: transitive
description:
@@ -337,7 +337,7 @@ packages:
source: hosted
version: "4.0.2"
image:
dependency: "direct main"
dependency: transitive
description:
name: image
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
@@ -444,26 +444,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.15"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.5.0"
meta:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: "direct main"
description:
@@ -697,18 +697,18 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
state_notifier:
dependency: transitive
description:
@@ -721,10 +721,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -745,10 +745,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.6.1"
top_snackbar_flutter:
dependency: "direct main"
description:
@@ -901,6 +901,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.17"
web:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.3.0"
whatsapp_share:
dependency: "direct main"
description:
@@ -942,5 +950,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.0.6 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.10.0"

View File

@@ -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
# 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.
version: 1.2.0
version: 1.1.5
environment:
sdk: '>=3.0.6 <4.0.0'
@@ -60,7 +60,6 @@ dependencies:
path_provider: ^2.1.2
flutter_share: ^2.0.0
whatsapp_share: ^2.0.2
image: ^4.1.4
dev_dependencies:
flutter_test: