feature(registration): iter6

This commit is contained in:
mso7nueh
2024-07-15 16:33:33 +03:00
parent ee37f02d78
commit 726b74a236
96 changed files with 358 additions and 3503 deletions

View File

@@ -1,5 +1,6 @@
import 'package:eatvio_app/core/token_storage.dart';
import 'package:go_router/go_router.dart';
import 'package:url_launcher/url_launcher.dart';
import 'bloc/auth_bloc.dart';
import 'models/auth_model.dart';
@@ -33,43 +34,46 @@ class AuthScreen extends StatelessWidget {
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 36.v),
Text("user_authorization".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 60.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
},),
SizedBox(height: 22.v),
Text("password".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.passwordController,
builder: (context, passwordController) {
return CustomTextFormField(
obscureText: true,
controller: passwordController,
);
},),
SizedBox(height: 50.v),
NextStepButton(
text: "no_account".tr.toUpperCase(),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapNoAccount(context),
),
/*NextStepButton(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
SizedBox(height: 36.v),
Text("user_authorization".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 60.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
},
),
SizedBox(height: 22.v),
Text("password".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.passwordController,
builder: (context, passwordController) {
return CustomTextFormField(
obscureText: true,
controller: passwordController,
);
},
),
SizedBox(height: 50.v),
NextStepButton(
text: "no_account".tr.toUpperCase(),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapNoAccount(context),
),
/*NextStepButton(
text: "Тест дневника".toUpperCase(),
margin:
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
@@ -81,14 +85,27 @@ class AuthScreen extends StatelessWidget {
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapProfileTest(context)),*/
BlocBuilder<AuthBloc, AuthState>(builder: (context, state) {
return NextStepButton(
text: "authentificate".tr.toUpperCase(),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapAuth(state, context),);
},),
],),),),);
BlocBuilder<AuthBloc, AuthState>(
builder: (context, state) {
return NextStepButton(
text: "authentificate".tr.toUpperCase(),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 16.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapAuth(state, context),
);
},
),
TextButton(
onPressed: () async {
await launchUrl(Uri.parse(dotenv.env['OFERTA']!));
},
child: Text('Пользовательское соглашение'),
),
],
),
),
),
);
}
onTapAuth(AuthState state, BuildContext context) {
@@ -99,8 +116,12 @@ class AuthScreen extends StatelessWidget {
'email': state.emailController!.text,
'password': state.passwordController!.text,
};
final response = await http.post(Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'),
headers: {'Content-Type': 'application/json'}, body: json.encode(credentials), encoding: utf8,);
final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/login'),
headers: {'Content-Type': 'application/json'},
body: json.encode(credentials),
encoding: utf8,
);
print(response.statusCode);
if (response.statusCode == 200) {
var res = await jsonDecode(response.body);

View File

@@ -1,61 +0,0 @@
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:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class AdditionalInformationScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const AdditionalInformationScreen({super.key, required this.sheet});
@override
State<AdditionalInformationScreen> createState() => _AdditionalInformationScreenState();
}
class _AdditionalInformationScreenState extends State<AdditionalInformationScreen> {
final editTextController = TextEditingController();
@override
void initState() {
super.initState();
editTextController.text = widget.sheet.additionalInfo;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Container(
width: 294.h,
margin: EdgeInsets.only(left: 24.h, right: 23.h),
child: Text(
"enter_additional_information".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.titleMediumSegoeUI,
),
),
SizedBox(height: 10.v),
CustomTextFormField(
controller: editTextController,
hintText: "У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
textInputAction: TextInputAction.done,
maxLines: 8,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(additionalInfo: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,22 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/additional_information_screen/models/additional_information_model.dart';
part 'additional_information_event.dart';
part 'additional_information_state.dart';
/// A bloc that manages the state of a AdditionalInformation according to the event that is dispatched to it.
class AdditionalInformationBloc
extends Bloc<AdditionalInformationEvent, AdditionalInformationState> {
AdditionalInformationBloc(AdditionalInformationState initialState)
: super(initialState) {
on<AdditionalInformationInitialEvent>(_onInitialize);
}
_onInitialize(
AdditionalInformationInitialEvent event,
Emitter<AdditionalInformationState> emit,
) async {
emit(state.copyWith(editTextController: TextEditingController()));
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'additional_information_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///AdditionalInformation widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AdditionalInformationEvent extends Equatable {}
/// Event that is dispatched when the AdditionalInformation widget is first created.
class AdditionalInformationInitialEvent extends AdditionalInformationEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,31 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'additional_information_bloc.dart';
/// Represents the state of AdditionalInformation in the application.
class AdditionalInformationState extends Equatable {
AdditionalInformationState({
this.editTextController,
this.additionalInformationModelObj,
});
TextEditingController? editTextController;
AdditionalInformationModel? additionalInformationModelObj;
@override
List<Object?> get props => [
editTextController,
additionalInformationModelObj,
];
AdditionalInformationState copyWith({
TextEditingController? editTextController,
AdditionalInformationModel? additionalInformationModelObj,
}) {
return AdditionalInformationState(
editTextController: editTextController ?? this.editTextController,
additionalInformationModelObj:
additionalInformationModelObj ?? this.additionalInformationModelObj,
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [additional_information_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AdditionalInformationModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
AdditionalInformationModel({required this.userRegistrationSheet});
AdditionalInformationModel copyWith() {
return AdditionalInformationModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,53 +0,0 @@
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_text_form_field.dart';
import 'package:flutter/material.dart';
class AllergiesScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const AllergiesScreen({super.key, required this.sheet});
@override
State<AllergiesScreen> createState() => _AllergiesScreenState();
}
class _AllergiesScreenState extends State<AllergiesScreen> {
final enterInformationController = TextEditingController();
@override
void initState() {
super.initState();
enterInformationController.text = widget.sheet.aboutAllergy;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text("allergies_presence".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 22.v),
Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
CustomTextFormField(
controller: enterInformationController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 8,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutAllergy: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/allergies_screen/models/allergies_model.dart';
part 'allergies_event.dart';
part 'allergies_state.dart';
/// A bloc that manages the state of a Allergies according to the event that is dispatched to it.
class AllergiesBloc extends Bloc<AllergiesEvent, AllergiesState> {
AllergiesBloc(AllergiesState initialState) : super(initialState) {
on<AllergiesInitialEvent>(_onInitialize);
}
_onInitialize(
AllergiesInitialEvent event,
Emitter<AllergiesState> emit,
) async {
emit(state.copyWith(enterInformationController: TextEditingController()));
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'allergies_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Allergies widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AllergiesEvent extends Equatable {}
/// Event that is dispatched when the Allergies widget is first created.
class AllergiesInitialEvent extends AllergiesEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,31 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'allergies_bloc.dart';
/// Represents the state of Allergies in the application.
class AllergiesState extends Equatable {
AllergiesState({
this.enterInformationController,
this.allergiesModelObj,
});
TextEditingController? enterInformationController;
AllergiesModel? allergiesModelObj;
@override
List<Object?> get props => [
enterInformationController,
allergiesModelObj,
];
AllergiesState copyWith({
TextEditingController? enterInformationController,
AllergiesModel? allergiesModelObj,
}) {
return AllergiesState(
enterInformationController:
enterInformationController ?? this.enterInformationController,
allergiesModelObj: allergiesModelObj ?? this.allergiesModelObj,
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [allergies_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AllergiesModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
AllergiesModel({required this.userRegistrationSheet});
AllergiesModel copyWith() {
return AllergiesModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,233 +0,0 @@
import 'package:go_router/go_router.dart';
import 'bloc/app_navigation_bloc.dart';
import 'models/app_navigation_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class AppNavigationScreen extends StatefulWidget {
const AppNavigationScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<AppNavigationBloc>(
create: (context) => AppNavigationBloc(AppNavigationState(
appNavigationModelObj: AppNavigationModel(),
),)
..add(AppNavigationInitialEvent()),
child: AppNavigationScreen(),
);
}
@override
State<AppNavigationScreen> createState() => _AppNavigationScreenState();
}
class _AppNavigationScreenState extends State<AppNavigationScreen> {
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<AppNavigationBloc, AppNavigationState>(
builder: (context, state) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0XFFFFFFFF),
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
_buildAppNavigation(context),
Expanded(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
_buildScreenTitle(
context,
screenTitle: "date_of_birth".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('dateOfBirthScreen'),
),
_buildScreenTitle(
context,
screenTitle: "city_of_living".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('cityOfLivingScreen'),
),
_buildScreenTitle(
context,
screenTitle: "body_circumferences".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('bodyCircumferencesScreen'),
),
_buildScreenTitle(
context,
screenTitle: "weight".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('weightScreen'),
),
_buildScreenTitle(
context,
screenTitle: "allergies".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('allergiesScreen'),
),
_buildScreenTitle(
context,
screenTitle: "medicine_intake".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('medicineIntakeScreen'),
),
_buildScreenTitle(
context,
screenTitle: "splash_screen".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('splashScreen'),
),
_buildScreenTitle(
context,
screenTitle: "gender".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('genderScreen'),
),
_buildScreenTitle(
context,
screenTitle: "blood_pressure".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('bloodPressureScreen'),
),
_buildScreenTitle(
context,
screenTitle: "favorite_sports".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteSportsScreen'),
),
_buildScreenTitle(
context,
screenTitle: "favorite_foods".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteFoodsScreen'),
),
_buildScreenTitle(
context,
screenTitle: "schedule".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('scheduleScreen'),
),
_buildScreenTitle(
context,
screenTitle: "additional_information".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('additionalInformationScreen'),
),
_buildScreenTitle(
context,
screenTitle: "language_select".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('languageSelectScreen'),
),
_buildScreenTitle(
context,
screenTitle: "auth".tr,
onTapScreenTitle: () => GoRouter.of(context).goNamed('authScreen'),
),
],
),
),
),
),
],
),
),
),
);
},
);
}
/// Section Widget
_buildAppNavigation(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
"App Navigation".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Text(
"Check your app's UI from the below demo screens of your app.".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF888888),
fontSize: 16.fSize,
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF000000),
),
],
),
);
}
/// Common widget
_buildScreenTitle(
BuildContext context, {
required String screenTitle,
Function? onTapScreenTitle,
}) {
return GestureDetector(
onTap: onTapScreenTitle!.call(),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
screenTitle,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF888888),
),
],
),
),
);
}
}

