Dynamic date value from DatePicker, fixed dropdown for blood_pressure, fixed AppBar for favorite_sports

This commit is contained in:
2023-12-19 15:32:48 +03:00
parent 75efb1e414
commit 1b7522b503
4 changed files with 60 additions and 16 deletions

View File

@@ -21,9 +21,8 @@ class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
SelectionPopupModel(id: 1, title: "Да", isSelected: true),
SelectionPopupModel(id: 2, title: "Нет"),
];
}

View File

@@ -67,13 +67,29 @@ class BloodPressureScreen extends StatelessWidget {
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
selector: (state) => state.valueController1,
builder: (context, valueController1) {
return CustomTextFormField(
controller: valueController1,
hintText: "lbl_60".tr,
textInputAction: TextInputAction.done);
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)),
hintText: "no".tr,
items:
bloodPressureModelObj?.dropdownItemList ??
[],
onChanged: (value) {
context
.read<BloodPressureBloc>()
.add(ChangeDropDownEvent(value: value));
});
})),
SizedBox(height: 22.v),
Text("do_you_have_hypertension_tendency".tr,

View File

@@ -7,7 +7,7 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class DateOfBirthScreen extends StatelessWidget {
class DateOfBirthScreen extends StatefulWidget {
const DateOfBirthScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
@@ -18,6 +18,12 @@ class DateOfBirthScreen extends StatelessWidget {
child: DateOfBirthScreen());
}
@override
State<DateOfBirthScreen> createState() => _DateOfBirthScreenState();
}
class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
DateTime selectedDate = DateTime.now();
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
@@ -109,7 +115,8 @@ class DateOfBirthScreen extends StatelessWidget {
onTap: () {
openDatePickerDialog(context);
},
child: Text('ТУТ БУДЕТ ДАТА'.tr,
child: Text(
'${selectedDate.day}.${selectedDate.month}.${selectedDate.year}',
style: theme.textTheme.titleMedium))),
SizedBox(height: 6.v)
]));
@@ -131,6 +138,11 @@ class DateOfBirthScreen extends StatelessWidget {
firstDate: DateTime(1970),
lastDate: DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day));
if (dateTime != null) {
setState(() {
selectedDate = dateTime;
});
}
}
/// Navigates to the cityOfLivingScreen when the action is triggered.

View File

@@ -1,6 +1,9 @@
import 'bloc/favorite_sports_bloc.dart';
import 'models/favorite_sports_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';
@@ -22,16 +25,13 @@ class FavoriteSportsScreen extends StatelessWidget {
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 5.v),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgLogoEatvio,
height: 50.adaptSize,
width: 50.adaptSize),
SizedBox(height: 20.v),
_buildProgressIndicatorSection(context),
SizedBox(height: 38.v),
@@ -52,6 +52,19 @@ class FavoriteSportsScreen extends StatelessWidget {
]))));
}
PreferredSizeWidget _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: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicatorSection(BuildContext context) {
return Container(
@@ -88,6 +101,10 @@ class FavoriteSportsScreen extends StatelessWidget {
]);
}
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
/// Navigates to the favoriteFoodsScreen when the action is triggered.
navigateToFoods(BuildContext context) {
NavigatorService.pushNamed(