forked from eatvio/eatvio_app
New screen names
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/date_of_birth_screen/models/date_of_birth_model.dart';
|
||||
part 'date_of_birth_event.dart';
|
||||
part 'date_of_birth_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a DateOfBirth according to the event that is dispatched to it.
|
||||
class DateOfBirthBloc extends Bloc<DateOfBirthEvent, DateOfBirthState> {
|
||||
DateOfBirthBloc(DateOfBirthState initialState) : super(initialState) {
|
||||
on<DateOfBirthInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
DateOfBirthInitialEvent event,
|
||||
Emitter<DateOfBirthState> emit,
|
||||
) async {}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'date_of_birth_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///DateOfBirth widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class DateOfBirthEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the DateOfBirth widget is first created.
|
||||
class DateOfBirthInitialEvent extends DateOfBirthEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'date_of_birth_bloc.dart';
|
||||
|
||||
/// Represents the state of DateOfBirth in the application.
|
||||
class DateOfBirthState extends Equatable {
|
||||
DateOfBirthState({this.dateOfBirthModelObj});
|
||||
|
||||
DateOfBirthModel? dateOfBirthModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
dateOfBirthModelObj,
|
||||
];
|
||||
DateOfBirthState copyWith({DateOfBirthModel? dateOfBirthModelObj}) {
|
||||
return DateOfBirthState(
|
||||
dateOfBirthModelObj: dateOfBirthModelObj ?? this.dateOfBirthModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
114
lib/presentation/date_of_birth_screen/date_of_birth_screen.dart
Normal file
114
lib/presentation/date_of_birth_screen/date_of_birth_screen.dart
Normal file
@@ -0,0 +1,114 @@
|
||||
import 'bloc/date_of_birth_bloc.dart';
|
||||
import 'models/date_of_birth_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:flutter/material.dart';
|
||||
|
||||
class DateOfBirthScreen extends StatelessWidget {
|
||||
const DateOfBirthScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<DateOfBirthBloc>(
|
||||
create: (context) => DateOfBirthBloc(
|
||||
DateOfBirthState(dateOfBirthModelObj: DateOfBirthModel()))
|
||||
..add(DateOfBirthInitialEvent()),
|
||||
child: DateOfBirthScreen());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
mediaQueryData = MediaQuery.of(context);
|
||||
return BlocBuilder<DateOfBirthBloc, DateOfBirthState>(
|
||||
builder: (context, state) {
|
||||
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),
|
||||
_buildProgressIndicator(context),
|
||||
SizedBox(height: 38.v),
|
||||
Text("lbl".tr, style: theme.textTheme.headlineSmall),
|
||||
Spacer(flex: 39),
|
||||
_buildDateInput(context),
|
||||
Spacer(flex: 60),
|
||||
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
|
||||
SizedBox(height: 17.v),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 8.h),
|
||||
child: 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 _buildProgressIndicator(BuildContext context) {
|
||||
return Container(
|
||||
width: 343.h,
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
|
||||
decoration: AppDecoration.outlinePrimary
|
||||
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
|
||||
child: Container(
|
||||
height: 8.v,
|
||||
width: 60.h,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(4.h),
|
||||
border:
|
||||
Border.all(color: theme.colorScheme.primary, width: 1.h))));
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
Widget _buildDateInput(BuildContext context) {
|
||||
return Container(
|
||||
width: 343.h,
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v),
|
||||
decoration: AppDecoration.outlineBlueA
|
||||
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CustomImageView(
|
||||
imagePath: ImageConstant.imgFavorite,
|
||||
height: 12.adaptSize,
|
||||
width: 12.adaptSize,
|
||||
radius: BorderRadius.circular(1.h)),
|
||||
SizedBox(height: 6.v),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text("lbl_01_01_2000".tr,
|
||||
style: theme.textTheme.titleMedium)),
|
||||
SizedBox(height: 4.v)
|
||||
]));
|
||||
}
|
||||
|
||||
/// 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 [date_of_birth_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class DateOfBirthModel extends Equatable {
|
||||
DateOfBirthModel() {}
|
||||
|
||||
DateOfBirthModel copyWith() {
|
||||
return DateOfBirthModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
Reference in New Issue
Block a user