diff --git a/lib/ui/auth/login_view.dart b/lib/ui/auth/login_view.dart index abfd7bc63..fd8394961 100644 --- a/lib/ui/auth/login_view.dart +++ b/lib/ui/auth/login_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:invoiceninja_flutter/constants.dart'; import 'package:invoiceninja_flutter/redux/ui/ui_state.dart'; import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart'; @@ -210,61 +211,84 @@ class _LoginState extends State { ), Padding( padding: EdgeInsets.only(top: 35, bottom: 10), - child: Row( - children: [ - Expanded( - child: ProgressButton( + child: _createAccount + ? ProgressButton( isLoading: viewModel.isLoading, - label: localization.emailLogin.toUpperCase(), + label: localization.signUp.toUpperCase(), onPressed: () => _submitForm(), + ) + : Row( + children: [ + Expanded( + child: ProgressButton( + isLoading: viewModel.isLoading, + label: localization.emailLogin.toUpperCase(), + onPressed: () => _submitForm(), + ), + ), + SizedBox(width: 20), + Expanded( + child: ElevatedButton( + label: localization.googleLogin.toUpperCase(), + onPressed: () => + viewModel.onGoogleLoginPressed( + context, + _urlController.text, + _secretController.text), + ), + ), + ], ), - ), - SizedBox(width: 20), - Expanded( - child: ElevatedButton( - label: localization.googleLogin.toUpperCase(), - onPressed: () => viewModel.onGoogleLoginPressed( - context, - _urlController.text, - _secretController.text), - ), - ), - ], - ), ), if (!isOneTimePassword) Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - _createAccount - ? FlatButton( - onPressed: () => - setState(() => _createAccount = false), - child: Text(localization.login)) - : FlatButton( - key: ValueKey(localization.selfhostLogin), - onPressed: () => - setState(() => _createAccount = true), - child: Text(localization.createAccount)), - _isSelfHosted - ? FlatButton( - onPressed: () => - setState(() => _isSelfHosted = false), - child: Text(localization.hostedLogin)) - : FlatButton( - key: ValueKey(localization.selfhostLogin), - onPressed: () => - setState(() => _isSelfHosted = true), - child: Text(localization.selfhostLogin)), - FlatButton( - child: Text(localization.viewWebsite), - onPressed: () async { - if (await canLaunch(kSiteUrl)) { - await launch(kSiteUrl, - forceSafariVC: false, forceWebView: false); - } - }, + Row( + children: [ + Icon(FontAwesomeIcons.user, size: 16), + _createAccount + ? FlatButton( + onPressed: () => + setState(() => _createAccount = false), + child: Text(localization.accountLogin)) + : FlatButton( + key: ValueKey(localization.selfhostLogin), + onPressed: () => setState(() { + _createAccount = true; + _isSelfHosted = false; + }), + child: Text(localization.createAccount)), + ], ), + Row(children: [ + Icon(FontAwesomeIcons.userCog, size: 16), + _isSelfHosted + ? FlatButton( + onPressed: () => + setState(() => _isSelfHosted = false), + child: Text(localization.hostedLogin)) + : FlatButton( + key: ValueKey(localization.selfhostLogin), + onPressed: () => + setState(() { + _isSelfHosted = true; + _createAccount = false; + }), + child: Text(localization.selfhostLogin)), + ]), + Row(children: [ + Icon(FontAwesomeIcons.externalLinkAlt, size: 16), + FlatButton( + child: Text(localization.viewWebsite), + onPressed: () async { + if (await canLaunch(kSiteUrl)) { + await launch(kSiteUrl, + forceSafariVC: false, forceWebView: false); + } + }, + ), + ]), ], ), if (isOneTimePassword && !viewModel.isLoading) diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 076054679..875ca0b17 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -14,6 +14,8 @@ abstract class LocaleCodeAware { mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { + 'sign_up': 'Sign Up', + 'account_login': 'Account Login', 'view_website': 'View Website', 'create_account': 'Create Account', 'email_login': 'Email Login', @@ -13812,6 +13814,9 @@ mixin LocalizationsProvider on LocaleCodeAware { String get viewWebsite => _localizedValues[localeCode]['view_website']; + String get accountLogin => _localizedValues[localeCode]['account_login']; + + String get signUp => _localizedValues[localeCode]['sign_up']; String lookup(String key) { final lookupKey = toSnakeCase(key);