View File

@@ -1,18 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/app_navigation_screen/models/app_navigation_model.dart';
part 'app_navigation_event.dart';
part 'app_navigation_state.dart';
/// A bloc that manages the state of a AppNavigation according to the event that is dispatched to it.
class AppNavigationBloc extends Bloc<AppNavigationEvent, AppNavigationState> {
AppNavigationBloc(AppNavigationState initialState) : super(initialState) {
on<AppNavigationInitialEvent>(_onInitialize);
}
_onInitialize(
AppNavigationInitialEvent event,
Emitter<AppNavigationState> emit,
) async {}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'app_navigation_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///AppNavigation widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AppNavigationEvent extends Equatable {}
/// Event that is dispatched when the AppNavigation widget is first created.
class AppNavigationInitialEvent extends AppNavigationEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,21 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'app_navigation_bloc.dart';
/// Represents the state of AppNavigation in the application.
class AppNavigationState extends Equatable {
AppNavigationState({this.appNavigationModelObj});
AppNavigationModel? appNavigationModelObj;
@override
List<Object?> get props => [
appNavigationModelObj,
];
AppNavigationState copyWith({AppNavigationModel? appNavigationModelObj}) {
return AppNavigationState(
appNavigationModelObj:
appNavigationModelObj ?? this.appNavigationModelObj,
);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [app_navigation_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AppNavigationModel extends Equatable {
AppNavigationModel();
AppNavigationModel copyWith() {
return AppNavigationModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -1,72 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/blood_pressure_screen/models/blood_pressure_model.dart';
part 'blood_pressure_event.dart';
part 'blood_pressure_state.dart';
/// A bloc that manages the state of a BloodPressure according to the event that is dispatched to it.
class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
BloodPressureBloc(BloodPressureState initialState) : super(initialState) {
on<BloodPressureInitialEvent>(_onInitialize);
on<ChangeHypoDownEvent>(_changeHypoDropDown);
on<ChangeHyperDropDownEvent>(_changeHyperDropDown);
}
_changeHyperDropDown(
ChangeHyperDropDownEvent event,
Emitter<BloodPressureState> emit,
) {
if (event.value.id == 1) {
// state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '1';
} else {
// state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = '0';
}
emit(state.copyWith(selectedHyperValue: event.value));
}
_changeHypoDropDown(
ChangeHypoDownEvent event,
Emitter<BloodPressureState> emit,
) {
if (event.value.id == 1) {
// state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '1';
} else {
// state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = '0';
}
emit(state.copyWith(selectedHypoValue: event.value));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(
id: 1,
title: "Да",
),
SelectionPopupModel(
id: 2,
title: "Нет",
isSelected: true,
),
];
}
_onInitialize(
BloodPressureInitialEvent event,
Emitter<BloodPressureState> emit,
) async {
emit(
state.copyWith(
upPressureController: TextEditingController(),
downPressureController: TextEditingController(),
),
);
emit(
state.copyWith(
bloodPressureModelObj: state.bloodPressureModelObj?.copyWith(dropdownItemList: fillDropdownItemList()),
),
);
}
}

View File

@@ -1,39 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'blood_pressure_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///BloodPressure widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class BloodPressureEvent extends Equatable {}
/// Event that is dispatched when the BloodPressure widget is first created.
class BloodPressureInitialEvent extends BloodPressureEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeHyperDropDownEvent extends BloodPressureEvent {
ChangeHyperDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}
class ChangeHypoDownEvent extends BloodPressureEvent {
ChangeHypoDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -1,50 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'blood_pressure_bloc.dart';
/// Represents the state of BloodPressure in the application.
class BloodPressureState extends Equatable {
BloodPressureState({
this.upPressureController,
this.downPressureController,
this.selectedHyperValue,
this.selectedHypoValue,
this.bloodPressureModelObj,
});
TextEditingController? upPressureController;
TextEditingController? downPressureController;
SelectionPopupModel? selectedHypoValue;
SelectionPopupModel? selectedHyperValue;
BloodPressureModel? bloodPressureModelObj;
@override
List<Object?> get props => [
upPressureController,
downPressureController,
selectedHyperValue,
selectedHypoValue,
bloodPressureModelObj,
];
BloodPressureState copyWith({
TextEditingController? upPressureController,
TextEditingController? downPressureController,
SelectionPopupModel? selectedHyperValue,
SelectionPopupModel? selectedHypoValue,
BloodPressureModel? bloodPressureModelObj,
}) {
return BloodPressureState(
upPressureController: upPressureController ?? this.upPressureController,
downPressureController:
downPressureController ?? this.downPressureController,
selectedHyperValue: selectedHyperValue ?? this.selectedHyperValue,
selectedHypoValue: selectedHypoValue ?? this.selectedHypoValue,
bloodPressureModelObj:
bloodPressureModelObj ?? this.bloodPressureModelObj,
);
}
}

View File

@@ -1,162 +0,0 @@
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:flutter/services.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class BloodPressureScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const BloodPressureScreen({super.key, required this.sheet});
@override
State<BloodPressureScreen> createState() => _BloodPressureScreenState();
}
class _BloodPressureScreenState extends State<BloodPressureScreen> {
final List<SelectionPopupModel> selectionPopupList = [
SelectionPopupModel(
id: 1,
title: "Да",
),
SelectionPopupModel(
id: 2,
title: "Нет",
),
];
late SelectionPopupModel selectedPopupHypo;
late SelectionPopupModel selectedPopupHyper;
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
final upPressureController = TextEditingController();
final downPressureController = TextEditingController();
@override
void initState() {
super.initState();
selectedPopupHypo = selectionPopupList[1];
selectedPopupHyper = selectionPopupList[1];
upPressureController.text = widget.sheet.bloodPressureUp;
downPressureController.text = widget.sheet.bloodPressureDown;
if (widget.sheet.hasHyper.isNotEmpty) {
widget.sheet.hasHyper == 'Да' ? selectedPopupHyper = selectionPopupList[0] : selectedPopupHyper = selectionPopupList[1];
}
if (widget.sheet.hasHypo.isNotEmpty) {
widget.sheet.hasHypo == 'Да' ? selectedPopupHypo = selectionPopupList[0] : selectedPopupHypo = selectionPopupList[1];
}
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v),
child: Column(
children: [
SizedBox(
width: 224.h,
child: Text(
"your_blood_pressure".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
),
SizedBox(height: 21.v),
Container(
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(
children: [
Text("up_pressure".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: upPressureController,
hintText: "90".tr,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: newValue));
},
),
],
),
),
SizedBox(height: 21.v),
Container(
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(
children: [
Text("down_pressure".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: downPressureController,
hintText: "90".tr,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: newValue));
},
),
],
),
),
SizedBox(height: 22.v),
Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),
),
hintText: "Не выбрано".tr,
items: selectionPopupList,
value: selectedPopupHypo,
onChanged: (newPopup) {
setState(() {
selectedPopupHypo = newPopup;
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHypo: selectedPopupHypo.title));
});
},
),
),
SizedBox(height: 22.v),
Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),
),
hintText: "Не выбрано".tr,
items: selectionPopupList,
value: selectedPopupHyper,
onChanged: (newPopup) {
setState(() {
selectedPopupHyper = newPopup;
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hasHyper: selectedPopupHyper.title));
});
},
),
),
],
),
),
);
}
}

