go router full

This commit is contained in:
mso7nueh
2024-06-06 16:02:39 +03:00
parent 7b55204659
commit 647e9e9133
42 changed files with 483 additions and 1018 deletions

View File

@@ -1,3 +1,5 @@
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';
@@ -91,10 +93,7 @@ class AdditionalInformationScreen extends StatelessWidget {
final box = await Hive.openBox('token');
final token = res['token'];
box.put('token', token);
Navigator.pushNamed(
context,
AppRoutes.myProfile,
);
GoRouter.of(context).goNamed('myProfileScreen');
} else {
showErrorMessage(context, res['message']);
}

View File

@@ -1,3 +1,5 @@
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';
@@ -13,12 +15,9 @@ 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;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<AllergiesBloc>(
create: (context) => AllergiesBloc(AllergiesState(
allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))
..add(AllergiesInitialEvent()),
create: (context) => AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet)))..add(AllergiesInitialEvent()),
child: AllergiesScreen());
}
@@ -45,32 +44,24 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.76,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.76, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 22.v),
Text("allergies_presence".tr,
style: theme.textTheme.headlineSmall),
Text("allergies_presence".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 36),
_buildTextFormField(context),
Spacer(flex: 54),
BlocBuilder<AllergiesBloc, AllergiesState>(
builder: (context, state) {
BlocBuilder<AllergiesBloc, AllergiesState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
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) {
BlocBuilder<AllergiesBloc, AllergiesState>(builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
@@ -81,26 +72,16 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
onTapSkip(AllergiesState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.allergiesModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.medicineIntakeScreen,
arguments: sheet,
);
UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet);
};
}
onTapContinue(AllergiesState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.allergiesModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.allergiesModelObj!.userRegistrationSheet;
sheet.aboutAllergy = state.enterInformationController!.text;
Navigator.pushNamed(
context,
AppRoutes.medicineIntakeScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('medicineIntakeScreen', extra: sheet);
};
}
@@ -108,10 +89,8 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -125,17 +104,13 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
/// Section Widget
_buildTextFormField(BuildContext context) {
return Column(children: [
Text("fill_in_information".tr,
style: CustomTextStyles.titleMediumSegoeUI),
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);
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8);
})
]);
}

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/app_navigation_bloc.dart';
import 'models/app_navigation_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -49,92 +51,77 @@ class _AppNavigationScreenState extends State<AppNavigationScreen> {
_buildScreenTitle(
context,
screenTitle: "date_of_birth".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.dateOfBirthScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('dateOfBirthScreen'),
),
_buildScreenTitle(
context,
screenTitle: "city_of_living".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.cityOfLivingScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('cityOfLivingScreen'),
),
_buildScreenTitle(
context,
screenTitle: "body_circumferences".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bodyCircumferencesScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('bodyCircumferencesScreen'),
),
_buildScreenTitle(
context,
screenTitle: "weight".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.weightScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('weightScreen'),
),
_buildScreenTitle(
context,
screenTitle: "allergies".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.allergiesScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('allergiesScreen'),
),
_buildScreenTitle(
context,
screenTitle: "medicine_intake".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.medicineIntakeScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('medicineIntakeScreen'),
),
_buildScreenTitle(
context,
screenTitle: "splash_screen".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.splashScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('splashScreen'),
),
_buildScreenTitle(
context,
screenTitle: "gender".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.genderScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('genderScreen'),
),
_buildScreenTitle(
context,
screenTitle: "blood_pressure".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bloodPressureScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('bloodPressureScreen'),
),
_buildScreenTitle(
context,
screenTitle: "favorite_sports".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteSportsScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteSportsScreen'),
),
_buildScreenTitle(
context,
screenTitle: "favorite_foods".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteFoodsScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('favoriteFoodsScreen'),
),
_buildScreenTitle(
context,
screenTitle: "schedule".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.scheduleScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('scheduleScreen'),
),
_buildScreenTitle(
context,
screenTitle: "additional_information".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.additionalInformationScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('additionalInformationScreen'),
),
_buildScreenTitle(
context,
screenTitle: "language_select".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.languageSelectScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('languageSelectScreen'),
),
_buildScreenTitle(
context,
screenTitle: "auth".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.authScreen),
onTapScreenTitle: () => GoRouter.of(context).goNamed('authScreen'),
),
],
),
@@ -181,8 +168,7 @@ class _AppNavigationScreenState extends State<AppNavigationScreen> {
child: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Text(
"Check your app's UI from the below demo screens of your app."
.tr,
"Check your app's UI from the below demo screens of your app.".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF888888),
@@ -247,9 +233,4 @@ class _AppNavigationScreenState extends State<AppNavigationScreen> {
),
);
}
/// Common click event
void onTapScreenTitle(String routeName) {
NavigatorService.pushNamed(routeName);
}
}

