diff --git a/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart b/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart index 6a58a1d..de36712 100644 --- a/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart +++ b/app_petty_cash/lib/screen/change_pasword/change_password_screen.dart @@ -25,6 +25,7 @@ class ChangePasswordScreen extends HookConsumerWidget { final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0"; final isLoading = useState(false); + final obscureText = useState(true); final ctrlOldPassword = useTextEditingController(text: ""); final ctrlNewPassword = useTextEditingController(text: ""); final ctrlConfirmPassword = useTextEditingController(text: ""); @@ -104,8 +105,7 @@ class ChangePasswordScreen extends HookConsumerWidget { height: Constant.getActualYPhone(context: context, y: 844), child: Column( children: [ - //Old Password - // inputan email + //Old password Padding( padding: EdgeInsets.only( // top: Constant.getActualYPhone(context: context, y: 63), @@ -133,10 +133,20 @@ class ChangePasswordScreen extends HookConsumerWidget { right: Constant.getActualXPhone(context: context, x: 20), ), child: TextField( - readOnly: loading.value, + obscureText: obscureText.value, controller: ctrlOldPassword, - obscureText: false, 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, @@ -157,8 +167,8 @@ class ChangePasswordScreen extends HookConsumerWidget { width: 1, ), ), - labelText: "Your Old Password", - hintText: 'Input Your Old Password', + labelText: "OldPassword", + hintText: 'Old Password', ), ), ), @@ -193,10 +203,20 @@ class ChangePasswordScreen extends HookConsumerWidget { right: Constant.getActualXPhone(context: context, x: 20), ), child: TextField( - readOnly: loading.value, + obscureText: obscureText.value, controller: ctrlNewPassword, - obscureText: false, 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, @@ -217,15 +237,17 @@ class ChangePasswordScreen extends HookConsumerWidget { width: 1, ), ), - labelText: "Your New Password", - hintText: 'Input Your New Password', + labelText: "New Password", + hintText: 'New Password', ), ), ), + SizedBox( height: Constant.getActualYPhone(context: context, y: 40), ), - //Confirm Password + + // Confirm password Padding( padding: EdgeInsets.only( // top: Constant.getActualYPhone(context: context, y: 63), @@ -253,10 +275,20 @@ class ChangePasswordScreen extends HookConsumerWidget { right: Constant.getActualXPhone(context: context, x: 20), ), child: TextField( - readOnly: loading.value, + obscureText: obscureText.value, controller: ctrlConfirmPassword, - obscureText: false, 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, @@ -277,15 +309,15 @@ class ChangePasswordScreen extends HookConsumerWidget { width: 1, ), ), - labelText: "Your Confirm Password", - hintText: 'Input Your Confirm Password', + labelText: "Confirm Password", + hintText: 'Confirm Password', ), ), ), - SizedBox( - height: Constant.getActualYPhone(context: context, y: 40), + height: Constant.getActualYPhone(context: context, y: 50), ), + //Button Update Password Padding( padding: EdgeInsets.only( @@ -296,9 +328,6 @@ class ChangePasswordScreen extends HookConsumerWidget { width: Constant.getActualXPhone(context: context, x: 390), height: Constant.getActualYPhone(context: context, y: 50), child: ElevatedButton( - // onPressed: () { - // Navigator.of(context).pushNamed(homeRoute); - // }, onPressed: (loading.value == true) ? null : () { @@ -355,7 +384,6 @@ class ChangePasswordScreen extends HookConsumerWidget { MaterialStateProperty.all(Color(0xffff48423d)), elevation: MaterialStateProperty.all(4.0), ), - child: Stack( children: [ (isLoading.value)