View File

@@ -1,25 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [blood_pressure_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class BloodPressureModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
BloodPressureModel(
{required this.userRegistrationSheet, this.dropdownItemList = const [],});
List<SelectionPopupModel> dropdownItemList;
BloodPressureModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return BloodPressureModel(
userRegistrationSheet: userRegistrationSheet,
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList, userRegistrationSheet];
}

View File

@@ -1,25 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/body_circumferences_screen/models/body_circumferences_model.dart';
part 'body_circumferences_event.dart';
part 'body_circumferences_state.dart';
/// A bloc that manages the state of a BodyCircumferences according to the event that is dispatched to it.
class BodyCircumferencesBloc
extends Bloc<BodyCircumferencesEvent, BodyCircumferencesState> {
BodyCircumferencesBloc(BodyCircumferencesState initialState)
: super(initialState) {
on<BodyCircumferencesInitialEvent>(_onInitialize);
}
_onInitialize(
BodyCircumferencesInitialEvent event,
Emitter<BodyCircumferencesState> emit,
) async {
emit(state.copyWith(
chestCircumferenceController: TextEditingController(),
waistCircumferenceController: TextEditingController(),
hipCircumferenceController: TextEditingController(),),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'body_circumferences_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///BodyCircumferences widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class BodyCircumferencesEvent extends Equatable {}
/// Event that is dispatched when the BodyCircumferences widget is first created.
class BodyCircumferencesInitialEvent extends BodyCircumferencesEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,46 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'body_circumferences_bloc.dart';
/// Represents the state of BodyCircumferences in the application.
class BodyCircumferencesState extends Equatable {
BodyCircumferencesState({
this.chestCircumferenceController,
this.waistCircumferenceController,
this.hipCircumferenceController,
this.bodyCircumferencesModelObj,
});
TextEditingController? chestCircumferenceController;
TextEditingController? waistCircumferenceController;
TextEditingController? hipCircumferenceController;
BodyCircumferencesModel? bodyCircumferencesModelObj;
@override
List<Object?> get props => [
chestCircumferenceController,
waistCircumferenceController,
hipCircumferenceController,
bodyCircumferencesModelObj,
];
BodyCircumferencesState copyWith({
TextEditingController? chestCircumferenceController,
TextEditingController? waistCircumferenceController,
TextEditingController? hipCircumferenceController,
BodyCircumferencesModel? bodyCircumferencesModelObj,
}) {
return BodyCircumferencesState(
chestCircumferenceController:
chestCircumferenceController ?? this.chestCircumferenceController,
waistCircumferenceController:
waistCircumferenceController ?? this.waistCircumferenceController,
hipCircumferenceController:
hipCircumferenceController ?? this.hipCircumferenceController,
bodyCircumferencesModelObj:
bodyCircumferencesModelObj ?? this.bodyCircumferencesModelObj,
);
}
}

View File

@@ -1,88 +0,0 @@
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:flutter/services.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class BodyCircumferencesScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const BodyCircumferencesScreen({super.key, required this.sheet});
@override
State<BodyCircumferencesScreen> createState() => _BodyCircumferencesScreenState();
}
class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
final chestCircumferenceController = TextEditingController();
final waistCircumferenceController = TextEditingController();
final hipCircumferenceController = TextEditingController();
@override
void initState() {
super.initState();
chestCircumferenceController.text = widget.sheet.chestCircumference;
waistCircumferenceController.text = widget.sheet.waistCircumference;
hipCircumferenceController.text = widget.sheet.hipCircumference;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text("initial_measurements".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 16.v),
Column(
children: [
Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: chestCircumferenceController,
hintText: "90".tr,
onChanged: (value) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: value));
},
),
],
),
SizedBox(height: 19.v),
Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: waistCircumferenceController,
hintText: "60".tr,
onChanged: (value) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: value));
},
),
SizedBox(height: 21.v),
Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
CustomTextFormField(
inputFormatters: [digitsOnly],
controller: hipCircumferenceController,
hintText: "90".tr,
textInputAction: TextInputAction.done,
onChanged: (value) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hipCircumference: value));
},
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [body_circumferences_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class BodyCircumferencesModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
BodyCircumferencesModel({required this.userRegistrationSheet});
BodyCircumferencesModel copyWith() {
return BodyCircumferencesModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,37 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/city_of_living_screen/models/city_of_living_model.dart';
part 'city_of_living_event.dart';
part 'city_of_living_state.dart';
/// A bloc that manages the state of a CityOfLiving according to the event that is dispatched to it.
class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
CityOfLivingBloc(CityOfLivingState initialState) : super(initialState) {
on<CityOfLivingInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_onInitialize(
CityOfLivingInitialEvent event,
Emitter<CityOfLivingState> emit,
) async {
emit(state.copyWith(
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
dropdownItemList: fillDropdownItemList(),
),),);
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<CityOfLivingState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
// state.cityOfLivingModelObj?.userRegistrationSheet.country =
event.value.title;
}
List<SelectionPopupModel> fillDropdownItemList() {
return [SelectionPopupModel(id: 1, title: "Россия", isSelected: true)];
}
}

View File

@@ -1,28 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'city_of_living_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///CityOfLiving widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class CityOfLivingEvent extends Equatable {}
/// Event that is dispatched when the CityOfLiving widget is first created.
class CityOfLivingInitialEvent extends CityOfLivingEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends CityOfLivingEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -1,37 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'city_of_living_bloc.dart';
/// Represents the state of CityOfLiving in the application.
class CityOfLivingState extends Equatable {
CityOfLivingState({
this.selectedDropDownValue,
this.cityController,
this.cityOfLivingModelObj,
});
SelectionPopupModel? selectedDropDownValue;
TextEditingController? cityController;
CityOfLivingModel? cityOfLivingModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
cityController,
cityOfLivingModelObj,
];
CityOfLivingState copyWith({
SelectionPopupModel? selectedDropDownValue,
SelectionPopupModel? selectedDropDownValue1,
CityOfLivingModel? cityOfLivingModelObj,
}) {
return CityOfLivingState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
cityController: cityController ?? this.cityController,
cityOfLivingModelObj: cityOfLivingModelObj ?? this.cityOfLivingModelObj,
);
}
}