View File

@@ -1,3 +1,6 @@
import 'package:eatvio_app/app_router.dart';
import 'package:go_router/go_router.dart';
import 'bloc/blood_pressure_bloc.dart';
import 'package:flutter/services.dart';
import 'models/blood_pressure_model.dart';
@@ -15,13 +18,10 @@ class BloodPressureScreen extends StatefulWidget {
const BloodPressureScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<BloodPressureBloc>(
create: (context) => BloodPressureBloc(BloodPressureState(
bloodPressureModelObj:
BloodPressureModel(userRegistrationSheet: sheet)))
..add(BloodPressureInitialEvent()),
create: (context) =>
BloodPressureBloc(BloodPressureState(bloodPressureModelObj: BloodPressureModel(userRegistrationSheet: sheet)))..add(BloodPressureInitialEvent()),
child: BloodPressureScreen());
}
@@ -46,9 +46,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
Container(
height: 16.v,
width: 343.h,
padding: EdgeInsets.symmetric(
horizontal:
4.h), // Apply padding directly to the Container
padding: EdgeInsets.symmetric(horizontal: 4.h),
// Apply padding directly to the Container
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
@@ -62,8 +61,7 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
child: LinearProgressIndicator(
value: 0.62,
backgroundColor: theme.colorScheme.onPrimary,
valueColor:
AlwaysStoppedAnimation<Color>(appTheme.blueA400),
valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),
),
),
),
@@ -71,26 +69,18 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
SizedBox(
width: 224.h,
child: Text("your_blood_pressure".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
SizedBox(height: 21.v),
Container(
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(children: [
Text("up_pressure".tr,
style: theme.textTheme.bodyLarge),
Text("up_pressure".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
BlocSelector<BloodPressureBloc, BloodPressureState, TextEditingController?>(
selector: (state) => state.upPressureController,
builder: (context, upPressureController) {
return CustomTextFormField(
inputFormatters: [digitsOnly],
controller: upPressureController,
hintText: "90".tr);
return CustomTextFormField(inputFormatters: [digitsOnly], controller: upPressureController, hintText: "90".tr);
})
])),
SizedBox(height: 21.v),
@@ -98,85 +88,57 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(children: [
Text("down_pressure".tr,
style: theme.textTheme.bodyLarge),
Text("down_pressure".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
BlocSelector<BloodPressureBloc, BloodPressureState, TextEditingController?>(
selector: (state) => state.downPressureController,
builder: (context, downPressureController) {
return CustomTextFormField(
inputFormatters: [digitsOnly],
controller: downPressureController,
hintText: "90".tr);
return CustomTextFormField(inputFormatters: [digitsOnly], controller: downPressureController, hintText: "90".tr);
})
])),
SizedBox(height: 22.v),
Text("do_you_have_hypotension_tendency".tr,
style: theme.textTheme.bodyLarge),
Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: BlocSelector<BloodPressureBloc, BloodPressureState,
BloodPressureModel?>(
child: BlocSelector<BloodPressureBloc, BloodPressureState, BloodPressureModel?>(
selector: (state) => state.bloodPressureModelObj,
builder: (context, bloodPressureModelObj) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(
30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)),
hintText: "Не выбрано".tr,
items:
bloodPressureModelObj?.dropdownItemList ??
[],
items: bloodPressureModelObj?.dropdownItemList ?? [],
onChanged: onChangeHyper(context));
})),
SizedBox(height: 22.v),
Text("do_you_have_hypertension_tendency".tr,
style: theme.textTheme.bodyLarge),
Text("do_you_have_hypertension_tendency".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: BlocSelector<BloodPressureBloc, BloodPressureState,
BloodPressureModel?>(
child: BlocSelector<BloodPressureBloc, BloodPressureState, BloodPressureModel?>(
selector: (state) => state.bloodPressureModelObj,
builder: (context, bloodPressureModelObj) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(
30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
margin: EdgeInsets.fromLTRB(30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)),
hintText: "Не выбрано".tr,
items:
bloodPressureModelObj?.dropdownItemList ??
[],
items: bloodPressureModelObj?.dropdownItemList ?? [],
onChanged: onChangeHypo(context));
})),
Spacer(),
BlocBuilder<BloodPressureBloc, BloodPressureState>(
builder: (context, state) {
BlocBuilder<BloodPressureBloc, BloodPressureState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context));
}),
BlocBuilder<BloodPressureBloc, BloodPressureState>(
builder: (context, state) {
BlocBuilder<BloodPressureBloc, BloodPressureState>(builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
@@ -187,30 +149,19 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
onTapSkip(BloodPressureState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.bloodPressureModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.allergiesScreen,
arguments: sheet,
);
UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet;
AppRouter.navigatorKey.currentContext?.goNamed('allergiesScreen', extra: sheet);
};
}
onTapContinue(BloodPressureState state, BuildContext context) {
return () {
List<String> errors = validateFields(
state.upPressureController!.text, state.downPressureController!.text);
List<String> errors = validateFields(state.upPressureController!.text, state.downPressureController!.text);
if (errors.isEmpty) {
UserRegistrationSheet sheet =
state.bloodPressureModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.bloodPressureModelObj!.userRegistrationSheet;
sheet.bloodPressureUp = state.upPressureController!.text;
sheet.bloodPressureDown = state.downPressureController!.text;
Navigator.pushNamed(
context,
AppRoutes.favoriteSportsScreen,
arguments: sheet,
);
AppRouter.navigatorKey.currentContext?.goNamed('favoriteSportsScreen', extra: sheet);
} else {
String errorMessage = '';
@@ -243,9 +194,7 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
onChangeHypo(BuildContext context) {
return (value) {
context
.read<BloodPressureBloc>()
.add(ChangeHyperDropDownEvent(value: value));
context.read<BloodPressureBloc>().add(ChangeHyperDropDownEvent(value: value));
};
}
@@ -259,10 +208,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -288,8 +235,7 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
errors.add('pressure_empty'.tr);
}
if (![bloodPressureUp, bloodPressureDown]
.every((pressure) => int.tryParse(pressure) != null)) {
if (![bloodPressureUp, bloodPressureDown].every((pressure) => int.tryParse(pressure) != null)) {
errors.add('pressure_is_not_a_number'.tr);
}

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/body_circumferences_bloc.dart';
import 'package:flutter/services.dart';
import 'models/body_circumferences_model.dart';
@@ -14,12 +16,9 @@ class BodyCircumferencesScreen extends StatelessWidget {
const BodyCircumferencesScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<BodyCircumferencesBloc>(
create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(
bodyCircumferencesModelObj:
BodyCircumferencesModel(userRegistrationSheet: sheet)))
create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(bodyCircumferencesModelObj: BodyCircumferencesModel(userRegistrationSheet: sheet)))
..add(BodyCircumferencesInitialEvent()),
child: BodyCircumferencesScreen());
}
@@ -43,67 +42,45 @@ class BodyCircumferencesScreen extends StatelessWidget {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.40,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.40, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 39.v),
Text("initial_measurements".tr,
style: theme.textTheme.headlineSmall),
Text("initial_measurements".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 93.v),
Column(children: [
Text("chest_circumference".tr,
style: theme.textTheme.bodyLarge),
Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<BodyCircumferencesBloc,
BodyCircumferencesState, TextEditingController?>(
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
selector: (state) => state.chestCircumferenceController,
builder: (context, chestCircumferenceController) {
return CustomTextFormField(
inputFormatters: [digitsOnly],
controller: chestCircumferenceController,
hintText: "90".tr);
return CustomTextFormField(inputFormatters: [digitsOnly], controller: chestCircumferenceController, hintText: "90".tr);
})
]),
SizedBox(height: 19.v),
Text("waist_circumference".tr,
style: theme.textTheme.bodyLarge),
Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
TextEditingController?>(
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
selector: (state) => state.waistCircumferenceController,
builder: (context, waistCircumferenceController) {
return CustomTextFormField(
inputFormatters: [digitsOnly],
controller: waistCircumferenceController,
hintText: "60".tr);
return CustomTextFormField(inputFormatters: [digitsOnly], controller: waistCircumferenceController, hintText: "60".tr);
}),
SizedBox(height: 21.v),
Text("hip_circumference".tr,
style: theme.textTheme.bodyLarge),
Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
TextEditingController?>(
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState, TextEditingController?>(
selector: (state) => state.hipCircumferenceController,
builder: (context, hipCircumferenceController) {
return CustomTextFormField(
inputFormatters: [digitsOnly],
controller: hipCircumferenceController,
hintText: "90".tr,
textInputAction: TextInputAction.done);
inputFormatters: [digitsOnly], controller: hipCircumferenceController, hintText: "90".tr, textInputAction: TextInputAction.done);
}),
Spacer(),
BlocBuilder<BodyCircumferencesBloc, BodyCircumferencesState>(
builder: (context, state) {
BlocBuilder<BodyCircumferencesBloc, BodyCircumferencesState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context));
}),
@@ -112,21 +89,14 @@ class BodyCircumferencesScreen extends StatelessWidget {
onTapContinue(BodyCircumferencesState state, BuildContext context) {
return () {
List<String> errors = validateFields(
state.chestCircumferenceController!.text,
state.waistCircumferenceController!.text,
state.hipCircumferenceController!.text);
List<String> errors =
validateFields(state.chestCircumferenceController!.text, state.waistCircumferenceController!.text, state.hipCircumferenceController!.text);
if (errors.isEmpty) {
UserRegistrationSheet sheet =
state.bodyCircumferencesModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.bodyCircumferencesModelObj!.userRegistrationSheet;
sheet.chestCircumference = state.chestCircumferenceController!.text;
sheet.waistCircumference = state.waistCircumferenceController!.text;
sheet.hipCircumference = state.hipCircumferenceController!.text;
Navigator.pushNamed(
context,
AppRoutes.weightScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('weightScreen', extra: sheet);
} else {
String errorMessage = '';
@@ -161,10 +131,8 @@ class BodyCircumferencesScreen extends StatelessWidget {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -181,11 +149,7 @@ class BodyCircumferencesScreen extends StatelessWidget {
}
/// Navigates to the weightScreen when the action is triggered.
navigateToWeight(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.weightScreen,
);
}
navigateToWeight(BuildContext context) => GoRouter.of(context).goNamed('weightScreen');
List<String> validateFields(
String chestCircumference,
@@ -194,14 +158,11 @@ class BodyCircumferencesScreen extends StatelessWidget {
) {
List<String> errors = [];
if (chestCircumference.isEmpty |
waistCircumference.isEmpty |
hipCircumference.isEmpty) {
if (chestCircumference.isEmpty | waistCircumference.isEmpty | hipCircumference.isEmpty) {
errors.add('circumference_empty'.tr);
}
if (![chestCircumference, waistCircumference, hipCircumference]
.every((circumference) => int.tryParse(circumference) != null)) {
if (![chestCircumference, waistCircumference, hipCircumference].every((circumference) => int.tryParse(circumference) != null)) {
errors.add('circumference_is_not_a_number'.tr);
}

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/city_of_living_bloc.dart';
import 'models/city_of_living_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -14,13 +16,10 @@ class CityOfLivingScreen extends StatelessWidget {
const CityOfLivingScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<CityOfLivingBloc>(
create: (context) => CityOfLivingBloc(CityOfLivingState(
cityOfLivingModelObj:
CityOfLivingModel(userRegistrationSheet: sheet)))
..add(CityOfLivingInitialEvent()),
create: (context) =>
CityOfLivingBloc(CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel(userRegistrationSheet: sheet)))..add(CityOfLivingInitialEvent()),
child: CityOfLivingScreen());
}
@@ -1160,35 +1159,24 @@ class CityOfLivingScreen extends StatelessWidget {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.32,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.32, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 39.v),
Text("place_of_living".tr,
style: theme.textTheme.headlineSmall),
Text("place_of_living".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 34),
Text("country".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<CityOfLivingBloc, CityOfLivingState,
CityOfLivingModel?>(
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)),
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));
@@ -1196,14 +1184,10 @@ class CityOfLivingScreen extends StatelessWidget {
SizedBox(height: 22.v),
Text("Населенный пункт", style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(
builder: (context, state) {
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(builder: (context, state) {
return RawAutocomplete<String>(
optionsBuilder: (TextEditingValue textEditingValue) =>
_options.where((String option) {
return option
.toLowerCase()
.startsWith(textEditingValue.text.toLowerCase());
optionsBuilder: (TextEditingValue textEditingValue) => _options.where((String option) {
return option.toLowerCase().startsWith(textEditingValue.text.toLowerCase());
}),
fieldViewBuilder: (
BuildContext context,
@@ -1214,8 +1198,7 @@ class CityOfLivingScreen extends StatelessWidget {
return CustomTextFormField(
controller: textEditingController,
focusNode: focusNode,
onFieldSubmitted: (String value) =>
onFieldSubmitted(),
onFieldSubmitted: (String value) => onFieldSubmitted(),
);
},
optionsViewBuilder: (
@@ -1233,8 +1216,7 @@ class CityOfLivingScreen extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
itemCount: options.length,
itemBuilder: (BuildContext context, int index) {
final String option =
options.elementAt(index);
final String option = options.elementAt(index);
return GestureDetector(
onTap: () => onSelected(option),
child: ListTile(
@@ -1250,12 +1232,10 @@ class CityOfLivingScreen extends StatelessWidget {
);
}),
Spacer(flex: 65),
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(
builder: (context, state) {
BlocBuilder<CityOfLivingBloc, CityOfLivingState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context));
}),
@@ -1264,13 +1244,8 @@ class CityOfLivingScreen extends StatelessWidget {
onTapContinue(CityOfLivingState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.cityOfLivingModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.bodyCircumferencesScreen,
arguments: sheet,
);
UserRegistrationSheet sheet = state.cityOfLivingModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed('bodyCircumferencesScreen', extra: sheet);
};
}
@@ -1284,10 +1259,8 @@ class CityOfLivingScreen extends StatelessWidget {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -1304,8 +1277,7 @@ class CityOfLivingScreen extends StatelessWidget {
}
}
selectProduct(AutocompleteOnSelected<String> onSelected, String option,
CityOfLivingState state) {
selectProduct(AutocompleteOnSelected<String> onSelected, String option, CityOfLivingState state) {
state.cityController?.text = option;
return () {
onSelected(option);

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/credentials_bloc.dart';
import 'models/credentials_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -126,11 +128,7 @@ class CredentialsScreen extends StatelessWidget {
sheet.name = state.nameController!.text;
sheet.password = state.passwordController!.text;
sheet.passwordConfirmation = state.passwordConfirmationController!.text;
Navigator.pushNamed(
context,
AppRoutes.nameScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('nameScreen');
} else {
String errorMessage = '';

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/date_of_birth_bloc.dart';
import 'models/date_of_birth_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -12,13 +14,10 @@ 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;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<DateOfBirthBloc>(
create: (context) => DateOfBirthBloc(DateOfBirthState(
dateOfBirthModelObj:
DateOfBirthModel(userRegistrationSheet: sheet)))
..add(DateOfBirthInitialEvent()),
create: (context) =>
DateOfBirthBloc(DateOfBirthState(dateOfBirthModelObj: DateOfBirthModel(userRegistrationSheet: sheet)))..add(DateOfBirthInitialEvent()),
child: DateOfBirthScreen());
}
@@ -28,18 +27,17 @@ class DateOfBirthScreen extends StatefulWidget {
class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
DateTime selectedDate = DateTime.now();
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<DateOfBirthBloc, DateOfBirthState>(
builder: (context, state) {
return BlocBuilder<DateOfBirthBloc, DateOfBirthState>(builder: (context, state) {
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding:
EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
Container(
height: 16.v,
@@ -47,27 +45,20 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.24,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.24, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 38.v),
Text("date_of_birth".tr,
style: theme.textTheme.headlineSmall),
Text("date_of_birth".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 39),
_buildDateInput(context),
Spacer(flex: 60),
BlocBuilder<DateOfBirthBloc, DateOfBirthState>(
builder: (context, state) {
BlocBuilder<DateOfBirthBloc, DateOfBirthState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context));
}),
@@ -77,14 +68,9 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
onTapContinue(DateOfBirthState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.dateOfBirthModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.dateOfBirthModelObj!.userRegistrationSheet;
sheet.birthdate = selectedDate.toString();
Navigator.pushNamed(
context,
AppRoutes.cityOfLivingScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('cityOfLivingScreen', extra: sheet);
};
}
@@ -92,10 +78,8 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -111,28 +95,17 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v),
decoration: AppDecoration.outlineBlueA
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize,
radius: BorderRadius.circular(1.h)),
SizedBox(height: 6.v),
Align(
alignment: Alignment.center,
child: GestureDetector(
onTap: onTapCalendar(context),
child: Text(
'${selectedDate.day}.${selectedDate.month}.${selectedDate.year}',
style: theme.textTheme.titleMedium))),
SizedBox(height: 6.v)
]));
decoration: AppDecoration.outlineBlueA.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [
CustomImageView(imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize, radius: BorderRadius.circular(1.h)),
SizedBox(height: 6.v),
Align(
alignment: Alignment.center,
child: GestureDetector(
onTap: onTapCalendar(context),
child: Text('${selectedDate.day}.${selectedDate.month}.${selectedDate.year}', style: theme.textTheme.titleMedium))),
SizedBox(height: 6.v)
]));
}
onTapCalendar(BuildContext context) {

View File

@@ -1,3 +1,5 @@
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';
@@ -13,13 +15,10 @@ class FavoriteFoodsScreen extends StatefulWidget {
const FavoriteFoodsScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<FavoriteFoodsBloc>(
create: (context) => FavoriteFoodsBloc(FavoriteFoodsState(
favoriteFoodsModelObj:
FavoriteFoodsModel(userRegistrationSheet: sheet)))
..add(FavoriteFoodsInitialEvent()),
create: (context) =>
FavoriteFoodsBloc(FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel(userRegistrationSheet: sheet)))..add(FavoriteFoodsInitialEvent()),
child: FavoriteFoodsScreen());
}
@@ -46,40 +45,30 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.90,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.90, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 19.v),
Container(
width: 327.h,
margin: EdgeInsets.only(left: 8.h, right: 7.h),
child: Text("favorite_unfavorite_foods".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
SizedBox(height: 13.v),
_buildTextFormFieldFav(context),
SizedBox(height: 12.v),
_buildTextFormFieldUnfav(context),
Spacer(),
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(
builder: (context, state) {
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 40.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 40.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context));
}),
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(
builder: (context, state) {
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
@@ -90,27 +79,17 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
onTapSkip(FavoriteFoodsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.favoriteFoodsModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.additionalInformationScreen,
arguments: sheet,
);
UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet);
};
}
onTapContinue(FavoriteFoodsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.favoriteFoodsModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.favoriteFoodsModelObj!.userRegistrationSheet;
sheet.favoriteFoods = state.favoriteFoodsController!.text;
sheet.unfavoriteFoods = state.unfavoriteFoodsController!.text;
Navigator.pushNamed(
context,
AppRoutes.additionalInformationScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('additionalInformationScreen', extra: sheet);
};
}
@@ -118,10 +97,8 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -137,14 +114,10 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
return Column(children: [
Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
TextEditingController?>(
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState, TextEditingController?>(
selector: (state) => state.favoriteFoodsController,
builder: (context, favoriteFoodsController) {
return CustomTextFormField(
controller: favoriteFoodsController,
hintText: "enter_information".tr,
maxLines: 7);
return CustomTextFormField(controller: favoriteFoodsController, hintText: "enter_information".tr, maxLines: 7);
})
]);
}
@@ -154,15 +127,11 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
return Column(children: [
Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
TextEditingController?>(
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState, TextEditingController?>(
selector: (state) => state.unfavoriteFoodsController,
builder: (context, unfavoriteFoodsController) {
return CustomTextFormField(
controller: unfavoriteFoodsController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 7);
controller: unfavoriteFoodsController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 7);
})
]);
}
@@ -174,8 +143,6 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
/// Navigates to the scheduleScreen when the action is triggered.
navigateToAdditionalInformationScreen(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.additionalInformationScreen,
);
GoRouter.of(context).goNamed('additionalInformationScreen');
}
}

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/favorite_sports_bloc.dart';
import 'models/favorite_sports_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -13,12 +15,9 @@ class FavoriteSportsScreen extends StatefulWidget {
const FavoriteSportsScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<FavoriteSportsBloc>(
create: (context) => FavoriteSportsBloc(FavoriteSportsState(
favoriteSportsModelObj:
FavoriteSportsModel(userRegistrationSheet: sheet)))
create: (context) => FavoriteSportsBloc(FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel(userRegistrationSheet: sheet)))
..add(FavoriteSportsInitialEvent()),
child: FavoriteSportsScreen());
}
@@ -38,84 +37,60 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 20.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary,
width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.83,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 38.v),
Text("your_favorite_sports".tr,
style: theme.textTheme.headlineSmall),
Spacer(flex: 32),
_buildTextFormFieldSection(context),
Spacer(flex: 67),
BlocBuilder<FavoriteSportsBloc, FavoriteSportsState>(
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<FavoriteSportsBloc, FavoriteSportsState>(
builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child:
Text("skip".tr, style: theme.textTheme.bodyLarge),
);
}),
]))));
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
SizedBox(height: 20.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.83, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 38.v),
Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 32),
_buildTextFormFieldSection(context),
Spacer(flex: 67),
BlocBuilder<FavoriteSportsBloc, FavoriteSportsState>(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<FavoriteSportsBloc, FavoriteSportsState>(builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
);
}),
]))));
}
onTapSkip(FavoriteSportsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.favoriteSportsModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.favoriteFoodsScreen,
arguments: sheet,
);
UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet);
};
}
onTapContinue(FavoriteSportsState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.favoriteSportsModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.favoriteSportsModelObj!.userRegistrationSheet;
sheet.aboutSportHobbies = state.enterinformationController!.text;
Navigator.pushNamed(
context,
AppRoutes.favoriteFoodsScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('favoriteFoodsScreen', extra: sheet);
};
}
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -129,11 +104,9 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
/// Section Widget
_buildTextFormFieldSection(BuildContext context) {
return Column(children: [
Text("fill_in_information".tr,
style: CustomTextStyles.titleMediumSegoeUI),
Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<FavoriteSportsBloc, FavoriteSportsState,
TextEditingController?>(
BlocSelector<FavoriteSportsBloc, FavoriteSportsState, TextEditingController?>(
selector: (state) => state.enterinformationController,
builder: (context, enterinformationController) {
return CustomTextFormField(

View File

@@ -1,3 +1,5 @@
import 'package:go_router/go_router.dart';
import 'bloc/gender_bloc.dart';
import 'models/gender_model.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
@@ -12,8 +14,7 @@ class GenderScreen extends StatefulWidget {
const GenderScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<GenderBloc>(
create: (context) => GenderBloc(
GenderState(
@@ -37,8 +38,7 @@ class _GenderScreenState extends State<GenderScreen> {
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding:
EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
@@ -47,18 +47,13 @@ class _GenderScreenState extends State<GenderScreen> {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.16,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.16, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 36.v),
Text("your_gender".tr,
style: theme.textTheme.headlineSmall),
Text("your_gender".tr, style: theme.textTheme.headlineSmall),
RadioListTile(
title: Text('Мужской'),
value: 'male',
@@ -82,12 +77,10 @@ class _GenderScreenState extends State<GenderScreen> {
),
),
Spacer(flex: 66),
BlocBuilder<GenderBloc, GenderState>(
builder: (context, state) {
BlocBuilder<GenderBloc, GenderState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapNext(state, context));
}),
@@ -99,25 +92,19 @@ class _GenderScreenState extends State<GenderScreen> {
return () {
UserRegistrationSheet sheet = state.genderModelObj!.userRegistrationSheet;
sheet.gender = state.selectedRadioValue!;
Navigator.pushNamed(
context,
AppRoutes.dateOfBirthScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('dateOfBirthScreen', extra: sheet);
};
}
onMale(BuildContext context) {
return (value) {
BlocProvider.of<GenderBloc>(context)
.add(GenderSelectEvent(value: 'male'));
BlocProvider.of<GenderBloc>(context).add(GenderSelectEvent(value: 'male'));
};
}
onFemale(BuildContext context) {
return (value) {
BlocProvider.of<GenderBloc>(context)
.add(GenderSelectEvent(value: 'female'));
BlocProvider.of<GenderBloc>(context).add(GenderSelectEvent(value: 'female'));
};
}
@@ -125,19 +112,14 @@ class _GenderScreenState extends State<GenderScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack()),
leading: AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack()),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
Function onTapBack() {
return () {
NavigatorService.pushNamed(
AppRoutes.dateOfBirthScreen,
);
GoRouter.of(context).goNamed('dateOfBirthScreen');
};
}

View File

@@ -1,3 +1,5 @@
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';
@@ -14,12 +16,9 @@ class HeightScreen extends StatelessWidget {
const HeightScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<HeightBloc>(
create: (context) => HeightBloc(HeightState(
heightModelObj: HeightModel(userRegistrationSheet: sheet)))
..add(HeightInitialEvent()),
create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()),
child: HeightScreen());
}
@@ -72,8 +71,7 @@ class HeightScreen extends StatelessWidget {
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
BlocBuilder<HeightBloc, HeightState>(
builder: (context, state) {
BlocBuilder<HeightBloc, HeightState>(builder: (context, state) {
return CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
@@ -113,11 +111,7 @@ class HeightScreen extends StatelessWidget {
onTapNext(HeightState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.heightModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.bloodPressureScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('bloodPressureScreen', extra: sheet);
};
}
@@ -125,10 +119,8 @@ class HeightScreen extends StatelessWidget {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}

View File

@@ -1,4 +1,5 @@
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:go_router/go_router.dart';
import 'bloc/language_select_bloc.dart';
import 'models/language_select_model.dart';
@@ -107,10 +108,9 @@ class LanguageSelectScreen extends StatelessWidget {
void Function()? _saveAndPush(LanguageSelectState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.languageSelectModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.credentialsScreen,
arguments: sheet,
GoRouter.of(context).goNamed(
'credentialsScreen',
extra: sheet,
);
};
}

View File

@@ -1,3 +1,5 @@
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';
@@ -13,12 +15,9 @@ class MedicineIntakeScreen extends StatefulWidget {
const MedicineIntakeScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<MedicineIntakeBloc>(
create: (context) => MedicineIntakeBloc(MedicineIntakeState(
medicineIntakeModelObj:
MedicineIntakeModel(userRegistrationSheet: sheet)))
create: (context) => MedicineIntakeBloc(MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel(userRegistrationSheet: sheet)))
..add(MedicineIntakeInitialEvent()),
child: MedicineIntakeScreen());
}
@@ -46,38 +45,28 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
border: Border.all(color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.69,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
value: 0.69, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400)))),
SizedBox(height: 20.v),
Container(
width: 271.h,
margin: EdgeInsets.only(left: 35.h, right: 36.h),
child: Text("do_you_take_pills".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)),
SizedBox(height: 86.v),
_buildTextFormField(context),
Spacer(),
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(
builder: (context, state) {
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(builder: (context, state) {
return NextStepButton(
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapNext(state, context));
}),
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(
builder: (context, state) {
BlocBuilder<MedicineIntakeBloc, MedicineIntakeState>(builder: (context, state) {
return GestureDetector(
onTap: onTapSkip(state, context),
child: Text("skip".tr, style: theme.textTheme.bodyLarge),
@@ -88,25 +77,21 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
onTapSkip(MedicineIntakeState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.medicineIntakeModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.bloodPressureScreen,
arguments: sheet,
UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed(
'bloodPressureScreen',
extra: sheet,
);
};
}
onTapNext(MedicineIntakeState state, BuildContext context) {
return () {
UserRegistrationSheet sheet =
state.medicineIntakeModelObj!.userRegistrationSheet;
UserRegistrationSheet sheet = state.medicineIntakeModelObj!.userRegistrationSheet;
sheet.aboutTakingPils = state.enterInformationController!.text;
Navigator.pushNamed(
context,
AppRoutes.bloodPressureScreen,
arguments: sheet,
GoRouter.of(context).goNamed(
'bloodPressureScreen',
extra: sheet,
);
};
}
@@ -115,10 +100,8 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -132,18 +115,13 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
/// Section Widget
_buildTextFormField(BuildContext context) {
return Column(children: [
Text("fill_in_information".tr,
style: CustomTextStyles.titleMediumSegoeUI),
Text("fill_in_information".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<MedicineIntakeBloc, MedicineIntakeState,
TextEditingController?>(
BlocSelector<MedicineIntakeBloc, MedicineIntakeState, TextEditingController?>(
selector: (state) => state.enterInformationController,
builder: (context, enterInformationController) {
return CustomTextFormField(
controller: enterInformationController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
controller: enterInformationController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 8);
})
]);
}

View File

@@ -1,3 +1,6 @@
import 'package:eatvio_app/app_router.dart';
import 'package:go_router/go_router.dart';
import 'bloc/name_bloc.dart';
import 'models/name_model.dart';
import 'package:eatvio_app/core/app_export.dart';
@@ -114,12 +117,7 @@ class NameScreen extends StatelessWidget {
UserRegistrationSheet sheet = state.nameModelObj!.userRegistrationSheet;
sheet.firstName = state.firstNameController!.text;
sheet.lastName = state.lastNameController!.text;
Navigator.pushNamed(
context,
AppRoutes.genderScreen,
arguments: sheet,
);
AppRouter.navigatorKey.currentContext?.goNamed('genderScreen', extra: sheet);
} else {
String errorMessage = '';

View File

@@ -1,8 +1,12 @@
import 'package:eatvio_app/app_router.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/registration/splash_screen/models/splash_model.dart';
part 'splash_event.dart';
part 'splash_state.dart';
/// A bloc that manages the state of a Splash according to the event that is dispatched to it.
@@ -16,9 +20,7 @@ class SplashBloc extends Bloc<SplashEvent, SplashState> {
Emitter<SplashState> emit,
) async {
Future.delayed(const Duration(milliseconds: 3000), () {
NavigatorService.popAndPushNamed(
AppRoutes.myProfile,
);
AppRouter.navigatorKey.currentContext?.goNamed('myProfileScreen');
});
}
}

View File

@@ -1,3 +1,5 @@
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';
@@ -14,12 +16,9 @@ class WeightScreen extends StatelessWidget {
const WeightScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
final sheet =
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
return BlocProvider<WeightBloc>(
create: (context) => WeightBloc(WeightState(
weightModelObj: WeightModel(userRegistrationSheet: sheet)))
..add(WeightInitialEvent()),
create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()),
child: WeightScreen());
}
@@ -72,8 +71,7 @@ class WeightScreen extends StatelessWidget {
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
BlocBuilder<WeightBloc, WeightState>(
builder: (context, state) {
BlocBuilder<WeightBloc, WeightState>(builder: (context, state) {
return CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
@@ -113,11 +111,7 @@ class WeightScreen extends StatelessWidget {
onTapNext(WeightState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.weightModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.heightScreen,
arguments: sheet,
);
GoRouter.of(context).goNamed('heightScreen', extra: sheet);
};
}
@@ -125,10 +119,8 @@ class WeightScreen extends StatelessWidget {
_buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: onTapBack(context)),
leading:
AppbarLeadingImage(imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: onTapBack(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}