forked from eatvio/eatvio_app
New screen names
This commit is contained in:
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user