WT1.1.3 logo change, error fixes

This commit is contained in:
bossanyit
2021-01-07 22:40:59 +01:00
parent 234a2f10e9
commit e6d0543021
119 changed files with 3580 additions and 1178 deletions
@@ -2,26 +2,30 @@ import 'dart:async';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/repository/customer_repository.dart';
import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
part 'customer_change_event.dart';
part 'customer_change_state.dart';
class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState> {
class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState> with Trans {
final CustomerRepository customerRepository;
final BuildContext context;
bool visiblePassword = false;
int year = 1990;
double weight = 60;
double height = 170;
CustomerChangeBloc({this.customerRepository}) : super(CustomerChangeInitial()) {
CustomerChangeBloc({this.customerRepository, this.context}) : super(CustomerChangeInitial()) {
year = this.customerRepository.customer.birthYear;
if (year == 0) {
year = 1990;
}
weight = this.customerRepository.getWeight();
height = this.customerRepository.getHeight();
weight = this.customerRepository.getWeight() == 0 ? 60 : this.customerRepository.getWeight();
height = this.customerRepository.getHeight() == 0 ? 170 : this.customerRepository.getHeight();
}
@override
@@ -98,21 +102,24 @@ class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState>
}
String emailValidation(String email) {
bool emailValid = RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email);
return emailValid ? null : "Please type an email address";
String message = Common.emailValidation(email);
if (message != null) {
message = t(message);
}
return message;
}
String passwordValidation(String value) {
if (value == null || value.length == 0) {
return null;
String message = Common.passwordValidation(value);
if (message != null) {
message = t(message);
}
bool valid = 8 < value.length;
return valid ? null : "Password too short";
return message;
}
String nameValidation(String value) {
if (value == null || value.length == 0) {
return "Name too short";
return t("Name too short");
}
return null;
}