Added Finish buttn, removed schedule screen, split blood pressure into up and down

This commit is contained in:
2023-12-21 12:28:41 +03:00
parent 753709000f
commit ac0f649069
12 changed files with 46 additions and 248 deletions

View File

@@ -36,6 +36,8 @@ final Map<String, String> ru = {
"do_you_have_hypertension_tendency": "Есть ли у вас склонность к гипертонии?",
"your_blood_pressure": "Ваше артериальное давление?",
"average_pressure": "Средние показатели давления:",
"up_pressure": "Верхние показатели давления:",
"down_pressure": "Нижние показатели давления:",
"do_you_have_hypotension_tendency": "Есть ли у вас склонность к гипотонии?",
// favorite_sports Screen

View File

@@ -59,13 +59,12 @@ class _AdditionalInformationScreenState
_buildTextFormField(context),
Spacer(),
CustomOutlinedButton(
text: "continue".tr.toUpperCase(),
text: "finish".tr.toUpperCase(),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: () {
showSuccessMessage(context);
}),
SizedBox(height: 17.v),
Text("finish".tr, style: theme.textTheme.bodyLarge)
]))));
}

View File

@@ -32,7 +32,8 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
) async {
emit(state.copyWith(
valueController: TextEditingController(),
valueController1: TextEditingController()));
valueController1: TextEditingController(),
valueController2: TextEditingController()));
emit(state.copyWith(
bloodPressureModelObj: state.bloodPressureModelObj
?.copyWith(dropdownItemList: fillDropdownItemList())));

View File

@@ -7,6 +7,7 @@ class BloodPressureState extends Equatable {
BloodPressureState({
this.valueController,
this.valueController1,
this.valueController2,
this.selectedDropDownValue,
this.bloodPressureModelObj,
});
@@ -15,6 +16,8 @@ class BloodPressureState extends Equatable {
TextEditingController? valueController1;
TextEditingController? valueController2;
SelectionPopupModel? selectedDropDownValue;
BloodPressureModel? bloodPressureModelObj;
@@ -29,6 +32,7 @@ class BloodPressureState extends Equatable {
BloodPressureState copyWith({
TextEditingController? valueController,
TextEditingController? valueController1,
TextEditingController? valueController2,
SelectionPopupModel? selectedDropDownValue,
BloodPressureModel? bloodPressureModelObj,
}) {

View File

@@ -63,8 +63,40 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
SizedBox(height: 77.v),
_buildThirtyThree(context),
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),
SizedBox(height: 2.v),
BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
selector: (state) => state.valueController1,
builder: (context, valueController1) {
return CustomTextFormField(
controller: valueController1,
hintText: "90".tr);
})
])),
SizedBox(height: 21.v),
Container(
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(children: [
Text("down_pressure".tr,
style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
selector: (state) => state.valueController2,
builder: (context, valueController2) {
return CustomTextFormField(
controller: valueController2,
hintText: "90".tr);
})
])),
SizedBox(height: 22.v),
Text("do_you_have_hypotension_tendency".tr,
style: theme.textTheme.bodyLarge),

View File

