refactor: Use non nullable localizations builder and lazy load on web

This commit is contained in:
krille-chan 2024-10-06 08:35:37 +02:00
commit 0d4b7d67cc
No known key found for this signature in database
111 changed files with 879 additions and 883 deletions

View file

@ -31,20 +31,20 @@ class SettingsPasswordController extends State<SettingsPassword> {
});
if (oldPasswordController.text.isEmpty) {
setState(() {
oldPasswordError = L10n.of(context)!.pleaseEnterYourPassword;
oldPasswordError = L10n.of(context).pleaseEnterYourPassword;
});
return;
}
if (newPassword1Controller.text.isEmpty ||
newPassword1Controller.text.length < 6) {
setState(() {
newPassword1Error = L10n.of(context)!.pleaseChooseAStrongPassword;
newPassword1Error = L10n.of(context).pleaseChooseAStrongPassword;
});
return;
}
if (newPassword1Controller.text != newPassword2Controller.text) {
setState(() {
newPassword2Error = L10n.of(context)!.passwordsDoNotMatch;
newPassword2Error = L10n.of(context).passwordsDoNotMatch;
});
return;
}
@ -60,7 +60,7 @@ class SettingsPasswordController extends State<SettingsPassword> {
);
scaffoldMessenger.showSnackBar(
SnackBar(
content: Text(L10n.of(context)!.passwordHasBeenChanged),
content: Text(L10n.of(context).passwordHasBeenChanged),
),
);
if (mounted) context.pop();

View file

@ -16,7 +16,7 @@ class SettingsPasswordView extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: Text(L10n.of(context)!.changePassword),
title: Text(L10n.of(context).changePassword),
),
body: ListTileTheme(
iconColor: theme.colorScheme.onSurface,
@ -35,7 +35,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration(
prefixIcon: const Icon(Icons.lock_outlined),
hintText: '********',
labelText: L10n.of(context)!.pleaseEnterYourCurrentPassword,
labelText: L10n.of(context).pleaseEnterYourCurrentPassword,
errorText: controller.oldPasswordError,
),
),
@ -48,7 +48,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration(
prefixIcon: const Icon(Icons.lock_reset_outlined),
hintText: '********',
labelText: L10n.of(context)!.newPassword,
labelText: L10n.of(context).newPassword,
errorText: controller.newPassword1Error,
),
),
@ -61,7 +61,7 @@ class SettingsPasswordView extends StatelessWidget {
decoration: InputDecoration(
prefixIcon: const Icon(Icons.repeat_outlined),
hintText: '********',
labelText: L10n.of(context)!.repeatPassword,
labelText: L10n.of(context).repeatPassword,
errorText: controller.newPassword2Error,
),
),
@ -73,12 +73,12 @@ class SettingsPasswordView extends StatelessWidget {
controller.loading ? null : controller.changePassword,
child: controller.loading
? const LinearProgressIndicator()
: Text(L10n.of(context)!.changePassword),
: Text(L10n.of(context).changePassword),
),
),
const SizedBox(height: 16),
TextButton(
child: Text(L10n.of(context)!.passwordRecoverySettings),
child: Text(L10n.of(context).passwordRecoverySettings),
onPressed: () => context.go('/rooms/settings/security/3pid'),
),
],