feature(registration): refactor

This commit is contained in:
mso7nueh
2024-07-14 16:30:10 +03:00
parent 12a0db5093
commit 3cdab9e1bb
31 changed files with 1214 additions and 689 deletions

View File

@@ -16,21 +16,6 @@ import 'package:eatvio_app/presentation/plans/plan_select_screen/plan_select_scr
import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart';
import 'package:eatvio_app/presentation/profile/my_profile_screen/my_settings_screen.dart';
import 'package:eatvio_app/presentation/recipe/recipe_select_screen/recipe_select_screen.dart';
import 'package:eatvio_app/presentation/registration/additional_information_screen/additional_information_screen.dart';
import 'package:eatvio_app/presentation/registration/allergies_screen/allergies_screen.dart';
import 'package:eatvio_app/presentation/registration/blood_pressure_screen/blood_pressure_screen.dart';
import 'package:eatvio_app/presentation/registration/body_circumferences_screen/body_circumferences_screen.dart';
import 'package:eatvio_app/presentation/registration/city_of_living_screen/city_of_living_screen.dart';
import 'package:eatvio_app/presentation/registration/credentials_screen/credentials_screen.dart';
import 'package:eatvio_app/presentation/registration/date_of_birth_screen/date_of_birth_screen.dart';
import 'package:eatvio_app/presentation/registration/favorite_foods_screen/favorite_foods_screen.dart';
import 'package:eatvio_app/presentation/registration/favorite_sports_screen/favorite_sports_screen.dart';
import 'package:eatvio_app/presentation/registration/gender_screen/gender_screen.dart';
import 'package:eatvio_app/presentation/registration/height_screen/height_screen.dart';
import 'package:eatvio_app/presentation/registration/language_select_screen/language_select_screen.dart';
import 'package:eatvio_app/presentation/registration/medicine_intake_screen/medicine_intake_screen.dart';
import 'package:eatvio_app/presentation/registration/name_screen/name_screen.dart';
import 'package:eatvio_app/presentation/registration/weight_screen/weight_screen.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
import 'package:flutter/material.dart';
@@ -60,109 +45,6 @@ class AppRouter {
name: 'registrationScreen',
builder: (context, state) => const RegistrationScreen(),
),
GoRoute(
path: 'language-select-screen',
name: 'languageSelectScreen',
builder: (context, state) => LanguageSelectScreen.builder(context),
routes: [
GoRoute(
path: 'credentials-screen',
name: 'credentialsScreen',
builder: (context, state) => CredentialsScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'name-screen',
name: 'nameScreen',
builder: (context, state) => NameScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'gender-screen',
name: 'genderScreen',
builder: (context, state) => GenderScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'date-of-birth-screen',
name: 'dateOfBirthScreen',
builder: (context, state) => DateOfBirthScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'city-of-living-screen',
name: 'cityOfLivingScreen',
builder: (context, state) => CityOfLivingScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'body-circumferences-screen',
name: 'bodyCircumferencesScreen',
builder: (context, state) => BodyCircumferencesScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'weight-screen',
name: 'weightScreen',
builder: (context, state) => WeightScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'height-screen',
name: 'heightScreen',
builder: (context, state) => HeightScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'blood-pressure-screen',
name: 'bloodPressureScreen',
builder: (context, state) => BloodPressureScreen.builder(context, state.extra),
routes: [
GoRoute(
name: 'allergiesScreen',
path: 'allergiesScreen',
builder: (context, state) => AllergiesScreen.builder(context, state.extra),
routes: [
GoRoute(
name: 'medicineIntakeScreen',
path: 'medicine-intake-screen',
builder: (context, state) => MedicineIntakeScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'favorite-sports-screen',
name: 'favoriteSportsScreen',
builder: (context, state) => FavoriteSportsScreen.builder(context, state.extra),
routes: [
GoRoute(
name: 'favoriteFoodsScreen',
path: 'favorite-foods-screen',
builder: (context, state) => FavoriteFoodsScreen.builder(context, state.extra),
routes: [
GoRoute(
path: 'additional-information-screen',
name: 'additionalInformationScreen',
builder: (context, state) => AdditionalInformationScreen.builder(context, state.extra),
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
],
),
ShellRoute(

View File

@@ -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);
}

View File

@@ -0,0 +1,811 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'user_registration_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
UserRegistrationSheet _$UserRegistrationSheetFromJson(
Map<String, dynamic> json) {
return _UserRegistrationSheet.fromJson(json);
}
/// @nodoc
mixin _$UserRegistrationSheet {
String get name => throw _privateConstructorUsedError;
@JsonKey(name: 'first_name')
String get firstName => throw _privateConstructorUsedError;
@JsonKey(name: 'last')
String get lastName => throw _privateConstructorUsedError;
String get email => throw _privateConstructorUsedError;
String get password => throw _privateConstructorUsedError;
@JsonKey(name: 'password_confirmation')
String get passwordConfirmation => throw _privateConstructorUsedError;
@JsonKey(name: 'terms')
String get termsAccepted => throw _privateConstructorUsedError;
String get birthdate => throw _privateConstructorUsedError;
String get gender => throw _privateConstructorUsedError;
String get country => throw _privateConstructorUsedError;
String get city => throw _privateConstructorUsedError;
String get lang => throw _privateConstructorUsedError;
String get weight => throw _privateConstructorUsedError;
String get height => throw _privateConstructorUsedError;
@JsonKey(name: 'chest_circumference')
String get chestCircumference => throw _privateConstructorUsedError;
@JsonKey(name: 'waist_circumference')
String get waistCircumference => throw _privateConstructorUsedError;
@JsonKey(name: 'hip_circumference')
String get hipCircumference => throw _privateConstructorUsedError;
@JsonKey(name: 'blood_pressure_up')
String get bloodPressureUp => throw _privateConstructorUsedError;
@JsonKey(name: 'blood_pressure_down')
String get bloodPressureDown => throw _privateConstructorUsedError;
@JsonKey(name: 'has_hypo')
String get hasHypo => throw _privateConstructorUsedError;
@JsonKey(name: 'has_hyper')
String get hasHyper => throw _privateConstructorUsedError;
@JsonKey(name: 'about_alergy')
String get aboutAllergy => throw _privateConstructorUsedError;
@JsonKey(name: 'about_taking_pils')
String get aboutTakingPils => throw _privateConstructorUsedError;
@JsonKey(name: 'about_sport_hobbies')
String get aboutSportHobbies => throw _privateConstructorUsedError;
@JsonKey(name: 'favorite_foods')
String get favoriteFoods => throw _privateConstructorUsedError;
@JsonKey(name: 'unfavorite_foods')
String get unfavoriteFoods => throw _privateConstructorUsedError;
@JsonKey(name: 'additional_info')
String get additionalInfo => throw _privateConstructorUsedError;
@JsonKey(name: 'activity_coefficient')
String get activityCoefficient => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$UserRegistrationSheetCopyWith<UserRegistrationSheet> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserRegistrationSheetCopyWith<$Res> {
factory $UserRegistrationSheetCopyWith(UserRegistrationSheet value,
$Res Function(UserRegistrationSheet) then) =
_$UserRegistrationSheetCopyWithImpl<$Res, UserRegistrationSheet>;
@useResult
$Res call(
{String name,
@JsonKey(name: 'first_name') String firstName,
@JsonKey(name: 'last') String lastName,
String email,
String password,
@JsonKey(name: 'password_confirmation') String passwordConfirmation,
@JsonKey(name: 'terms') String termsAccepted,
String birthdate,
String gender,
String country,
String city,
String lang,
String weight,
String height,
@JsonKey(name: 'chest_circumference') String chestCircumference,
@JsonKey(name: 'waist_circumference') String waistCircumference,
@JsonKey(name: 'hip_circumference') String hipCircumference,
@JsonKey(name: 'blood_pressure_up') String bloodPressureUp,
@JsonKey(name: 'blood_pressure_down') String bloodPressureDown,
@JsonKey(name: 'has_hypo') String hasHypo,
@JsonKey(name: 'has_hyper') String hasHyper,
@JsonKey(name: 'about_alergy') String aboutAllergy,
@JsonKey(name: 'about_taking_pils') String aboutTakingPils,
@JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies,
@JsonKey(name: 'favorite_foods') String favoriteFoods,
@JsonKey(name: 'unfavorite_foods') String unfavoriteFoods,
@JsonKey(name: 'additional_info') String additionalInfo,
@JsonKey(name: 'activity_coefficient') String activityCoefficient});
}
/// @nodoc
class _$UserRegistrationSheetCopyWithImpl<$Res,
$Val extends UserRegistrationSheet>
implements $UserRegistrationSheetCopyWith<$Res> {
_$UserRegistrationSheetCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? firstName = null,
Object? lastName = null,
Object? email = null,
Object? password = null,
Object? passwordConfirmation = null,
Object? termsAccepted = null,
Object? birthdate = null,
Object? gender = null,
Object? country = null,
Object? city = null,
Object? lang = null,
Object? weight = null,
Object? height = null,
Object? chestCircumference = null,
Object? waistCircumference = null,
Object? hipCircumference = null,
Object? bloodPressureUp = null,
Object? bloodPressureDown = null,
Object? hasHypo = null,
Object? hasHyper = null,
Object? aboutAllergy = null,
Object? aboutTakingPils = null,
Object? aboutSportHobbies = null,
Object? favoriteFoods = null,
Object? unfavoriteFoods = null,
Object? additionalInfo = null,
Object? activityCoefficient = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
firstName: null == firstName
? _value.firstName
: firstName // ignore: cast_nullable_to_non_nullable
as String,
lastName: null == lastName
? _value.lastName
: lastName // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
passwordConfirmation: null == passwordConfirmation
? _value.passwordConfirmation
: passwordConfirmation // ignore: cast_nullable_to_non_nullable
as String,
termsAccepted: null == termsAccepted
? _value.termsAccepted
: termsAccepted // ignore: cast_nullable_to_non_nullable
as String,
birthdate: null == birthdate
? _value.birthdate
: birthdate // ignore: cast_nullable_to_non_nullable
as String,
gender: null == gender
? _value.gender
: gender // ignore: cast_nullable_to_non_nullable
as String,
country: null == country
? _value.country
: country // ignore: cast_nullable_to_non_nullable
as String,
city: null == city
? _value.city
: city // ignore: cast_nullable_to_non_nullable
as String,
lang: null == lang
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String,
weight: null == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as String,
height: null == height
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as String,
chestCircumference: null == chestCircumference
? _value.chestCircumference
: chestCircumference // ignore: cast_nullable_to_non_nullable
as String,
waistCircumference: null == waistCircumference
? _value.waistCircumference
: waistCircumference // ignore: cast_nullable_to_non_nullable
as String,
hipCircumference: null == hipCircumference
? _value.hipCircumference
: hipCircumference // ignore: cast_nullable_to_non_nullable
as String,
bloodPressureUp: null == bloodPressureUp
? _value.bloodPressureUp
: bloodPressureUp // ignore: cast_nullable_to_non_nullable
as String,
bloodPressureDown: null == bloodPressureDown
? _value.bloodPressureDown
: bloodPressureDown // ignore: cast_nullable_to_non_nullable
as String,
hasHypo: null == hasHypo
? _value.hasHypo
: hasHypo // ignore: cast_nullable_to_non_nullable
as String,
hasHyper: null == hasHyper
? _value.hasHyper
: hasHyper // ignore: cast_nullable_to_non_nullable
as String,
aboutAllergy: null == aboutAllergy
? _value.aboutAllergy
: aboutAllergy // ignore: cast_nullable_to_non_nullable
as String,
aboutTakingPils: null == aboutTakingPils
? _value.aboutTakingPils
: aboutTakingPils // ignore: cast_nullable_to_non_nullable
as String,
aboutSportHobbies: null == aboutSportHobbies
? _value.aboutSportHobbies
: aboutSportHobbies // ignore: cast_nullable_to_non_nullable
as String,
favoriteFoods: null == favoriteFoods
? _value.favoriteFoods
: favoriteFoods // ignore: cast_nullable_to_non_nullable
as String,
unfavoriteFoods: null == unfavoriteFoods
? _value.unfavoriteFoods
: unfavoriteFoods // ignore: cast_nullable_to_non_nullable
as String,
additionalInfo: null == additionalInfo
? _value.additionalInfo
: additionalInfo // ignore: cast_nullable_to_non_nullable
as String,
activityCoefficient: null == activityCoefficient
? _value.activityCoefficient
: activityCoefficient // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$UserRegistrationSheetImplCopyWith<$Res>
implements $UserRegistrationSheetCopyWith<$Res> {
factory _$$UserRegistrationSheetImplCopyWith(
_$UserRegistrationSheetImpl value,
$Res Function(_$UserRegistrationSheetImpl) then) =
__$$UserRegistrationSheetImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String name,
@JsonKey(name: 'first_name') String firstName,
@JsonKey(name: 'last') String lastName,
String email,
String password,
@JsonKey(name: 'password_confirmation') String passwordConfirmation,
@JsonKey(name: 'terms') String termsAccepted,
String birthdate,
String gender,
String country,
String city,
String lang,
String weight,
String height,
@JsonKey(name: 'chest_circumference') String chestCircumference,
@JsonKey(name: 'waist_circumference') String waistCircumference,
@JsonKey(name: 'hip_circumference') String hipCircumference,
@JsonKey(name: 'blood_pressure_up') String bloodPressureUp,
@JsonKey(name: 'blood_pressure_down') String bloodPressureDown,
@JsonKey(name: 'has_hypo') String hasHypo,
@JsonKey(name: 'has_hyper') String hasHyper,
@JsonKey(name: 'about_alergy') String aboutAllergy,
@JsonKey(name: 'about_taking_pils') String aboutTakingPils,
@JsonKey(name: 'about_sport_hobbies') String aboutSportHobbies,
@JsonKey(name: 'favorite_foods') String favoriteFoods,
@JsonKey(name: 'unfavorite_foods') String unfavoriteFoods,
@JsonKey(name: 'additional_info') String additionalInfo,
@JsonKey(name: 'activity_coefficient') String activityCoefficient});
}
/// @nodoc
class __$$UserRegistrationSheetImplCopyWithImpl<$Res>
extends _$UserRegistrationSheetCopyWithImpl<$Res,
_$UserRegistrationSheetImpl>
implements _$$UserRegistrationSheetImplCopyWith<$Res> {
__$$UserRegistrationSheetImplCopyWithImpl(_$UserRegistrationSheetImpl _value,
$Res Function(_$UserRegistrationSheetImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? firstName = null,
Object? lastName = null,
Object? email = null,
Object? password = null,
Object? passwordConfirmation = null,
Object? termsAccepted = null,
Object? birthdate = null,
Object? gender = null,
Object? country = null,
Object? city = null,
Object? lang = null,
Object? weight = null,
Object? height = null,
Object? chestCircumference = null,
Object? waistCircumference = null,
Object? hipCircumference = null,
Object? bloodPressureUp = null,
Object? bloodPressureDown = null,
Object? hasHypo = null,
Object? hasHyper = null,
Object? aboutAllergy = null,
Object? aboutTakingPils = null,
Object? aboutSportHobbies = null,
Object? favoriteFoods = null,
Object? unfavoriteFoods = null,
Object? additionalInfo = null,
Object? activityCoefficient = null,
}) {
return _then(_$UserRegistrationSheetImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
firstName: null == firstName
? _value.firstName
: firstName // ignore: cast_nullable_to_non_nullable
as String,
lastName: null == lastName
? _value.lastName
: lastName // ignore: cast_nullable_to_non_nullable
as String,
email: null == email
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
password: null == password
? _value.password
: password // ignore: cast_nullable_to_non_nullable
as String,
passwordConfirmation: null == passwordConfirmation
? _value.passwordConfirmation
: passwordConfirmation // ignore: cast_nullable_to_non_nullable
as String,
termsAccepted: null == termsAccepted
? _value.termsAccepted
: termsAccepted // ignore: cast_nullable_to_non_nullable
as String,
birthdate: null == birthdate
? _value.birthdate
: birthdate // ignore: cast_nullable_to_non_nullable
as String,
gender: null == gender
? _value.gender
: gender // ignore: cast_nullable_to_non_nullable
as String,
country: null == country
? _value.country
: country // ignore: cast_nullable_to_non_nullable
as String,
city: null == city
? _value.city
: city // ignore: cast_nullable_to_non_nullable
as String,
lang: null == lang
? _value.lang
: lang // ignore: cast_nullable_to_non_nullable
as String,
weight: null == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as String,
height: null == height
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as String,
chestCircumference: null == chestCircumference
? _value.chestCircumference
: chestCircumference // ignore: cast_nullable_to_non_nullable
as String,
waistCircumference: null == waistCircumference
? _value.waistCircumference
: waistCircumference // ignore: cast_nullable_to_non_nullable
as String,
hipCircumference: null == hipCircumference
? _value.hipCircumference
: hipCircumference // ignore: cast_nullable_to_non_nullable
as String,
bloodPressureUp: null == bloodPressureUp
? _value.bloodPressureUp
: bloodPressureUp // ignore: cast_nullable_to_non_nullable
as String,
bloodPressureDown: null == bloodPressureDown
? _value.bloodPressureDown
: bloodPressureDown // ignore: cast_nullable_to_non_nullable
as String,
hasHypo: null == hasHypo
? _value.hasHypo
: hasHypo // ignore: cast_nullable_to_non_nullable
as String,
hasHyper: null == hasHyper
? _value.hasHyper
: hasHyper // ignore: cast_nullable_to_non_nullable
as String,
aboutAllergy: null == aboutAllergy
? _value.aboutAllergy
: aboutAllergy // ignore: cast_nullable_to_non_nullable
as String,
aboutTakingPils: null == aboutTakingPils
? _value.aboutTakingPils
: aboutTakingPils // ignore: cast_nullable_to_non_nullable
as String,
aboutSportHobbies: null == aboutSportHobbies
? _value.aboutSportHobbies
: aboutSportHobbies // ignore: cast_nullable_to_non_nullable
as String,
favoriteFoods: null == favoriteFoods
? _value.favoriteFoods
: favoriteFoods // ignore: cast_nullable_to_non_nullable
as String,
unfavoriteFoods: null == unfavoriteFoods
? _value.unfavoriteFoods
: unfavoriteFoods // ignore: cast_nullable_to_non_nullable
as String,
additionalInfo: null == additionalInfo
? _value.additionalInfo
: additionalInfo // ignore: cast_nullable_to_non_nullable
as String,
activityCoefficient: null == activityCoefficient
? _value.activityCoefficient
: activityCoefficient // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UserRegistrationSheetImpl implements _UserRegistrationSheet {
const _$UserRegistrationSheetImpl(
{required this.name,
@JsonKey(name: 'first_name') required this.firstName,
@JsonKey(name: 'last') required this.lastName,
required this.email,
required this.password,
@JsonKey(name: 'password_confirmation')
required this.passwordConfirmation,
@JsonKey(name: 'terms') this.termsAccepted = 'accepted',
required this.birthdate,
required this.gender,
required this.country,
required this.city,
required this.lang,
required this.weight,
required this.height,
@JsonKey(name: 'chest_circumference') required this.chestCircumference,
@JsonKey(name: 'waist_circumference') required this.waistCircumference,
@JsonKey(name: 'hip_circumference') required this.hipCircumference,
@JsonKey(name: 'blood_pressure_up') required this.bloodPressureUp,
@JsonKey(name: 'blood_pressure_down') required this.bloodPressureDown,
@JsonKey(name: 'has_hypo') required this.hasHypo,
@JsonKey(name: 'has_hyper') required this.hasHyper,
@JsonKey(name: 'about_alergy') required this.aboutAllergy,
@JsonKey(name: 'about_taking_pils') required this.aboutTakingPils,
@JsonKey(name: 'about_sport_hobbies') required this.aboutSportHobbies,
@JsonKey(name: 'favorite_foods') required this.favoriteFoods,
@JsonKey(name: 'unfavorite_foods') required this.unfavoriteFoods,
@JsonKey(name: 'additional_info') required this.additionalInfo,
@JsonKey(name: 'activity_coefficient') this.activityCoefficient = '1.2'});
factory _$UserRegistrationSheetImpl.fromJson(Map<String, dynamic> json) =>
_$$UserRegistrationSheetImplFromJson(json);
@override
final String name;
@override
@JsonKey(name: 'first_name')
final String firstName;
@override
@JsonKey(name: 'last')
final String lastName;
@override
final String email;
@override
final String password;
@override
@JsonKey(name: 'password_confirmation')
final String passwordConfirmation;
@override
@JsonKey(name: 'terms')
final String termsAccepted;
@override
final String birthdate;
@override
final String gender;
@override
final String country;
@override
final String city;
@override
final String lang;
@override
final String weight;
@override
final String height;
@override
@JsonKey(name: 'chest_circumference')
final String chestCircumference;
@override
@JsonKey(name: 'waist_circumference')
final String waistCircumference;
@override
@JsonKey(name: 'hip_circumference')
final String hipCircumference;
@override
@JsonKey(name: 'blood_pressure_up')
final String bloodPressureUp;
@override
@JsonKey(name: 'blood_pressure_down')
final String bloodPressureDown;
@override
@JsonKey(name: 'has_hypo')
final String hasHypo;
@override
@JsonKey(name: 'has_hyper')
final String hasHyper;
@override
@JsonKey(name: 'about_alergy')
final String aboutAllergy;
@override
@JsonKey(name: 'about_taking_pils')
final String aboutTakingPils;
@override
@JsonKey(name: 'about_sport_hobbies')
final String aboutSportHobbies;
@override
@JsonKey(name: 'favorite_foods')
final String favoriteFoods;
@override
@JsonKey(name: 'unfavorite_foods')
final String unfavoriteFoods;
@override
@JsonKey(name: 'additional_info')
final String additionalInfo;
@override
@JsonKey(name: 'activity_coefficient')
final String activityCoefficient;
@override
String toString() {
return 'UserRegistrationSheet(name: $name, firstName: $firstName, lastName: $lastName, email: $email, password: $password, passwordConfirmation: $passwordConfirmation, termsAccepted: $termsAccepted, birthdate: $birthdate, gender: $gender, country: $country, city: $city, lang: $lang, weight: $weight, height: $height, chestCircumference: $chestCircumference, waistCircumference: $waistCircumference, hipCircumference: $hipCircumference, bloodPressureUp: $bloodPressureUp, bloodPressureDown: $bloodPressureDown, hasHypo: $hasHypo, hasHyper: $hasHyper, aboutAllergy: $aboutAllergy, aboutTakingPils: $aboutTakingPils, aboutSportHobbies: $aboutSportHobbies, favoriteFoods: $favoriteFoods, unfavoriteFoods: $unfavoriteFoods, additionalInfo: $additionalInfo, activityCoefficient: $activityCoefficient)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserRegistrationSheetImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.firstName, firstName) ||
other.firstName == firstName) &&
(identical(other.lastName, lastName) ||
other.lastName == lastName) &&
(identical(other.email, email) || other.email == email) &&
(identical(other.password, password) ||
other.password == password) &&
(identical(other.passwordConfirmation, passwordConfirmation) ||
other.passwordConfirmation == passwordConfirmation) &&
(identical(other.termsAccepted, termsAccepted) ||
other.termsAccepted == termsAccepted) &&
(identical(other.birthdate, birthdate) ||
other.birthdate == birthdate) &&
(identical(other.gender, gender) || other.gender == gender) &&
(identical(other.country, country) || other.country == country) &&
(identical(other.city, city) || other.city == city) &&
(identical(other.lang, lang) || other.lang == lang) &&
(identical(other.weight, weight) || other.weight == weight) &&
(identical(other.height, height) || other.height == height) &&
(identical(other.chestCircumference, chestCircumference) ||
other.chestCircumference == chestCircumference) &&
(identical(other.waistCircumference, waistCircumference) ||
other.waistCircumference == waistCircumference) &&
(identical(other.hipCircumference, hipCircumference) ||
other.hipCircumference == hipCircumference) &&
(identical(other.bloodPressureUp, bloodPressureUp) ||
other.bloodPressureUp == bloodPressureUp) &&
(identical(other.bloodPressureDown, bloodPressureDown) ||
other.bloodPressureDown == bloodPressureDown) &&
(identical(other.hasHypo, hasHypo) || other.hasHypo == hasHypo) &&
(identical(other.hasHyper, hasHyper) ||
other.hasHyper == hasHyper) &&
(identical(other.aboutAllergy, aboutAllergy) ||
other.aboutAllergy == aboutAllergy) &&
(identical(other.aboutTakingPils, aboutTakingPils) ||
other.aboutTakingPils == aboutTakingPils) &&
(identical(other.aboutSportHobbies, aboutSportHobbies) ||
other.aboutSportHobbies == aboutSportHobbies) &&
(identical(other.favoriteFoods, favoriteFoods) ||
other.favoriteFoods == favoriteFoods) &&
(identical(other.unfavoriteFoods, unfavoriteFoods) ||
other.unfavoriteFoods == unfavoriteFoods) &&
(identical(other.additionalInfo, additionalInfo) ||
other.additionalInfo == additionalInfo) &&
(identical(other.activityCoefficient, activityCoefficient) ||
other.activityCoefficient == activityCoefficient));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hashAll([
runtimeType,
name,
firstName,
lastName,
email,
password,
passwordConfirmation,
termsAccepted,
birthdate,
gender,
country,
city,
lang,
weight,
height,
chestCircumference,
waistCircumference,
hipCircumference,
bloodPressureUp,
bloodPressureDown,
hasHypo,
hasHyper,
aboutAllergy,
aboutTakingPils,
aboutSportHobbies,
favoriteFoods,
unfavoriteFoods,
additionalInfo,
activityCoefficient
]);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl>
get copyWith => __$$UserRegistrationSheetImplCopyWithImpl<
_$UserRegistrationSheetImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UserRegistrationSheetImplToJson(
this,
);
}
}
abstract class _UserRegistrationSheet implements UserRegistrationSheet {
const factory _UserRegistrationSheet(
{required final String name,
@JsonKey(name: 'first_name') required final String firstName,
@JsonKey(name: 'last') required final String lastName,
required final String email,
required final String password,
@JsonKey(name: 'password_confirmation')
required final String passwordConfirmation,
@JsonKey(name: 'terms') final String termsAccepted,
required final String birthdate,
required final String gender,
required final String country,
required final String city,
required final String lang,
required final String weight,
required final String height,
@JsonKey(name: 'chest_circumference')
required final String chestCircumference,
@JsonKey(name: 'waist_circumference')
required final String waistCircumference,
@JsonKey(name: 'hip_circumference')
required final String hipCircumference,
@JsonKey(name: 'blood_pressure_up') required final String bloodPressureUp,
@JsonKey(name: 'blood_pressure_down')
required final String bloodPressureDown,
@JsonKey(name: 'has_hypo') required final String hasHypo,
@JsonKey(name: 'has_hyper') required final String hasHyper,
@JsonKey(name: 'about_alergy') required final String aboutAllergy,
@JsonKey(name: 'about_taking_pils') required final String aboutTakingPils,
@JsonKey(name: 'about_sport_hobbies')
required final String aboutSportHobbies,
@JsonKey(name: 'favorite_foods') required final String favoriteFoods,
@JsonKey(name: 'unfavorite_foods') required final String unfavoriteFoods,
@JsonKey(name: 'additional_info') required final String additionalInfo,
@JsonKey(name: 'activity_coefficient')
final String activityCoefficient}) = _$UserRegistrationSheetImpl;
factory _UserRegistrationSheet.fromJson(Map<String, dynamic> json) =
_$UserRegistrationSheetImpl.fromJson;
@override
String get name;
@override
@JsonKey(name: 'first_name')
String get firstName;
@override
@JsonKey(name: 'last')
String get lastName;
@override
String get email;
@override
String get password;
@override
@JsonKey(name: 'password_confirmation')
String get passwordConfirmation;
@override
@JsonKey(name: 'terms')
String get termsAccepted;
@override
String get birthdate;
@override
String get gender;
@override
String get country;
@override
String get city;
@override
String get lang;
@override
String get weight;
@override
String get height;
@override
@JsonKey(name: 'chest_circumference')
String get chestCircumference;
@override
@JsonKey(name: 'waist_circumference')
String get waistCircumference;
@override
@JsonKey(name: 'hip_circumference')
String get hipCircumference;
@override
@JsonKey(name: 'blood_pressure_up')
String get bloodPressureUp;
@override
@JsonKey(name: 'blood_pressure_down')
String get bloodPressureDown;
@override
@JsonKey(name: 'has_hypo')
String get hasHypo;
@override
@JsonKey(name: 'has_hyper')
String get hasHyper;
@override
@JsonKey(name: 'about_alergy')
String get aboutAllergy;
@override
@JsonKey(name: 'about_taking_pils')
String get aboutTakingPils;
@override
@JsonKey(name: 'about_sport_hobbies')
String get aboutSportHobbies;
@override
@JsonKey(name: 'favorite_foods')
String get favoriteFoods;
@override
@JsonKey(name: 'unfavorite_foods')
String get unfavoriteFoods;
@override
@JsonKey(name: 'additional_info')
String get additionalInfo;
@override
@JsonKey(name: 'activity_coefficient')
String get activityCoefficient;
@override
@JsonKey(ignore: true)
_$$UserRegistrationSheetImplCopyWith<_$UserRegistrationSheetImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,73 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_registration_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$UserRegistrationSheetImpl _$$UserRegistrationSheetImplFromJson(
Map<String, dynamic> json) =>
_$UserRegistrationSheetImpl(
name: json['name'] as String,
firstName: json['first_name'] as String,
lastName: json['last'] as String,
email: json['email'] as String,
password: json['password'] as String,
passwordConfirmation: json['password_confirmation'] as String,
termsAccepted: json['terms'] as String? ?? 'accepted',
birthdate: json['birthdate'] as String,
gender: json['gender'] as String,
country: json['country'] as String,
city: json['city'] as String,
lang: json['lang'] as String,
weight: json['weight'] as String,
height: json['height'] as String,
chestCircumference: json['chest_circumference'] as String,
waistCircumference: json['waist_circumference'] as String,
hipCircumference: json['hip_circumference'] as String,
bloodPressureUp: json['blood_pressure_up'] as String,
bloodPressureDown: json['blood_pressure_down'] as String,
hasHypo: json['has_hypo'] as String,
hasHyper: json['has_hyper'] as String,
aboutAllergy: json['about_alergy'] as String,
aboutTakingPils: json['about_taking_pils'] as String,
aboutSportHobbies: json['about_sport_hobbies'] as String,
favoriteFoods: json['favorite_foods'] as String,
unfavoriteFoods: json['unfavorite_foods'] as String,
additionalInfo: json['additional_info'] as String,
activityCoefficient: json['activity_coefficient'] as String? ?? '1.2',
);
Map<String, dynamic> _$$UserRegistrationSheetImplToJson(
_$UserRegistrationSheetImpl instance) =>
<String, dynamic>{
'name': instance.name,
'first_name': instance.firstName,
'last': instance.lastName,
'email': instance.email,
'password': instance.password,
'password_confirmation': instance.passwordConfirmation,
'terms': instance.termsAccepted,
'birthdate': instance.birthdate,
'gender': instance.gender,
'country': instance.country,
'city': instance.city,
'lang': instance.lang,
'weight': instance.weight,
'height': instance.height,
'chest_circumference': instance.chestCircumference,
'waist_circumference': instance.waistCircumference,
'hip_circumference': instance.hipCircumference,
'blood_pressure_up': instance.bloodPressureUp,
'blood_pressure_down': instance.bloodPressureDown,
'has_hypo': instance.hasHypo,
'has_hyper': instance.hasHyper,
'about_alergy': instance.aboutAllergy,
'about_taking_pils': instance.aboutTakingPils,
'about_sport_hobbies': instance.aboutSportHobbies,
'favorite_foods': instance.favoriteFoods,
'unfavorite_foods': instance.unfavoriteFoods,
'additional_info': instance.additionalInfo,
'activity_coefficient': instance.activityCoefficient,
};

View File

@@ -4,7 +4,7 @@ import 'package:eatvio_app/features/registration/presentation/bloc/registration_
import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart';
class RegistrationCubit extends Cubit<RegistrationState> {
RegistrationCubit() : super(RegistrationState.loaded(sheet: LanguageSelectModel().userRegistrationSheet));
RegistrationCubit() : super(RegistrationState(sheet: LanguageSelectModel().userRegistrationSheet));
updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState.loaded(sheet: sheet));
updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet));
}

View File

@@ -4,10 +4,8 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'registration_state.freezed.dart';
@freezed
abstract class RegistrationState with _$RegistrationState {
const factory RegistrationState() = _RegistrationState;
const factory RegistrationState.loaded({
class RegistrationState with _$RegistrationState {
const factory RegistrationState({
required UserRegistrationSheet sheet,
}) = RegistrationStateLoaded;
}) = _RegistrationState;
}

View File

@@ -16,43 +16,10 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$RegistrationState {
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function(UserRegistrationSheet sheet) loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function(UserRegistrationSheet sheet)? loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function(UserRegistrationSheet sheet)? loaded,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_RegistrationState value) $default, {
required TResult Function(RegistrationStateLoaded value) loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_RegistrationState value)? $default, {
TResult? Function(RegistrationStateLoaded value)? loaded,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_RegistrationState value)? $default, {
TResult Function(RegistrationStateLoaded value)? loaded,
required TResult orElse(),
}) =>
UserRegistrationSheet get sheet => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$RegistrationStateCopyWith<RegistrationState> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -61,6 +28,10 @@ abstract class $RegistrationStateCopyWith<$Res> {
factory $RegistrationStateCopyWith(
RegistrationState value, $Res Function(RegistrationState) then) =
_$RegistrationStateCopyWithImpl<$Res, RegistrationState>;
@useResult
$Res call({UserRegistrationSheet sheet});
$UserRegistrationSheetCopyWith<$Res> get sheet;
}
/// @nodoc
@@ -72,13 +43,41 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? sheet = null,
}) {
return _then(_value.copyWith(
sheet: null == sheet
? _value.sheet
: sheet // ignore: cast_nullable_to_non_nullable
as UserRegistrationSheet,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$UserRegistrationSheetCopyWith<$Res> get sheet {
return $UserRegistrationSheetCopyWith<$Res>(_value.sheet, (value) {
return _then(_value.copyWith(sheet: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$RegistrationStateImplCopyWith<$Res> {
abstract class _$$RegistrationStateImplCopyWith<$Res>
implements $RegistrationStateCopyWith<$Res> {
factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value,
$Res Function(_$RegistrationStateImpl) then) =
__$$RegistrationStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({UserRegistrationSheet sheet});
@override
$UserRegistrationSheetCopyWith<$Res> get sheet;
}
/// @nodoc
@@ -88,119 +87,13 @@ class __$$RegistrationStateImplCopyWithImpl<$Res>
__$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value,
$Res Function(_$RegistrationStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$RegistrationStateImpl implements _RegistrationState {
const _$RegistrationStateImpl();
@override
String toString() {
return 'RegistrationState()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$RegistrationStateImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function(UserRegistrationSheet sheet) loaded,
}) {
return $default();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function(UserRegistrationSheet sheet)? loaded,
}) {
return $default?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function(UserRegistrationSheet sheet)? loaded,
required TResult orElse(),
}) {
if ($default != null) {
return $default();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_RegistrationState value) $default, {
required TResult Function(RegistrationStateLoaded value) loaded,
}) {
return $default(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_RegistrationState value)? $default, {
TResult? Function(RegistrationStateLoaded value)? loaded,
}) {
return $default?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_RegistrationState value)? $default, {
TResult Function(RegistrationStateLoaded value)? loaded,
required TResult orElse(),
}) {
if ($default != null) {
return $default(this);
}
return orElse();
}
}
abstract class _RegistrationState implements RegistrationState {
const factory _RegistrationState() = _$RegistrationStateImpl;
}
/// @nodoc
abstract class _$$RegistrationStateLoadedImplCopyWith<$Res> {
factory _$$RegistrationStateLoadedImplCopyWith(
_$RegistrationStateLoadedImpl value,
$Res Function(_$RegistrationStateLoadedImpl) then) =
__$$RegistrationStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({UserRegistrationSheet sheet});
}
/// @nodoc
class __$$RegistrationStateLoadedImplCopyWithImpl<$Res>
extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateLoadedImpl>
implements _$$RegistrationStateLoadedImplCopyWith<$Res> {
__$$RegistrationStateLoadedImplCopyWithImpl(
_$RegistrationStateLoadedImpl _value,
$Res Function(_$RegistrationStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? sheet = null,
}) {
return _then(_$RegistrationStateLoadedImpl(
return _then(_$RegistrationStateImpl(
sheet: null == sheet
? _value.sheet
: sheet // ignore: cast_nullable_to_non_nullable
@@ -211,22 +104,22 @@ class __$$RegistrationStateLoadedImplCopyWithImpl<$Res>
/// @nodoc
class _$RegistrationStateLoadedImpl implements RegistrationStateLoaded {
const _$RegistrationStateLoadedImpl({required this.sheet});
class _$RegistrationStateImpl implements _RegistrationState {
const _$RegistrationStateImpl({required this.sheet});
@override
final UserRegistrationSheet sheet;
@override
String toString() {
return 'RegistrationState.loaded(sheet: $sheet)';
return 'RegistrationState(sheet: $sheet)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$RegistrationStateLoadedImpl &&
other is _$RegistrationStateImpl &&
(identical(other.sheet, sheet) || other.sheet == sheet));
}
@@ -236,80 +129,19 @@ class _$RegistrationStateLoadedImpl implements RegistrationStateLoaded {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl>
get copyWith => __$$RegistrationStateLoadedImplCopyWithImpl<
_$RegistrationStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function(UserRegistrationSheet sheet) loaded,
}) {
return loaded(sheet);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function(UserRegistrationSheet sheet)? loaded,
}) {
return loaded?.call(sheet);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function(UserRegistrationSheet sheet)? loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(sheet);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_RegistrationState value) $default, {
required TResult Function(RegistrationStateLoaded value) loaded,
}) {
return loaded(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_RegistrationState value)? $default, {
TResult? Function(RegistrationStateLoaded value)? loaded,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_RegistrationState value)? $default, {
TResult Function(RegistrationStateLoaded value)? loaded,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(this);
}
return orElse();
}
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
__$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(
this, _$identity);
}
abstract class RegistrationStateLoaded implements RegistrationState {
const factory RegistrationStateLoaded(
{required final UserRegistrationSheet sheet}) =
_$RegistrationStateLoadedImpl;
abstract class _RegistrationState implements RegistrationState {
const factory _RegistrationState(
{required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl;
@override
UserRegistrationSheet get sheet;
@override
@JsonKey(ignore: true)
_$$RegistrationStateLoadedImplCopyWith<_$RegistrationStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -20,6 +20,7 @@ import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:validators/validators.dart';
class RegistrationScreen extends StatefulWidget {
const RegistrationScreen({super.key});
@@ -64,7 +65,6 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
create: (BuildContext context) => RegistrationCubit(),
child: BlocBuilder<RegistrationCubit, RegistrationState>(
builder: (BuildContext context, RegistrationState state) {
(state as RegistrationStateLoaded);
return PopScope(
canPop: false,
onPopInvoked: (_) => _showPopDialog(),
@@ -112,12 +112,14 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
),
backgroundColor: appTheme.blueA400,
onPressed: () {
setState(() {
pageController.nextPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
);
});
if (canGoNext(state)) {
setState(() {
pageController.nextPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
);
});
}
},
label: Text(
'Продолжить',
@@ -169,21 +171,21 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
});
},
children: [
LanguageSelectScreen.builder(context),
CredentialsScreen.builder(context, state.sheet),
NameScreen.builder(context, state.sheet),
GenderScreen.builder(context, state.sheet),
DateOfBirthScreen.builder(context, state.sheet),
CityOfLivingScreen.builder(context, state.sheet),
BodyCircumferencesScreen.builder(context, state.sheet),
WeightScreen.builder(context, state.sheet),
HeightScreen.builder(context, state.sheet),
BloodPressureScreen.builder(context, state.sheet),
AllergiesScreen.builder(context, state.sheet),
MedicineIntakeScreen.builder(context, state.sheet),
FavoriteSportsScreen.builder(context, state.sheet),
FavoriteFoodsScreen.builder(context, state.sheet),
AdditionalInformationScreen.builder(context, state.sheet),
LanguageSelectScreen(sheet: context.read<RegistrationCubit>().state.sheet),
CredentialsScreen(sheet: context.read<RegistrationCubit>().state.sheet),
NameScreen(),
GenderScreen(),
DateOfBirthScreen(),
CityOfLivingScreen(),
BodyCircumferencesScreen(),
WeightScreen(),
HeightScreen(),
BloodPressureScreen(),
AllergiesScreen(),
MedicineIntakeScreen(),
FavoriteSportsScreen(),
FavoriteFoodsScreen(),
AdditionalInformationScreen(),
],
),
),
@@ -192,4 +194,71 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
),
);
}
bool canGoNext(state) {
switch (step) {
case 2:
List<String> errors = validateFields(state.sheet.email, state.sheet.name, state.sheet.password, state.sheet.passwordConfirmation);
if (errors.isEmpty) {
return true;
} else {
String errorMessage = '';
for (var error in errors) {
errorMessage += error + '\n\n';
}
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Ошибка'),
content: Text(errorMessage),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text('OK'),
),
],
),
);
return false;
}
default:
return true;
}
}
List<String> validateFields(String email, String name, String password, String passwordConfirmation) {
List<String> errors = [];
if (!isEmail(email)) {
errors.add('email_invalid'.tr);
}
if (email.isEmpty) {
errors.add('email_empty'.tr);
}
if (name.length < 6) {
errors.add('name_short'.tr);
}
if (name.isEmpty) {
errors.add('name_empty'.tr);
}
if (password.isEmpty) {
errors.add('name_empty'.tr);
}
if (password.length < 6) {
errors.add('password_short'.tr);
}
if (password != passwordConfirmation) {
errors.add('password_confirmation_mismatch'.tr);
}
return errors;
}
}

View File

@@ -52,7 +52,7 @@ class AdditionalInformationScreen extends StatelessWidget {
onTapFinish(AdditionalInformationState state, BuildContext context) {
return () async {
UserRegistrationSheet sheet = state.additionalInformationModelObj!.userRegistrationSheet;
sheet.additionalInfo = state.editTextController!.text;
// sheet.additionalInfo = state.editTextController!.text;
final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'),

View File

@@ -68,7 +68,7 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
onTapContinue(AllergiesState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet;
sheet.aboutAllergy = state.enterInformationController!.text;
// sheet.aboutAllergy = state.enterInformationController!.text;
GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet);
};
}

View File

@@ -18,9 +18,9 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
Emitter<BloodPressureState> emit,
) {
if (event.value.id == 1) {
state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1';
// state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1';
} else {
state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0';
// state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0';
}
emit(state.copyWith(selectedHyperValue: event.value));
}
@@ -30,9 +30,9 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
Emitter<BloodPressureState> emit,
) {
if (event.value.id == 1) {
state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1';
// state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1';
} else {
state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0';
// state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0';
}
emit(state.copyWith(selectedHypoValue: event.value));
}

View File

@@ -159,8 +159,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
List<String> errors = validateFields(state.upPressureController!.text, state.downPressureController!.text);
if (errors.isEmpty) {
UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet;
sheet.bloodPressureUp = state.upPressureController!.text;
sheet.bloodPressureDown = state.downPressureController!.text;
// sheet.bloodPressureUp = state.upPressureController!.text;
// sheet.bloodPressureDown = state.downPressureController!.text;
AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet);
} else {
String errorMessage = '';

View File

@@ -36,7 +36,7 @@ class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
child: Column(
children: [
Text("initial_measurements".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 93.v),
SizedBox(height: 16.v),
Column(
children: [
Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
@@ -94,9 +94,9 @@ class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
validateFields(state.chestCircumferenceController!.text, state.waistCircumferenceController!.text, state.hipCircumferenceController!.text);
if (errors.isEmpty) {
UserRegistrationSheet sheet = state.bodyCircumferencesModelObj!.userRegistrationSheet;
sheet.chestCircumference = state.chestCircumferenceController!.text;
sheet.waistCircumference = state.waistCircumferenceController!.text;
sheet.hipCircumference = state.hipCircumferenceController!.text;
// sheet.chestCircumference = state.chestCircumferenceController!.text;
// sheet.waistCircumference = state.waistCircumferenceController!.text;
// sheet.hipCircumference = state.hipCircumferenceController!.text;
GoRouter.of(context).goNamed('weightScreen', extra: sheet);
} else {
String errorMessage = '';

View File

@@ -27,7 +27,7 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
Emitter<CityOfLivingState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
state.cityOfLivingModelObj?.userRegistrationSheet.country =
// state.cityOfLivingModelObj?.userRegistrationSheet.country =
event.value.title;
}

View File

@@ -28,7 +28,6 @@ class CityOfLivingScreen extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
SizedBox(height: 39.v),
Text("place_of_living".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 39.v),
Text("country".tr, style: theme.textTheme.bodyLarge),

View File

@@ -1,23 +1,34 @@
import 'package:go_router/go_router.dart';
import 'bloc/credentials_bloc.dart';
import 'models/credentials_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:validators/validators.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class CredentialsScreen extends StatelessWidget {
static Widget builder(BuildContext context, sheet) {
return BlocProvider<CredentialsBloc>(
create: (context) => CredentialsBloc(
CredentialsState(
credentialsModelObj: CredentialsModel(userRegistrationSheet: sheet),
),
)..add(CredentialsInitialEvent()),
child: CredentialsScreen(),
);
class CredentialsScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const CredentialsScreen({super.key, required this.sheet});
@override
State<CredentialsScreen> createState() => _CredentialsScreenState();
}
class _CredentialsScreenState extends State<CredentialsScreen> {
final emailController = TextEditingController();
final nameController = TextEditingController();
final passwordController = TextEditingController();
final passwordConfirmationController = TextEditingController();
@override
void initState() {
super.initState();
emailController.text = widget.sheet.email;
nameController.text = widget.sheet.name;
passwordController.text = widget.sheet.password;
passwordConfirmationController.text = widget.sheet.passwordConfirmation;
}
@override
@@ -34,131 +45,51 @@ class CredentialsScreen extends StatelessWidget {
SizedBox(height: 16.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
CustomTextFormField(
controller: emailController,
textInputAction: TextInputAction.done,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(email: newValue));
},
),
SizedBox(height: 22.v),
Text("username".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.nameController,
builder: (context, nameController) {
return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done);
CustomTextFormField(
controller: nameController,
textInputAction: TextInputAction.done,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(name: newValue));
},
),
SizedBox(height: 19.v),
Text("password".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.passwordController,
builder: (context, passwordController) {
return CustomTextFormField(
obscureText: true,
controller: passwordController,
);
CustomTextFormField(
obscureText: true,
controller: passwordController,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue));
},
),
SizedBox(height: 21.v),
Text("password_confirmation".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.passwordConfirmationController,
builder: (context, passwordConfirmationController) {
return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done);
CustomTextFormField(
obscureText: true,
controller: passwordConfirmationController,
textInputAction: TextInputAction.done,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(passwordConfirmation: newValue));
},
),
// BlocBuilder<CredentialsBloc, CredentialsState>(
// builder: (context, state) {
// return NextStepButton(
// text: "continue".tr.toUpperCase(),
// margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
// buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
// onPressed: onTapContinue(state, context),
// );
// },
// ),
],
),
),
);
}
onTapContinue(CredentialsState state, BuildContext context) {
return () {
List<String> errors =
validateFields(state.emailController!.text, state.nameController!.text, state.passwordController!.text, state.passwordConfirmationController!.text);
if (errors.isEmpty) {
UserRegistrationSheet sheet = state.credentialsModelObj!.userRegistrationSheet;
sheet.email = state.emailController!.text;
sheet.name = state.nameController!.text;
sheet.password = state.passwordController!.text;
sheet.passwordConfirmation = state.passwordConfirmationController!.text;
GoRouter.of(context).goNamed('nameScreen', extra: sheet);
} else {
String errorMessage = '';
for (var error in errors) {
errorMessage += error + '\n\n';
}
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Ошибка'),
content: Text(errorMessage),
actions: [
TextButton(
onPressed: onTapOk(context),
child: Text('OK'),
),
],
),
);
}
};
}
onTapOk(BuildContext context) {
return () {
Navigator.pop(context);
};
}
List<String> validateFields(String email, String name, String password, String passwordConfirmation) {
List<String> errors = [];
if (!isEmail(email)) {
errors.add('email_invalid'.tr);
}
if (email.isEmpty) {
errors.add('email_empty'.tr);
}
if (name.length < 6) {
errors.add('name_short'.tr);
}
if (name.isEmpty) {
errors.add('name_empty'.tr);
}
if (password.isEmpty) {
errors.add('name_empty'.tr);
}
if (password.length < 6) {
errors.add('password_short'.tr);
}
if (password != passwordConfirmation) {
errors.add('password_confirmation_mismatch'.tr);
}
return errors;
}
}

