forked from eatvio/eatvio_app
Added logic for Height and Weight
This commit is contained in:
@@ -26,6 +26,8 @@ class HeightBloc extends Bloc<HeightEvent, HeightState> {
|
||||
Emitter<HeightState> emit,
|
||||
) {
|
||||
emit(state.copyWith(selectedDropDownValue: event.value));
|
||||
state.heightModelObj?.userRegistrationSheet.height =
|
||||
int.tryParse(event.value.title)!;
|
||||
}
|
||||
|
||||
List<SelectionPopupModel> fillDropdownItemList() {
|
||||
|
||||
@@ -13,10 +13,12 @@ class HeightScreen extends StatefulWidget {
|
||||
const HeightScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<HeightBloc>(
|
||||
create: (context) =>
|
||||
HeightBloc(HeightState(heightModelObj: HeightModel()))
|
||||
..add(HeightInitialEvent()),
|
||||
create: (context) => HeightBloc(HeightState(
|
||||
heightModelObj: HeightModel(userRegistrationSheet: sheet)))
|
||||
..add(HeightInitialEvent()),
|
||||
child: HeightScreen());
|
||||
}
|
||||
|
||||
@@ -84,12 +86,23 @@ class _HeightScreenState extends State<HeightScreen> {
|
||||
])
|
||||
]),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToAllergies(context);
|
||||
}),
|
||||
BlocBuilder<HeightBloc, HeightState>(
|
||||
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.heightModelObj!.userRegistrationSheet;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.heightScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
]))));
|
||||
}
|
||||
@@ -112,11 +125,4 @@ class _HeightScreenState extends State<HeightScreen> {
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
|
||||
/// Navigates to the allergiesScreen when the action is triggered.
|
||||
navigateToAllergies(BuildContext context) {
|
||||
NavigatorService.pushNamed(
|
||||
AppRoutes.allergiesScreen,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 [height_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class HeightModel extends Equatable {
|
||||
HeightModel({this.dropdownItemList = const []});
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
HeightModel(
|
||||
{this.dropdownItemList = const [], required this.userRegistrationSheet});
|
||||
|
||||
List<SelectionPopupModel> dropdownItemList;
|
||||
|
||||
HeightModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
|
||||
return HeightModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [dropdownItemList];
|
||||
List<Object?> get props => [dropdownItemList, userRegistrationSheet];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user