forked from eatvio/eatvio_app
feat(profile): Replaced the diet and calendar icons, reduced the height of the bottom nav bar, added the first version of the measurements graph, added the time of the chat message and changed the design slightly
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
|
||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class ProfileAvatarCubit extends Cubit<ProfileAvatarState> {
|
||||
final ProfileRepository profileRepository;
|
||||
|
||||
ProfileAvatarCubit({
|
||||
required this.profileRepository,
|
||||
}) : super(const ProfileAvatarState.loading());
|
||||
|
||||
getMyProfile() async {
|
||||
try {
|
||||
emit(ProfileAvatarState.loaded(
|
||||
profile: await profileRepository.getMyProfile(),
|
||||
));
|
||||
} catch (e) {
|
||||
emit(ProfileAvatarState.error(errorMessage: e.toString()));
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'profile_avatar_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ProfileAvatarState with _$ProfileAvatarState {
|
||||
const factory ProfileAvatarState() = _ProfileAvatarState;
|
||||
|
||||
const factory ProfileAvatarState.loading() = ProfileAvatarStateLoading;
|
||||
|
||||
const factory ProfileAvatarState.loaded({
|
||||
required ProfileModel profile,
|
||||
}) = ProfileAvatarStateLoaded;
|
||||
|
||||
const factory ProfileAvatarState.error({
|
||||
required String errorMessage,
|
||||
}) = ProfileAvatarStateError;
|
||||
}
|
||||
@@ -0,0 +1,630 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'profile_avatar_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfileAvatarState {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value) $default, {
|
||||
required TResult Function(ProfileAvatarStateLoading value) loading,
|
||||
required TResult Function(ProfileAvatarStateLoaded value) loaded,
|
||||
required TResult Function(ProfileAvatarStateError value) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ProfileAvatarState value)? $default, {
|
||||
TResult? Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult? Function(ProfileAvatarStateError value)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value)? $default, {
|
||||
TResult Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult Function(ProfileAvatarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfileAvatarStateCopyWith<$Res> {
|
||||
factory $ProfileAvatarStateCopyWith(
|
||||
ProfileAvatarState value, $Res Function(ProfileAvatarState) then) =
|
||||
_$ProfileAvatarStateCopyWithImpl<$Res, ProfileAvatarState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfileAvatarStateCopyWithImpl<$Res, $Val extends ProfileAvatarState>
|
||||
implements $ProfileAvatarStateCopyWith<$Res> {
|
||||
_$ProfileAvatarStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileAvatarStateImplCopyWith<$Res> {
|
||||
factory _$$ProfileAvatarStateImplCopyWith(_$ProfileAvatarStateImpl value,
|
||||
$Res Function(_$ProfileAvatarStateImpl) then) =
|
||||
__$$ProfileAvatarStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileAvatarStateImplCopyWithImpl<$Res>
|
||||
extends _$ProfileAvatarStateCopyWithImpl<$Res, _$ProfileAvatarStateImpl>
|
||||
implements _$$ProfileAvatarStateImplCopyWith<$Res> {
|
||||
__$$ProfileAvatarStateImplCopyWithImpl(_$ProfileAvatarStateImpl _value,
|
||||
$Res Function(_$ProfileAvatarStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfileAvatarStateImpl implements _ProfileAvatarState {
|
||||
const _$ProfileAvatarStateImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileAvatarState()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$ProfileAvatarStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return $default();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value) $default, {
|
||||
required TResult Function(ProfileAvatarStateLoading value) loading,
|
||||
required TResult Function(ProfileAvatarStateLoaded value) loaded,
|
||||
required TResult Function(ProfileAvatarStateError value) error,
|
||||
}) {
|
||||
return $default(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ProfileAvatarState value)? $default, {
|
||||
TResult? Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult? Function(ProfileAvatarStateError value)? error,
|
||||
}) {
|
||||
return $default?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value)? $default, {
|
||||
TResult Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult Function(ProfileAvatarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if ($default != null) {
|
||||
return $default(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ProfileAvatarState implements ProfileAvatarState {
|
||||
const factory _ProfileAvatarState() = _$ProfileAvatarStateImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$ProfileAvatarStateLoadingImplCopyWith(
|
||||
_$ProfileAvatarStateLoadingImpl value,
|
||||
$Res Function(_$ProfileAvatarStateLoadingImpl) then) =
|
||||
__$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileAvatarStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$ProfileAvatarStateCopyWithImpl<$Res,
|
||||
_$ProfileAvatarStateLoadingImpl>
|
||||
implements _$$ProfileAvatarStateLoadingImplCopyWith<$Res> {
|
||||
__$$ProfileAvatarStateLoadingImplCopyWithImpl(
|
||||
_$ProfileAvatarStateLoadingImpl _value,
|
||||
$Res Function(_$ProfileAvatarStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfileAvatarStateLoadingImpl implements ProfileAvatarStateLoading {
|
||||
const _$ProfileAvatarStateLoadingImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileAvatarState.loading()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileAvatarStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loading();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value) $default, {
|
||||
required TResult Function(ProfileAvatarStateLoading value) loading,
|
||||
required TResult Function(ProfileAvatarStateLoaded value) loaded,
|
||||
required TResult Function(ProfileAvatarStateError value) error,
|
||||
}) {
|
||||
return loading(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ProfileAvatarState value)? $default, {
|
||||
TResult? Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult? Function(ProfileAvatarStateError value)? error,
|
||||
}) {
|
||||
return loading?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value)? $default, {
|
||||
TResult Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult Function(ProfileAvatarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loading != null) {
|
||||
return loading(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ProfileAvatarStateLoading implements ProfileAvatarState {
|
||||
const factory ProfileAvatarStateLoading() = _$ProfileAvatarStateLoadingImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$ProfileAvatarStateLoadedImplCopyWith(
|
||||
_$ProfileAvatarStateLoadedImpl value,
|
||||
$Res Function(_$ProfileAvatarStateLoadedImpl) then) =
|
||||
__$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({ProfileModel profile});
|
||||
|
||||
$ProfileModelCopyWith<$Res> get profile;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileAvatarStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$ProfileAvatarStateCopyWithImpl<$Res,
|
||||
_$ProfileAvatarStateLoadedImpl>
|
||||
implements _$$ProfileAvatarStateLoadedImplCopyWith<$Res> {
|
||||
__$$ProfileAvatarStateLoadedImplCopyWithImpl(
|
||||
_$ProfileAvatarStateLoadedImpl _value,
|
||||
$Res Function(_$ProfileAvatarStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? profile = null,
|
||||
}) {
|
||||
return _then(_$ProfileAvatarStateLoadedImpl(
|
||||
profile: null == profile
|
||||
? _value.profile
|
||||
: profile // ignore: cast_nullable_to_non_nullable
|
||||
as ProfileModel,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfileModelCopyWith<$Res> get profile {
|
||||
return $ProfileModelCopyWith<$Res>(_value.profile, (value) {
|
||||
return _then(_value.copyWith(profile: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfileAvatarStateLoadedImpl implements ProfileAvatarStateLoaded {
|
||||
const _$ProfileAvatarStateLoadedImpl({required this.profile});
|
||||
|
||||
@override
|
||||
final ProfileModel profile;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileAvatarState.loaded(profile: $profile)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileAvatarStateLoadedImpl &&
|
||||
(identical(other.profile, profile) || other.profile == profile));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, profile);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
|
||||
get copyWith => __$$ProfileAvatarStateLoadedImplCopyWithImpl<
|
||||
_$ProfileAvatarStateLoadedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loaded(profile);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loaded?.call(profile);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(profile);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value) $default, {
|
||||
required TResult Function(ProfileAvatarStateLoading value) loading,
|
||||
required TResult Function(ProfileAvatarStateLoaded value) loaded,
|
||||
required TResult Function(ProfileAvatarStateError value) error,
|
||||
}) {
|
||||
return loaded(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ProfileAvatarState value)? $default, {
|
||||
TResult? Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult? Function(ProfileAvatarStateError value)? error,
|
||||
}) {
|
||||
return loaded?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value)? $default, {
|
||||
TResult Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult Function(ProfileAvatarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ProfileAvatarStateLoaded implements ProfileAvatarState {
|
||||
const factory ProfileAvatarStateLoaded(
|
||||
{required final ProfileModel profile}) = _$ProfileAvatarStateLoadedImpl;
|
||||
|
||||
ProfileModel get profile;
|
||||
@JsonKey(ignore: true)
|
||||
_$$ProfileAvatarStateLoadedImplCopyWith<_$ProfileAvatarStateLoadedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
|
||||
factory _$$ProfileAvatarStateErrorImplCopyWith(
|
||||
_$ProfileAvatarStateErrorImpl value,
|
||||
$Res Function(_$ProfileAvatarStateErrorImpl) then) =
|
||||
__$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileAvatarStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$ProfileAvatarStateCopyWithImpl<$Res,
|
||||
_$ProfileAvatarStateErrorImpl>
|
||||
implements _$$ProfileAvatarStateErrorImplCopyWith<$Res> {
|
||||
__$$ProfileAvatarStateErrorImplCopyWithImpl(
|
||||
_$ProfileAvatarStateErrorImpl _value,
|
||||
$Res Function(_$ProfileAvatarStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? errorMessage = null,
|
||||
}) {
|
||||
return _then(_$ProfileAvatarStateErrorImpl(
|
||||
errorMessage: null == errorMessage
|
||||
? _value.errorMessage
|
||||
: errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfileAvatarStateErrorImpl implements ProfileAvatarStateError {
|
||||
const _$ProfileAvatarStateErrorImpl({required this.errorMessage});
|
||||
|
||||
@override
|
||||
final String errorMessage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileAvatarState.error(errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileAvatarStateErrorImpl &&
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, errorMessage);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
|
||||
get copyWith => __$$ProfileAvatarStateErrorImplCopyWithImpl<
|
||||
_$ProfileAvatarStateErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile) loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile)? loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile)? loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(errorMessage);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value) $default, {
|
||||
required TResult Function(ProfileAvatarStateLoading value) loading,
|
||||
required TResult Function(ProfileAvatarStateLoaded value) loaded,
|
||||
required TResult Function(ProfileAvatarStateError value) error,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_ProfileAvatarState value)? $default, {
|
||||
TResult? Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult? Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult? Function(ProfileAvatarStateError value)? error,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_ProfileAvatarState value)? $default, {
|
||||
TResult Function(ProfileAvatarStateLoading value)? loading,
|
||||
TResult Function(ProfileAvatarStateLoaded value)? loaded,
|
||||
TResult Function(ProfileAvatarStateError value)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ProfileAvatarStateError implements ProfileAvatarState {
|
||||
const factory ProfileAvatarStateError({required final String errorMessage}) =
|
||||
_$ProfileAvatarStateErrorImpl;
|
||||
|
||||
String get errorMessage;
|
||||
@JsonKey(ignore: true)
|
||||
_$$ProfileAvatarStateErrorImplCopyWith<_$ProfileAvatarStateErrorImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_state.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_state.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
|
||||
import 'package:eatvio_app/widgets/custom_navigation_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
@@ -68,119 +70,154 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: widget.child,
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
onTap: _onItemTapped,
|
||||
selectedFontSize: 12,
|
||||
unselectedFontSize: 12,
|
||||
selectedItemColor: appTheme.blueA400,
|
||||
currentIndex: currentBottomNavBarIndex,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
label: '',
|
||||
icon: SvgPicture.asset(
|
||||
ImageConstant.imgLogo,
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: 'Лента',
|
||||
icon: SvgPicture.asset(
|
||||
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
width: 24,
|
||||
height: 24,
|
||||
ImageConstant.icnFeed,
|
||||
),
|
||||
activeIcon: SvgPicture.asset(
|
||||
ImageConstant.icnFeed,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
bottomNavigationBar: SizedBox(
|
||||
height: 58,
|
||||
child: BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
onTap: _onItemTapped,
|
||||
selectedFontSize: 10,
|
||||
unselectedFontSize: 10,
|
||||
selectedItemColor: appTheme.blueA400,
|
||||
currentIndex: currentBottomNavBarIndex,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
label: '',
|
||||
icon: SvgPicture.asset(
|
||||
ImageConstant.imgLogo,
|
||||
height: 32,
|
||||
),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: "diary".tr,
|
||||
icon: SvgPicture.asset(
|
||||
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
ImageConstant.icnDiary,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
activeIcon: SvgPicture.asset(
|
||||
ImageConstant.icnDiary,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
BottomNavigationBarItem(
|
||||
label: 'Лента',
|
||||
icon: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
width: 20,
|
||||
height: 20,
|
||||
ImageConstant.icnFeed,
|
||||
),
|
||||
),
|
||||
activeIcon: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnFeed,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: "chat".tr,
|
||||
icon: BlocBuilder<NewMessagesCubit, NewMessagesState>(
|
||||
builder: (BuildContext context, NewMessagesState state) {
|
||||
return badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(),
|
||||
badgeContent: Text(
|
||||
(state is NewMessagesStateLoaded) ? state.messagesCount.toString() : '0',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
BottomNavigationBarItem(
|
||||
label: "diary".tr,
|
||||
icon: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
ImageConstant.icnDiary,
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
),
|
||||
activeIcon: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnDiary,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: "chat".tr,
|
||||
icon: BlocBuilder<NewMessagesCubit, NewMessagesState>(
|
||||
builder: (BuildContext context, NewMessagesState state) {
|
||||
return badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(),
|
||||
badgeAnimation: badges.BadgeAnimation.fade(),
|
||||
badgeContent: Text(
|
||||
(state is NewMessagesStateLoaded) ? state.messagesCount.toString() : '0',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 8,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnChat,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: currentBottomNavBarIndex == 3
|
||||
? ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
)
|
||||
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: '',
|
||||
icon: BlocBuilder<NotificationsCubit, NotificationsState>(
|
||||
builder: (BuildContext context, NotificationsState state) {
|
||||
return badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(),
|
||||
badgeContent: Text(
|
||||
(state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnChat,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: currentBottomNavBarIndex == 3
|
||||
? ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
)
|
||||
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnBell,
|
||||
colorFilter: currentBottomNavBarIndex == 4
|
||||
? ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
)
|
||||
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: '',
|
||||
icon: Image.asset(
|
||||
ImageConstant.imgEllipse1,
|
||||
width: 32,
|
||||
height: 32,
|
||||
BottomNavigationBarItem(
|
||||
label: 'Уведомления',
|
||||
icon: BlocBuilder<NotificationsCubit, NotificationsState>(
|
||||
builder: (BuildContext context, NotificationsState state) {
|
||||
return badges.Badge(
|
||||
position: badges.BadgePosition.topEnd(),
|
||||
badgeAnimation: badges.BadgeAnimation.fade(),
|
||||
badgeContent: Text(
|
||||
(state is NotificationsStateLoaded) ? state.notificationsCount.toString() : '0',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 8,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: SvgPicture.asset(
|
||||
ImageConstant.icnBell,
|
||||
colorFilter: currentBottomNavBarIndex == 4
|
||||
? ColorFilter.mode(
|
||||
appTheme.blueA400,
|
||||
BlendMode.srcIn,
|
||||
)
|
||||
: ColorFilter.mode(Colors.grey, BlendMode.srcIn),
|
||||
width: 20,
|
||||
height: 20,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BottomNavigationBarItem(
|
||||
label: '',
|
||||
icon: BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
|
||||
builder: (BuildContext context, ProfileAvatarState state) {
|
||||
if (state is ProfileAvatarStateLoaded && state.profile.user.profilePhotoUrl.isNotEmpty) {
|
||||
return CircleAvatar(
|
||||
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
|
||||
radius: 16,
|
||||
);
|
||||
}
|
||||
return CircleAvatar(
|
||||
radius: 16,
|
||||
backgroundColor: Colors.black12,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user