refactor(legacy-account): use .select for AsyncValue field reads
This commit is contained in:
@@ -68,7 +68,9 @@ class _ChangePasswordScreenState extends ConsumerState<ChangePasswordScreen> {
|
||||
}
|
||||
});
|
||||
|
||||
final submitState = ref.watch(changePasswordControllerProvider);
|
||||
final isLoading = ref.watch(
|
||||
changePasswordControllerProvider.select((s) => s.isLoading),
|
||||
);
|
||||
|
||||
return LegacyPageLayout(
|
||||
title: context.translate(I18n.changePassword),
|
||||
@@ -108,7 +110,7 @@ class _ChangePasswordScreenState extends ConsumerState<ChangePasswordScreen> {
|
||||
footer: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||
child: PrimaryButton(
|
||||
onPressed: submitState.isLoading ? null : _onSubmit,
|
||||
onPressed: isLoading ? null : _onSubmit,
|
||||
text: context.translate(I18n.save),
|
||||
color: context.sfColors.legacyPrimary,
|
||||
),
|
||||
|
||||
@@ -62,7 +62,9 @@ class _EditLinkedDeviceScreenState
|
||||
}
|
||||
});
|
||||
|
||||
final submitState = ref.watch(linkedDevicesControllerProvider);
|
||||
final isLoading = ref.watch(
|
||||
linkedDevicesControllerProvider.select((s) => s.isLoading),
|
||||
);
|
||||
|
||||
return LegacyPageLayout(
|
||||
title: context.translate(I18n.editDeviceTitle),
|
||||
@@ -131,7 +133,7 @@ class _EditLinkedDeviceScreenState
|
||||
footer: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||
child: PrimaryButton(
|
||||
onPressed: submitState.isLoading ? null : _onSubmit,
|
||||
onPressed: isLoading ? null : _onSubmit,
|
||||
text: context.translate(I18n.save),
|
||||
color: context.sfColors.legacyPrimary,
|
||||
),
|
||||
|
||||
@@ -119,7 +119,9 @@ class _PersonalDataFormState extends ConsumerState<_PersonalDataForm> {
|
||||
}
|
||||
});
|
||||
|
||||
final submitState = ref.watch(personalDataControllerProvider);
|
||||
final isLoading = ref.watch(
|
||||
personalDataControllerProvider.select((s) => s.isLoading),
|
||||
);
|
||||
|
||||
return LegacyPageLayout(
|
||||
title: context.translate(I18n.personalData),
|
||||
@@ -204,7 +206,7 @@ class _PersonalDataFormState extends ConsumerState<_PersonalDataForm> {
|
||||
vertical: 10,
|
||||
),
|
||||
child: PrimaryButton(
|
||||
onPressed: submitState.isLoading ? null : _onSubmit,
|
||||
onPressed: isLoading ? null : _onSubmit,
|
||||
text: context.translate(I18n.submit),
|
||||
color: context.sfColors.legacyPrimary,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user