WT1.1.11 Null-Safe migration
This commit is contained in:
@@ -14,14 +14,13 @@ part 'customer_change_state.dart';
|
||||
|
||||
class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState> with Trans {
|
||||
final CustomerRepository customerRepository;
|
||||
final BuildContext context;
|
||||
bool visiblePassword = false;
|
||||
int year = 1990;
|
||||
int? year = 1990;
|
||||
double weight = 60;
|
||||
double height = 170;
|
||||
CustomerChangeBloc({this.customerRepository, this.context}) : super(CustomerChangeInitial()) {
|
||||
CustomerChangeBloc({required this.customerRepository}) : super(CustomerChangeInitial()) {
|
||||
year = this.customerRepository.customer.birthYear;
|
||||
if (year == 0) {
|
||||
if (year == null || year == 0) {
|
||||
year = 1990;
|
||||
}
|
||||
weight = this.customerRepository.getWeight() == 0 ? 60 : this.customerRepository.getWeight();
|
||||
@@ -102,23 +101,23 @@ class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState>
|
||||
(nameValidation(customerRepository.customer.name) == null); */
|
||||
}
|
||||
|
||||
String emailValidation(String email) {
|
||||
String message = Common.emailValidation(email);
|
||||
String? emailValidation(String email) {
|
||||
String? message = Common.emailValidation(email);
|
||||
if (message != null) {
|
||||
message = t(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
String passwordValidation(String value) {
|
||||
String message = Common.passwordValidation(value);
|
||||
String? passwordValidation(String value) {
|
||||
String? message = Common.passwordValidation(value);
|
||||
if (message != null) {
|
||||
message = t(message);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
String nameValidation(String value) {
|
||||
String? nameValidation(String? value) {
|
||||
if (value == null || value.length == 0) {
|
||||
return t("Name too short");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ abstract class CustomerChangeEvent extends Equatable {
|
||||
|
||||
class CustomerGoalChange extends CustomerChangeEvent {
|
||||
final String goal;
|
||||
const CustomerGoalChange({this.goal});
|
||||
const CustomerGoalChange({required this.goal});
|
||||
|
||||
@override
|
||||
List<Object> get props => [goal];
|
||||
@@ -17,7 +17,7 @@ class CustomerGoalChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerFitnessChange extends CustomerChangeEvent {
|
||||
final String fitness;
|
||||
const CustomerFitnessChange({this.fitness});
|
||||
const CustomerFitnessChange({required this.fitness});
|
||||
|
||||
@override
|
||||
List<Object> get props => [fitness];
|
||||
@@ -25,7 +25,7 @@ class CustomerFitnessChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerBodyTypeChange extends CustomerChangeEvent {
|
||||
final String bodyType;
|
||||
const CustomerBodyTypeChange({this.bodyType});
|
||||
const CustomerBodyTypeChange({required this.bodyType});
|
||||
|
||||
@override
|
||||
List<Object> get props => [bodyType];
|
||||
@@ -33,7 +33,7 @@ class CustomerBodyTypeChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerBirthYearChange extends CustomerChangeEvent {
|
||||
final int year;
|
||||
const CustomerBirthYearChange({this.year});
|
||||
const CustomerBirthYearChange({required this.year});
|
||||
|
||||
@override
|
||||
List<Object> get props => [year];
|
||||
@@ -41,7 +41,7 @@ class CustomerBirthYearChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerWeightChange extends CustomerChangeEvent {
|
||||
final int weight;
|
||||
const CustomerWeightChange({this.weight});
|
||||
const CustomerWeightChange({required this.weight});
|
||||
|
||||
@override
|
||||
List<Object> get props => [weight];
|
||||
@@ -49,7 +49,7 @@ class CustomerWeightChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerHeightChange extends CustomerChangeEvent {
|
||||
final int height;
|
||||
const CustomerHeightChange({this.height});
|
||||
const CustomerHeightChange({required this.height});
|
||||
|
||||
@override
|
||||
List<Object> get props => [height];
|
||||
@@ -57,7 +57,7 @@ class CustomerHeightChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerGenderChange extends CustomerChangeEvent {
|
||||
final int gender;
|
||||
const CustomerGenderChange({this.gender});
|
||||
const CustomerGenderChange({required this.gender});
|
||||
|
||||
@override
|
||||
List<Object> get props => [gender];
|
||||
@@ -65,7 +65,7 @@ class CustomerGenderChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerEmailChange extends CustomerChangeEvent {
|
||||
final String email;
|
||||
const CustomerEmailChange({this.email});
|
||||
const CustomerEmailChange({required this.email});
|
||||
|
||||
@override
|
||||
List<Object> get props => [email];
|
||||
@@ -73,7 +73,7 @@ class CustomerEmailChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerFirstNameChange extends CustomerChangeEvent {
|
||||
final String firstName;
|
||||
const CustomerFirstNameChange({this.firstName});
|
||||
const CustomerFirstNameChange({required this.firstName});
|
||||
|
||||
@override
|
||||
List<Object> get props => [firstName];
|
||||
@@ -81,7 +81,7 @@ class CustomerFirstNameChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerNameChange extends CustomerChangeEvent {
|
||||
final String name;
|
||||
const CustomerNameChange({this.name});
|
||||
const CustomerNameChange({required this.name});
|
||||
|
||||
@override
|
||||
List<Object> get props => [name];
|
||||
@@ -89,7 +89,7 @@ class CustomerNameChange extends CustomerChangeEvent {
|
||||
|
||||
class CustomerPasswordChange extends CustomerChangeEvent {
|
||||
final String password;
|
||||
const CustomerPasswordChange({this.password});
|
||||
const CustomerPasswordChange({required this.password});
|
||||
|
||||
@override
|
||||
List<Object> get props => [password];
|
||||
|
||||
@@ -29,7 +29,7 @@ class CustomerSaveSuccess extends CustomerChangeState {
|
||||
|
||||
class CustomerSaveError extends CustomerChangeState {
|
||||
final String message;
|
||||
const CustomerSaveError({this.message});
|
||||
const CustomerSaveError({required this.message});
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
|
||||
Reference in New Issue
Block a user