forked from eatvio/eatvio_app
New screen names
This commit is contained in:
20
lib/presentation/schedule_screen/bloc/schedule_bloc.dart
Normal file
20
lib/presentation/schedule_screen/bloc/schedule_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/schedule_screen/models/schedule_model.dart';
|
||||
part 'schedule_event.dart';
|
||||
part 'schedule_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a Schedule according to the event that is dispatched to it.
|
||||
class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
||||
ScheduleBloc(ScheduleState initialState) : super(initialState) {
|
||||
on<ScheduleInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
ScheduleInitialEvent event,
|
||||
Emitter<ScheduleState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(inputPlaceholderController: TextEditingController()));
|
||||
}
|
||||
}
|
||||
16
lib/presentation/schedule_screen/bloc/schedule_event.dart
Normal file
16
lib/presentation/schedule_screen/bloc/schedule_event.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'schedule_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///Schedule widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class ScheduleEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the Schedule widget is first created.
|
||||
class ScheduleInitialEvent extends ScheduleEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
31
lib/presentation/schedule_screen/bloc/schedule_state.dart
Normal file
31
lib/presentation/schedule_screen/bloc/schedule_state.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'schedule_bloc.dart';
|
||||
|
||||
/// Represents the state of Schedule in the application.
|
||||
class ScheduleState extends Equatable {
|
||||
ScheduleState({
|
||||
this.inputPlaceholderController,
|
||||
this.scheduleModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? inputPlaceholderController;
|
||||
|
||||
ScheduleModel? scheduleModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
inputPlaceholderController,
|
||||
scheduleModelObj,
|
||||
];
|
||||
ScheduleState copyWith({
|
||||
TextEditingController? inputPlaceholderController,
|
||||
ScheduleModel? scheduleModelObj,
|
||||
}) {
|
||||
return ScheduleState(
|
||||
inputPlaceholderController:
|
||||
inputPlaceholderController ?? this.inputPlaceholderController,
|
||||
scheduleModelObj: scheduleModelObj ?? this.scheduleModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
16
lib/presentation/schedule_screen/models/schedule_model.dart
Normal file
16
lib/presentation/schedule_screen/models/schedule_model.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// This class defines the variables used in the [schedule_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class ScheduleModel extends Equatable {
|
||||
ScheduleModel() {}
|
||||
|
||||
ScheduleModel copyWith() {
|
||||
return ScheduleModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
105
lib/presentation/schedule_screen/schedule_screen.dart
Normal file
105
lib/presentation/schedule_screen/schedule_screen.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'bloc/schedule_bloc.dart';
|
||||
import 'models/schedule_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 ScheduleScreen extends StatelessWidget {
|
||||
const ScheduleScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<ScheduleBloc>(
|
||||
create: (context) =>
|
||||
ScheduleBloc(ScheduleState(scheduleModelObj: ScheduleModel()))
|
||||
..add(ScheduleInitialEvent()),
|
||||
child: ScheduleScreen());
|
||||
}
|
||||
|
||||
@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),
|
||||
_buildProgressIndicator(context),
|
||||
SizedBox(height: 38.v),
|
||||
Text("lbl16".tr, style: theme.textTheme.headlineSmall),
|
||||
SizedBox(height: 67.v),
|
||||
_buildNinetyThree(context),
|
||||
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: 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 _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: 297.h,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(4.h),
|
||||
border:
|
||||
Border.all(color: theme.colorScheme.primary, width: 1.h))));
|
||||
}
|
||||
|
||||
/// Section Widget
|
||||
Widget _buildNinetyThree(BuildContext context) {
|
||||
return Column(children: [
|
||||
Container(
|
||||
width: 324.h,
|
||||
margin: EdgeInsets.symmetric(horizontal: 9.h),
|
||||
child: Text("msg14".tr,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: CustomTextStyles.titleMediumSegoeUI)),
|
||||
SizedBox(height: 12.v),
|
||||
BlocSelector<ScheduleBloc, ScheduleState, TextEditingController?>(
|
||||
selector: (state) => state.inputPlaceholderController,
|
||||
builder: (context, inputPlaceholderController) {
|
||||
return CustomTextFormField(
|
||||
controller: inputPlaceholderController,
|
||||
hintText: "msg5".tr,
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
/// Navigates to the previous screen.
|
||||
onTapArrowLeft(BuildContext context) {
|
||||
NavigatorService.goBack();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user