View File

@@ -1,24 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart';
part 'credentials_event.dart';
part 'credentials_state.dart';
/// A bloc that manages the state of a Credentials according to the event that is dispatched to it.
class CredentialsBloc extends Bloc<CredentialsEvent, CredentialsState> {
CredentialsBloc(CredentialsState initialState) : super(initialState) {
on<CredentialsInitialEvent>(_onInitialize);
}
_onInitialize(
CredentialsInitialEvent event,
Emitter<CredentialsState> emit,
) async {
emit(state.copyWith(
emailController: TextEditingController(),
nameController: TextEditingController(),
passwordController: TextEditingController(),
passwordConfirmationController: TextEditingController(),),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'credentials_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Credentials widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class CredentialsEvent extends Equatable {}
/// Event that is dispatched when the Credentials widget is first created.
class CredentialsInitialEvent extends CredentialsEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,49 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'credentials_bloc.dart';
/// Represents the state of Credentials in the application.
class CredentialsState extends Equatable {
CredentialsState({
this.emailController,
this.nameController,
this.passwordController,
this.passwordConfirmationController,
this.credentialsModelObj,
});
TextEditingController? emailController;
TextEditingController? nameController;
TextEditingController? passwordController;
TextEditingController? passwordConfirmationController;
CredentialsModel? credentialsModelObj;
@override
List<Object?> get props => [
emailController,
nameController,
passwordController,
passwordConfirmationController,
credentialsModelObj,
];
CredentialsState copyWith({
TextEditingController? nameController,
TextEditingController? emailController,
TextEditingController? passwordController,
TextEditingController? passwordConfirmationController,
CredentialsModel? credentialsModelObj,
}) {
return CredentialsState(
emailController: emailController ?? this.emailController,
nameController: nameController ?? this.nameController,
passwordController: passwordController ?? this.passwordController,
passwordConfirmationController:
passwordConfirmationController ?? this.passwordConfirmationController,
credentialsModelObj: credentialsModelObj ?? this.credentialsModelObj,
);
}
}

View File

@@ -1,95 +0,0 @@
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 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
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("user_registration".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 16.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
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),
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),
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),
CustomTextFormField(
obscureText: true,
controller: passwordConfirmationController,
textInputAction: TextInputAction.done,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(passwordConfirmation: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,22 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [credentials_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class CredentialsModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
CredentialsModel({required this.userRegistrationSheet});
CredentialsModel copyWith({UserRegistrationSheet? userRegistrationSheet}) {
return CredentialsModel(
userRegistrationSheet:
userRegistrationSheet ?? this.userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,18 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/date_of_birth_screen/models/date_of_birth_model.dart';
part 'date_of_birth_event.dart';
part 'date_of_birth_state.dart';
/// A bloc that manages the state of a DateOfBirth according to the event that is dispatched to it.
class DateOfBirthBloc extends Bloc<DateOfBirthEvent, DateOfBirthState> {
DateOfBirthBloc(DateOfBirthState initialState) : super(initialState) {
on<DateOfBirthInitialEvent>(_onInitialize);
}
_onInitialize(
DateOfBirthInitialEvent event,
Emitter<DateOfBirthState> emit,
) async {}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'date_of_birth_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///DateOfBirth widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class DateOfBirthEvent extends Equatable {}
/// Event that is dispatched when the DateOfBirth widget is first created.
class DateOfBirthInitialEvent extends DateOfBirthEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'date_of_birth_bloc.dart';
/// Represents the state of DateOfBirth in the application.
class DateOfBirthState extends Equatable {
DateOfBirthState({this.dateOfBirthModelObj});
DateOfBirthModel? dateOfBirthModelObj;
@override
List<Object?> get props => [
dateOfBirthModelObj,
];
DateOfBirthState copyWith({DateOfBirthModel? dateOfBirthModelObj}) {
return DateOfBirthState(
dateOfBirthModelObj: dateOfBirthModelObj ?? this.dateOfBirthModelObj,
);
}
}

View File

@@ -1,117 +0,0 @@
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:flutter/cupertino.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:intl/intl.dart';
class DateOfBirthScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const DateOfBirthScreen({super.key, required this.sheet});
@override
State<DateOfBirthScreen> createState() => _DateOfBirthScreenState();
}
class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
late DateTime selectedDate;
@override
void initState() {
super.initState();
if (widget.sheet.birthdate.isNotEmpty) {
selectedDate = DateFormat('yyyy-mm-dd').parse(widget.sheet.birthdate);
} else {
selectedDate = DateTime.now();
}
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text("date_of_birth".tr, style: theme.textTheme.headlineSmall),
const SizedBox(height: 32),
_buildDateInput(context),
],
),
),
);
}
/// Section Widget
_buildDateInput(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v),
decoration: AppDecoration.outlineBlueA.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize, radius: BorderRadius.circular(1.h)),
SizedBox(height: 6.v),
Align(
alignment: Alignment.center,
child: GestureDetector(
onTap: onTapCalendar(context),
child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium),
),
),
SizedBox(height: 6.v),
],
),
);
}
onTapCalendar(BuildContext context) {
return () {
_showDialog(
CupertinoDatePicker(
initialDateTime: DateTime.now(),
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (DateTime newDateTime) {
setState(() {
selectedDate = newDateTime;
print(selectedDate);
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(birthdate: selectedDate.toString()));
});
},
),
);
};
}
void _showDialog(Widget child) {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) =>
Container(
height: 216,
padding: const EdgeInsets.only(top: 6.0),
// The Bottom margin is provided to align the popup above the system
// navigation bar.
margin: EdgeInsets.only(
bottom: MediaQuery
.of(context)
.viewInsets
.bottom,
),
// Provide a background color for the popup.
color: CupertinoColors.systemBackground.resolveFrom(context),
// Use a SafeArea widget to avoid system overlaps.
child: SafeArea(
top: false,
child: child,
),
),
);
}
}

