Compare commits
6 Commits
main
...
add_change
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3e455c371 | ||
|
|
6b28794577 | ||
|
|
81733ec865 | ||
|
|
9d9db9eeb4 | ||
|
|
acc42c2d8f | ||
|
|
f03266674a |
@@ -1,3 +1,5 @@
|
|||||||
|
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';
|
||||||
@@ -20,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";
|
||||||
@@ -119,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) {
|
||||||
|
|||||||
@@ -59,35 +59,26 @@ class AuthRepository extends BaseRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> change_password({
|
Future<String> changePassword({
|
||||||
|
required String userID,
|
||||||
required String token,
|
required String token,
|
||||||
required String M_UserID,
|
required String tokenx,
|
||||||
required String username,
|
required String oldPassword,
|
||||||
required String doctor_id,
|
required String newPassword,
|
||||||
required String new_password,
|
required String confirmPassword,
|
||||||
required String confirm_password,
|
|
||||||
}) async {
|
}) async {
|
||||||
final param = {
|
final param = {
|
||||||
|
"tokenx": tokenx,
|
||||||
"token": token,
|
"token": token,
|
||||||
"M_UserID": M_UserID,
|
"M_UserID": userID,
|
||||||
"username": username,
|
"old_password": oldPassword,
|
||||||
"doctor_id": doctor_id,
|
"new_password": newPassword,
|
||||||
"new_password": new_password,
|
"confirm_password": confirmPassword
|
||||||
"confirm_password": confirm_password
|
|
||||||
|
|
||||||
// "username": "alhadad",
|
|
||||||
// "doctor_id": "3101210841",
|
|
||||||
// "password": "riau123"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final service = "${Constant.baseUrlDevone}auth/change_password";
|
final service = "${Constant.baseUrlDevone}auth/change_password";
|
||||||
final resp = await post(param: param, service: service);
|
final resp = await post(param: param, service: service, token: token);
|
||||||
|
|
||||||
// final result = AuthModel(
|
|
||||||
// token: resp["data"]["token"],
|
|
||||||
// model: AuthDoctorModel.fromJson(resp["data"]["user"]),
|
|
||||||
// );
|
|
||||||
// return result;
|
|
||||||
|
|
||||||
if (resp["status"] == "OK") {
|
if (resp["status"] == "OK") {
|
||||||
return resp['message'];
|
return resp['message'];
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
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),
|
||||||
|
);
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
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';
|
||||||
|
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';
|
||||||
|
|
||||||
|
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 obscureText = 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 () {};
|
||||||
|
}, []);
|
||||||
|
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: obscureText.value,
|
||||||
|
controller: ctrlOldPassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
obscureText.value
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Constant.textGreyv2,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
obscureText.value = !obscureText.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: obscureText.value,
|
||||||
|
controller: ctrlNewPassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
obscureText.value
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Constant.textGreyv2,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
obscureText.value = !obscureText.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: obscureText.value,
|
||||||
|
controller: ctrlConfirmPassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
obscureText.value
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Constant.textGreyv2,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
obscureText.value = !obscureText.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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -272,6 +272,28 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
ref.read(currentPageProvider.state).update((state) => 4);
|
ref.read(currentPageProvider.state).update((state) => 4);
|
||||||
Navigator.pushNamed(context, changeCompanyRoute);
|
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(
|
ListTile(
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -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:
|
||||||
@@ -901,6 +901,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.17"
|
version: "2.0.17"
|
||||||
|
web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: web
|
||||||
|
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.0"
|
||||||
whatsapp_share:
|
whatsapp_share:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -942,5 +950,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"
|
||||||
|
|||||||
Reference in New Issue
Block a user