refactor(diary): Revenge of the Refactoring

This commit is contained in:
2024-03-05 14:44:04 +03:00
parent 2f338b04d1
commit 5d7467db51

View File

@@ -77,11 +77,7 @@ class _WeightScreenState extends State<WeightScreen> {
width: 12.adaptSize)),
hintText: "Не выбрано",
items: weightModelObj?.dropdownItemList ?? [],
onChanged: (value) {
context
.read<WeightBloc>()
.add(ChangeDropDownEvent(value: value));
});
onChanged: _onDropDownChanged);
})
])
]),
@@ -93,29 +89,19 @@ class _WeightScreenState extends State<WeightScreen> {
margin: EdgeInsets.only(
left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: () {
UserRegistrationSheet sheet =
state.weightModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.heightScreen,
arguments: sheet,
);
});
onPressed: onTapNext(context, state));
}),
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
_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);
}),
onTap: onTapArrowLeft(context)),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
@@ -125,10 +111,23 @@ class _WeightScreenState extends State<WeightScreen> {
NavigatorService.goBack();
}
onTapNext(BuildContext context, state) {
UserRegistrationSheet sheet = state.weightModelObj!.userRegistrationSheet;
Navigator.pushNamed(
context,
AppRoutes.heightScreen,
arguments: sheet,
);
}
/// Navigates to the allergiesScreen when the action is triggered.
navigateToHeight(BuildContext context) {
NavigatorService.pushNamed(
AppRoutes.heightScreen,
);
}
void _onDropDownChanged(value) {
context.read<WeightBloc>().add(ChangeDropDownEvent(value: value));
}
}