forked from eatvio/eatvio_app
Added logic for body_circumferences and city_of_living
This commit is contained in:
@@ -12,9 +12,12 @@ class DateOfBirthScreen extends StatefulWidget {
|
||||
const DateOfBirthScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<DateOfBirthBloc>(
|
||||
create: (context) => DateOfBirthBloc(
|
||||
DateOfBirthState(dateOfBirthModelObj: DateOfBirthModel()))
|
||||
create: (context) => DateOfBirthBloc(DateOfBirthState(
|
||||
dateOfBirthModelObj:
|
||||
DateOfBirthModel(userRegistrationSheet: sheet)))
|
||||
..add(DateOfBirthInitialEvent()),
|
||||
child: DateOfBirthScreen());
|
||||
}
|
||||
@@ -59,12 +62,24 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
Spacer(flex: 39),
|
||||
_buildDateInput(context),
|
||||
Spacer(flex: 60),
|
||||
NextStepButton(
|
||||
text: "continue".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
navigateToCity(context);
|
||||
}),
|
||||
BlocBuilder<DateOfBirthBloc, DateOfBirthState>(
|
||||
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
|
||||
.dateOfBirthModelObj!.userRegistrationSheet;
|
||||
sheet.birthdate = selectedDate;
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.cityOfLivingScreen,
|
||||
arguments: sheet,
|
||||
);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
]))));
|
||||
});
|
||||
@@ -124,7 +139,6 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
///
|
||||
/// This function returns a `Future` that completes with `void`.
|
||||
Future<void> openDatePickerDialog(BuildContext context) async {
|
||||
var initialState = BlocProvider.of<DateOfBirthBloc>(context).state;
|
||||
DateTime? dateTime = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
@@ -137,11 +151,4 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Navigates to the cityOfLivingScreen when the action is triggered.
|
||||
navigateToCity(BuildContext context) {
|
||||
NavigatorService.pushNamed(
|
||||
AppRoutes.cityOfLivingScreen,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
// 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 {
|
||||
DateOfBirthModel() {}
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
|
||||
DateOfBirthModel({required this.userRegistrationSheet}) {}
|
||||
|
||||
DateOfBirthModel copyWith() {
|
||||
return DateOfBirthModel();
|
||||
return DateOfBirthModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user