View File

@@ -1,21 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [date_of_birth_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class DateOfBirthModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
DateOfBirthModel({required this.userRegistrationSheet});
DateOfBirthModel copyWith() {
return DateOfBirthModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,22 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/favorite_foods_screen/models/favorite_foods_model.dart';
part 'favorite_foods_event.dart';
part 'favorite_foods_state.dart';
/// A bloc that manages the state of a FavoriteFoods according to the event that is dispatched to it.
class FavoriteFoodsBloc extends Bloc<FavoriteFoodsEvent, FavoriteFoodsState> {
FavoriteFoodsBloc(FavoriteFoodsState initialState) : super(initialState) {
on<FavoriteFoodsInitialEvent>(_onInitialize);
}
_onInitialize(
FavoriteFoodsInitialEvent event,
Emitter<FavoriteFoodsState> emit,
) async {
emit(state.copyWith(
favoriteFoodsController: TextEditingController(),
unfavoriteFoodsController: TextEditingController(),),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'favorite_foods_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///FavoriteFoods widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class FavoriteFoodsEvent extends Equatable {}
/// Event that is dispatched when the FavoriteFoods widget is first created.
class FavoriteFoodsInitialEvent extends FavoriteFoodsEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,39 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'favorite_foods_bloc.dart';
/// Represents the state of FavoriteFoods in the application.
class FavoriteFoodsState extends Equatable {
FavoriteFoodsState({
this.favoriteFoodsController,
this.unfavoriteFoodsController,
this.favoriteFoodsModelObj,
});
TextEditingController? favoriteFoodsController;
TextEditingController? unfavoriteFoodsController;
FavoriteFoodsModel? favoriteFoodsModelObj;
@override
List<Object?> get props => [
favoriteFoodsController,
unfavoriteFoodsController,
favoriteFoodsModelObj,
];
FavoriteFoodsState copyWith({
TextEditingController? favoriteFoodsController,
TextEditingController? unfavoriteFoodsController,
FavoriteFoodsModel? favoriteFoodsModelObj,
}) {
return FavoriteFoodsState(
favoriteFoodsController:
favoriteFoodsController ?? this.favoriteFoodsController,
unfavoriteFoodsController:
unfavoriteFoodsController ?? this.unfavoriteFoodsController,
favoriteFoodsModelObj:
favoriteFoodsModelObj ?? this.favoriteFoodsModelObj,
);
}
}

View File

@@ -1,77 +0,0 @@
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/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class FavoriteFoodsScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const FavoriteFoodsScreen({super.key, required this.sheet});
@override
State<FavoriteFoodsScreen> createState() => _FavoriteFoodsScreenState();
}
class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
final favoriteFoodsController = TextEditingController();
final unFavoriteFoodsController = TextEditingController();
@override
void initState() {
super.initState();
favoriteFoodsController.text = widget.sheet.favoriteFoods;
unFavoriteFoodsController.text = widget.sheet.unfavoriteFoods;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Container(
width: 327.h,
margin: EdgeInsets.only(left: 8.h, right: 7.h),
child: Text(
"favorite_unfavorite_foods".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
),
SizedBox(height: 13.v),
Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
CustomTextFormField(
controller: favoriteFoodsController,
hintText: "enter_information".tr,
maxLines: 7,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(favoriteFoods: newValue));
},
),
SizedBox(height: 12.v),
Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
CustomTextFormField(
controller: unFavoriteFoodsController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 7,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(unfavoriteFoods: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [favorite_foods_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class FavoriteFoodsModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
FavoriteFoodsModel({required this.userRegistrationSheet});
FavoriteFoodsModel copyWith() {
return FavoriteFoodsModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,21 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/favorite_sports_screen/models/favorite_sports_model.dart';
part 'favorite_sports_event.dart';
part 'favorite_sports_state.dart';
/// A bloc that manages the state of a FavoriteSports according to the event that is dispatched to it.
class FavoriteSportsBloc
extends Bloc<FavoriteSportsEvent, FavoriteSportsState> {
FavoriteSportsBloc(FavoriteSportsState initialState) : super(initialState) {
on<FavoriteSportsInitialEvent>(_onInitialize);
}
_onInitialize(
FavoriteSportsInitialEvent event,
Emitter<FavoriteSportsState> emit,
) async {
emit(state.copyWith(enterinformationController: TextEditingController()));
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'favorite_sports_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///FavoriteSports widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class FavoriteSportsEvent extends Equatable {}
/// Event that is dispatched when the FavoriteSports widget is first created.
class FavoriteSportsInitialEvent extends FavoriteSportsEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,32 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'favorite_sports_bloc.dart';
/// Represents the state of FavoriteSports in the application.
class FavoriteSportsState extends Equatable {
FavoriteSportsState({
this.enterinformationController,
this.favoriteSportsModelObj,
});
TextEditingController? enterinformationController;
FavoriteSportsModel? favoriteSportsModelObj;
@override
List<Object?> get props => [
enterinformationController,
favoriteSportsModelObj,
];
FavoriteSportsState copyWith({
TextEditingController? enterinformationController,
FavoriteSportsModel? favoriteSportsModelObj,
}) {
return FavoriteSportsState(
enterinformationController:
enterinformationController ?? this.enterinformationController,
favoriteSportsModelObj:
favoriteSportsModelObj ?? this.favoriteSportsModelObj,
);
}
}

View File

@@ -1,54 +0,0 @@
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/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class FavoriteSportsScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const FavoriteSportsScreen({super.key, required this.sheet});
@override
State<FavoriteSportsScreen> createState() => _FavoriteSportsScreenState();
}
class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
final enterInformationController = TextEditingController();
@override
void initState() {
super.initState();
enterInformationController.text = widget.sheet.aboutSportHobbies;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 22.v),
Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
CustomTextFormField(
controller: enterInformationController,
hintText: "Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
textInputAction: TextInputAction.done,
maxLines: 8,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutSportHobbies: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [favorite_sports_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class FavoriteSportsModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
FavoriteSportsModel({required this.userRegistrationSheet});
FavoriteSportsModel copyWith() {
return FavoriteSportsModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,29 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/gender_screen/models/gender_model.dart';
part 'gender_event.dart';
part 'gender_state.dart';
/// A bloc that manages the state of a Gender according to the event that is dispatched to it.
class GenderBloc extends Bloc<GenderEvent, GenderState> {
GenderBloc(GenderState initialState) : super(initialState) {
on<GenderInitialEvent>(_onInitialize);
on<GenderSelectEvent>(_genderSelect);
}
_onInitialize(
GenderInitialEvent event,
Emitter<GenderState> emit,
) async {
emit(state.copyWith(genderModelObj: state.genderModelObj));
}
_genderSelect(
GenderSelectEvent event,
Emitter<GenderState> emit,
) {
emit(state.copyWith(selectedRadioValue: event.value));
// state.genderModelObj?.userRegistrationSheet.gender = event.value;
}
}

View File

@@ -1,26 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'gender_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Gender widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class GenderEvent extends Equatable {}
class GenderInitialEvent extends GenderEvent {
@override
List<Object?> get props => [];
}
class GenderSelectEvent extends GenderEvent {
GenderSelectEvent({required this.value});
String value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -1,30 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'gender_bloc.dart';
/// Represents the state of Gender in the application.
class GenderState extends Equatable {
GenderState({
this.selectedRadioValue,
this.genderModelObj,
});
String? selectedRadioValue;
GenderModel? genderModelObj;
@override
List<Object?> get props => [
selectedRadioValue,
genderModelObj,
];
GenderState copyWith({
String? selectedRadioValue,
GenderModel? genderModelObj,
}) {
return GenderState(
selectedRadioValue: selectedRadioValue ?? this.selectedRadioValue,
genderModelObj: genderModelObj ?? this.genderModelObj,
);
}
}

View File

@@ -1,79 +0,0 @@
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class GenderScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const GenderScreen({super.key, required this.sheet});
@override
State<GenderScreen> createState() => _GenderScreenState();
}
class _GenderScreenState extends State<GenderScreen> {
late String currentValue;
@override
void initState() {
super.initState();
currentValue = widget.sheet.gender;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text("your_gender".tr, style: theme.textTheme.headlineSmall),
RadioListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
title: Text('Мужской'),
value: 'male',
groupValue: currentValue,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male'));
setState(() {
currentValue = 'male';
});
},
secondary: Image.asset(
'assets/images/img_male.png',
width: 40,
height: 40,
),
),
RadioListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
title: Text('Женский'),
value: 'female',
groupValue: currentValue,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female'));
setState(() {
currentValue = 'female';
});
},
secondary: Image.asset(
'assets/images/img_female.png',
width: 40,
height: 40,
),
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [gender_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class GenderModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
GenderModel({required this.userRegistrationSheet});
GenderModel copyWith({UserRegistrationSheet? userRegistrationSheet, gender}) {
return GenderModel(
userRegistrationSheet:
userRegistrationSheet ?? this.userRegistrationSheet,);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,22 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/height_screen/models/height_model.dart';
part 'height_event.dart';
part 'height_state.dart';
/// A bloc that manages the state of a Height according to the event that is dispatched to it.
class HeightBloc extends Bloc<HeightEvent, HeightState> {
HeightBloc(HeightState initialState) : super(initialState) {
on<HeightInitialEvent>(_onInitialize);
}
_onInitialize(
HeightInitialEvent event,
Emitter<HeightState> emit,
) async {
emit(state.copyWith(
heightModelObj: state.heightModelObj?.copyWith(),
heightController: state.heightController,),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'height_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Height widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class HeightEvent extends Equatable {}
/// Event that is dispatched when the Height widget is first created.
class HeightInitialEvent extends HeightEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,30 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'height_bloc.dart';
/// Represents the state of Height in the application.
class HeightState extends Equatable {
HeightState({
this.heightController,
this.heightModelObj,
});
TextEditingController? heightController;
HeightModel? heightModelObj;
@override
List<Object?> get props => [
heightController,
heightModelObj,
];
HeightState copyWith({
TextEditingController? heightController,
HeightModel? heightModelObj,
}) {
return HeightState(
heightController: heightController ?? this.heightController,
heightModelObj: heightModelObj ?? this.heightModelObj,
);
}
}

View File

@@ -1,67 +0,0 @@
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/services.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class HeightScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const HeightScreen({super.key, required this.sheet});
@override
State<HeightScreen> createState() => _HeightScreenState();
}
class _HeightScreenState extends State<HeightScreen> {
final heightController = TextEditingController();
@override
void initState() {
super.initState();
heightController.text = widget.sheet.height;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text(
"height_measurements".tr,
style: theme.textTheme.headlineSmall,
),
SizedBox(height: 16.v),
Column(
children: [
Text(
"your_height".tr,
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
controller: heightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
],
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(height: newValue));
},
),
],
),
],
),
),
);
}
}

View File

@@ -1,25 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [height_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class HeightModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
HeightModel(
{this.dropdownItemList = const [], required this.userRegistrationSheet,});
List<SelectionPopupModel> dropdownItemList;
HeightModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return HeightModel(
userRegistrationSheet: userRegistrationSheet,
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList, userRegistrationSheet];
}

View File

@@ -1,35 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/language_select_screen/models/language_select_model.dart';
part 'language_select_event.dart';
part 'language_select_state.dart';
/// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it.
class LanguageSelectBloc extends Bloc<LanguageSelectEvent, LanguageSelectState> {
LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) {
on<LanguageSelectInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_onInitialize(LanguageSelectInitialEvent event, Emitter<LanguageSelectState> emit) async {
emit(
state.copyWith(
languageSelectModelObj: state.languageSelectModelObj?.copyWith(dropdownItemList: fillDropdownItemList()),
),
);
}
_changeDropDown(ChangeDropDownEvent event, Emitter<LanguageSelectState> emit) {
emit(state.copyWith(selectedDropDownValue: event.value));
// state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title;
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Русский", isSelected: true),
];
}
}

View File

@@ -1,28 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'language_select_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///LanguageSelect widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class LanguageSelectEvent extends Equatable {}
/// Event that is dispatched when the LanguageSelect widget is first created.
class LanguageSelectInitialEvent extends LanguageSelectEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends LanguageSelectEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -1,32 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'language_select_bloc.dart';
/// Represents the state of LanguageSelect in the application.
class LanguageSelectState extends Equatable {
LanguageSelectState({
this.selectedDropDownValue,
this.languageSelectModelObj,
});
SelectionPopupModel? selectedDropDownValue;
LanguageSelectModel? languageSelectModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
languageSelectModelObj,
];
LanguageSelectState copyWith({
SelectionPopupModel? selectedDropDownValue,
LanguageSelectModel? languageSelectModelObj,
}) {
return LanguageSelectState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
languageSelectModelObj:
languageSelectModelObj ?? this.languageSelectModelObj,
);
}
}

View File

@@ -1,63 +0,0 @@
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 StatefulWidget {
final UserRegistrationSheet sheet;
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),
];
SelectionPopupModel? value;
@override
void initState() {
super.initState();
if (widget.sheet.lang.isNotEmpty) {
value = dropdownItemList.first;
}
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Column(
children: [
Container(
width: 262.h,
margin: EdgeInsets.only(left: 41.h, right: 39.h),
child: Text(
"preferred_language".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
),
const SizedBox(height: 32),
CustomDropDown(
value: value,
hintText: "Не выбрано".tr,
items: dropdownItemList,
onChanged: (SelectionPopupModel newValue) => setState(() {
value = newValue;
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value!.title));
}),
),
],
),
);
}
}

View File

@@ -1,51 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
/// This class defines the variables used in the [language_select_screen],
/// 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: '',
lastName: '',
email: '',
password: '',
passwordConfirmation: '',
termsAccepted: 'accepted',
birthdate: DateTime.now().toString(),
gender: '',
country: '',
city: '',
lang: '',
weight: '',
height: '',
chestCircumference: '',
waistCircumference: '',
hipCircumference: '',
bloodPressureUp: '',
bloodPressureDown: '',
hasHypo: '',
hasHyper: '',
aboutAllergy: '',
aboutTakingPils: '',
aboutSportHobbies: '',
favoriteFoods: '',
unfavoriteFoods: '',
additionalInfo: '',
);
List<SelectionPopupModel> dropdownItemList;
LanguageSelectModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return LanguageSelectModel(
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList];
}

