feature(registration): refactor i 4
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/additional_information_bloc.dart';
|
||||
import 'models/additional_information_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
@@ -11,18 +10,16 @@ import 'dart:convert';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class AdditionalInformationScreen extends StatelessWidget {
|
||||
const AdditionalInformationScreen({Key? key}) : super(key: key);
|
||||
class AdditionalInformationScreen extends StatefulWidget {
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<AdditionalInformationBloc>(
|
||||
create: (context) =>
|
||||
AdditionalInformationBloc(AdditionalInformationState(additionalInformationModelObj: AdditionalInformationModel(userRegistrationSheet: sheet)))
|
||||
..add(AdditionalInformationInitialEvent()),
|
||||
child: AdditionalInformationScreen(),
|
||||
);
|
||||
}
|
||||
const AdditionalInformationScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<AdditionalInformationScreen> createState() => _AdditionalInformationScreenState();
|
||||
}
|
||||
|
||||
class _AdditionalInformationScreenState extends State<AdditionalInformationScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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';
|
||||
@@ -8,14 +9,9 @@ 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);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<AllergiesBloc>(
|
||||
create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()),
|
||||
child: AllergiesScreen(),
|
||||
);
|
||||
}
|
||||
const AllergiesScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<AllergiesScreen> createState() => _AllergiesScreenState();
|
||||
@@ -27,33 +23,33 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
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),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
),
|
||||
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),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,15 +11,9 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BloodPressureScreen extends StatefulWidget {
|
||||
const BloodPressureScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<BloodPressureBloc>(
|
||||
create: (context) =>
|
||||
BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()),
|
||||
child: BloodPressureScreen(),
|
||||
);
|
||||
}
|
||||
const BloodPressureScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<BloodPressureScreen> createState() => _BloodPressureScreenState();
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
|
||||
|
||||
import 'bloc/body_circumferences_bloc.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'models/body_circumferences_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 BodyCircumferencesScreen extends StatefulWidget {
|
||||
const BodyCircumferencesScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<BodyCircumferencesBloc>(
|
||||
create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(bodyCircumferencesModelObj: BodyCircumferencesModel(userRegistrationSheet: sheet)))
|
||||
..add(BodyCircumferencesInitialEvent()),
|
||||
child: BodyCircumferencesScreen(),
|
||||
);
|
||||
}
|
||||
const BodyCircumferencesScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<BodyCircumferencesScreen> createState() => _BodyCircumferencesScreenState();
|
||||
@@ -25,139 +17,72 @@ class BodyCircumferencesScreen extends StatefulWidget {
|
||||
|
||||
class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
|
||||
final digitsOnly = FilteringTextInputFormatter.digitsOnly;
|
||||
final chestCircumferenceController = TextEditingController();
|
||||
final waistCircumferenceController = TextEditingController();
|
||||
final hipCircumferenceController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
chestCircumferenceController.text = widget.sheet.chestCircumference;
|
||||
waistCircumferenceController.text = widget.sheet.waistCircumference;
|
||||
hipCircumferenceController.text = widget.sheet.hipCircumference;
|
||||
}
|
||||
|
||||
@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("initial_measurements".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 16.v),
|
||||
Column(
|
||||
children: [
|
||||
Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
|
||||
selector: (state) => state.chestCircumferenceController,
|
||||
builder: (context, chestCircumferenceController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 19.v),
|
||||
Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
|
||||
selector: (state) => state.waistCircumferenceController,
|
||||
builder: (context, waistCircumferenceController) {
|
||||
return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 21.v),
|
||||
Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
|
||||
selector: (state) => state.hipCircumferenceController,
|
||||
builder: (context, hipCircumferenceController) {
|
||||
return CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: hipCircumferenceController,
|
||||
hintText: "90".tr,
|
||||
textInputAction: TextInputAction.done,
|
||||
);
|
||||
},
|
||||
),
|
||||
// BlocBuilder<BodyCircumferencesBloc, BodyCircumferencesState>(
|
||||
// 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),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
),
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("initial_measurements".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 16.v),
|
||||
Column(
|
||||
children: [
|
||||
Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: chestCircumferenceController,
|
||||
hintText: "90".tr,
|
||||
onChanged: (value) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: value));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 19.v),
|
||||
Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: waistCircumferenceController,
|
||||
hintText: "60".tr,
|
||||
onChanged: (value) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: value));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 21.v),
|
||||
Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: hipCircumferenceController,
|
||||
hintText: "90".tr,
|
||||
textInputAction: TextInputAction.done,
|
||||
onChanged: (value) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(hipCircumference: value));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
onTapContinue(BodyCircumferencesState state, BuildContext context) {
|
||||
return () {
|
||||
List<String> errors =
|
||||
validateFields(state.chestCircumferenceController!.text, state.waistCircumferenceController!.text, state.hipCircumferenceController!.text);
|
||||
if (errors.isEmpty) {
|
||||
UserRegistrationSheet sheet = state.bodyCircumferencesModelObj!.userRegistrationSheet;
|
||||
// sheet.chestCircumference = state.chestCircumferenceController!.text;
|
||||
// sheet.waistCircumference = state.waistCircumferenceController!.text;
|
||||
// sheet.hipCircumference = state.hipCircumferenceController!.text;
|
||||
GoRouter.of(context).goNamed('weightScreen', extra: sheet);
|
||||
} else {
|
||||
String errorMessage = '';
|
||||
|
||||
for (var error in errors) {
|
||||
errorMessage += error + '\n\n';
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: onTapOk(context),
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
onTapOk(BuildContext context) {
|
||||
return () {
|
||||
Navigator.pop(context);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
return () {
|
||||
onTapArrowLeft(context);
|
||||
};
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
GoRouter.of(context).pop();
|
||||
}
|
||||
|
||||
/// Navigates to the weightScreen when the action is triggered.
|
||||
navigateToWeight(BuildContext context) => GoRouter.of(context).goNamed('weightScreen');
|
||||
|
||||
List<String> validateFields(
|
||||
String chestCircumference,
|
||||
String waistCircumference,
|
||||
String hipCircumference,
|
||||
) {
|
||||
List<String> errors = [];
|
||||
|
||||
if (chestCircumference.isEmpty | waistCircumference.isEmpty | hipCircumference.isEmpty) {
|
||||
errors.add('circumference_empty'.tr);
|
||||
}
|
||||
|
||||
if (![chestCircumference, waistCircumference, hipCircumference].every((circumference) => int.tryParse(circumference) != null)) {
|
||||
errors.add('circumference_is_not_a_number'.tr);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/city_of_living_bloc.dart';
|
||||
@@ -8,108 +9,101 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CityOfLivingScreen extends StatelessWidget {
|
||||
const CityOfLivingScreen({Key? key}) : super(key: key);
|
||||
class CityOfLivingScreen extends StatefulWidget {
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<CityOfLivingBloc>(
|
||||
create: (context) =>
|
||||
CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: sheet)))..add(CityOfLivingInitialEvent()),
|
||||
child: CityOfLivingScreen(),
|
||||
);
|
||||
}
|
||||
const CityOfLivingScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<CityOfLivingScreen> createState() => _CityOfLivingScreenState();
|
||||
}
|
||||
|
||||
class _CityOfLivingScreenState extends State<CityOfLivingScreen> {
|
||||
@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("place_of_living".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 39.v),
|
||||
Text("country".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<CityOfLivingBloc, CityOfLivingState, CityOfLivingModel?>(
|
||||
selector: (state) => state.cityOfLivingModelObj,
|
||||
builder: (context, cityOfLivingModelObj) {
|
||||
return CustomDropDown(
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),
|
||||
),
|
||||
hintText: "Не выбрано".tr,
|
||||
items: cityOfLivingModelObj?.dropdownItemList ?? [],
|
||||
onChanged: onDropDownChange(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 22.v),
|
||||
Text("Населенный пункт", style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(
|
||||
builder: (context, state) {
|
||||
return RawAutocomplete<String>(
|
||||
optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) {
|
||||
return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase());
|
||||
}),
|
||||
fieldViewBuilder: (
|
||||
BuildContext context,
|
||||
TextEditingController textEditingController,
|
||||
FocusNode focusNode,
|
||||
VoidCallback onFieldSubmitted,
|
||||
) {
|
||||
return CustomTextFormField(
|
||||
controller: textEditingController,
|
||||
focusNode: focusNode,
|
||||
onFieldSubmitted: (String value) => onFieldSubmitted(),
|
||||
);
|
||||
},
|
||||
optionsViewBuilder: (
|
||||
BuildContext context,
|
||||
AutocompleteOnSelected<String> onSelected,
|
||||
Iterable<String> options,
|
||||
) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Material(
|
||||
elevation: 4.0,
|
||||
child: SizedBox(
|
||||
height: 200.0,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
itemCount: options.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final String option = options.elementAt(index);
|
||||
return GestureDetector(
|
||||
onTap: () => onSelected(option),
|
||||
child: ListTile(
|
||||
title: Text(option),
|
||||
),
|
||||
);
|
||||
},
|
||||
return BlocProvider<CityOfLivingBloc>(
|
||||
create: (BuildContext context) =>
|
||||
CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: widget.sheet)))..add(CityOfLivingInitialEvent()),
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80),
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("place_of_living".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 39.v),
|
||||
Text("country".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<CityOfLivingBloc, CityOfLivingState, CityOfLivingModel?>(
|
||||
selector: (state) => state.cityOfLivingModelObj,
|
||||
builder: (context, cityOfLivingModelObj) {
|
||||
return CustomDropDown(
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
|
||||
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize),
|
||||
),
|
||||
hintText: "Не выбрано".tr,
|
||||
items: cityOfLivingModelObj?.dropdownItemList ?? [],
|
||||
onChanged: onDropDownChange(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 22.v),
|
||||
Text("Населенный пункт", style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 2.v),
|
||||
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(
|
||||
builder: (context, state) {
|
||||
return RawAutocomplete<String>(
|
||||
optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) {
|
||||
return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase());
|
||||
}),
|
||||
fieldViewBuilder: (
|
||||
BuildContext context,
|
||||
TextEditingController textEditingController,
|
||||
FocusNode focusNode,
|
||||
VoidCallback onFieldSubmitted,
|
||||
) {
|
||||
return CustomTextFormField(
|
||||
controller: textEditingController,
|
||||
focusNode: focusNode,
|
||||
onFieldSubmitted: (String value) => onFieldSubmitted(),
|
||||
);
|
||||
},
|
||||
optionsViewBuilder: (
|
||||
BuildContext context,
|
||||
AutocompleteOnSelected<String> onSelected,
|
||||
Iterable<String> options,
|
||||
) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Material(
|
||||
elevation: 4.0,
|
||||
child: SizedBox(
|
||||
height: 200.0,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
itemCount: options.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final String option = options.elementAt(index);
|
||||
return GestureDetector(
|
||||
onTap: () => onSelected(option),
|
||||
child: ListTile(
|
||||
title: Text(option),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
// BlocBuilder<CityOfLivingBloc, CityOfLivingState>(
|
||||
// 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),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -125,10 +119,11 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
onDropDownChange(BuildContext context) {
|
||||
return (value) {
|
||||
context.read<CityOfLivingBloc>().add(ChangeDropDownEvent(value: value));
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(country: value));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
return () {
|
||||
onTapArrowLeft(context);
|
||||
@@ -141,8 +136,10 @@ class CityOfLivingScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
selectProduct(AutocompleteOnSelected<String> onSelected, String option, CityOfLivingState state) {
|
||||
selectProduct(AutocompleteOnSelected<String> onSelected, String option, CityOfLivingState state, BuildContext context) {
|
||||
state.cityController?.text = option;
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(city: option));
|
||||
return () {
|
||||
onSelected(option);
|
||||
};
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/favorite_foods_bloc.dart';
|
||||
import 'models/favorite_foods_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 FavoriteFoodsScreen extends StatefulWidget {
|
||||
const FavoriteFoodsScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<FavoriteFoodsBloc>(
|
||||
create: (context) =>
|
||||
FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()),
|
||||
child: FavoriteFoodsScreen(),
|
||||
);
|
||||
}
|
||||
const FavoriteFoodsScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<FavoriteFoodsScreen> createState() => _FavoriteFoodsScreenState();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/favorite_sports_bloc.dart';
|
||||
// ignore: unused_import
|
||||
import 'models/favorite_sports_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
@@ -8,15 +9,9 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FavoriteSportsScreen extends StatefulWidget {
|
||||
const FavoriteSportsScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<FavoriteSportsBloc>(
|
||||
create: (context) =>
|
||||
FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet)))..add(FavoriteSportsInitialEvent()),
|
||||
child: FavoriteSportsScreen(),
|
||||
);
|
||||
}
|
||||
const FavoriteSportsScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<FavoriteSportsScreen> createState() => _FavoriteSportsScreenState();
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/height_bloc.dart';
|
||||
import 'models/height_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HeightScreen extends StatelessWidget {
|
||||
const HeightScreen({Key? key}) : super(key: key);
|
||||
class HeightScreen extends StatefulWidget {
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<HeightBloc>(
|
||||
create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()),
|
||||
child: HeightScreen(),
|
||||
);
|
||||
}
|
||||
const HeightScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<HeightScreen> createState() => _HeightScreenState();
|
||||
}
|
||||
|
||||
class _HeightScreenState extends State<HeightScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
@@ -67,7 +66,6 @@ class HeightScreen extends StatelessWidget {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Function onTapBack(BuildContext context) {
|
||||
return () {
|
||||
onTapArrowLeft(context);
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/medicine_intake_bloc.dart';
|
||||
import 'models/medicine_intake_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MedicineIntakeScreen extends StatefulWidget {
|
||||
const MedicineIntakeScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<MedicineIntakeBloc>(
|
||||
create: (context) =>
|
||||
MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet)))..add(MedicineIntakeInitialEvent()),
|
||||
child: MedicineIntakeScreen(),
|
||||
);
|
||||
}
|
||||
const MedicineIntakeScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
State<MedicineIntakeScreen> createState() => _MedicineIntakeScreenState();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'bloc/weight_bloc.dart';
|
||||
import 'models/weight_model.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -9,14 +8,9 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class WeightScreen extends StatelessWidget {
|
||||
const WeightScreen({Key? key}) : super(key: key);
|
||||
final UserRegistrationSheet sheet;
|
||||
|
||||
static Widget builder(BuildContext context, sheet) {
|
||||
return BlocProvider<WeightBloc>(
|
||||
create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()),
|
||||
child: WeightScreen(),
|
||||
);
|
||||
}
|
||||
const WeightScreen({super.key, required this.sheet});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user