forked from eatvio/eatvio_app
123 lines
5.1 KiB
Dart
123 lines
5.1 KiB
Dart
import 'bloc/height_bloc.dart';
|
|
import 'models/height_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_drop_down.dart';
|
|
import 'package:eatvio_app/widgets/next_step_button.dart';
|
|
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class HeightScreen extends StatefulWidget {
|
|
const HeightScreen({Key? key}) : super(key: key);
|
|
|
|
static Widget builder(BuildContext context) {
|
|
return BlocProvider<HeightBloc>(
|
|
create: (context) =>
|
|
HeightBloc(HeightState(heightModelObj: HeightModel()))
|
|
..add(HeightInitialEvent()),
|
|
child: HeightScreen());
|
|
}
|
|
|
|
@override
|
|
State<HeightScreen> createState() => _HeightScreenState();
|
|
}
|
|
|
|
class _HeightScreenState extends State<HeightScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
mediaQueryData = MediaQuery.of(context);
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
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.55,
|
|
backgroundColor: theme.colorScheme.onPrimary,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
appTheme.blueA400)))),
|
|
SizedBox(height: 39.v),
|
|
Column(children: [
|
|
Text("height_measurements".tr,
|
|
style: theme.textTheme.headlineSmall),
|
|
SizedBox(height: 174.v),
|
|
Column(children: [
|
|
Text("your_height".tr, style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 4.v),
|
|
BlocSelector<HeightBloc, HeightState, HeightModel?>(
|
|
selector: (state) => state.heightModelObj,
|
|
builder: (context, heightModelObj) {
|
|
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: "170",
|
|
items: heightModelObj?.dropdownItemList ?? [],
|
|
onChanged: (value) {
|
|
context
|
|
.read<HeightBloc>()
|
|
.add(ChangeDropDownEvent(value: value));
|
|
});
|
|
})
|
|
])
|
|
]),
|
|
Spacer(),
|
|
NextStepButton(
|
|
text: "continue".tr.toUpperCase(),
|
|
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
|
onPressed: () {
|
|
navigateToAllergies(context);
|
|
}),
|
|
SizedBox(height: 17.v),
|
|
]))));
|
|
}
|
|
|
|
/// Section Widget
|
|
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));
|
|
}
|
|
|
|
/// Navigates to the previous screen.
|
|
onTapArrowLeft(BuildContext context) {
|
|
NavigatorService.goBack();
|
|
}
|
|
|
|
/// Navigates to the allergiesScreen when the action is triggered.
|
|
navigateToAllergies(BuildContext context) {
|
|
NavigatorService.pushNamed(
|
|
AppRoutes.allergiesScreen,
|
|
);
|
|
}
|
|
}
|