Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,10 @@
"@loginMethodDivider": {
"description": "Text on the divider between the username/password form and the third-party login options. Uppercase (for languages with letter case)."
},
"loginMethodDividerSemanticLabel": "Log-in alternatives",
"@loginMethodDividerSemanticLabel": {
"description": "Semantic label for divider between the username/password form and the third-party login options."
},
"signInWithFoo": "Sign in with {method}",
"@signInWithFoo": {
"description": "Button to use {method} to sign in to the app.",
Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,12 @@ abstract class ZulipLocalizations {
/// **'OR'**
String get loginMethodDivider;

/// Semantic label for divider between the username/password form and the third-party login options.
///
/// In en, this message translates to:
/// **'Log-in alternatives'**
String get loginMethodDividerSemanticLabel;

/// Button to use {method} to sign in to the app.
///
/// In en, this message translates to:
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
@override
String get loginMethodDivider => 'ODER';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Anmelden mit $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_el.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsEl extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_es.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsEs extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,9 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_he.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsHe extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_hu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsHu extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ class ZulipLocalizationsIt extends ZulipLocalizations {
@override
String get loginMethodDivider => 'O';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Accedi con $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get loginMethodDivider => 'または';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return '$methodでログイン';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get loginMethodDivider => 'LUB';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Logowanie z $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get loginMethodDivider => 'ИЛИ';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Войти с помощью $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get loginMethodDivider => 'alebo';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Prihlásiť sa pomocou $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_sl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ class ZulipLocalizationsSl extends ZulipLocalizations {
@override
String get loginMethodDivider => 'ALI';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Prijava z $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_uk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,9 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
@override
String get loginMethodDivider => 'АБО';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Увійти з $method';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ class ZulipLocalizationsZh extends ZulipLocalizations {
@override
String get loginMethodDivider => 'OR';

@override
String get loginMethodDividerSemanticLabel => 'Log-in alternatives';

@override
String signInWithFoo(String method) {
return 'Sign in with $method';
Expand Down
37 changes: 19 additions & 18 deletions lib/widgets/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@ class _LoginPageState extends State<LoginPage> {

final externalAuthenticationMethods = widget.serverSettings.externalAuthenticationMethods;

final loginForm = Column(mainAxisAlignment: MainAxisAlignment.center, children: [
final loginContent = Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

login [nfc]: Replace `loginForm` with more explicit `loginContent`

nit: This new name seems fine, but I don't agree that it's "more explicit" than the old name. The improvement is in accuracy/correctness, because now the variable doesn't misrepresent part of its job. But there isn't anything particularly "implicit" (vague/abstract) about the old name.

How about:

login [nfc]: Rename loginForm to loginContent

This variable holds things other than the username/password form, in 
particular, the third-party auth buttons.

_UsernamePasswordForm(loginPageState: this),
if (externalAuthenticationMethods.isNotEmpty) ...[
const OrDivider(),
_AlternativeAuthDivider(),
...externalAuthenticationMethods.map((method) {
final icon = method.displayIcon;
return OutlinedButton.icon(
Expand Down Expand Up @@ -497,7 +497,7 @@ class _LoginPageState extends State<LoginPage> {
// left or the right of this box
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: loginForm))))));
child: loginContent))))));
}
}

Expand Down Expand Up @@ -664,9 +664,7 @@ class _UsernamePasswordFormState extends State<_UsernamePasswordForm> {
}

// Loosely based on the corresponding element in the web app.
class OrDivider extends StatelessWidget {
const OrDivider({super.key});

class _AlternativeAuthDivider extends StatelessWidget {
@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
Expand All @@ -677,17 +675,20 @@ class OrDivider extends StatelessWidget {

return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
divider,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: Text(zulipLocalizations.loginMethodDivider,
textAlign: TextAlign.center,
style: TextStyle(
color: designVariables.loginOrDividerText,
height: 1.5,
).merge(weightVariableTextStyle(context, wght: 600)))),
divider,
]));
child: Semantics(
excludeSemantics: true,
label: zulipLocalizations.loginMethodDividerSemanticLabel,
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
divider,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: Text(zulipLocalizations.loginMethodDivider,
textAlign: TextAlign.center,
style: TextStyle(
color: designVariables.loginOrDividerText,
height: 1.5,
).merge(weightVariableTextStyle(context, wght: 600)))),
divider,
])));
}
}