Feat: add loading for button in forget password screen

This commit is contained in:
orangdeso 2025-05-12 00:01:13 +07:00
parent c2f0d75a17
commit fc76ecf4c8
1 changed files with 28 additions and 13 deletions

View File

@ -73,19 +73,34 @@ class _ForgetPasswordScreenState extends State<ForgetPasswordScreen> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ZoomTapAnimation( Obx(() {
child: ButtonFill( if (!authController.isLoading.value) {
text: 'Atur Ulang Password', return SizedBox(
textColor: Colors.white, width: double.infinity,
onTap: () { height: 48.h,
if (_formKey.currentState!.validate()) { child: Center(
authController.sendResetEmail(emailController.text); child: CircularProgressIndicator(
Get.offAllNamed(Routes.LOGIN, arguments: role); color: PrimaryColors.primary800,
emailController.clear(); ),
} ),
}, );
), }
), return ZoomTapAnimation(
child: ButtonFill(
text: 'Atur Ulang Password',
textColor: Colors.white,
onTap: () async {
if (_formKey.currentState!.validate()) {
authController.isLoading.value = true;
await authController.sendResetEmail(emailController.text);
authController.isLoading.value = false;
emailController.clear();
Get.offAllNamed(Routes.LOGIN, arguments: role);
}
},
),
);
}),
SizedBox(height: 10.h), SizedBox(height: 10.h),
ZoomTapAnimation( ZoomTapAnimation(
child: ButtonNoFill( child: ButtonNoFill(