View File

@@ -65,7 +65,7 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
onTapContinue(DateOfBirthState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.dateOfBirthModelObj!.userRegistrationSheet;
sheet.birthdate = selectedDate.toString();
// sheet.birthdate = selectedDate.toString();
GoRouter.of(context).goNamed('cityOfLivingScreen', extra: sheet);
};
}

View File

@@ -81,8 +81,8 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
onTapContinue(FavoriteFoodsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet;
sheet.favoriteFoods = state.favoriteFoodsController!.text;
sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text;
// sheet.favoriteFoods = state.favoriteFoodsController!.text;
// sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text;
GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet);
};
}

View File

@@ -70,7 +70,7 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
onTapContinue(FavoriteSportsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet;
sheet.aboutSportHobbies = state.enterinformationController!.text;
// sheet.aboutSportHobbies = state.enterinformationController!.text;
GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet);
};
}

View File

@@ -24,6 +24,6 @@ class GenderBloc extends Bloc<GenderEvent, GenderState> {
Emitter<GenderState> emit,
) {
emit(state.copyWith(selectedRadioValue: event.value));
state.genderModelObj?.userRegistrationSheet.gender = event.value;
// state.genderModelObj?.userRegistrationSheet.gender = event.value;
}
}

View File

@@ -80,7 +80,7 @@ class _GenderScreenState extends State<GenderScreen> {
onTapNext(GenderState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.genderModelObj!.userRegistrationSheet;
sheet.gender = state.selectedRadioValue!;
// sheet.gender = state.selectedRadioValue!;
GoRouter.of(context).goNamed('dateOfBirthScreen', extra: sheet);
};
}

