WT 1.1.11+5 bug fixes customer change
This commit is contained in:
@@ -3,7 +3,6 @@ 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';
|
||||
@@ -14,7 +13,7 @@ import '../../model/fitness_state.dart';
|
||||
part 'customer_change_event.dart';
|
||||
part 'customer_change_state.dart';
|
||||
|
||||
class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState> with Trans {
|
||||
class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState> {
|
||||
final CustomerRepository customerRepository;
|
||||
bool visiblePassword = false;
|
||||
int? year = 1990;
|
||||
@@ -138,33 +137,27 @@ class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState>
|
||||
}
|
||||
|
||||
bool validation() {
|
||||
if (customerRepository.customer == null) throw Exception("Customer object not defined");
|
||||
return true;
|
||||
/* print("f " + customerRepository.customer.firstname);
|
||||
return (emailValidation(customerRepository.customer.email) == null) &&
|
||||
(passwordValidation(customerRepository.customer.password) == null) &&
|
||||
(nameValidation(customerRepository.customer.firstname) == null) &&
|
||||
(nameValidation(customerRepository.customer.name) == null); */
|
||||
/* return (emailValidation(customerRepository.customer!.email) == null) &&
|
||||
(passwordValidation(customerRepository.customer!.password) == null) &&
|
||||
(nameValidation(customerRepository.customer!.firstname) == null) &&
|
||||
(nameValidation(customerRepository.customer!.name) == null); */
|
||||
}
|
||||
|
||||
String? emailValidation(String email) {
|
||||
String? emailValidation(String? email) {
|
||||
String? message = Common.emailValidation(email);
|
||||
if (message != null) {
|
||||
message = t(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
String? passwordValidation(String value) {
|
||||
String? passwordValidation(String? value) {
|
||||
String? message = Common.passwordValidation(value);
|
||||
if (message != null) {
|
||||
message = t(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
String? nameValidation(String? value) {
|
||||
if (value == null || value.length == 0) {
|
||||
return t("Name too short");
|
||||
return "Name too short";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user