refactor: Enable lint use_build_context_synchronously

This commit is contained in:
Christian Kußowski 2026-03-25 10:42:17 +01:00
commit 3296c0d92d
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
50 changed files with 490 additions and 293 deletions

View file

@ -24,6 +24,8 @@ class SettingsPasswordController extends State<SettingsPassword> {
bool loading = false;
Future<void> changePassword() async {
final l10n = L10n.of(context);
final scaffoldMessenger = ScaffoldMessenger.of(context);
setState(() {
oldPasswordError = newPassword1Error = newPassword2Error = null;
});
@ -51,13 +53,13 @@ class SettingsPasswordController extends State<SettingsPassword> {
loading = true;
});
try {
final scaffoldMessenger = ScaffoldMessenger.of(context);
await Matrix.of(context).client.changePassword(
newPassword1Controller.text,
oldPassword: oldPasswordController.text,
);
if (!mounted) return;
scaffoldMessenger.showSnackBar(
SnackBar(content: Text(L10n.of(context).passwordHasBeenChanged)),
SnackBar(content: Text(l10n.passwordHasBeenChanged)),
);
if (mounted) context.pop();
} catch (e) {