View File

@@ -1,21 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/medicine_intake_screen/models/medicine_intake_model.dart';
part 'medicine_intake_event.dart';
part 'medicine_intake_state.dart';
/// A bloc that manages the state of a MedicineIntake according to the event that is dispatched to it.
class MedicineIntakeBloc
extends Bloc<MedicineIntakeEvent, MedicineIntakeState> {
MedicineIntakeBloc(MedicineIntakeState initialState) : super(initialState) {
on<MedicineIntakeInitialEvent>(_onInitialize);
}
_onInitialize(
MedicineIntakeInitialEvent event,
Emitter<MedicineIntakeState> emit,
) async {
emit(state.copyWith(enterInformationController: TextEditingController()));
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'medicine_intake_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///MedicineIntake widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class MedicineIntakeEvent extends Equatable {}
/// Event that is dispatched when the MedicineIntake widget is first created.
class MedicineIntakeInitialEvent extends MedicineIntakeEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,32 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'medicine_intake_bloc.dart';
/// Represents the state of MedicineIntake in the application.
class MedicineIntakeState extends Equatable {
MedicineIntakeState({
this.enterInformationController,
this.medicineIntakeModelObj,
});
TextEditingController? enterInformationController;
MedicineIntakeModel? medicineIntakeModelObj;
@override
List<Object?> get props => [
enterInformationController,
medicineIntakeModelObj,
];
MedicineIntakeState copyWith({
TextEditingController? enterInformationController,
MedicineIntakeModel? medicineIntakeModelObj,
}) {
return MedicineIntakeState(
enterInformationController:
enterInformationController ?? this.enterInformationController,
medicineIntakeModelObj:
medicineIntakeModelObj ?? this.medicineIntakeModelObj,
);
}
}

View File

@@ -1,63 +0,0 @@
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:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class MedicineIntakeScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const MedicineIntakeScreen({super.key, required this.sheet});
@override
State<MedicineIntakeScreen> createState() => _MedicineIntakeScreenState();
}
class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
final enterInformationController = TextEditingController();
@override
void initState() {
super.initState();
enterInformationController.text = widget.sheet.aboutTakingPils;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Container(
width: 271.h,
margin: EdgeInsets.only(left: 35.h, right: 36.h),
child: Text(
"do_you_take_pills".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
),
SizedBox(height: 16.v),
Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
CustomTextFormField(
controller: enterInformationController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 8,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutTakingPils: newValue));
},
),
],
),
),
);
}
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [medicine_intake_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class MedicineIntakeModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
MedicineIntakeModel({required this.userRegistrationSheet});
MedicineIntakeModel copyWith() {
return MedicineIntakeModel(
userRegistrationSheet: userRegistrationSheet,
);
}
@override
List<Object?> get props => [userRegistrationSheet];
}

