forked from eatvio/eatvio_app
refatcor(diary): Refactored (doesn't work yet though)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,171 +0,0 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'diary_edit_bloc.dart';
|
||||
|
||||
/// Abstract class for all events that can be dispatched from the
|
||||
///DiaryEdit widget.
|
||||
///
|
||||
/// Events must be immutable and implement the [Equatable] interface.
|
||||
@immutable
|
||||
abstract class DiaryEditEvent extends Equatable {}
|
||||
|
||||
/// Event that is dispatched when the DiaryEdit widget is first created.
|
||||
class DiaryEditInitialEvent extends DiaryEditEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ChangeSatiety extends DiaryEditEvent {
|
||||
ChangeSatiety(
|
||||
this.selectedElement,
|
||||
);
|
||||
final int selectedElement;
|
||||
|
||||
@override
|
||||
List<Object> get props => [selectedElement];
|
||||
}
|
||||
|
||||
class ChangeMood extends DiaryEditEvent {
|
||||
ChangeMood(
|
||||
this.selectedElement,
|
||||
);
|
||||
final int selectedElement;
|
||||
|
||||
@override
|
||||
List<Object> get props => [selectedElement];
|
||||
}
|
||||
|
||||
class ChangeMealTime extends DiaryEditEvent {
|
||||
ChangeMealTime(this.time);
|
||||
final TimeOfDay time;
|
||||
|
||||
@override
|
||||
List<Object> get props => [time];
|
||||
}
|
||||
|
||||
class AddComment extends DiaryEditEvent {
|
||||
AddComment(this.diaryId, this.comment);
|
||||
final String comment;
|
||||
final int diaryId;
|
||||
|
||||
@override
|
||||
List<Object> get props => [comment, diaryId];
|
||||
}
|
||||
|
||||
class WakeupEvent extends DiaryEditEvent {
|
||||
WakeupEvent(this.selectedTime);
|
||||
final TimeOfDay selectedTime;
|
||||
|
||||
@override
|
||||
List<Object> get props => [selectedTime];
|
||||
}
|
||||
|
||||
class RetireEvent extends DiaryEditEvent {
|
||||
RetireEvent(this.selectedTime);
|
||||
final TimeOfDay selectedTime;
|
||||
|
||||
@override
|
||||
List<Object> get props => [selectedTime];
|
||||
}
|
||||
|
||||
class ToggleMoodExpandedEvent extends DiaryEditEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ToggleWakeupExpandedEvent extends DiaryEditEvent {
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class AddPortionEvent extends DiaryEditEvent {
|
||||
AddPortionEvent();
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class RemovePortionEvent extends DiaryEditEvent {
|
||||
RemovePortionEvent(this.portionId);
|
||||
final int portionId;
|
||||
@override
|
||||
List<Object> get props => [portionId];
|
||||
}
|
||||
|
||||
class UploadImages extends DiaryEditEvent {
|
||||
UploadImages(this.image);
|
||||
final XFile image;
|
||||
@override
|
||||
List<Object> get props => [image];
|
||||
}
|
||||
|
||||
class RemoveImageEvent extends DiaryEditEvent {
|
||||
RemoveImageEvent(this.photoID, this.path);
|
||||
final String photoID;
|
||||
final String path;
|
||||
@override
|
||||
List<Object> get props => [photoID, path];
|
||||
}
|
||||
|
||||
class ProductInput extends DiaryEditEvent {
|
||||
ProductInput(this.input);
|
||||
final String input;
|
||||
@override
|
||||
List<Object> get props => [input];
|
||||
}
|
||||
|
||||
class ChangeMeal extends DiaryEditEvent {
|
||||
ChangeMeal({required this.value, required this.meals});
|
||||
|
||||
SelectionPopupModel value;
|
||||
List<dynamic>? meals;
|
||||
@override
|
||||
List<Object?> get props => [value, meals];
|
||||
}
|
||||
|
||||
|
||||
class ClearInput extends DiaryEditEvent {
|
||||
ClearInput({required this.value});
|
||||
|
||||
TextEditingController value;
|
||||
@override
|
||||
List<Object?> get props => [value];
|
||||
}
|
||||
|
||||
class ChangePortion extends DiaryEditEvent {
|
||||
ChangePortion({required this.value});
|
||||
|
||||
SelectionPopupModel value;
|
||||
@override
|
||||
List<Object?> get props => [value];
|
||||
}
|
||||
|
||||
class FinishDay extends DiaryEditEvent {
|
||||
FinishDay();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class RefreshEvent extends DiaryEditEvent {
|
||||
RefreshEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class SendModeration extends DiaryEditEvent {
|
||||
SendModeration(
|
||||
{required this.name,
|
||||
required this.energyOn100gr,
|
||||
required this.proteinsOn100gr,
|
||||
required this.fatsOn100gr,
|
||||
required this.carbohydratesOn100gr,});
|
||||
String name;
|
||||
String energyOn100gr;
|
||||
String proteinsOn100gr;
|
||||
String fatsOn100gr;
|
||||
String carbohydratesOn100gr;
|
||||
@override
|
||||
List<Object?> get props =>
|
||||
[name, energyOn100gr, proteinsOn100gr, fatsOn100gr, carbohydratesOn100gr];
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
part of 'diary_edit_bloc.dart';
|
||||
/*part of '../../../../features/diary/presentation/bloc/diary_bloc.dart';
|
||||
|
||||
class DiaryEditState extends Equatable {
|
||||
const DiaryEditState({this.diaryEditModelObj});
|
||||
@@ -182,4 +182,4 @@ class DiaryEditErrorState extends DiaryEditState {
|
||||
|
||||
@override
|
||||
List<Object> get props => [errorMessage];
|
||||
}
|
||||
}*/
|
||||
@@ -1,6 +1,6 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
import 'bloc/diary_edit_bloc.dart';
|
||||
/*import '../../../features/diary/presentation/bloc/diary_bloc.dart';
|
||||
import 'models/diary_edit_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -1250,3 +1250,4 @@ bool checkConsumedValues(List<int> recommendedValues, List<int> consumedValues)
|
||||
// Если ни одно потребленное значение не превышает рекомендованное с соответствующим индексом
|
||||
return false; // Возвращаем true
|
||||
}
|
||||
*/
|
||||
@@ -1,235 +0,0 @@
|
||||
// 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 '../../../../features/blog_post_create/models/blog_post_create_credentials_model.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');
|
||||
|
||||
BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _BlogPostCreateCredentialsModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BlogPostCreateCredentialsModel {
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
String get description => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'youtube_url')
|
||||
String get youtubeUrl => throw _privateConstructorUsedError;
|
||||
String get status => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$BlogPostCreateCredentialsModelCopyWith<BlogPostCreateCredentialsModel>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
factory $BlogPostCreateCredentialsModelCopyWith(
|
||||
BlogPostCreateCredentialsModel value,
|
||||
$Res Function(BlogPostCreateCredentialsModel) then) =
|
||||
_$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
BlogPostCreateCredentialsModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
String description,
|
||||
@JsonKey(name: 'youtube_url') String youtubeUrl,
|
||||
String status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
$Val extends BlogPostCreateCredentialsModel>
|
||||
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
_$BlogPostCreateCredentialsModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? description = null,
|
||||
Object? youtubeUrl = null,
|
||||
Object? status = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
description: null == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
youtubeUrl: null == youtubeUrl
|
||||
? _value.youtubeUrl
|
||||
: youtubeUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res>
|
||||
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
|
||||
factory _$$BlogPostCreateCredentialsModelImplCopyWith(
|
||||
_$BlogPostCreateCredentialsModelImpl value,
|
||||
$Res Function(_$BlogPostCreateCredentialsModelImpl) then) =
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String title,
|
||||
String description,
|
||||
@JsonKey(name: 'youtube_url') String youtubeUrl,
|
||||
String status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>
|
||||
extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
implements _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> {
|
||||
__$$BlogPostCreateCredentialsModelImplCopyWithImpl(
|
||||
_$BlogPostCreateCredentialsModelImpl _value,
|
||||
$Res Function(_$BlogPostCreateCredentialsModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? title = null,
|
||||
Object? description = null,
|
||||
Object? youtubeUrl = null,
|
||||
Object? status = null,
|
||||
}) {
|
||||
return _then(_$BlogPostCreateCredentialsModelImpl(
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
description: null == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
youtubeUrl: null == youtubeUrl
|
||||
? _value.youtubeUrl
|
||||
: youtubeUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$BlogPostCreateCredentialsModelImpl
|
||||
implements _BlogPostCreateCredentialsModel {
|
||||
const _$BlogPostCreateCredentialsModelImpl(
|
||||
{required this.title,
|
||||
required this.description,
|
||||
@JsonKey(name: 'youtube_url') required this.youtubeUrl,
|
||||
this.status = 'active'});
|
||||
|
||||
factory _$BlogPostCreateCredentialsModelImpl.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$$BlogPostCreateCredentialsModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String title;
|
||||
@override
|
||||
final String description;
|
||||
@override
|
||||
@JsonKey(name: 'youtube_url')
|
||||
final String youtubeUrl;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BlogPostCreateCredentialsModel(title: $title, description: $description, youtubeUrl: $youtubeUrl, status: $status)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$BlogPostCreateCredentialsModelImpl &&
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
(identical(other.youtubeUrl, youtubeUrl) ||
|
||||
other.youtubeUrl == youtubeUrl) &&
|
||||
(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, title, description, youtubeUrl, status);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
get copyWith => __$$BlogPostCreateCredentialsModelImplCopyWithImpl<
|
||||
_$BlogPostCreateCredentialsModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$BlogPostCreateCredentialsModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _BlogPostCreateCredentialsModel
|
||||
implements BlogPostCreateCredentialsModel {
|
||||
const factory _BlogPostCreateCredentialsModel(
|
||||
{required final String title,
|
||||
required final String description,
|
||||
@JsonKey(name: 'youtube_url') required final String youtubeUrl,
|
||||
final String status}) = _$BlogPostCreateCredentialsModelImpl;
|
||||
|
||||
factory _BlogPostCreateCredentialsModel.fromJson(Map<String, dynamic> json) =
|
||||
_$BlogPostCreateCredentialsModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get title;
|
||||
@override
|
||||
String get description;
|
||||
@override
|
||||
@JsonKey(name: 'youtube_url')
|
||||
String get youtubeUrl;
|
||||
@override
|
||||
String get status;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$BlogPostCreateCredentialsModelImplCopyWith<
|
||||
_$BlogPostCreateCredentialsModelImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of '../../../../features/blog_post_create/models/blog_post_create_credentials_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$BlogPostCreateCredentialsModelImpl
|
||||
_$$BlogPostCreateCredentialsModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$BlogPostCreateCredentialsModelImpl(
|
||||
title: json['title'] as String,
|
||||
description: json['description'] as String,
|
||||
youtubeUrl: json['youtube_url'] as String,
|
||||
status: json['status'] as String? ?? 'active',
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$BlogPostCreateCredentialsModelImplToJson(
|
||||
_$BlogPostCreateCredentialsModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'title': instance.title,
|
||||
'description': instance.description,
|
||||
'youtube_url': instance.youtubeUrl,
|
||||
'status': instance.status,
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// This class defines the variables used in the [k0_page],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class FeedModel extends Equatable {
|
||||
FeedModel();
|
||||
|
||||
FeedModel copyWith() {
|
||||
return FeedModel();
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
Reference in New Issue
Block a user