@@ -69,7 +69,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
text: "continue".tr.toUpperCase(),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: () {
navigateToSchedule(context);
navigateToAdditionalInformationScreen(context);
}),
SizedBox(height: 17.v),
Text("skip".tr, style: theme.textTheme.bodyLarge)
@@ -90,23 +90,6 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 279.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildTextFormField(BuildContext context) {
return Column(children: [
@@ -148,9 +131,9 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
}
/// Navigates to the scheduleScreen when the action is triggered.
navigateToSchedule(BuildContext context) {
navigateToAdditionalInformationScreen(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.scheduleScreen,
AppRoutes.additionalInformationScreen,
);
}
}

View File

@@ -1,20 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/schedule_screen/models/schedule_model.dart';
part 'schedule_event.dart';
part 'schedule_state.dart';
/// A bloc that manages the state of a Schedule according to the event that is dispatched to it.
class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
ScheduleBloc(ScheduleState initialState) : super(initialState) {
on<ScheduleInitialEvent>(_onInitialize);
}
_onInitialize(
ScheduleInitialEvent event,
Emitter<ScheduleState> emit,
) async {
emit(state.copyWith(inputPlaceholderController: TextEditingController()));
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'schedule_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Schedule widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class ScheduleEvent extends Equatable {}
/// Event that is dispatched when the Schedule widget is first created.
class ScheduleInitialEvent extends ScheduleEvent {
@override
List<Object?> get props => [];
}

View File

@@ -1,31 +0,0 @@
// ignore_for_file: must_be_immutable
part of 'schedule_bloc.dart';
/// Represents the state of Schedule in the application.
class ScheduleState extends Equatable {
ScheduleState({
this.inputPlaceholderController,
this.scheduleModelObj,
});
TextEditingController? inputPlaceholderController;
ScheduleModel? scheduleModelObj;
@override
List<Object?> get props => [
inputPlaceholderController,
scheduleModelObj,
];
ScheduleState copyWith({
TextEditingController? inputPlaceholderController,
ScheduleModel? scheduleModelObj,
}) {
return ScheduleState(
inputPlaceholderController:
inputPlaceholderController ?? this.inputPlaceholderController,
scheduleModelObj: scheduleModelObj ?? this.scheduleModelObj,
);
}
}

View File

@@ -1,16 +0,0 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [schedule_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class ScheduleModel extends Equatable {
ScheduleModel() {}
ScheduleModel copyWith() {
return ScheduleModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -1,137 +0,0 @@
import 'bloc/schedule_bloc.dart';
import 'models/schedule_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class ScheduleScreen extends StatefulWidget {
const ScheduleScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<ScheduleBloc>(
create: (context) =>
ScheduleBloc(ScheduleState(scheduleModelObj: ScheduleModel()))
..add(ScheduleInitialEvent()),
child: ScheduleScreen());
}
@override
State<ScheduleScreen> createState() => _ScheduleScreenState();
}
class _ScheduleScreenState extends State<ScheduleScreen> {
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.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.95,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 38.v),
Text("your_schedule".tr,
style: theme.textTheme.headlineSmall),
SizedBox(height: 67.v),
_buildTextFormField(context),
Spacer(),
CustomOutlinedButton(
text: "continue".tr.toUpperCase(),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: () {
navigateToAdditional(context);
}),
SizedBox(height: 17.v),
Text("skip".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _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: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 297.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildTextFormField(BuildContext context) {
return Column(children: [
Container(
width: 324.h,
margin: EdgeInsets.symmetric(horizontal: 9.h),
child: Text("tell_your_schedule".tr,
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.titleMediumSegoeUI)),
SizedBox(height: 12.v),
BlocSelector<ScheduleBloc, ScheduleState, TextEditingController?>(
selector: (state) => state.inputPlaceholderController,
builder: (context, inputPlaceholderController) {
return CustomTextFormField(
controller: inputPlaceholderController,
hintText: "enter_information".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
/// Navigates to the additionalInformationScreen when the action is triggered.
navigateToAdditional(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.additionalInformationScreen,
);
}
}

View File

@@ -1,4 +1,3 @@
import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart';
import 'package:flutter/material.dart';
import 'package:eatvio_app/presentation/date_of_birth_screen/date_of_birth_screen.dart';
import 'package:eatvio_app/presentation/city_of_living_screen/city_of_living_screen.dart';
@@ -11,7 +10,6 @@ import 'package:eatvio_app/presentation/gender_screen/gender_screen.dart';
import 'package:eatvio_app/presentation/blood_pressure_screen/blood_pressure_screen.dart';
import 'package:eatvio_app/presentation/favorite_sports_screen/favorite_sports_screen.dart';
import 'package:eatvio_app/presentation/favorite_foods_screen/favorite_foods_screen.dart';
import 'package:eatvio_app/presentation/schedule_screen/schedule_screen.dart';
import 'package:eatvio_app/presentation/additional_information_screen/additional_information_screen.dart';
import 'package:eatvio_app/presentation/language_select_screen/language_select_screen.dart';
import 'package:eatvio_app/presentation/height_screen/height_screen.dart';
@@ -76,7 +74,6 @@ class AppRoutes {
bloodPressureScreen: BloodPressureScreen.builder,
favoriteSportsScreen: FavoriteSportsScreen.builder,
favoriteFoodsScreen: FavoriteFoodsScreen.builder,
scheduleScreen: ScheduleScreen.builder,
additionalInformationScreen: AdditionalInformationScreen.builder,
languageSelectScreen: LanguageSelectScreen.builder,
appNavigationScreen: AppNavigationScreen.builder,