WT 1.1.5 ios: apple login - remove unnecessary fields

This commit is contained in:
bossanyit
2021-02-05 22:18:19 +01:00
parent ef2bd04a3a
commit 3c5360f224
13 changed files with 187 additions and 103 deletions
+15 -1
View File
@@ -37,18 +37,32 @@ class AccountPage extends StatelessWidget with Trans {
}, builder: (context, state) {
if (state is AccountInitial) {
String customerName = accountBloc.customerRepository.firstName + " " + accountBloc.customerRepository.name;
if (customerName.length < 3) {
customerName = t("Personal data");
}
return accountWidget(context, customerName, accountBloc);
} else if (state is AccountLoggedIn) {
String customerName = accountBloc.customerRepository.firstName + " " + accountBloc.customerRepository.name;
if (customerName.length < 3) {
customerName = t("Personal data");
}
return accountWidget(context, customerName, accountBloc);
} else if (state is AccountLoggedOut) {
String customerName = "";
if (customerName.length < 3) {
customerName = t("Personal data");
}
return accountWidget(context, customerName, accountBloc);
} else if (state is AccountReady) {
String customerName = accountBloc.customerRepository.firstName + " " + accountBloc.customerRepository.name;
if (customerName.length < 3) {
customerName = t("Personal data");
}
return accountWidget(context, customerName, accountBloc);
} else {
return accountWidget(context, "", accountBloc);
return accountWidget(context, t("Personal data"), accountBloc);
}
}),
),
+106 -88
View File
@@ -1,12 +1,15 @@
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
import 'package:aitrainer_app/bloc/customer_change/customer_change_bloc.dart';
import 'package:aitrainer_app/library/numberpicker.dart';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/util/enums.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:modal_progress_hud/modal_progress_hud.dart';
import 'package:toggle_switch/toggle_switch.dart';
@@ -80,103 +83,118 @@ class CustomerModifyPage extends StatelessWidget with Trans {
alignment: Alignment.center,
child: Column(
children: [
TextFormField(
key: LibraryKeys.loginEmailField,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('Email'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 4.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.email,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.emailValidation(val);
},
keyboardType: TextInputType.emailAddress,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
),
Text(t("Please provide us some personal data"),
style: GoogleFonts.inter(color: Colors.indigo, fontSize: 16), textAlign: TextAlign.center),
Text(t("To lift your experience using the app"),
style: GoogleFonts.inter(color: Colors.orange[700], fontSize: 16), textAlign: TextAlign.center),
Divider(
color: Colors.transparent,
),
TextFormField(
key: LibraryKeys.loginPasswordField,
obscureText: true,
decoration: InputDecoration(
labelStyle: TextStyle(fontSize: 14),
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
suffixIcon: IconButton(
onPressed: () => {customerBloc.add(CustomerChangePasswordObscure())},
icon: Icon(Icons.remove_red_eye),
),
labelText: t('Password (Leave empty if no change)'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 1.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.password,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.passwordValidation(val);
},
keyboardType: TextInputType.visiblePassword,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
),
Cache().getLoginType() == LoginType.email
? TextFormField(
key: LibraryKeys.loginEmailField,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('Email'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 4.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.email,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.emailValidation(val);
},
keyboardType: TextInputType.emailAddress,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
)
: Offstage(),
Divider(
color: Colors.transparent,
),
TextFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('Name'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 1.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.name,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.nameValidation(val);
},
keyboardType: TextInputType.name,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
onChanged: (value) => {customerBloc.add(CustomerNameChange(name: value))}),
Cache().getLoginType() == LoginType.email
? TextFormField(
key: LibraryKeys.loginPasswordField,
obscureText: true,
decoration: InputDecoration(
labelStyle: TextStyle(fontSize: 14),
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
suffixIcon: IconButton(
onPressed: () => {customerBloc.add(CustomerChangePasswordObscure())},
icon: Icon(Icons.remove_red_eye),
),
labelText: t('Password (Leave empty if no change)'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 1.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.password,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.passwordValidation(val);
},
keyboardType: TextInputType.visiblePassword,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
)
: Offstage(),
Divider(
color: Colors.transparent,
),
TextFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('First Name'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 2.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.firstname,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.nameValidation(val);
},
keyboardType: TextInputType.name,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
onChanged: (value) => {customerBloc.add(CustomerFirstNameChange(firstName: value))}),
Cache().getLoginType() != LoginType.apple
? TextFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('Name'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 1.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.name,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.nameValidation(val);
},
keyboardType: TextInputType.name,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
onChanged: (value) => {customerBloc.add(CustomerNameChange(name: value))})
: Offstage(),
Divider(
color: Colors.transparent,
),
Cache().getLoginType() != LoginType.apple
? TextFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 15, top: 15, bottom: 15),
labelText: t('First Name'),
fillColor: Colors.white24,
filled: true,
border: OutlineInputBorder(
gapPadding: 2.0,
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(color: Colors.green[50], width: 0.4),
),
),
initialValue: customerBloc.customerRepository.customer.firstname,
autovalidateMode: AutovalidateMode.always,
validator: (val) {
return customerBloc.nameValidation(val);
},
keyboardType: TextInputType.name,
style: new TextStyle(fontSize: 16, color: Colors.indigo),
onChanged: (value) => {customerBloc.add(CustomerFirstNameChange(firstName: value))})
: Offstage(),
Divider(
color: Colors.transparent,
),