5 Commits

Author SHA1 Message Date
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 66 additions and 378 deletions

View File

@@ -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.1.5";
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/"; // 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 '../screen/change_company/change_company.dart';
import 'package:app_petty_cash/screen/camera/coba_camera.dart'; 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';
@@ -21,6 +22,7 @@ const transaksiRoute = "/transaksiRoute";
const userRoute = "/userRoute"; const userRoute = "/userRoute";
const reportRoute = "/reportRoute"; const reportRoute = "/reportRoute";
const changeCompanyRoute = "/changeCompanyRoute"; const changeCompanyRoute = "/changeCompanyRoute";
const changePasswordRoute = "/changePasswordRoute";
const historyTransaksiRoute = "/historyTransaksiRoute"; const historyTransaksiRoute = "/historyTransaksiRoute";
const cameraExampleRoute = "/cameraExampleRoute"; const cameraExampleRoute = "/cameraExampleRoute";
const cobaCameraRoute = "/cobaCameraRoute"; const cobaCameraRoute = "/cobaCameraRoute";
@@ -28,24 +30,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) {
@@ -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 // test file picker screen
if (settings.name == testFilePickerRoute) { 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,53 +59,14 @@ 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({ Future<String> changePassword({
required String userID, required String userID,
required String token, required String token,
required String tokenx,
required String oldPassword, required String oldPassword,
required String newPassword, required String newPassword,
required String confirmPassword, required String confirmPassword,
}) async { }) async {
final param = { final param = {
"tokenx": tokenx,
"token": token, "token": token,
"M_UserID": userID, "M_UserID": userID,
"old_password": oldPassword, "old_password": oldPassword,

View File

@@ -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';
@@ -217,33 +216,4 @@ class TransaksiRepository extends BaseRepository {
return resp['status']; 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

@@ -40,6 +40,7 @@ class ChangePasswordStateDone extends ChangePasswordState {
}) : super(DateTime.now()); }) : super(DateTime.now());
} }
//notifier //notifier
class ChangePasswordNotifier extends StateNotifier<ChangePasswordState> { class ChangePasswordNotifier extends StateNotifier<ChangePasswordState> {
final Ref ref; final Ref ref;
@@ -50,21 +51,16 @@ class ChangePasswordNotifier extends StateNotifier<ChangePasswordState> {
void postChangePassword({ void postChangePassword({
required String userID, required String userID,
required String userToken, required String userToken,
required String userTokenx,
required String oldPassword, required String oldPassword,
required String newPassword, required String newPassword,
required String confirmPassword, required String confirmPassword,
}) async {
}) async {
try { try {
state = ChangePasswordStateLoading(); state = ChangePasswordStateLoading();
final dio = ref.read(dioProvider); final dio = ref.read(dioProvider);
final resp = await AuthRepository(dio: dio).changePassword( final resp =
userID: userID, await AuthRepository(dio: dio).changePassword(userID: userID,token: userToken, oldPassword: oldPassword, newPassword: newPassword, confirmPassword: confirmPassword);
tokenx: userTokenx,
token: userToken,
oldPassword: oldPassword,
newPassword: newPassword,
confirmPassword: confirmPassword);
state = ChangePasswordStateDone(model: resp); state = ChangePasswordStateDone(model: resp);
} catch (e) { } catch (e) {
if (e is BaseRepositoryException) { if (e is BaseRepositoryException) {

View File

@@ -1,4 +1,9 @@
import 'dart:async';
import 'package:app_petty_cash/app/constant.dart'; 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/custom_drawer.dart';
import 'package:app_petty_cash/widget/sankbar_widget.dart'; import 'package:app_petty_cash/widget/sankbar_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -8,7 +13,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import '../../app/route.dart'; import '../../app/route.dart';
import '../../provider/current_user_provider.dart'; import '../../provider/current_user_provider.dart';
import 'change_password_provider.dart';
class ChangePasswordScreen extends HookConsumerWidget { class ChangePasswordScreen extends HookConsumerWidget {
const ChangePasswordScreen({super.key}); const ChangePasswordScreen({super.key});
@@ -19,14 +23,9 @@ class ChangePasswordScreen extends HookConsumerWidget {
//menampung user token jika ada //menampung user token jika ada
final userToken = ref.read(currentUserProvider)?.token ?? ""; final userToken = ref.read(currentUserProvider)?.token ?? "";
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0"; final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
final tokenx = ref.read(currentUserProvider)?.token ?? "";
final isLoading = useState(false); final isLoading = useState(false);
final obscureText = useState<bool>(true);
final obscureTextOldPassword = useState<bool>(true);
final obscureTextNewPassword = useState<bool>(true);
final obscureTextConfirmPassword = useState<bool>(true);
final ctrlOldPassword = useTextEditingController(text: ""); final ctrlOldPassword = useTextEditingController(text: "");
final ctrlNewPassword = useTextEditingController(text: ""); final ctrlNewPassword = useTextEditingController(text: "");
final ctrlConfirmPassword = useTextEditingController(text: ""); final ctrlConfirmPassword = useTextEditingController(text: "");
@@ -47,8 +46,6 @@ class ChangePasswordScreen extends HookConsumerWidget {
}); });
return () {}; return () {};
}, []); }, []);
// fungsi logout
Logout() async { Logout() async {
final shared = await SharedPreferences.getInstance(); final shared = await SharedPreferences.getInstance();
final bearerString = shared.get(Constant.bearerName).toString(); final bearerString = shared.get(Constant.bearerName).toString();
@@ -136,18 +133,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20), right: Constant.getActualXPhone(context: context, x: 20),
), ),
child: TextField( child: TextField(
obscureText: obscureTextOldPassword.value, obscureText: obscureText.value,
controller: ctrlOldPassword, controller: ctrlOldPassword,
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
obscureTextOldPassword.value obscureText.value
? Icons.visibility ? Icons.visibility
: Icons.visibility_off, : Icons.visibility_off,
color: Constant.textGreyv2, color: Constant.textGreyv2,
), ),
onPressed: () { onPressed: () {
obscureTextOldPassword.value = !obscureTextOldPassword.value; obscureText.value = !obscureText.value;
}, },
), ),
hintStyle: hintStyle:
@@ -206,18 +203,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20), right: Constant.getActualXPhone(context: context, x: 20),
), ),
child: TextField( child: TextField(
obscureText: obscureTextNewPassword.value, obscureText: obscureText.value,
controller: ctrlNewPassword, controller: ctrlNewPassword,
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
obscureTextNewPassword.value obscureText.value
? Icons.visibility ? Icons.visibility
: Icons.visibility_off, : Icons.visibility_off,
color: Constant.textGreyv2, color: Constant.textGreyv2,
), ),
onPressed: () { onPressed: () {
obscureTextNewPassword.value = !obscureTextNewPassword.value; obscureText.value = !obscureText.value;
}, },
), ),
hintStyle: hintStyle:
@@ -278,18 +275,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
right: Constant.getActualXPhone(context: context, x: 20), right: Constant.getActualXPhone(context: context, x: 20),
), ),
child: TextField( child: TextField(
obscureText: obscureTextConfirmPassword.value, obscureText: obscureText.value,
controller: ctrlConfirmPassword, controller: ctrlConfirmPassword,
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
obscureTextConfirmPassword.value obscureText.value
? Icons.visibility ? Icons.visibility
: Icons.visibility_off, : Icons.visibility_off,
color: Constant.textGreyv2, color: Constant.textGreyv2,
), ),
onPressed: () { onPressed: () {
obscureTextConfirmPassword.value = !obscureTextConfirmPassword.value; obscureText.value = !obscureText.value;
}, },
), ),
hintStyle: hintStyle:
@@ -360,7 +357,6 @@ class ChangePasswordScreen extends HookConsumerWidget {
ref ref
.read(ChangePasswordProvider.notifier) .read(ChangePasswordProvider.notifier)
.postChangePassword( .postChangePassword(
userTokenx: tokenx,
userToken: userToken, userToken: userToken,
userID: userID, userID: userID,
oldPassword: ctrlOldPassword.text, oldPassword: ctrlOldPassword.text,

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 '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/confirm_transaksi_provider.dart';
import 'package:app_petty_cash/screen/transaksi/delete_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:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -19,7 +17,6 @@ import '../../app/route.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 '../../model/list_type_model.dart'; import '../../model/list_type_model.dart';
import '../../provider/current_total_history_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/field_row_history_transaksi.dart'; import '../../widget/field_row_history_transaksi.dart';
@@ -67,8 +64,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
), ),
); );
final historyTotalLoading = useState(false);
// A. LISTEN PROVIDER // A. LISTEN PROVIDER
// type // 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 // delete transaksi
ref.listen( ref.listen(
deleteTransaksiProvider, 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) (searchHistoryIsLoading.value)
? Center( ? Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),

View File

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

View File

@@ -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(

View File

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

View File

@@ -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:
@@ -337,7 +337,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 +444,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 +697,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 +721,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 +745,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:
@@ -942,5 +942,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"

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