Files
eatvio_app_old/lib/presentation/registration/allergies_screen/allergies_screen.dart
2024-07-15 11:19:29 +03:00

104 lines
3.4 KiB
Dart

import 'package:go_router/go_router.dart';
import 'bloc/allergies_bloc.dart';
// ignore: unused_import
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 {
final UserRegistrationSheet sheet;
const AllergiesScreen({super.key, required this.sheet});
@override
State<AllergiesScreen> createState() => _AllergiesScreenState();
}
class _AllergiesScreenState extends State<AllergiesScreen> {
@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<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: onTapContinue(state, context),
// );
// },
// ),
// BlocBuilder<AllergiesBloc, AllergiesState>(
// 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<AllergiesBloc, AllergiesState, TextEditingController?>(
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();
}
}