Create account
This commit is contained in:
parent
278d3b0cf6
commit
3105ce2e1a
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
|
||||||
|
|
@ -210,61 +211,84 @@ class _LoginState extends State<LoginView> {
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 35, bottom: 10),
|
padding: EdgeInsets.only(top: 35, bottom: 10),
|
||||||
child: Row(
|
child: _createAccount
|
||||||
children: <Widget>[
|
? ProgressButton(
|
||||||
Expanded(
|
|
||||||
child: ProgressButton(
|
|
||||||
isLoading: viewModel.isLoading,
|
isLoading: viewModel.isLoading,
|
||||||
label: localization.emailLogin.toUpperCase(),
|
label: localization.signUp.toUpperCase(),
|
||||||
onPressed: () => _submitForm(),
|
onPressed: () => _submitForm(),
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
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)
|
if (!isOneTimePassword)
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_createAccount
|
Row(
|
||||||
? FlatButton(
|
children: <Widget>[
|
||||||
onPressed: () =>
|
Icon(FontAwesomeIcons.user, size: 16),
|
||||||
setState(() => _createAccount = false),
|
_createAccount
|
||||||
child: Text(localization.login))
|
? FlatButton(
|
||||||
: FlatButton(
|
onPressed: () =>
|
||||||
key: ValueKey(localization.selfhostLogin),
|
setState(() => _createAccount = false),
|
||||||
onPressed: () =>
|
child: Text(localization.accountLogin))
|
||||||
setState(() => _createAccount = true),
|
: FlatButton(
|
||||||
child: Text(localization.createAccount)),
|
key: ValueKey(localization.selfhostLogin),
|
||||||
_isSelfHosted
|
onPressed: () => setState(() {
|
||||||
? FlatButton(
|
_createAccount = true;
|
||||||
onPressed: () =>
|
_isSelfHosted = false;
|
||||||
setState(() => _isSelfHosted = false),
|
}),
|
||||||
child: Text(localization.hostedLogin))
|
child: Text(localization.createAccount)),
|
||||||
: 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: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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)
|
if (isOneTimePassword && !viewModel.isLoading)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'sign_up': 'Sign Up',
|
||||||
|
'account_login': 'Account Login',
|
||||||
'view_website': 'View Website',
|
'view_website': 'View Website',
|
||||||
'create_account': 'Create Account',
|
'create_account': 'Create Account',
|
||||||
'email_login': 'Email Login',
|
'email_login': 'Email Login',
|
||||||
|
|
@ -13812,6 +13814,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get viewWebsite => _localizedValues[localeCode]['view_website'];
|
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) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue