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(() {
if (!authController.isLoading.value) {
return SizedBox(
width: double.infinity,
height: 48.h,
child: Center(
child: CircularProgressIndicator(
color: PrimaryColors.primary800,
),
),
);
}
return ZoomTapAnimation(
child: ButtonFill( child: ButtonFill(
text: 'Atur Ulang Password', text: 'Atur Ulang Password',
textColor: Colors.white, textColor: Colors.white,
onTap: () { onTap: () async {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
authController.sendResetEmail(emailController.text); authController.isLoading.value = true;
Get.offAllNamed(Routes.LOGIN, arguments: role); await authController.sendResetEmail(emailController.text);
authController.isLoading.value = false;
emailController.clear(); emailController.clear();
Get.offAllNamed(Routes.LOGIN, arguments: role);
} }
}, },
), ),
), );
}),
SizedBox(height: 10.h), SizedBox(height: 10.h),
ZoomTapAnimation( ZoomTapAnimation(
child: ButtonNoFill( child: ButtonNoFill(