View File

@@ -1,22 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/name_screen/models/name_model.dart';
part 'name_event.dart';
part 'name_state.dart';
/// A bloc that manages the state of a Name according to the event that is dispatched to it.
class NameBloc extends Bloc<NameEvent, NameState> {
NameBloc(NameState initialState) : super(initialState) {
on<NameInitialEvent>(_onInitialize);
}
_onInitialize(
NameInitialEvent event,
Emitter<NameState> emit,
) async {
emit(state.copyWith(
firstNameController: TextEditingController(),
lastNameController: TextEditingController(),),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'name_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Name widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class NameEvent extends Equatable {}
/// Event that is dispatched when the Name widget is first created.
class NameInitialEvent extends NameEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,36 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'name_bloc.dart';
/// Represents the state of Name in the application.
class NameState extends Equatable {
NameState({
this.firstNameController,
this.lastNameController,
this.nameModelObj,
});
TextEditingController? firstNameController;
TextEditingController? lastNameController;
NameModel? nameModelObj;
@override
List<Object?> get props => [
firstNameController,
lastNameController,
nameModelObj,
];
NameState copyWith({
TextEditingController? firstNameController,
TextEditingController? lastNameController,
NameModel? nameModelObj,
}) {
return NameState(
firstNameController: firstNameController ?? this.firstNameController,
lastNameController: lastNameController ?? this.lastNameController,
nameModelObj: nameModelObj ?? this.nameModelObj,
);
}
}

View File

@@ -1,21 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [name_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class NameModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
NameModel({required this.userRegistrationSheet});
NameModel copyWith({UserRegistrationSheet? userRegistrationSheet}) {
return NameModel(
userRegistrationSheet:
userRegistrationSheet ?? this.userRegistrationSheet,
);
}
@override
List<Object?> get props => [];
}

View File

@@ -1,63 +0,0 @@
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 NameScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const NameScreen({required this.sheet, super.key});
@override
State<NameScreen> createState() => _NameScreenState();
}
class _NameScreenState extends State<NameScreen> {
final firstNameController = TextEditingController();
final lastNameController = TextEditingController();
@override
void initState() {
super.initState();
firstNameController.text = widget.sheet.firstName;
lastNameController.text = widget.sheet.lastName;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 16.v),
Text("first_name".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
CustomTextFormField(
controller: firstNameController,
textInputAction: TextInputAction.done,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(firstName: newValue));
},
),
SizedBox(height: 19.v),
Text("last_name".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
CustomTextFormField(
controller: lastNameController,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lastName: newValue));
},
)
],
),
),
);
}
}

