forked from eatvio/eatvio_app
Finish comlipling JSON file from screens
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user