forked from eatvio/eatvio_app
Finish comlipling JSON file from screens
This commit is contained in:
@@ -8,15 +8,19 @@ import 'package:eatvio_app/widgets/next_step_button.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';
|
||||
import 'dart:convert';
|
||||
|
||||
class AdditionalInformationScreen extends StatefulWidget {
|
||||
const AdditionalInformationScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<AdditionalInformationBloc>(
|
||||
create: (context) => AdditionalInformationBloc(
|
||||
AdditionalInformationState(
|
||||
additionalInformationModelObj: AdditionalInformationModel()))
|
||||
additionalInformationModelObj:
|
||||
AdditionalInformationModel(userRegistrationSheet: sheet)))
|
||||
..add(AdditionalInformationInitialEvent()),
|
||||
child: AdditionalInformationScreen());
|
||||
}
|
||||
@@ -59,12 +63,23 @@ class _AdditionalInformationScreenState
|
||||
SizedBox(height: 73.v),
|
||||
_buildTextFormField(context),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "finish".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
showSuccessMessage(context);
|
||||
}),
|
||||
BlocBuilder<AdditionalInformationBloc,
|
||||
AdditionalInformationState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "finish".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
var message;
|
||||
UserRegistrationSheet sheet = state
|
||||
.additionalInformationModelObj!
|
||||
.userRegistrationSheet;
|
||||
sheet.additionalInfo = state.editTextController!.text;
|
||||
message = sheet.toJson();
|
||||
print(message);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
]))));
|
||||
}
|
||||
@@ -120,13 +135,12 @@ class _AdditionalInformationScreenState
|
||||
|
||||
/// Displays an alert dialog when the action is triggered.
|
||||
/// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения`
|
||||
showSuccessMessage(BuildContext context) {
|
||||
showSuccessMessage(BuildContext context, String text) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Регистрация завершена!'),
|
||||
content: const Text(
|
||||
'Теперь вы можете пользоваться полным функционалом приложения'),
|
||||
content: const Text(text),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// 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 {
|
||||
AdditionalInformationModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
AdditionalInformationModel({required this.userRegistrationSheet});
|
||||
|
||||
AdditionalInformationModel copyWith() {
|
||||
return AdditionalInformationModel();
|
||||
return AdditionalInformationModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
@@ -13,10 +13,12 @@ class AllergiesScreen extends StatefulWidget {
|
||||
const AllergiesScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<AllergiesBloc>(
|
||||
create: (context) =>
|
||||
AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel()))
|
||||
..add(AllergiesInitialEvent()),
|
||||
create: (context) => AllergiesBloc(AllergiesState(
|
||||
allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))
|
||||
..add(AllergiesInitialEvent()),
|
||||
child: AllergiesScreen());
|
||||
}
|
||||
|
||||
@@ -58,12 +60,25 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
Spacer(flex: 36),
|
||||
_buildTextFormField(context),
|
||||
Spacer(flex: 63),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToMedicine(context);
|
||||
}),
|
||||
BlocBuilder<AllergiesBloc, AllergiesState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet =
|
||||
state.allergiesModelObj!.userRegistrationSheet;
|
||||
sheet.aboutAllergy =
|
||||
state.enterInformationController!.text;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.medicineIntakeScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
||||
]))));
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// 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 {
|
||||
AllergiesModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
AllergiesModel({required this.userRegistrationSheet});
|
||||
|
||||
AllergiesModel copyWith() {
|
||||
return AllergiesModel();
|
||||
return AllergiesModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
@@ -9,20 +9,41 @@ part 'blood_pressure_state.dart';
|
||||
class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
|
||||
BloodPressureBloc(BloodPressureState initialState) : super(initialState) {
|
||||
on<BloodPressureInitialEvent>(_onInitialize);
|
||||
on<ChangeDropDownEvent>(_changeDropDown);
|
||||
on<ChangeHypoDownEvent>(_changeHypoDropDown);
|
||||
on<ChangeHyperDropDownEvent>(_changeHyperDropDown);
|
||||
}
|
||||
|
||||
_changeDropDown(
|
||||
ChangeDropDownEvent event,
|
||||
_changeHyperDropDown(
|
||||
ChangeHyperDropDownEvent event,
|
||||
Emitter<BloodPressureState> emit,
|
||||
) {
|
||||
emit(state.copyWith(selectedDropDownValue: event.value));
|
||||
if (event.value.id == 1) {
|
||||
state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = true;
|
||||
} else {
|
||||
state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = false;
|
||||
}
|
||||
emit(state.copyWith(selectedHyperValue: event.value));
|
||||
}
|
||||
|
||||
_changeHypoDropDown(
|
||||
ChangeHypoDownEvent event,
|
||||
Emitter<BloodPressureState> emit,
|
||||
) {
|
||||
if (event.value.id == 1) {
|
||||
state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = true;
|
||||
} else {
|
||||
state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = false;
|
||||
}
|
||||
emit(state.copyWith(selectedHypoValue: event.value));
|
||||
}
|
||||
|
||||
List<SelectionPopupModel> fillDropdownItemList() {
|
||||
return [
|
||||
SelectionPopupModel(id: 1, title: "Да", isSelected: true),
|
||||
SelectionPopupModel(id: 2, title: "Нет"),
|
||||
SelectionPopupModel(
|
||||
id: 1,
|
||||
title: "Да",
|
||||
),
|
||||
SelectionPopupModel(id: 2, title: "Нет", isSelected: true),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -31,9 +52,8 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
|
||||
Emitter<BloodPressureState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
valueController: TextEditingController(),
|
||||
valueController1: TextEditingController(),
|
||||
valueController2: TextEditingController()));
|
||||
upPressureController: TextEditingController(),
|
||||
downPressureController: TextEditingController()));
|
||||
emit(state.copyWith(
|
||||
bloodPressureModelObj: state.bloodPressureModelObj
|
||||
?.copyWith(dropdownItemList: fillDropdownItemList())));
|
||||
|
||||
@@ -16,8 +16,19 @@ class BloodPressureInitialEvent extends BloodPressureEvent {
|
||||
}
|
||||
|
||||
///event for dropdown selection
|
||||
class ChangeDropDownEvent extends BloodPressureEvent {
|
||||
ChangeDropDownEvent({required this.value});
|
||||
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;
|
||||
|
||||
|
||||
@@ -5,42 +5,44 @@ part of 'blood_pressure_bloc.dart';
|
||||
/// Represents the state of BloodPressure in the application.
|
||||
class BloodPressureState extends Equatable {
|
||||
BloodPressureState({
|
||||
this.valueController,
|
||||
this.valueController1,
|
||||
this.valueController2,
|
||||
this.selectedDropDownValue,
|
||||
this.upPressureController,
|
||||
this.downPressureController,
|
||||
this.selectedHyperValue,
|
||||
this.selectedHypoValue,
|
||||
this.bloodPressureModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? valueController;
|
||||
TextEditingController? upPressureController;
|
||||
|
||||
TextEditingController? valueController1;
|
||||
TextEditingController? downPressureController;
|
||||
|
||||
TextEditingController? valueController2;
|
||||
SelectionPopupModel? selectedHypoValue;
|
||||
|
||||
SelectionPopupModel? selectedDropDownValue;
|
||||
SelectionPopupModel? selectedHyperValue;
|
||||
|
||||
BloodPressureModel? bloodPressureModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
valueController,
|
||||
valueController1,
|
||||
selectedDropDownValue,
|
||||
upPressureController,
|
||||
downPressureController,
|
||||
selectedHyperValue,
|
||||
selectedHypoValue,
|
||||
bloodPressureModelObj,
|
||||
];
|
||||
BloodPressureState copyWith({
|
||||
TextEditingController? valueController,
|
||||
TextEditingController? valueController1,
|
||||
TextEditingController? valueController2,
|
||||
SelectionPopupModel? selectedDropDownValue,
|
||||
TextEditingController? upPressureController,
|
||||
TextEditingController? downPressureController,
|
||||
SelectionPopupModel? selectedHyperValue,
|
||||
SelectionPopupModel? selectedHypoValue,
|
||||
BloodPressureModel? bloodPressureModelObj,
|
||||
}) {
|
||||
return BloodPressureState(
|
||||
valueController: valueController ?? this.valueController,
|
||||
valueController1: valueController1 ?? this.valueController1,
|
||||
selectedDropDownValue:
|
||||
selectedDropDownValue ?? this.selectedDropDownValue,
|
||||
upPressureController: upPressureController ?? this.upPressureController,
|
||||
downPressureController:
|
||||
downPressureController ?? this.downPressureController,
|
||||
selectedHyperValue: selectedHyperValue ?? this.selectedHyperValue,
|
||||
selectedHypoValue: selectedHypoValue ?? this.selectedHypoValue,
|
||||
bloodPressureModelObj:
|
||||
bloodPressureModelObj ?? this.bloodPressureModelObj,
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'bloc/blood_pressure_bloc.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'models/blood_pressure_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
|
||||
@@ -7,15 +8,19 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
|
||||
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
||||
import 'package:eatvio_app/widgets/next_step_button.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 {
|
||||
const BloodPressureScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<BloodPressureBloc>(
|
||||
create: (context) => BloodPressureBloc(
|
||||
BloodPressureState(bloodPressureModelObj: BloodPressureModel()))
|
||||
create: (context) => BloodPressureBloc(BloodPressureState(
|
||||
bloodPressureModelObj:
|
||||
BloodPressureModel(userRegistrationSheet: sheet)))
|
||||
..add(BloodPressureInitialEvent()),
|
||||
child: BloodPressureScreen());
|
||||
}
|
||||
@@ -27,6 +32,7 @@ class BloodPressureScreen extends StatefulWidget {
|
||||
class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||
mediaQueryData = MediaQuery.of(context);
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
@@ -73,10 +79,11 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<BloodPressureBloc, BloodPressureState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.valueController1,
|
||||
builder: (context, valueController1) {
|
||||
selector: (state) => state.upPressureController,
|
||||
builder: (context, upPressureController) {
|
||||
return CustomTextFormField(
|
||||
controller: valueController1,
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: upPressureController,
|
||||
hintText: "90".tr);
|
||||
})
|
||||
])),
|
||||
@@ -90,10 +97,11 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<BloodPressureBloc, BloodPressureState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.valueController2,
|
||||
builder: (context, valueController2) {
|
||||
selector: (state) => state.downPressureController,
|
||||
builder: (context, downPressureController) {
|
||||
return CustomTextFormField(
|
||||
controller: valueController2,
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: downPressureController,
|
||||
hintText: "90".tr);
|
||||
})
|
||||
])),
|
||||
@@ -118,14 +126,14 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
imagePath: ImageConstant.imgFavorite,
|
||||
height: 12.adaptSize,
|
||||
width: 12.adaptSize)),
|
||||
hintText: "no".tr,
|
||||
hintText: "Не выбрано".tr,
|
||||
items:
|
||||
bloodPressureModelObj?.dropdownItemList ??
|
||||
[],
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<BloodPressureBloc>()
|
||||
.add(ChangeDropDownEvent(value: value));
|
||||
.add(ChangeHypoDownEvent(value: value));
|
||||
});
|
||||
})),
|
||||
SizedBox(height: 22.v),
|
||||
@@ -149,24 +157,37 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
imagePath: ImageConstant.imgFavorite,
|
||||
height: 12.adaptSize,
|
||||
width: 12.adaptSize)),
|
||||
hintText: "no".tr,
|
||||
hintText: "Не выбрано".tr,
|
||||
items:
|
||||
bloodPressureModelObj?.dropdownItemList ??
|
||||
[],
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<BloodPressureBloc>()
|
||||
.add(ChangeDropDownEvent(value: value));
|
||||
context.read<BloodPressureBloc>().add(
|
||||
ChangeHyperDropDownEvent(value: value));
|
||||
});
|
||||
})),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.symmetric(horizontal: 4.h),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToSports(context);
|
||||
}),
|
||||
BlocBuilder<BloodPressureBloc, BloodPressureState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet = state
|
||||
.bloodPressureModelObj!.userRegistrationSheet;
|
||||
sheet.bloodPressureUp =
|
||||
int.tryParse(state.upPressureController!.text)!;
|
||||
sheet.bloodPressureDown =
|
||||
int.tryParse(state.downPressureController!.text)!;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.favoriteSportsScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
||||
]))));
|
||||
|
||||
@@ -2,20 +2,25 @@
|
||||
|
||||
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 {
|
||||
BloodPressureModel({this.dropdownItemList = const []});
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
BloodPressureModel(
|
||||
{required this.userRegistrationSheet, this.dropdownItemList = const []});
|
||||
|
||||
List<SelectionPopupModel> dropdownItemList;
|
||||
|
||||
BloodPressureModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
|
||||
return BloodPressureModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [dropdownItemList];
|
||||
List<Object?> get props => [dropdownItemList, userRegistrationSheet];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class FavoriteFoodsBloc extends Bloc<FavoriteFoodsEvent, FavoriteFoodsState> {
|
||||
Emitter<FavoriteFoodsState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
enterinformationController: TextEditingController(),
|
||||
enterinformationController1: TextEditingController()));
|
||||
favoriteFoodsController: TextEditingController(),
|
||||
unfavoriteFoodsController: TextEditingController()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,33 +5,33 @@ part of 'favorite_foods_bloc.dart';
|
||||
/// Represents the state of FavoriteFoods in the application.
|
||||
class FavoriteFoodsState extends Equatable {
|
||||
FavoriteFoodsState({
|
||||
this.enterinformationController,
|
||||
this.enterinformationController1,
|
||||
this.favoriteFoodsController,
|
||||
this.unfavoriteFoodsController,
|
||||
this.favoriteFoodsModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? enterinformationController;
|
||||
TextEditingController? favoriteFoodsController;
|
||||
|
||||
TextEditingController? enterinformationController1;
|
||||
TextEditingController? unfavoriteFoodsController;
|
||||
|
||||
FavoriteFoodsModel? favoriteFoodsModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
enterinformationController,
|
||||
enterinformationController1,
|
||||
favoriteFoodsController,
|
||||
unfavoriteFoodsController,
|
||||
favoriteFoodsModelObj,
|
||||
];
|
||||
FavoriteFoodsState copyWith({
|
||||
TextEditingController? enterinformationController,
|
||||
TextEditingController? enterinformationController1,
|
||||
TextEditingController? favoriteFoodsController,
|
||||
TextEditingController? unfavoriteFoodsController,
|
||||
FavoriteFoodsModel? favoriteFoodsModelObj,
|
||||
}) {
|
||||
return FavoriteFoodsState(
|
||||
enterinformationController:
|
||||
enterinformationController ?? this.enterinformationController,
|
||||
enterinformationController1:
|
||||
enterinformationController1 ?? this.enterinformationController1,
|
||||
favoriteFoodsController:
|
||||
favoriteFoodsController ?? this.favoriteFoodsController,
|
||||
unfavoriteFoodsController:
|
||||
unfavoriteFoodsController ?? this.unfavoriteFoodsController,
|
||||
favoriteFoodsModelObj:
|
||||
favoriteFoodsModelObj ?? this.favoriteFoodsModelObj,
|
||||
);
|
||||
|
||||
@@ -13,9 +13,12 @@ class FavoriteFoodsScreen extends StatefulWidget {
|
||||
const FavoriteFoodsScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<FavoriteFoodsBloc>(
|
||||
create: (context) => FavoriteFoodsBloc(
|
||||
FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel()))
|
||||
create: (context) => FavoriteFoodsBloc(FavoriteFoodsState(
|
||||
favoriteFoodsModelObj:
|
||||
FavoriteFoodsModel(userRegistrationSheet: sheet)))
|
||||
..add(FavoriteFoodsInitialEvent()),
|
||||
child: FavoriteFoodsScreen());
|
||||
}
|
||||
@@ -62,16 +65,31 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.headlineSmall)),
|
||||
SizedBox(height: 23.v),
|
||||
_buildTextFormField(context),
|
||||
_buildTextFormFieldFav(context),
|
||||
SizedBox(height: 22.v),
|
||||
_buildTextFormField1(context),
|
||||
_buildTextFormFieldUnfav(context),
|
||||
SizedBox(height: 27.v),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToAdditionalInformationScreen(context);
|
||||
}),
|
||||
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet = state
|
||||
.favoriteFoodsModelObj!.userRegistrationSheet;
|
||||
sheet.favoriteFoods =
|
||||
state.favoriteFoodsController!.text;
|
||||
sheet.unfavoriteFoods =
|
||||
state.unfavoriteFoodsController!.text;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.additionalInformationScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
||||
]))));
|
||||
@@ -92,16 +110,16 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
Widget _buildTextFormField(BuildContext context) {
|
||||
Widget _buildTextFormFieldFav(BuildContext context) {
|
||||
return Column(children: [
|
||||
Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.enterinformationController,
|
||||
builder: (context, enterinformationController) {
|
||||
selector: (state) => state.favoriteFoodsController,
|
||||
builder: (context, favoriteFoodsController) {
|
||||
return CustomTextFormField(
|
||||
controller: enterinformationController,
|
||||
controller: favoriteFoodsController,
|
||||
hintText: "enter_information".tr,
|
||||
maxLines: 7);
|
||||
})
|
||||
@@ -109,16 +127,16 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
Widget _buildTextFormField1(BuildContext context) {
|
||||
Widget _buildTextFormFieldUnfav(BuildContext context) {
|
||||
return Column(children: [
|
||||
Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.enterinformationController1,
|
||||
builder: (context, enterinformationController1) {
|
||||
selector: (state) => state.unfavoriteFoodsController,
|
||||
builder: (context, unfavoriteFoodsController) {
|
||||
return CustomTextFormField(
|
||||
controller: enterinformationController1,
|
||||
controller: unfavoriteFoodsController,
|
||||
hintText: "enter_information".tr,
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 7);
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// 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 {
|
||||
FavoriteFoodsModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
FavoriteFoodsModel({required this.userRegistrationSheet});
|
||||
|
||||
FavoriteFoodsModel copyWith() {
|
||||
return FavoriteFoodsModel();
|
||||
return FavoriteFoodsModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
@@ -13,9 +13,12 @@ class FavoriteSportsScreen extends StatefulWidget {
|
||||
const FavoriteSportsScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<FavoriteSportsBloc>(
|
||||
create: (context) => FavoriteSportsBloc(
|
||||
FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel()))
|
||||
create: (context) => FavoriteSportsBloc(FavoriteSportsState(
|
||||
favoriteSportsModelObj:
|
||||
FavoriteSportsModel(userRegistrationSheet: sheet)))
|
||||
..add(FavoriteSportsInitialEvent()),
|
||||
child: FavoriteSportsScreen());
|
||||
}
|
||||
@@ -61,12 +64,26 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
Spacer(flex: 32),
|
||||
_buildTextFormFieldSection(context),
|
||||
Spacer(flex: 67),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToFoods(context);
|
||||
}),
|
||||
BlocBuilder<FavoriteSportsBloc, FavoriteSportsState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet = state
|
||||
.favoriteSportsModelObj!
|
||||
.userRegistrationSheet;
|
||||
sheet.aboutSportHobbies =
|
||||
state.enterinformationController!.text;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.favoriteFoodsScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
Text("skip".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 4.v)
|
||||
@@ -108,11 +125,4 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
|
||||
/// Navigates to the favoriteFoodsScreen when the action is triggered.
|
||||
navigateToFoods(BuildContext context) {
|
||||
NavigatorService.pushNamed(
|
||||
AppRoutes.favoriteFoodsScreen,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// 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 {
|
||||
FavoriteSportsModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
FavoriteSportsModel({required this.userRegistrationSheet});
|
||||
|
||||
FavoriteSportsModel copyWith() {
|
||||
return FavoriteSportsModel();
|
||||
return FavoriteSportsModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class _HeightScreenState extends State<HeightScreen> {
|
||||
state.heightModelObj!.userRegistrationSheet;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.heightScreen,
|
||||
AppRoutes.allergiesScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6,15 +6,19 @@ import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
|
||||
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
|
||||
import 'package:eatvio_app/widgets/next_step_button.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 {
|
||||
const MedicineIntakeScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<MedicineIntakeBloc>(
|
||||
create: (context) => MedicineIntakeBloc(
|
||||
MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel()))
|
||||
create: (context) => MedicineIntakeBloc(MedicineIntakeState(
|
||||
medicineIntakeModelObj:
|
||||
MedicineIntakeModel(userRegistrationSheet: sheet)))
|
||||
..add(MedicineIntakeInitialEvent()),
|
||||
child: MedicineIntakeScreen());
|
||||
}
|
||||
@@ -63,12 +67,25 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
SizedBox(height: 86.v),
|
||||
_buildTextFormField(context),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToPressure(context);
|
||||
}),
|
||||
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
UserRegistrationSheet sheet = state
|
||||
.medicineIntakeModelObj!.userRegistrationSheet;
|
||||
sheet.aboutTakingPils =
|
||||
state.enterInformationController!.text;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.bloodPressureScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
||||
]))));
|
||||
@@ -111,11 +128,4 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
|
||||
/// Navigates to the bloodPressureScreen when the action is triggered.
|
||||
navigateToPressure(BuildContext context) {
|
||||
NavigatorService.pushNamed(
|
||||
AppRoutes.bloodPressureScreen,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// 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 {
|
||||
MedicineIntakeModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
MedicineIntakeModel({required this.userRegistrationSheet});
|
||||
|
||||
MedicineIntakeModel copyWith() {
|
||||
return MedicineIntakeModel();
|
||||
return MedicineIntakeModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user