forked from eatvio/eatvio_app
feature(registration): refactor
This commit is contained in:
@@ -1,92 +1,60 @@
|
||||
class UserRegistrationSheet {
|
||||
String name;
|
||||
String firstName;
|
||||
String lastName;
|
||||
String email;
|
||||
String password;
|
||||
String passwordConfirmation;
|
||||
String termsAccepted;
|
||||
String birthdate;
|
||||
String gender;
|
||||
String country;
|
||||
String city;
|
||||
String lang;
|
||||
String weight;
|
||||
String height;
|
||||
String chestCircumference;
|
||||
String waistCircumference;
|
||||
String hipCircumference;
|
||||
String bloodPressureUp;
|
||||
String bloodPressureDown;
|
||||
String hasHypo = '';
|
||||
String hasHyper = '';
|
||||
String aboutAllergy = '';
|
||||
String aboutTakingPils = '';
|
||||
String aboutSportHobbies = '';
|
||||
String favoriteFoods = '';
|
||||
String unfavoriteFoods = '';
|
||||
String additionalInfo = '';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
UserRegistrationSheet({
|
||||
required this.name,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.email,
|
||||
required this.password,
|
||||
required this.passwordConfirmation,
|
||||
required this.termsAccepted,
|
||||
required this.birthdate,
|
||||
required this.gender,
|
||||
required this.country,
|
||||
required this.city,
|
||||
required this.lang,
|
||||
required this.weight,
|
||||
required this.height,
|
||||
required this.chestCircumference,
|
||||
required this.waistCircumference,
|
||||
required this.hipCircumference,
|
||||
required this.bloodPressureUp,
|
||||
required this.bloodPressureDown,
|
||||
required this.hasHypo,
|
||||
required this.hasHyper,
|
||||
required this.aboutAllergy,
|
||||
required this.aboutTakingPils,
|
||||
required this.aboutSportHobbies,
|
||||
required this.favoriteFoods,
|
||||
required this.unfavoriteFoods,
|
||||
required this.additionalInfo,
|
||||
});
|
||||
part 'user_registration_model.freezed.dart';
|
||||
part 'user_registration_model.g.dart';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'name': name,
|
||||
'first_name': firstName,
|
||||
'last_name': lastName,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'password_confirmation': passwordConfirmation,
|
||||
'terms': termsAccepted,
|
||||
'birthdate': birthdate.toString(),
|
||||
'gender': gender,
|
||||
'country': country,
|
||||
'city': city,
|
||||
'lang': lang,
|
||||
'weight': weight,
|
||||
'height': height,
|
||||
'chest_circumference': chestCircumference,
|
||||
'waist_circumference': waistCircumference,
|
||||
'hip_circumference': hipCircumference,
|
||||
'blood_pressure_up': bloodPressureUp,
|
||||
'blood_pressure_down': bloodPressureDown,
|
||||
'has_hypo': hasHypo,
|
||||
'has_hyper': hasHyper,
|
||||
'about_alergy': aboutAllergy,
|
||||
'about_taking_pils': aboutTakingPils,
|
||||
'about_sport_hobbies': aboutSportHobbies,
|
||||
'favorite_foods': favoriteFoods,
|
||||
'unfavorite_foods': unfavoriteFoods,
|
||||
'additional_info': additionalInfo,
|
||||
'activity_coefficient': '1.2',
|
||||
};
|
||||
}
|
||||
@freezed
|
||||
class UserRegistrationSheet with _$UserRegistrationSheet {
|
||||
const factory UserRegistrationSheet({
|
||||
required String name,
|
||||
@JsonKey(name: 'first_name')
|
||||
required String firstName,
|
||||
@JsonKey(name: 'last')
|
||||
required String lastName,
|
||||
required String email,
|
||||
required String password,
|
||||
@JsonKey(name: 'password_confirmation')
|
||||
required String passwordConfirmation,
|
||||
@Default('accepted')
|
||||
@JsonKey(name: 'terms')
|
||||
String termsAccepted,
|
||||
required String birthdate,
|
||||
required String gender,
|
||||
required String country,
|
||||
required String city,
|
||||
required String lang,
|
||||
required String weight,
|
||||
required String height,
|
||||
@JsonKey(name: 'chest_circumference')
|
||||
required String chestCircumference,
|
||||
@JsonKey(name: 'waist_circumference')
|
||||
required String waistCircumference,
|
||||
@JsonKey(name: 'hip_circumference')
|
||||
required String hipCircumference,
|
||||
@JsonKey(name: 'blood_pressure_up')
|
||||
required String bloodPressureUp,
|
||||
@JsonKey(name: 'blood_pressure_down')
|
||||
required String bloodPressureDown,
|
||||
@JsonKey(name: 'has_hypo')
|
||||
required String hasHypo,
|
||||
@JsonKey(name: 'has_hyper')
|
||||
required String hasHyper,
|
||||
@JsonKey(name: 'about_alergy')
|
||||
required String aboutAllergy,
|
||||
@JsonKey(name: 'about_taking_pils')
|
||||
required String aboutTakingPils,
|
||||
@JsonKey(name: 'about_sport_hobbies')
|
||||
required String aboutSportHobbies,
|
||||
@JsonKey(name: 'favorite_foods')
|
||||
required String favoriteFoods,
|
||||
@JsonKey(name: 'unfavorite_foods')
|
||||
required String unfavoriteFoods,
|
||||
@JsonKey(name: 'additional_info')
|
||||
required String additionalInfo,
|
||||
@Default('1.2')
|
||||
@JsonKey(name: 'activity_coefficient')
|
||||
String activityCoefficient,
|
||||
}) = _UserRegistrationSheet;
|
||||
|
||||
factory UserRegistrationSheet.fromJson(Map<String, Object?> json) => _$UserRegistrationSheetFromJson(json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user