View File

@@ -31,7 +31,7 @@ class HeightScreen extends StatelessWidget {
"height_measurements".tr,
style: theme.textTheme.headlineSmall,
),
SizedBox(height: 174.v),
SizedBox(height: 16.v),
Column(
children: [
Text(

View File

@@ -24,7 +24,7 @@ class LanguageSelectBloc extends Bloc<LanguageSelectEvent, LanguageSelectState>
_changeDropDown(ChangeDropDownEvent event, Emitter<LanguageSelectState> emit) {
emit(state.copyWith(selectedDropDownValue: event.value));
state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title;
// state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title;
}
List<SelectionPopupModel> fillDropdownItemList() {

View File

@@ -1,21 +1,29 @@
import 'bloc/language_select_bloc.dart';
import 'models/language_select_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:flutter/material.dart';
class LanguageSelectScreen extends StatelessWidget {
const LanguageSelectScreen({Key? key}) : super(key: key);
class LanguageSelectScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
static Widget builder(BuildContext context) {
return BlocProvider<LanguageSelectBloc>(
create: (context) => LanguageSelectBloc(
LanguageSelectState(
languageSelectModelObj: LanguageSelectModel(),
),
)..add(LanguageSelectInitialEvent()),
child: LanguageSelectScreen(),
);
const LanguageSelectScreen({required this.sheet, super.key});
@override
State<LanguageSelectScreen> createState() => _LanguageSelectScreenState();
}
class _LanguageSelectScreenState extends State<LanguageSelectScreen> {
final List<SelectionPopupModel> dropdownItemList = [
SelectionPopupModel(id: 1, title: "Русский", isSelected: true),
];
late SelectionPopupModel value;
@override
void initState() {
super.initState();
value = SelectionPopupModel(title: widget.sheet.lang);
}
@override
@@ -36,56 +44,28 @@ class LanguageSelectScreen extends StatelessWidget {
),
),
const SizedBox(height: 32),
BlocSelector<LanguageSelectBloc, LanguageSelectState, LanguageSelectModel?>(
selector: (state) => state.languageSelectModelObj,
builder: (
context,
languageSelectModelObj,
) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.h),
),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize,
),
),
hintText: "Не выбрано".tr,
items: languageSelectModelObj?.dropdownItemList ?? [],
onChanged: (value) => _onDropDownChanged(context, value),
);
},
CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.h),
),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize,
),
),
hintText: "Не выбрано".tr,
items: dropdownItemList,
onChanged: (SelectionPopupModel newValue) => setState(() {
value = newValue;
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value.title));
}),
),
// bottomNavigationBar: BlocBuilder<LanguageSelectBloc, LanguageSelectState>(
// builder: (context, state) {
// return NextStepButton(
// text: "continue".tr.toUpperCase(),
// margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
// buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
// onPressed: _saveAndPush(state, context),
// );
// },
// ),
],
),
);
}
// void Function()? _saveAndPush(LanguageSelectState state, BuildContext context) {
// return () {
// UserRegistrationSheet sheet = state.languageSelectModelObj!.userRegistrationSheet;
// GoRouter.of(context).goNamed(
// 'credentialsScreen',
// extra: sheet,
// );
// };
// }
void _onDropDownChanged(BuildContext context, value) {
context.read<LanguageSelectBloc>().add(ChangeDropDownEvent(value: value));
}
}

