forked from eatvio/eatvio_app
New screen names
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/body_circumferences_screen/models/body_circumferences_model.dart';
|
||||
part 'body_circumferences_event.dart';
|
||||
part 'body_circumferences_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a BodyCircumferences according to the event that is dispatched to it.
|
||||
class BodyCircumferencesBloc
|
||||
extends Bloc<BodyCircumferencesEvent, BodyCircumferencesState> {
|
||||
BodyCircumferencesBloc(BodyCircumferencesState initialState)
|
||||
: super(initialState) {
|
||||
on<BodyCircumferencesInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
BodyCircumferencesInitialEvent event,
|
||||
Emitter<BodyCircumferencesState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
valueController: TextEditingController(),
|
||||
valueController1: TextEditingController(),
|
||||
valueController2: TextEditingController()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'body_circumferences_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///BodyCircumferences widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class BodyCircumferencesEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the BodyCircumferences widget is first created.
|
||||
class BodyCircumferencesInitialEvent extends BodyCircumferencesEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'body_circumferences_bloc.dart';
|
||||
|
||||
/// Represents the state of BodyCircumferences in the application.
|
||||
class BodyCircumferencesState extends Equatable {
|
||||
BodyCircumferencesState({
|
||||
this.valueController,
|
||||
this.valueController1,
|
||||
this.valueController2,
|
||||
this.bodyCircumferencesModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? valueController;
|
||||
|
||||
TextEditingController? valueController1;
|
||||
|
||||
TextEditingController? valueController2;
|
||||
|
||||
BodyCircumferencesModel? bodyCircumferencesModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
valueController,
|
||||
valueController1,
|
||||
valueController2,
|
||||
bodyCircumferencesModelObj,
|
||||
];
|
||||
BodyCircumferencesState copyWith({
|
||||
TextEditingController? valueController,
|
||||
TextEditingController? valueController1,
|
||||
TextEditingController? valueController2,
|
||||
BodyCircumferencesModel? bodyCircumferencesModelObj,
|
||||
}) {
|
||||
return BodyCircumferencesState(
|
||||
valueController: valueController ?? this.valueController,
|
||||
valueController1: valueController1 ?? this.valueController1,
|
||||
valueController2: valueController2 ?? this.valueController2,
|
||||
bodyCircumferencesModelObj:
|
||||
bodyCircumferencesModelObj ?? this.bodyCircumferencesModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import 'bloc/body_circumferences_bloc.dart';
|
||||
import 'models/body_circumferences_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 BodyCircumferencesScreen extends StatelessWidget {
|
||||
const BodyCircumferencesScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<BodyCircumferencesBloc>(
|
||||
create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(
|
||||
bodyCircumferencesModelObj: BodyCircumferencesModel()))
|
||||
..add(BodyCircumferencesInitialEvent()),
|
||||
child: BodyCircumferencesScreen());
|
||||
}
|
||||
|
||||
@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.29,
|
||||
backgroundColor: theme.colorScheme.onPrimary,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
appTheme.blueA400)))),
|
||||
SizedBox(height: 39.v),
|
||||
Text("msg2".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 93.v),
|
||||
_buildTwentySeven(context),
|
||||
SizedBox(height: 19.v),
|
||||
Text("lbl9".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.valueController1,
|
||||
builder: (context, valueController1) {
|
||||
return CustomTextFormField(
|
||||
controller: valueController1,
|
||||
hintText: "lbl_60".tr);
|
||||
}),
|
||||
SizedBox(height: 21.v),
|
||||
Text("lbl10".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.valueController2,
|
||||
builder: (context, valueController2) {
|
||||
return CustomTextFormField(
|
||||
controller: valueController2,
|
||||
hintText: "lbl_90".tr,
|
||||
textInputAction: TextInputAction.done);
|
||||
}),
|
||||
Spacer(),
|
||||
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
|
||||
SizedBox(height: 17.v),
|
||||
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
|
||||
]))));
|
||||
}
|
||||
|
||||
/// 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));
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
Widget _buildTwentySeven(BuildContext context) {
|
||||
return Column(children: [
|
||||
Text("lbl8".tr, style: theme.textTheme.bodyLarge),
|
||||
SizedBox(height: 3.v),
|
||||
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state.valueController,
|
||||
builder: (context, valueController) {
|
||||
return CustomTextFormField(
|
||||
controller: valueController, hintText: "lbl_90".tr);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// This class defines the variables used in the [body_circumferences_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class BodyCircumferencesModel extends Equatable {
|
||||
BodyCircumferencesModel() {}
|
||||
|
||||
BodyCircumferencesModel copyWith() {
|
||||
return BodyCircumferencesModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
Reference in New Issue
Block a user