forked from eatvio/eatvio_app
New screen names
This commit is contained in:
95
lib/presentation/allergies_screen/allergies_screen.dart
Normal file
95
lib/presentation/allergies_screen/allergies_screen.dart
Normal file
@@ -0,0 +1,95 @@
|
||||
import 'bloc/allergies_bloc.dart';
|
||||
import 'models/allergies_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 AllergiesScreen extends StatelessWidget {
|
||||
const AllergiesScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<AllergiesBloc>(
|
||||
create: (context) =>
|
||||
AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel()))
|
||||
..add(AllergiesInitialEvent()),
|
||||
child: AllergiesScreen());
|
||||
}
|
||||
|
||||
@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.41,
|
||||
backgroundColor: theme.colorScheme.onPrimary,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
appTheme.blueA400)))),
|
||||
SizedBox(height: 22.v),
|
||||
Text("msg3".tr, style: CustomTextStyles.headlineSmallMulish),
|
||||
Spacer(flex: 36),
|
||||
_buildNinetyThree(context),
|
||||
Spacer(flex: 63),
|
||||
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: 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 _buildNinetyThree(BuildContext context) {
|
||||
return Column(children: [
|
||||
Text("msg4".tr, style: CustomTextStyles.titleMediumSegoeUI),
|
||||
SizedBox(height: 2.v),
|
||||
BlocSelector<AllergiesBloc, AllergiesState, TextEditingController?>(
|
||||
selector: (state) => state.enterInformationController,
|
||||
builder: (context, enterInformationController) {
|
||||
return CustomTextFormField(
|
||||
controller: enterInformationController,
|
||||
hintText: "msg5".tr,
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
}
|
||||
20
lib/presentation/allergies_screen/bloc/allergies_bloc.dart
Normal file
20
lib/presentation/allergies_screen/bloc/allergies_bloc.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/allergies_screen/models/allergies_model.dart';
|
||||
part 'allergies_event.dart';
|
||||
part 'allergies_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a Allergies according to the event that is dispatched to it.
|
||||
class AllergiesBloc extends Bloc<AllergiesEvent, AllergiesState> {
|
||||
AllergiesBloc(AllergiesState initialState) : super(initialState) {
|
||||
on<AllergiesInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
AllergiesInitialEvent event,
|
||||
Emitter<AllergiesState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(enterInformationController: TextEditingController()));
|
||||
}
|
||||
}
|
||||
16
lib/presentation/allergies_screen/bloc/allergies_event.dart
Normal file
16
lib/presentation/allergies_screen/bloc/allergies_event.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'allergies_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///Allergies widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class AllergiesEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the Allergies widget is first created.
|
||||
class AllergiesInitialEvent extends AllergiesEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
31
lib/presentation/allergies_screen/bloc/allergies_state.dart
Normal file
31
lib/presentation/allergies_screen/bloc/allergies_state.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'allergies_bloc.dart';
|
||||
|
||||
/// Represents the state of Allergies in the application.
|
||||
class AllergiesState extends Equatable {
|
||||
AllergiesState({
|
||||
this.enterInformationController,
|
||||
this.allergiesModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? enterInformationController;
|
||||
|
||||
AllergiesModel? allergiesModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
enterInformationController,
|
||||
allergiesModelObj,
|
||||
];
|
||||
AllergiesState copyWith({
|
||||
TextEditingController? enterInformationController,
|
||||
AllergiesModel? allergiesModelObj,
|
||||
}) {
|
||||
return AllergiesState(
|
||||
enterInformationController:
|
||||
enterInformationController ?? this.enterInformationController,
|
||||
allergiesModelObj: allergiesModelObj ?? this.allergiesModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// This class defines the variables used in the [allergies_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class AllergiesModel extends Equatable {
|
||||
AllergiesModel() {}
|
||||
|
||||
AllergiesModel copyWith() {
|
||||
return AllergiesModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
Reference in New Issue
Block a user