import 'package:go_router/go_router.dart'; import 'bloc/allergies_bloc.dart'; import 'models/allergies_model.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 AllergiesScreen extends StatefulWidget { const AllergiesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context, sheet) { return BlocProvider( create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()), child: AllergiesScreen(), ); } @override State createState() => _AllergiesScreenState(); } class _AllergiesScreenState extends State { @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), _buildTextFormField(context), // BlocBuilder( // 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: onTapContinue(state, context), // ); // }, // ), // BlocBuilder( // builder: (context, state) { // return GestureDetector( // onTap: onTapSkip(state, context), // child: Text("skip".tr, style: theme.textTheme.bodyLarge), // ); // }, // ), ], ), ), ); } onTapSkip(AllergiesState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet; GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet); }; } onTapContinue(AllergiesState state, BuildContext context) { return () { UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet; sheet.aboutAllergy = state.enterInformationController!.text; GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet); }; } onTapBack(BuildContext context) { return () { onTapArrowLeft(context); }; } /// Section Widget _buildTextFormField(BuildContext context) { return Column( children: [ Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI), SizedBox(height: 2.v), BlocSelector( selector: (state) => state.enterInformationController, builder: (context, enterInformationController) { return CustomTextFormField( controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8, ); }, ), ], ); } /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { GoRouter.of(context).pop(); } }