feat(profile): add weight and imt charts, menu add dividers

This commit is contained in:
mso7nueh
2024-08-28 15:55:08 +03:00
parent fda601106a
commit f994589baa
12 changed files with 287 additions and 32 deletions

View File

@@ -3,11 +3,18 @@ import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/noti
class NotificationsCubit extends Cubit<NotificationsState> {
int _notificationsCount = 0;
List<String> notifications = [];
NotificationsCubit() : super(const NotificationsState.empty());
incrementCounter() {
incrementCounter(String data) {
_notificationsCount++;
emit(NotificationsState.loaded(notificationsCount: _notificationsCount));
notifications.add(data);
emit(
NotificationsState.loaded(
notifications: notifications,
notificationsCount: _notificationsCount,
),
);
}
}

View File

@@ -9,6 +9,7 @@ abstract class NotificationsState with _$NotificationsState {
const factory NotificationsState.empty() = NotificationsStateEmpty;
const factory NotificationsState.loaded({
required List<String> notifications,
required int notificationsCount,
}) = NotificationsStateLoaded;

View File

@@ -20,7 +20,9 @@ mixin _$NotificationsState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@@ -28,7 +30,8 @@ mixin _$NotificationsState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@@ -36,7 +39,8 @@ mixin _$NotificationsState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
@@ -126,7 +130,9 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -137,7 +143,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -148,7 +155,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -244,7 +252,9 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return empty();
@@ -255,7 +265,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return empty?.call();
@@ -266,7 +277,8 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -325,7 +337,7 @@ abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> {
$Res Function(_$NotificationsStateLoadedImpl) then) =
__$$NotificationsStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({int notificationsCount});
$Res call({List<String> notifications, int notificationsCount});
}
/// @nodoc
@@ -341,9 +353,14 @@ class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? notifications = null,
Object? notificationsCount = null,
}) {
return _then(_$NotificationsStateLoadedImpl(
notifications: null == notifications
? _value._notifications
: notifications // ignore: cast_nullable_to_non_nullable
as List<String>,
notificationsCount: null == notificationsCount
? _value.notificationsCount
: notificationsCount // ignore: cast_nullable_to_non_nullable
@@ -355,14 +372,25 @@ class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
/// @nodoc
class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
const _$NotificationsStateLoadedImpl({required this.notificationsCount});
const _$NotificationsStateLoadedImpl(
{required final List<String> notifications,
required this.notificationsCount})
: _notifications = notifications;
final List<String> _notifications;
@override
List<String> get notifications {
if (_notifications is EqualUnmodifiableListView) return _notifications;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_notifications);
}
@override
final int notificationsCount;
@override
String toString() {
return 'NotificationsState.loaded(notificationsCount: $notificationsCount)';
return 'NotificationsState.loaded(notifications: $notifications, notificationsCount: $notificationsCount)';
}
@override
@@ -370,12 +398,15 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateLoadedImpl &&
const DeepCollectionEquality()
.equals(other._notifications, _notifications) &&
(identical(other.notificationsCount, notificationsCount) ||
other.notificationsCount == notificationsCount));
}
@override
int get hashCode => Object.hash(runtimeType, notificationsCount);
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_notifications), notificationsCount);
@JsonKey(ignore: true)
@override
@@ -389,10 +420,12 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(notificationsCount);
return loaded(notifications, notificationsCount);
}
@override
@@ -400,10 +433,11 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(notificationsCount);
return loaded?.call(notifications, notificationsCount);
}
@override
@@ -411,12 +445,13 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(notificationsCount);
return loaded(notifications, notificationsCount);
}
return orElse();
}
@@ -461,8 +496,10 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
abstract class NotificationsStateLoaded implements NotificationsState {
const factory NotificationsStateLoaded(
{required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
{required final List<String> notifications,
required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
List<String> get notifications;
int get notificationsCount;
@JsonKey(ignore: true)
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
@@ -540,7 +577,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() empty,
required TResult Function(int notificationsCount) loaded,
required TResult Function(
List<String> notifications, int notificationsCount)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -551,7 +590,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? empty,
TResult? Function(int notificationsCount)? loaded,
TResult? Function(List<String> notifications, int notificationsCount)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -562,7 +602,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? empty,
TResult Function(int notificationsCount)? loaded,
TResult Function(List<String> notifications, int notificationsCount)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {