forked from eatvio/eatvio_app
Created a new Profile section, added new styles, made some layouts for user profile screen
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '/core/app_export.dart';
|
||||
import 'package:eatvio_app/presentation/registration/credentials_screen/models/credentials_model.dart';
|
||||
part 'credentials_event.dart';
|
||||
part 'credentials_state.dart';
|
||||
|
||||
/// A bloc that manages the state of a Credentials according to the event that is dispatched to it.
|
||||
class CredentialsBloc extends Bloc<CredentialsEvent, CredentialsState> {
|
||||
CredentialsBloc(CredentialsState initialState) : super(initialState) {
|
||||
on<CredentialsInitialEvent>(_onInitialize);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
CredentialsInitialEvent event,
|
||||
Emitter<CredentialsState> emit,
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
emailController: TextEditingController(),
|
||||
nameController: TextEditingController(),
|
||||
passwordController: TextEditingController(),
|
||||
passwordConfirmationController: TextEditingController()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'credentials_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///Credentials widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class CredentialsEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the Credentials widget is first created.
|
||||
class CredentialsInitialEvent extends CredentialsEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'credentials_bloc.dart';
|
||||
|
||||
/// Represents the state of Credentials in the application.
|
||||
class CredentialsState extends Equatable {
|
||||
CredentialsState({
|
||||
this.emailController,
|
||||
this.nameController,
|
||||
this.passwordController,
|
||||
this.passwordConfirmationController,
|
||||
this.credentialsModelObj,
|
||||
});
|
||||
|
||||
TextEditingController? emailController;
|
||||
|
||||
TextEditingController? nameController;
|
||||
|
||||
TextEditingController? passwordController;
|
||||
|
||||
TextEditingController? passwordConfirmationController;
|
||||
|
||||
CredentialsModel? credentialsModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
emailController,
|
||||
nameController,
|
||||
passwordController,
|
||||
passwordConfirmationController,
|
||||
credentialsModelObj,
|
||||
];
|
||||
CredentialsState copyWith({
|
||||
TextEditingController? nameController,
|
||||
TextEditingController? emailController,
|
||||
TextEditingController? passwordController,
|
||||
TextEditingController? passwordConfirmationController,
|
||||
CredentialsModel? credentialsModelObj,
|
||||
}) {
|
||||
return CredentialsState(
|
||||
emailController: emailController ?? this.emailController,
|
||||
nameController: nameController ?? this.nameController,
|
||||
passwordController: passwordController ?? this.passwordController,
|
||||
passwordConfirmationController:
|
||||
passwordConfirmationController ?? this.passwordConfirmationController,
|
||||
credentialsModelObj: credentialsModelObj ?? this.credentialsModelObj,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user