View File

@@ -8,6 +8,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model
/// and is typically used to hold data that is passed between different parts of the application.
class LanguageSelectModel extends Equatable {
LanguageSelectModel({this.dropdownItemList = const []});
UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet(
name: '',
firstName: '',

View File

@@ -82,7 +82,7 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
onTapNext(MedicineIntakeState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet;
sheet.aboutTakingPils = state.enterInformationController!.text;
// sheet.aboutTakingPils = state.enterInformationController!.text;
GoRouter.of(context).goNamed(
'favoriteSportsScreen',
extra: sheet,

View File

@@ -29,7 +29,7 @@ class NameScreen extends StatelessWidget {
child: Column(
children: [
Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 93.v),
SizedBox(height: 16.v),
Text("first_name".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<NameBloc, NameState, TextEditingController?>(

View File

@@ -31,7 +31,7 @@ class WeightScreen extends StatelessWidget {
"weight_measurements".tr,
style: theme.textTheme.headlineSmall,
),
SizedBox(height: 174.v),
SizedBox(height: 16.v),
Column(
children: [
Text(

View File

@@ -3,35 +3,16 @@ import 'package:flutter/material.dart';
// ignore: must_be_immutable
class AppbarTitleImage extends StatelessWidget {
AppbarTitleImage({
Key? key,
this.imagePath,
this.margin,
this.onTap,
}) : super(
key: key,
);
const AppbarTitleImage({required this.imagePath, super.key});
String? imagePath;
EdgeInsetsGeometry? margin;
Function? onTap;
final String? imagePath;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTapCall,
child: Padding(
padding: margin ?? EdgeInsets.zero,
child: CustomImageView(
imagePath: imagePath,
height: 48,
fit: BoxFit.contain,
),
),
return CustomImageView(
imagePath: imagePath,
height: 48,
fit: BoxFit.contain,
);
}
void onTapCall() {}
}

View File

@@ -92,7 +92,6 @@ class CustomDropDown extends StatelessWidget {
value: item,
child: Text(
item.title,
overflow: TextOverflow.fade,
style: hintStyle ?? Theme.of(context).textTheme.titleMedium,
),
);

View File

@@ -62,7 +62,7 @@ class CustomTextFormField extends StatelessWidget {
final String? initialValue;
final Function(String)? onFieldSubmitted;
final void Function(String?)? onSaved;
final void Function(String?)? onChanged;
final void Function(String)? onChanged;
@override
Widget build(BuildContext context) {
@@ -128,6 +128,7 @@ class CustomTextFormField extends StatelessWidget {
: SizedBox(
width: width ?? double.maxFinite,
child: TextFormField(
onChanged: onChanged,
controller: controller,
focusNode: focusNode ?? null,
autofocus: autofocus!,