View File

@@ -1,26 +0,0 @@
import 'package:eatvio_app/app_router.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/splash_screen/models/splash_model.dart';
part 'splash_event.dart';
part 'splash_state.dart';
/// A bloc that manages the state of a Splash according to the event that is dispatched to it.
class SplashBloc extends Bloc<SplashEvent, SplashState> {
SplashBloc(SplashState initialState) : super(initialState) {
on<SplashInitialEvent>(_onInitialize);
}
_onInitialize(
SplashInitialEvent event,
Emitter<SplashState> emit,
) async {
Future.delayed(const Duration(milliseconds: 3000), () {
AppRouter.navigatorKey.currentContext?.goNamed('myProfileScreen');
});
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'splash_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Splash widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class SplashEvent extends Equatable {}
/// Event that is dispatched when the Splash widget is first created.
class SplashInitialEvent extends SplashEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,20 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'splash_bloc.dart';
/// Represents the state of Splash in the application.
class SplashState extends Equatable {
SplashState({this.splashModelObj});
SplashModel? splashModelObj;
@override
List<Object?> get props => [
splashModelObj,
];
SplashState copyWith({SplashModel? splashModelObj}) {
return SplashState(
splashModelObj: splashModelObj ?? this.splashModelObj,
);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [splash_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class SplashModel extends Equatable {
SplashModel();
SplashModel copyWith() {
return SplashModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -1,36 +0,0 @@
import 'bloc/splash_bloc.dart';
import 'models/splash_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<SplashBloc>(
create: (context) =>
SplashBloc(SplashState(splashModelObj: SplashModel()))
..add(SplashInitialEvent()),
child: SplashScreen(),);
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<SplashBloc, SplashState>(builder: (context, state) {
return SafeArea(
child: Scaffold(
body: SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 16.v),
CustomImageView(
imagePath: ImageConstant.img2456927096976,
height: 137.adaptSize,
width: 137.adaptSize,),
],),),),);
},);
}
}

View File

@@ -1,22 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/weight_screen/models/weight_model.dart';
part 'weight_event.dart';
part 'weight_state.dart';
/// A bloc that manages the state of a Weight according to the event that is dispatched to it.
class WeightBloc extends Bloc<WeightEvent, WeightState> {
WeightBloc(WeightState initialState) : super(initialState) {
on<WeightInitialEvent>(_onInitialize);
}
_onInitialize(
WeightInitialEvent event,
Emitter<WeightState> emit,
) async {
emit(state.copyWith(
weightModelObj: state.weightModelObj?.copyWith(),
weightController: state.weightController,),);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Weight widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class WeightEvent extends Equatable {}
/// Event that is dispatched when the Weight widget is first created.
class WeightInitialEvent extends WeightEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,30 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Represents the state of Weight in the application.
class WeightState extends Equatable {
WeightState({
this.weightController,
this.weightModelObj,
});
TextEditingController? weightController;
WeightModel? weightModelObj;
@override
List<Object?> get props => [
weightController,
weightModelObj,
];
WeightState copyWith({
TextEditingController? weightController,
WeightModel? weightModelObj,
}) {
return WeightState(
weightController: weightController ?? this.weightController,
weightModelObj: weightModelObj ?? this.weightModelObj,
);
}
}

View File

@@ -1,25 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
/// This class defines the variables used in the [weight_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class WeightModel extends Equatable {
UserRegistrationSheet userRegistrationSheet;
WeightModel(
{this.dropdownItemList = const [], required this.userRegistrationSheet,});
List<SelectionPopupModel> dropdownItemList;
WeightModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return WeightModel(
userRegistrationSheet: userRegistrationSheet,
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList, userRegistrationSheet];
}

View File

@@ -1,67 +0,0 @@
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/services.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class WeightScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const WeightScreen({super.key, required this.sheet});
@override
State<WeightScreen> createState() => _WeightScreenState();
}
class _WeightScreenState extends State<WeightScreen> {
final weightController = TextEditingController();
@override
void initState() {
super.initState();
weightController.text = widget.sheet.weight;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
padding: EdgeInsets.only(bottom: 80),
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(
children: [
Text(
"weight_measurements".tr,
style: theme.textTheme.headlineSmall,
),
SizedBox(height: 16.v),
Column(
children: [
Text(
"your_weight".tr,
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
controller: weightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
],
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(weight: newValue));
},
),
],
),
],
),
),
);
}
}