Merge remote-tracking branch 'refs/remotes/origin/feature/feed' into recipe_refactor

# Conflicts:
#	lib/features/recipes/models/image.g.dart
#	lib/features/recipes/presentation/bloc/recipe_create_cubit.dart
#	lib/features/recipes/services/recipe_service.g.dart
This commit is contained in:
mso7nueh
2024-08-16 17:36:37 +03:00
45 changed files with 1708 additions and 1029 deletions

View File

@@ -4,7 +4,7 @@ on: [ pull_request ]
env:
flutter_version: "3.22.0"
java_version: "12.x"
java_version: "17.x"
flutter_channel: "stable"
jobs:

View File

@@ -24,7 +24,6 @@ mixin _$InitializationState {
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -71,31 +70,36 @@ mixin _$InitializationState {
/// @nodoc
abstract class $InitializationStateCopyWith<$Res> {
factory $InitializationStateCopyWith(InitializationState value, $Res Function(InitializationState) then) =
factory $InitializationStateCopyWith(
InitializationState value, $Res Function(InitializationState) then) =
_$InitializationStateCopyWithImpl<$Res, InitializationState>;
}
/// @nodoc
class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState> implements $InitializationStateCopyWith<$Res> {
class _$InitializationStateCopyWithImpl<$Res, $Val extends InitializationState>
implements $InitializationStateCopyWith<$Res> {
_$InitializationStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$InitializationStateImplCopyWith<$Res> {
factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value, $Res Function(_$InitializationStateImpl) then) =
factory _$$InitializationStateImplCopyWith(_$InitializationStateImpl value,
$Res Function(_$InitializationStateImpl) then) =
__$$InitializationStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$InitializationStateImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl>
class __$$InitializationStateImplCopyWithImpl<$Res>
extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateImpl>
implements _$$InitializationStateImplCopyWith<$Res> {
__$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value, $Res Function(_$InitializationStateImpl) _then) : super(_value, _then);
__$$InitializationStateImplCopyWithImpl(_$InitializationStateImpl _value,
$Res Function(_$InitializationStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -110,7 +114,9 @@ class _$InitializationStateImpl implements _InitializationState {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$InitializationStateImpl);
}
@override
@@ -197,14 +203,20 @@ abstract class _InitializationState implements InitializationState {
/// @nodoc
abstract class _$$InitializationStateLoadingImplCopyWith<$Res> {
factory _$$InitializationStateLoadingImplCopyWith(_$InitializationStateLoadingImpl value, $Res Function(_$InitializationStateLoadingImpl) then) =
factory _$$InitializationStateLoadingImplCopyWith(
_$InitializationStateLoadingImpl value,
$Res Function(_$InitializationStateLoadingImpl) then) =
__$$InitializationStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$InitializationStateLoadingImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateLoadingImpl>
class __$$InitializationStateLoadingImplCopyWithImpl<$Res>
extends _$InitializationStateCopyWithImpl<$Res,
_$InitializationStateLoadingImpl>
implements _$$InitializationStateLoadingImplCopyWith<$Res> {
__$$InitializationStateLoadingImplCopyWithImpl(_$InitializationStateLoadingImpl _value, $Res Function(_$InitializationStateLoadingImpl) _then)
__$$InitializationStateLoadingImplCopyWithImpl(
_$InitializationStateLoadingImpl _value,
$Res Function(_$InitializationStateLoadingImpl) _then)
: super(_value, _then);
}
@@ -220,7 +232,9 @@ class _$InitializationStateLoadingImpl implements InitializationStateLoading {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$InitializationStateLoadingImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$InitializationStateLoadingImpl);
}
@override
@@ -307,17 +321,22 @@ abstract class InitializationStateLoading implements InitializationState {
/// @nodoc
abstract class _$$InitializationStateSuccessImplCopyWith<$Res> {
factory _$$InitializationStateSuccessImplCopyWith(_$InitializationStateSuccessImpl value, $Res Function(_$InitializationStateSuccessImpl) then) =
factory _$$InitializationStateSuccessImplCopyWith(
_$InitializationStateSuccessImpl value,
$Res Function(_$InitializationStateSuccessImpl) then) =
__$$InitializationStateSuccessImplCopyWithImpl<$Res>;
@useResult
$Res call({PusherChannelsClient client});
}
/// @nodoc
class __$$InitializationStateSuccessImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateSuccessImpl>
class __$$InitializationStateSuccessImplCopyWithImpl<$Res>
extends _$InitializationStateCopyWithImpl<$Res,
_$InitializationStateSuccessImpl>
implements _$$InitializationStateSuccessImplCopyWith<$Res> {
__$$InitializationStateSuccessImplCopyWithImpl(_$InitializationStateSuccessImpl _value, $Res Function(_$InitializationStateSuccessImpl) _then)
__$$InitializationStateSuccessImplCopyWithImpl(
_$InitializationStateSuccessImpl _value,
$Res Function(_$InitializationStateSuccessImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -350,7 +369,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess {
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$InitializationStateSuccessImpl && (identical(other.client, client) || other.client == client));
(other.runtimeType == runtimeType &&
other is _$InitializationStateSuccessImpl &&
(identical(other.client, client) || other.client == client));
}
@override
@@ -359,8 +380,9 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith =>
__$$InitializationStateSuccessImplCopyWithImpl<_$InitializationStateSuccessImpl>(this, _$identity);
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl>
get copyWith => __$$InitializationStateSuccessImplCopyWithImpl<
_$InitializationStateSuccessImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -438,27 +460,34 @@ class _$InitializationStateSuccessImpl implements InitializationStateSuccess {
}
abstract class InitializationStateSuccess implements InitializationState {
const factory InitializationStateSuccess({required final PusherChannelsClient client}) = _$InitializationStateSuccessImpl;
const factory InitializationStateSuccess(
{required final PusherChannelsClient client}) =
_$InitializationStateSuccessImpl;
PusherChannelsClient get client;
@JsonKey(ignore: true)
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl> get copyWith => throw _privateConstructorUsedError;
_$$InitializationStateSuccessImplCopyWith<_$InitializationStateSuccessImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$InitializationStateErrorImplCopyWith<$Res> {
factory _$$InitializationStateErrorImplCopyWith(_$InitializationStateErrorImpl value, $Res Function(_$InitializationStateErrorImpl) then) =
factory _$$InitializationStateErrorImplCopyWith(
_$InitializationStateErrorImpl value,
$Res Function(_$InitializationStateErrorImpl) then) =
__$$InitializationStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$InitializationStateErrorImplCopyWithImpl<$Res> extends _$InitializationStateCopyWithImpl<$Res, _$InitializationStateErrorImpl>
class __$$InitializationStateErrorImplCopyWithImpl<$Res>
extends _$InitializationStateCopyWithImpl<$Res,
_$InitializationStateErrorImpl>
implements _$$InitializationStateErrorImplCopyWith<$Res> {
__$$InitializationStateErrorImplCopyWithImpl(_$InitializationStateErrorImpl _value, $Res Function(_$InitializationStateErrorImpl) _then)
__$$InitializationStateErrorImplCopyWithImpl(
_$InitializationStateErrorImpl _value,
$Res Function(_$InitializationStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -493,7 +522,8 @@ class _$InitializationStateErrorImpl implements InitializationStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$InitializationStateErrorImpl &&
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
@@ -502,8 +532,9 @@ class _$InitializationStateErrorImpl implements InitializationStateError {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith =>
__$$InitializationStateErrorImplCopyWithImpl<_$InitializationStateErrorImpl>(this, _$identity);
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
get copyWith => __$$InitializationStateErrorImplCopyWithImpl<
_$InitializationStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -581,10 +612,11 @@ class _$InitializationStateErrorImpl implements InitializationStateError {
}
abstract class InitializationStateError implements InitializationState {
const factory InitializationStateError({required final String errorMessage}) = _$InitializationStateErrorImpl;
const factory InitializationStateError({required final String errorMessage}) =
_$InitializationStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
_$$InitializationStateErrorImplCopyWith<_$InitializationStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -17,33 +17,31 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$SelectionPopupModel {
int? get id => throw _privateConstructorUsedError;
String get title => throw _privateConstructorUsedError;
dynamic get value => throw _privateConstructorUsedError;
bool get isSelected => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$SelectionPopupModelCopyWith<SelectionPopupModel> get copyWith => throw _privateConstructorUsedError;
$SelectionPopupModelCopyWith<SelectionPopupModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SelectionPopupModelCopyWith<$Res> {
factory $SelectionPopupModelCopyWith(SelectionPopupModel value, $Res Function(SelectionPopupModel) then) =
factory $SelectionPopupModelCopyWith(
SelectionPopupModel value, $Res Function(SelectionPopupModel) then) =
_$SelectionPopupModelCopyWithImpl<$Res, SelectionPopupModel>;
@useResult
$Res call({int? id, String title, dynamic value, bool isSelected});
}
/// @nodoc
class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel> implements $SelectionPopupModelCopyWith<$Res> {
class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel>
implements $SelectionPopupModelCopyWith<$Res> {
_$SelectionPopupModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -77,19 +75,23 @@ class _$SelectionPopupModelCopyWithImpl<$Res, $Val extends SelectionPopupModel>
}
/// @nodoc
abstract class _$$SelectionPopupModelImplCopyWith<$Res> implements $SelectionPopupModelCopyWith<$Res> {
factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value, $Res Function(_$SelectionPopupModelImpl) then) =
abstract class _$$SelectionPopupModelImplCopyWith<$Res>
implements $SelectionPopupModelCopyWith<$Res> {
factory _$$SelectionPopupModelImplCopyWith(_$SelectionPopupModelImpl value,
$Res Function(_$SelectionPopupModelImpl) then) =
__$$SelectionPopupModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int? id, String title, dynamic value, bool isSelected});
}
/// @nodoc
class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl>
class __$$SelectionPopupModelImplCopyWithImpl<$Res>
extends _$SelectionPopupModelCopyWithImpl<$Res, _$SelectionPopupModelImpl>
implements _$$SelectionPopupModelImplCopyWith<$Res> {
__$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value, $Res Function(_$SelectionPopupModelImpl) _then) : super(_value, _then);
__$$SelectionPopupModelImplCopyWithImpl(_$SelectionPopupModelImpl _value,
$Res Function(_$SelectionPopupModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -123,7 +125,8 @@ class __$$SelectionPopupModelImplCopyWithImpl<$Res> extends _$SelectionPopupMode
/// @nodoc
class _$SelectionPopupModelImpl implements _SelectionPopupModel {
const _$SelectionPopupModelImpl({this.id, required this.title, this.value, this.isSelected = false});
const _$SelectionPopupModelImpl(
{this.id, required this.title, this.value, this.isSelected = false});
@override
final int? id;
@@ -148,35 +151,39 @@ class _$SelectionPopupModelImpl implements _SelectionPopupModel {
(identical(other.id, id) || other.id == id) &&
(identical(other.title, title) || other.title == title) &&
const DeepCollectionEquality().equals(other.value, value) &&
(identical(other.isSelected, isSelected) || other.isSelected == isSelected));
(identical(other.isSelected, isSelected) ||
other.isSelected == isSelected));
}
@override
int get hashCode => Object.hash(runtimeType, id, title, const DeepCollectionEquality().hash(value), isSelected);
int get hashCode => Object.hash(runtimeType, id, title,
const DeepCollectionEquality().hash(value), isSelected);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith =>
__$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(this, _$identity);
__$$SelectionPopupModelImplCopyWithImpl<_$SelectionPopupModelImpl>(
this, _$identity);
}
abstract class _SelectionPopupModel implements SelectionPopupModel {
const factory _SelectionPopupModel({final int? id, required final String title, final dynamic value, final bool isSelected}) = _$SelectionPopupModelImpl;
const factory _SelectionPopupModel(
{final int? id,
required final String title,
final dynamic value,
final bool isSelected}) = _$SelectionPopupModelImpl;
@override
int? get id;
@override
String get title;
@override
dynamic get value;
@override
bool get isSelected;
@override
@JsonKey(ignore: true)
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$SelectionPopupModelImplCopyWith<_$SelectionPopupModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -24,7 +24,6 @@ mixin _$NewMessagesState {
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -71,30 +70,36 @@ mixin _$NewMessagesState {
/// @nodoc
abstract class $NewMessagesStateCopyWith<$Res> {
factory $NewMessagesStateCopyWith(NewMessagesState value, $Res Function(NewMessagesState) then) = _$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>;
factory $NewMessagesStateCopyWith(
NewMessagesState value, $Res Function(NewMessagesState) then) =
_$NewMessagesStateCopyWithImpl<$Res, NewMessagesState>;
}
/// @nodoc
class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState> implements $NewMessagesStateCopyWith<$Res> {
class _$NewMessagesStateCopyWithImpl<$Res, $Val extends NewMessagesState>
implements $NewMessagesStateCopyWith<$Res> {
_$NewMessagesStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$NewMessagesStateImplCopyWith<$Res> {
factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value, $Res Function(_$NewMessagesStateImpl) then) =
factory _$$NewMessagesStateImplCopyWith(_$NewMessagesStateImpl value,
$Res Function(_$NewMessagesStateImpl) then) =
__$$NewMessagesStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NewMessagesStateImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl>
class __$$NewMessagesStateImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateImpl>
implements _$$NewMessagesStateImplCopyWith<$Res> {
__$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value, $Res Function(_$NewMessagesStateImpl) _then) : super(_value, _then);
__$$NewMessagesStateImplCopyWithImpl(_$NewMessagesStateImpl _value,
$Res Function(_$NewMessagesStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -109,7 +114,8 @@ class _$NewMessagesStateImpl implements _NewMessagesState {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$NewMessagesStateImpl);
}
@override
@@ -196,14 +202,19 @@ abstract class _NewMessagesState implements NewMessagesState {
/// @nodoc
abstract class _$$NewMessagesStateEmptyImplCopyWith<$Res> {
factory _$$NewMessagesStateEmptyImplCopyWith(_$NewMessagesStateEmptyImpl value, $Res Function(_$NewMessagesStateEmptyImpl) then) =
factory _$$NewMessagesStateEmptyImplCopyWith(
_$NewMessagesStateEmptyImpl value,
$Res Function(_$NewMessagesStateEmptyImpl) then) =
__$$NewMessagesStateEmptyImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl>
class __$$NewMessagesStateEmptyImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateEmptyImpl>
implements _$$NewMessagesStateEmptyImplCopyWith<$Res> {
__$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value, $Res Function(_$NewMessagesStateEmptyImpl) _then) : super(_value, _then);
__$$NewMessagesStateEmptyImplCopyWithImpl(_$NewMessagesStateEmptyImpl _value,
$Res Function(_$NewMessagesStateEmptyImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -218,7 +229,9 @@ class _$NewMessagesStateEmptyImpl implements NewMessagesStateEmpty {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$NewMessagesStateEmptyImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NewMessagesStateEmptyImpl);
}
@override
@@ -305,17 +318,22 @@ abstract class NewMessagesStateEmpty implements NewMessagesState {
/// @nodoc
abstract class _$$NewMessagesStateLoadedImplCopyWith<$Res> {
factory _$$NewMessagesStateLoadedImplCopyWith(_$NewMessagesStateLoadedImpl value, $Res Function(_$NewMessagesStateLoadedImpl) then) =
factory _$$NewMessagesStateLoadedImplCopyWith(
_$NewMessagesStateLoadedImpl value,
$Res Function(_$NewMessagesStateLoadedImpl) then) =
__$$NewMessagesStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({int messagesCount});
}
/// @nodoc
class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl>
class __$$NewMessagesStateLoadedImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateLoadedImpl>
implements _$$NewMessagesStateLoadedImplCopyWith<$Res> {
__$$NewMessagesStateLoadedImplCopyWithImpl(_$NewMessagesStateLoadedImpl _value, $Res Function(_$NewMessagesStateLoadedImpl) _then) : super(_value, _then);
__$$NewMessagesStateLoadedImplCopyWithImpl(
_$NewMessagesStateLoadedImpl _value,
$Res Function(_$NewMessagesStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -349,7 +367,8 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NewMessagesStateLoadedImpl &&
(identical(other.messagesCount, messagesCount) || other.messagesCount == messagesCount));
(identical(other.messagesCount, messagesCount) ||
other.messagesCount == messagesCount));
}
@override
@@ -358,8 +377,9 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith =>
__$$NewMessagesStateLoadedImplCopyWithImpl<_$NewMessagesStateLoadedImpl>(this, _$identity);
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
get copyWith => __$$NewMessagesStateLoadedImplCopyWithImpl<
_$NewMessagesStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -437,27 +457,32 @@ class _$NewMessagesStateLoadedImpl implements NewMessagesStateLoaded {
}
abstract class NewMessagesStateLoaded implements NewMessagesState {
const factory NewMessagesStateLoaded({required final int messagesCount}) = _$NewMessagesStateLoadedImpl;
const factory NewMessagesStateLoaded({required final int messagesCount}) =
_$NewMessagesStateLoadedImpl;
int get messagesCount;
@JsonKey(ignore: true)
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
_$$NewMessagesStateLoadedImplCopyWith<_$NewMessagesStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$NewMessagesStateErrorImplCopyWith<$Res> {
factory _$$NewMessagesStateErrorImplCopyWith(_$NewMessagesStateErrorImpl value, $Res Function(_$NewMessagesStateErrorImpl) then) =
factory _$$NewMessagesStateErrorImplCopyWith(
_$NewMessagesStateErrorImpl value,
$Res Function(_$NewMessagesStateErrorImpl) then) =
__$$NewMessagesStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$NewMessagesStateErrorImplCopyWithImpl<$Res> extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl>
class __$$NewMessagesStateErrorImplCopyWithImpl<$Res>
extends _$NewMessagesStateCopyWithImpl<$Res, _$NewMessagesStateErrorImpl>
implements _$$NewMessagesStateErrorImplCopyWith<$Res> {
__$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value, $Res Function(_$NewMessagesStateErrorImpl) _then) : super(_value, _then);
__$$NewMessagesStateErrorImplCopyWithImpl(_$NewMessagesStateErrorImpl _value,
$Res Function(_$NewMessagesStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -491,7 +516,8 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NewMessagesStateErrorImpl &&
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
@@ -500,8 +526,9 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith =>
__$$NewMessagesStateErrorImplCopyWithImpl<_$NewMessagesStateErrorImpl>(this, _$identity);
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
get copyWith => __$$NewMessagesStateErrorImplCopyWithImpl<
_$NewMessagesStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -579,10 +606,11 @@ class _$NewMessagesStateErrorImpl implements NewMessagesStateError {
}
abstract class NewMessagesStateError implements NewMessagesState {
const factory NewMessagesStateError({required final String errorMessage}) = _$NewMessagesStateErrorImpl;
const factory NewMessagesStateError({required final String errorMessage}) =
_$NewMessagesStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
_$$NewMessagesStateErrorImplCopyWith<_$NewMessagesStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -24,7 +24,6 @@ mixin _$NotificationsState {
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -71,31 +70,36 @@ mixin _$NotificationsState {
/// @nodoc
abstract class $NotificationsStateCopyWith<$Res> {
factory $NotificationsStateCopyWith(NotificationsState value, $Res Function(NotificationsState) then) =
factory $NotificationsStateCopyWith(
NotificationsState value, $Res Function(NotificationsState) then) =
_$NotificationsStateCopyWithImpl<$Res, NotificationsState>;
}
/// @nodoc
class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> implements $NotificationsStateCopyWith<$Res> {
class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState>
implements $NotificationsStateCopyWith<$Res> {
_$NotificationsStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$NotificationsStateImplCopyWith<$Res> {
factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value, $Res Function(_$NotificationsStateImpl) then) =
factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value,
$Res Function(_$NotificationsStateImpl) then) =
__$$NotificationsStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NotificationsStateImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl>
class __$$NotificationsStateImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl>
implements _$$NotificationsStateImplCopyWith<$Res> {
__$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value, $Res Function(_$NotificationsStateImpl) _then) : super(_value, _then);
__$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value,
$Res Function(_$NotificationsStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -110,7 +114,8 @@ class _$NotificationsStateImpl implements _NotificationsState {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$NotificationsStateImpl);
}
@override
@@ -197,14 +202,21 @@ abstract class _NotificationsState implements NotificationsState {
/// @nodoc
abstract class _$$NotificationsStateEmptyImplCopyWith<$Res> {
factory _$$NotificationsStateEmptyImplCopyWith(_$NotificationsStateEmptyImpl value, $Res Function(_$NotificationsStateEmptyImpl) then) =
factory _$$NotificationsStateEmptyImplCopyWith(
_$NotificationsStateEmptyImpl value,
$Res Function(_$NotificationsStateEmptyImpl) then) =
__$$NotificationsStateEmptyImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$NotificationsStateEmptyImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateEmptyImpl>
class __$$NotificationsStateEmptyImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateEmptyImpl>
implements _$$NotificationsStateEmptyImplCopyWith<$Res> {
__$$NotificationsStateEmptyImplCopyWithImpl(_$NotificationsStateEmptyImpl _value, $Res Function(_$NotificationsStateEmptyImpl) _then) : super(_value, _then);
__$$NotificationsStateEmptyImplCopyWithImpl(
_$NotificationsStateEmptyImpl _value,
$Res Function(_$NotificationsStateEmptyImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -219,7 +231,9 @@ class _$NotificationsStateEmptyImpl implements NotificationsStateEmpty {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotificationsStateEmptyImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateEmptyImpl);
}
@override
@@ -306,17 +320,22 @@ abstract class NotificationsStateEmpty implements NotificationsState {
/// @nodoc
abstract class _$$NotificationsStateLoadedImplCopyWith<$Res> {
factory _$$NotificationsStateLoadedImplCopyWith(_$NotificationsStateLoadedImpl value, $Res Function(_$NotificationsStateLoadedImpl) then) =
factory _$$NotificationsStateLoadedImplCopyWith(
_$NotificationsStateLoadedImpl value,
$Res Function(_$NotificationsStateLoadedImpl) then) =
__$$NotificationsStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({int notificationsCount});
}
/// @nodoc
class __$$NotificationsStateLoadedImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateLoadedImpl>
class __$$NotificationsStateLoadedImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateLoadedImpl>
implements _$$NotificationsStateLoadedImplCopyWith<$Res> {
__$$NotificationsStateLoadedImplCopyWithImpl(_$NotificationsStateLoadedImpl _value, $Res Function(_$NotificationsStateLoadedImpl) _then)
__$$NotificationsStateLoadedImplCopyWithImpl(
_$NotificationsStateLoadedImpl _value,
$Res Function(_$NotificationsStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@@ -351,7 +370,8 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateLoadedImpl &&
(identical(other.notificationsCount, notificationsCount) || other.notificationsCount == notificationsCount));
(identical(other.notificationsCount, notificationsCount) ||
other.notificationsCount == notificationsCount));
}
@override
@@ -360,8 +380,9 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith =>
__$$NotificationsStateLoadedImplCopyWithImpl<_$NotificationsStateLoadedImpl>(this, _$identity);
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
get copyWith => __$$NotificationsStateLoadedImplCopyWithImpl<
_$NotificationsStateLoadedImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -439,27 +460,34 @@ class _$NotificationsStateLoadedImpl implements NotificationsStateLoaded {
}
abstract class NotificationsStateLoaded implements NotificationsState {
const factory NotificationsStateLoaded({required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
const factory NotificationsStateLoaded(
{required final int notificationsCount}) = _$NotificationsStateLoadedImpl;
int get notificationsCount;
@JsonKey(ignore: true)
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
_$$NotificationsStateLoadedImplCopyWith<_$NotificationsStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$NotificationsStateErrorImplCopyWith<$Res> {
factory _$$NotificationsStateErrorImplCopyWith(_$NotificationsStateErrorImpl value, $Res Function(_$NotificationsStateErrorImpl) then) =
factory _$$NotificationsStateErrorImplCopyWith(
_$NotificationsStateErrorImpl value,
$Res Function(_$NotificationsStateErrorImpl) then) =
__$$NotificationsStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$NotificationsStateErrorImplCopyWithImpl<$Res> extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateErrorImpl>
class __$$NotificationsStateErrorImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res,
_$NotificationsStateErrorImpl>
implements _$$NotificationsStateErrorImplCopyWith<$Res> {
__$$NotificationsStateErrorImplCopyWithImpl(_$NotificationsStateErrorImpl _value, $Res Function(_$NotificationsStateErrorImpl) _then) : super(_value, _then);
__$$NotificationsStateErrorImplCopyWithImpl(
_$NotificationsStateErrorImpl _value,
$Res Function(_$NotificationsStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -493,7 +521,8 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateErrorImpl &&
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
@@ -502,8 +531,9 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith =>
__$$NotificationsStateErrorImplCopyWithImpl<_$NotificationsStateErrorImpl>(this, _$identity);
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
get copyWith => __$$NotificationsStateErrorImplCopyWithImpl<
_$NotificationsStateErrorImpl>(this, _$identity);
@override
@optionalTypeArgs
@@ -581,10 +611,11 @@ class _$NotificationsStateErrorImpl implements NotificationsStateError {
}
abstract class NotificationsStateError implements NotificationsState {
const factory NotificationsStateError({required final String errorMessage}) = _$NotificationsStateErrorImpl;
const factory NotificationsStateError({required final String errorMessage}) =
_$NotificationsStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
_$$NotificationsStateErrorImplCopyWith<_$NotificationsStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -12,38 +12,47 @@ class _CalendarService implements CalendarService {
_CalendarService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<List<CalendarModel>> getCalendar() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<List<dynamic>>(_setStreamType<List<CalendarModel>>(Options(
final _options = _setStreamType<List<CalendarModel>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/calendar/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
var _value = _result.data!
.map((dynamic i) => CalendarModel.fromJson(i as Map<String, dynamic>))
.toList();
.compose(
_dio.options,
'/api/calendar/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<List<dynamic>>(_options);
late List<CalendarModel> _value;
try {
_value = _result.data!
.map((dynamic i) => CalendarModel.fromJson(i as Map<String, dynamic>))
.toList();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}

View File

@@ -21,28 +21,25 @@ ChatMessageModel _$ChatMessageModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ChatMessageModel {
int get id => throw _privateConstructorUsedError;
String get data => throw _privateConstructorUsedError;
@JsonKey(name: 'media_data')
List<dynamic>? get mediaData => throw _privateConstructorUsedError;
@JsonKey(name: 'author_id')
int get authorId => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ChatMessageModelCopyWith<ChatMessageModel> get copyWith => throw _privateConstructorUsedError;
$ChatMessageModelCopyWith<ChatMessageModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatMessageModelCopyWith<$Res> {
factory $ChatMessageModelCopyWith(ChatMessageModel value, $Res Function(ChatMessageModel) then) = _$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>;
factory $ChatMessageModelCopyWith(
ChatMessageModel value, $Res Function(ChatMessageModel) then) =
_$ChatMessageModelCopyWithImpl<$Res, ChatMessageModel>;
@useResult
$Res call(
{int id,
@@ -53,12 +50,12 @@ abstract class $ChatMessageModelCopyWith<$Res> {
}
/// @nodoc
class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implements $ChatMessageModelCopyWith<$Res> {
class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
implements $ChatMessageModelCopyWith<$Res> {
_$ChatMessageModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -97,10 +94,11 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel> implem
}
/// @nodoc
abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageModelCopyWith<$Res> {
factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value, $Res Function(_$ChatMessageModelImpl) then) =
abstract class _$$ChatMessageModelImplCopyWith<$Res>
implements $ChatMessageModelCopyWith<$Res> {
factory _$$ChatMessageModelImplCopyWith(_$ChatMessageModelImpl value,
$Res Function(_$ChatMessageModelImpl) then) =
__$$ChatMessageModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
@@ -112,9 +110,12 @@ abstract class _$$ChatMessageModelImplCopyWith<$Res> implements $ChatMessageMode
}
/// @nodoc
class __$$ChatMessageModelImplCopyWithImpl<$Res> extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl>
class __$$ChatMessageModelImplCopyWithImpl<$Res>
extends _$ChatMessageModelCopyWithImpl<$Res, _$ChatMessageModelImpl>
implements _$$ChatMessageModelImplCopyWith<$Res> {
__$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value, $Res Function(_$ChatMessageModelImpl) _then) : super(_value, _then);
__$$ChatMessageModelImplCopyWithImpl(_$ChatMessageModelImpl _value,
$Res Function(_$ChatMessageModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -161,14 +162,14 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
@JsonKey(name: 'updated_at') required this.updatedAt})
: _mediaData = mediaData;
factory _$ChatMessageModelImpl.fromJson(Map<String, dynamic> json) => _$$ChatMessageModelImplFromJson(json);
factory _$ChatMessageModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatMessageModelImplFromJson(json);
@override
final int id;
@override
final String data;
final List<dynamic>? _mediaData;
@override
@JsonKey(name: 'media_data')
List<dynamic>? get mediaData {
@@ -198,19 +199,25 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
other is _$ChatMessageModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.data, data) || other.data == data) &&
const DeepCollectionEquality().equals(other._mediaData, _mediaData) &&
(identical(other.authorId, authorId) || other.authorId == authorId) &&
(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
const DeepCollectionEquality()
.equals(other._mediaData, _mediaData) &&
(identical(other.authorId, authorId) ||
other.authorId == authorId) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, data, const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt);
int get hashCode => Object.hash(runtimeType, id, data,
const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => __$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(this, _$identity);
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
__$$ChatMessageModelImplCopyWithImpl<_$ChatMessageModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -222,33 +229,31 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
abstract class _ChatMessageModel implements ChatMessageModel {
const factory _ChatMessageModel(
{required final int id,
required final String data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required final int authorId,
@JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatMessageModelImpl;
{required final int id,
required final String data,
@JsonKey(name: 'media_data') required final List<dynamic>? mediaData,
@JsonKey(name: 'author_id') required final int authorId,
@JsonKey(name: 'updated_at') required final String updatedAt}) =
_$ChatMessageModelImpl;
factory _ChatMessageModel.fromJson(Map<String, dynamic> json) = _$ChatMessageModelImpl.fromJson;
factory _ChatMessageModel.fromJson(Map<String, dynamic> json) =
_$ChatMessageModelImpl.fromJson;
@override
int get id;
@override
String get data;
@override
@JsonKey(name: 'media_data')
List<dynamic>? get mediaData;
@override
@JsonKey(name: 'author_id')
int get authorId;
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
@override
@JsonKey(ignore: true)
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -6,7 +6,9 @@ part of 'chat_message_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map<String, dynamic> json) => _$ChatMessageModelImpl(
_$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(
Map<String, dynamic> json) =>
_$ChatMessageModelImpl(
id: (json['id'] as num).toInt(),
data: json['data'] as String,
mediaData: json['media_data'] as List<dynamic>?,
@@ -14,7 +16,9 @@ _$ChatMessageModelImpl _$$ChatMessageModelImplFromJson(Map<String, dynamic> json
updatedAt: json['updated_at'] as String,
);
Map<String, dynamic> _$$ChatMessageModelImplToJson(_$ChatMessageModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$ChatMessageModelImplToJson(
_$ChatMessageModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'data': instance.data,
'media_data': instance.mediaData,

View File

@@ -24,26 +24,27 @@ mixin _$ChatMetaModel {
int get lastPage => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ChatMetaModelCopyWith<ChatMetaModel> get copyWith => throw _privateConstructorUsedError;
$ChatMetaModelCopyWith<ChatMetaModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatMetaModelCopyWith<$Res> {
factory $ChatMetaModelCopyWith(ChatMetaModel value, $Res Function(ChatMetaModel) then) = _$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>;
factory $ChatMetaModelCopyWith(
ChatMetaModel value, $Res Function(ChatMetaModel) then) =
_$ChatMetaModelCopyWithImpl<$Res, ChatMetaModel>;
@useResult
$Res call({@JsonKey(name: "last_page") int lastPage});
}
/// @nodoc
class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $ChatMetaModelCopyWith<$Res> {
class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel>
implements $ChatMetaModelCopyWith<$Res> {
_$ChatMetaModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -62,17 +63,23 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel> implements $
}
/// @nodoc
abstract class _$$ChatMetaModelImplCopyWith<$Res> implements $ChatMetaModelCopyWith<$Res> {
factory _$$ChatMetaModelImplCopyWith(_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) = __$$ChatMetaModelImplCopyWithImpl<$Res>;
abstract class _$$ChatMetaModelImplCopyWith<$Res>
implements $ChatMetaModelCopyWith<$Res> {
factory _$$ChatMetaModelImplCopyWith(
_$ChatMetaModelImpl value, $Res Function(_$ChatMetaModelImpl) then) =
__$$ChatMetaModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: "last_page") int lastPage});
}
/// @nodoc
class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl> implements _$$ChatMetaModelImplCopyWith<$Res> {
__$$ChatMetaModelImplCopyWithImpl(_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then) : super(_value, _then);
class __$$ChatMetaModelImplCopyWithImpl<$Res>
extends _$ChatMetaModelCopyWithImpl<$Res, _$ChatMetaModelImpl>
implements _$$ChatMetaModelImplCopyWith<$Res> {
__$$ChatMetaModelImplCopyWithImpl(
_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -91,9 +98,11 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res> extends _$ChatMetaModelCopyWithImp
/// @nodoc
@JsonSerializable()
class _$ChatMetaModelImpl implements _ChatMetaModel {
const _$ChatMetaModelImpl({@JsonKey(name: "last_page") required this.lastPage});
const _$ChatMetaModelImpl(
{@JsonKey(name: "last_page") required this.lastPage});
factory _$ChatMetaModelImpl.fromJson(Map<String, dynamic> json) => _$$ChatMetaModelImplFromJson(json);
factory _$ChatMetaModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatMetaModelImplFromJson(json);
@override
@JsonKey(name: "last_page")
@@ -107,7 +116,10 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$ChatMetaModelImpl && (identical(other.lastPage, lastPage) || other.lastPage == lastPage));
(other.runtimeType == runtimeType &&
other is _$ChatMetaModelImpl &&
(identical(other.lastPage, lastPage) ||
other.lastPage == lastPage));
}
@JsonKey(ignore: true)
@@ -117,7 +129,8 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => __$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity);
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
__$$ChatMetaModelImplCopyWithImpl<_$ChatMetaModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -128,15 +141,18 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
}
abstract class _ChatMetaModel implements ChatMetaModel {
const factory _ChatMetaModel({@JsonKey(name: "last_page") required final int lastPage}) = _$ChatMetaModelImpl;
const factory _ChatMetaModel(
{@JsonKey(name: "last_page") required final int lastPage}) =
_$ChatMetaModelImpl;
factory _ChatMetaModel.fromJson(Map<String, dynamic> json) = _$ChatMetaModelImpl.fromJson;
factory _ChatMetaModel.fromJson(Map<String, dynamic> json) =
_$ChatMetaModelImpl.fromJson;
@override
@JsonKey(name: "last_page")
int get lastPage;
@override
@JsonKey(ignore: true)
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -6,10 +6,12 @@ part of 'chat_meta_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map<String, dynamic> json) => _$ChatMetaModelImpl(
_$ChatMetaModelImpl _$$ChatMetaModelImplFromJson(Map<String, dynamic> json) =>
_$ChatMetaModelImpl(
lastPage: (json['last_page'] as num).toInt(),
);
Map<String, dynamic> _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$ChatMetaModelImplToJson(_$ChatMetaModelImpl instance) =>
<String, dynamic>{
'last_page': instance.lastPage,
};

View File

@@ -21,35 +21,39 @@ ChatRoomModel _$ChatRoomModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ChatRoomModel {
String get id => throw _privateConstructorUsedError;
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel get chatRoomSettings => throw _privateConstructorUsedError;
ChatRoomSettingsModel get chatRoomSettings =>
throw _privateConstructorUsedError;
Map<String, ChatUserModel> get users => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ChatRoomModelCopyWith<ChatRoomModel> get copyWith => throw _privateConstructorUsedError;
$ChatRoomModelCopyWith<ChatRoomModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatRoomModelCopyWith<$Res> {
factory $ChatRoomModelCopyWith(ChatRoomModel value, $Res Function(ChatRoomModel) then) = _$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>;
factory $ChatRoomModelCopyWith(
ChatRoomModel value, $Res Function(ChatRoomModel) then) =
_$ChatRoomModelCopyWithImpl<$Res, ChatRoomModel>;
@useResult
$Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map<String, ChatUserModel> users});
$Res call(
{String id,
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings,
Map<String, ChatUserModel> users});
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
}
/// @nodoc
class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $ChatRoomModelCopyWith<$Res> {
class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
implements $ChatRoomModelCopyWith<$Res> {
_$ChatRoomModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -79,27 +83,38 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel> implements $
@override
@pragma('vm:prefer-inline')
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings {
return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings, (value) {
return $ChatRoomSettingsModelCopyWith<$Res>(_value.chatRoomSettings,
(value) {
return _then(_value.copyWith(chatRoomSettings: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$ChatRoomModelImplCopyWith<$Res> implements $ChatRoomModelCopyWith<$Res> {
factory _$$ChatRoomModelImplCopyWith(_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) = __$$ChatRoomModelImplCopyWithImpl<$Res>;
abstract class _$$ChatRoomModelImplCopyWith<$Res>
implements $ChatRoomModelCopyWith<$Res> {
factory _$$ChatRoomModelImplCopyWith(
_$ChatRoomModelImpl value, $Res Function(_$ChatRoomModelImpl) then) =
__$$ChatRoomModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String id, @JsonKey(name: 'chat_room_setting') ChatRoomSettingsModel chatRoomSettings, Map<String, ChatUserModel> users});
$Res call(
{String id,
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel chatRoomSettings,
Map<String, ChatUserModel> users});
@override
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings;
}
/// @nodoc
class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl> implements _$$ChatRoomModelImplCopyWith<$Res> {
__$$ChatRoomModelImplCopyWithImpl(_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then) : super(_value, _then);
class __$$ChatRoomModelImplCopyWithImpl<$Res>
extends _$ChatRoomModelCopyWithImpl<$Res, _$ChatRoomModelImpl>
implements _$$ChatRoomModelImplCopyWith<$Res> {
__$$ChatRoomModelImplCopyWithImpl(
_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -129,10 +144,13 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res> extends _$ChatRoomModelCopyWithImp
@JsonSerializable()
class _$ChatRoomModelImpl implements _ChatRoomModel {
const _$ChatRoomModelImpl(
{required this.id, @JsonKey(name: 'chat_room_setting') required this.chatRoomSettings, required final Map<String, ChatUserModel> users})
{required this.id,
@JsonKey(name: 'chat_room_setting') required this.chatRoomSettings,
required final Map<String, ChatUserModel> users})
: _users = users;
factory _$ChatRoomModelImpl.fromJson(Map<String, dynamic> json) => _$$ChatRoomModelImplFromJson(json);
factory _$ChatRoomModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomModelImplFromJson(json);
@override
final String id;
@@ -140,7 +158,6 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
@JsonKey(name: 'chat_room_setting')
final ChatRoomSettingsModel chatRoomSettings;
final Map<String, ChatUserModel> _users;
@override
Map<String, ChatUserModel> get users {
if (_users is EqualUnmodifiableMapView) return _users;
@@ -159,18 +176,21 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
(other.runtimeType == runtimeType &&
other is _$ChatRoomModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.chatRoomSettings, chatRoomSettings) || other.chatRoomSettings == chatRoomSettings) &&
(identical(other.chatRoomSettings, chatRoomSettings) ||
other.chatRoomSettings == chatRoomSettings) &&
const DeepCollectionEquality().equals(other._users, _users));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, chatRoomSettings, const DeepCollectionEquality().hash(_users));
int get hashCode => Object.hash(runtimeType, id, chatRoomSettings,
const DeepCollectionEquality().hash(_users));
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => __$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity);
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
__$$ChatRoomModelImplCopyWithImpl<_$ChatRoomModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -183,22 +203,22 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
abstract class _ChatRoomModel implements ChatRoomModel {
const factory _ChatRoomModel(
{required final String id,
@JsonKey(name: 'chat_room_setting') required final ChatRoomSettingsModel chatRoomSettings,
@JsonKey(name: 'chat_room_setting')
required final ChatRoomSettingsModel chatRoomSettings,
required final Map<String, ChatUserModel> users}) = _$ChatRoomModelImpl;
factory _ChatRoomModel.fromJson(Map<String, dynamic> json) = _$ChatRoomModelImpl.fromJson;
factory _ChatRoomModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomModelImpl.fromJson;
@override
String get id;
@override
@JsonKey(name: 'chat_room_setting')
ChatRoomSettingsModel get chatRoomSettings;
@override
Map<String, ChatUserModel> get users;
@override
@JsonKey(ignore: true)
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -6,15 +6,19 @@ part of 'chat_room_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map<String, dynamic> json) => _$ChatRoomModelImpl(
_$ChatRoomModelImpl _$$ChatRoomModelImplFromJson(Map<String, dynamic> json) =>
_$ChatRoomModelImpl(
id: json['id'] as String,
chatRoomSettings: ChatRoomSettingsModel.fromJson(json['chat_room_setting'] as Map<String, dynamic>),
chatRoomSettings: ChatRoomSettingsModel.fromJson(
json['chat_room_setting'] as Map<String, dynamic>),
users: (json['users'] as Map<String, dynamic>).map(
(k, e) => MapEntry(k, ChatUserModel.fromJson(e as Map<String, dynamic>)),
(k, e) =>
MapEntry(k, ChatUserModel.fromJson(e as Map<String, dynamic>)),
),
);
Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$ChatRoomModelImplToJson(_$ChatRoomModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'chat_room_setting': instance.chatRoomSettings,
'users': instance.users,

View File

@@ -14,36 +14,33 @@ 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');
ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(Map<String, dynamic> json) {
ChatRoomSettingsModel _$ChatRoomSettingsModelFromJson(
Map<String, dynamic> json) {
return _ChatRoomSettingsModel.fromJson(json);
}
/// @nodoc
mixin _$ChatRoomSettingsModel {
int get id => throw _privateConstructorUsedError;
@JsonKey(name: 'room_name')
String get roomName => throw _privateConstructorUsedError;
String get state => throw _privateConstructorUsedError;
@JsonKey(name: 'access_level')
String get accessLevel => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ChatRoomSettingsModelCopyWith<ChatRoomSettingsModel> get copyWith => throw _privateConstructorUsedError;
$ChatRoomSettingsModelCopyWith<ChatRoomSettingsModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatRoomSettingsModelCopyWith<$Res> {
factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value, $Res Function(ChatRoomSettingsModel) then) =
factory $ChatRoomSettingsModelCopyWith(ChatRoomSettingsModel value,
$Res Function(ChatRoomSettingsModel) then) =
_$ChatRoomSettingsModelCopyWithImpl<$Res, ChatRoomSettingsModel>;
@useResult
$Res call(
{int id,
@@ -54,12 +51,13 @@ abstract class $ChatRoomSettingsModelCopyWith<$Res> {
}
/// @nodoc
class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsModel> implements $ChatRoomSettingsModelCopyWith<$Res> {
class _$ChatRoomSettingsModelCopyWithImpl<$Res,
$Val extends ChatRoomSettingsModel>
implements $ChatRoomSettingsModelCopyWith<$Res> {
_$ChatRoomSettingsModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -98,10 +96,12 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res, $Val extends ChatRoomSettingsMod
}
/// @nodoc
abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSettingsModelCopyWith<$Res> {
factory _$$ChatRoomSettingsModelImplCopyWith(_$ChatRoomSettingsModelImpl value, $Res Function(_$ChatRoomSettingsModelImpl) then) =
abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res>
implements $ChatRoomSettingsModelCopyWith<$Res> {
factory _$$ChatRoomSettingsModelImplCopyWith(
_$ChatRoomSettingsModelImpl value,
$Res Function(_$ChatRoomSettingsModelImpl) then) =
__$$ChatRoomSettingsModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
@@ -113,9 +113,13 @@ abstract class _$$ChatRoomSettingsModelImplCopyWith<$Res> implements $ChatRoomSe
}
/// @nodoc
class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res> extends _$ChatRoomSettingsModelCopyWithImpl<$Res, _$ChatRoomSettingsModelImpl>
class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>
extends _$ChatRoomSettingsModelCopyWithImpl<$Res,
_$ChatRoomSettingsModelImpl>
implements _$$ChatRoomSettingsModelImplCopyWith<$Res> {
__$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value, $Res Function(_$ChatRoomSettingsModelImpl) _then) : super(_value, _then);
__$$ChatRoomSettingsModelImplCopyWithImpl(_$ChatRoomSettingsModelImpl _value,
$Res Function(_$ChatRoomSettingsModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -161,7 +165,8 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
@JsonKey(name: 'access_level') required this.accessLevel,
@JsonKey(name: 'updated_at') required this.updatedAt});
factory _$ChatRoomSettingsModelImpl.fromJson(Map<String, dynamic> json) => _$$ChatRoomSettingsModelImplFromJson(json);
factory _$ChatRoomSettingsModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatRoomSettingsModelImplFromJson(json);
@override
final int id;
@@ -188,21 +193,26 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
(other.runtimeType == runtimeType &&
other is _$ChatRoomSettingsModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.roomName, roomName) || other.roomName == roomName) &&
(identical(other.roomName, roomName) ||
other.roomName == roomName) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.accessLevel, accessLevel) || other.accessLevel == accessLevel) &&
(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
(identical(other.accessLevel, accessLevel) ||
other.accessLevel == accessLevel) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt);
int get hashCode =>
Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith =>
__$$ChatRoomSettingsModelImplCopyWithImpl<_$ChatRoomSettingsModelImpl>(this, _$identity);
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith => __$$ChatRoomSettingsModelImplCopyWithImpl<
_$ChatRoomSettingsModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -214,33 +224,31 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel {
const factory _ChatRoomSettingsModel(
{required final int id,
@JsonKey(name: 'room_name') required final String roomName,
required final String state,
@JsonKey(name: 'access_level') required final String accessLevel,
@JsonKey(name: 'updated_at') required final String updatedAt}) = _$ChatRoomSettingsModelImpl;
{required final int id,
@JsonKey(name: 'room_name') required final String roomName,
required final String state,
@JsonKey(name: 'access_level') required final String accessLevel,
@JsonKey(name: 'updated_at') required final String updatedAt}) =
_$ChatRoomSettingsModelImpl;
factory _ChatRoomSettingsModel.fromJson(Map<String, dynamic> json) = _$ChatRoomSettingsModelImpl.fromJson;
factory _ChatRoomSettingsModel.fromJson(Map<String, dynamic> json) =
_$ChatRoomSettingsModelImpl.fromJson;
@override
int get id;
@override
@JsonKey(name: 'room_name')
String get roomName;
@override
String get state;
@override
@JsonKey(name: 'access_level')
String get accessLevel;
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
@override
@JsonKey(ignore: true)
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -6,7 +6,9 @@ part of 'chat_room_settings_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map<String, dynamic> json) => _$ChatRoomSettingsModelImpl(
_$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(
Map<String, dynamic> json) =>
_$ChatRoomSettingsModelImpl(
id: (json['id'] as num).toInt(),
roomName: json['room_name'] as String,
state: json['state'] as String,
@@ -14,7 +16,9 @@ _$ChatRoomSettingsModelImpl _$$ChatRoomSettingsModelImplFromJson(Map<String, dyn
updatedAt: json['updated_at'] as String,
);
Map<String, dynamic> _$$ChatRoomSettingsModelImplToJson(_$ChatRoomSettingsModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$ChatRoomSettingsModelImplToJson(
_$ChatRoomSettingsModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'room_name': instance.roomName,
'state': instance.state,

View File

@@ -21,36 +21,38 @@ ChatUserModel _$ChatUserModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$ChatUserModel {
int get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
@JsonKey(name: 'profile_photo_path')
String? get profilePhotoPath => throw _privateConstructorUsedError;
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$ChatUserModelCopyWith<ChatUserModel> get copyWith => throw _privateConstructorUsedError;
$ChatUserModelCopyWith<ChatUserModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ChatUserModelCopyWith<$Res> {
factory $ChatUserModelCopyWith(ChatUserModel value, $Res Function(ChatUserModel) then) = _$ChatUserModelCopyWithImpl<$Res, ChatUserModel>;
factory $ChatUserModelCopyWith(
ChatUserModel value, $Res Function(ChatUserModel) then) =
_$ChatUserModelCopyWithImpl<$Res, ChatUserModel>;
@useResult
$Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
$Res call(
{int id,
String name,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
}
/// @nodoc
class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $ChatUserModelCopyWith<$Res> {
class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel>
implements $ChatUserModelCopyWith<$Res> {
_$ChatUserModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -84,17 +86,27 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel> implements $
}
/// @nodoc
abstract class _$$ChatUserModelImplCopyWith<$Res> implements $ChatUserModelCopyWith<$Res> {
factory _$$ChatUserModelImplCopyWith(_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) = __$$ChatUserModelImplCopyWithImpl<$Res>;
abstract class _$$ChatUserModelImplCopyWith<$Res>
implements $ChatUserModelCopyWith<$Res> {
factory _$$ChatUserModelImplCopyWith(
_$ChatUserModelImpl value, $Res Function(_$ChatUserModelImpl) then) =
__$$ChatUserModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, String name, @JsonKey(name: 'profile_photo_path') String? profilePhotoPath, @JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
$Res call(
{int id,
String name,
@JsonKey(name: 'profile_photo_path') String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') String? profilePhotoUrl});
}
/// @nodoc
class __$$ChatUserModelImplCopyWithImpl<$Res> extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl> implements _$$ChatUserModelImplCopyWith<$Res> {
__$$ChatUserModelImplCopyWithImpl(_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then) : super(_value, _then);
class __$$ChatUserModelImplCopyWithImpl<$Res>
extends _$ChatUserModelCopyWithImpl<$Res, _$ChatUserModelImpl>
implements _$$ChatUserModelImplCopyWith<$Res> {
__$$ChatUserModelImplCopyWithImpl(
_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -134,7 +146,8 @@ class _$ChatUserModelImpl implements _ChatUserModel {
@JsonKey(name: 'profile_photo_path') this.profilePhotoPath,
@JsonKey(name: 'profile_photo_url') this.profilePhotoUrl});
factory _$ChatUserModelImpl.fromJson(Map<String, dynamic> json) => _$$ChatUserModelImplFromJson(json);
factory _$ChatUserModelImpl.fromJson(Map<String, dynamic> json) =>
_$$ChatUserModelImplFromJson(json);
@override
final int id;
@@ -159,18 +172,22 @@ class _$ChatUserModelImpl implements _ChatUserModel {
other is _$ChatUserModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.profilePhotoPath, profilePhotoPath) || other.profilePhotoPath == profilePhotoPath) &&
(identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl));
(identical(other.profilePhotoPath, profilePhotoPath) ||
other.profilePhotoPath == profilePhotoPath) &&
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
int get hashCode =>
Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => __$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity);
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
__$$ChatUserModelImplCopyWithImpl<_$ChatUserModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -182,28 +199,27 @@ class _$ChatUserModelImpl implements _ChatUserModel {
abstract class _ChatUserModel implements ChatUserModel {
const factory _ChatUserModel(
{required final int id,
required final String name,
@JsonKey(name: 'profile_photo_path') final String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) = _$ChatUserModelImpl;
{required final int id,
required final String name,
@JsonKey(name: 'profile_photo_path') final String? profilePhotoPath,
@JsonKey(name: 'profile_photo_url') final String? profilePhotoUrl}) =
_$ChatUserModelImpl;
factory _ChatUserModel.fromJson(Map<String, dynamic> json) = _$ChatUserModelImpl.fromJson;
factory _ChatUserModel.fromJson(Map<String, dynamic> json) =
_$ChatUserModelImpl.fromJson;
@override
int get id;
@override
String get name;
@override
@JsonKey(name: 'profile_photo_path')
String? get profilePhotoPath;
@override
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl;
@override
@JsonKey(ignore: true)
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -6,14 +6,16 @@ part of 'chat_user_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map<String, dynamic> json) => _$ChatUserModelImpl(
_$ChatUserModelImpl _$$ChatUserModelImplFromJson(Map<String, dynamic> json) =>
_$ChatUserModelImpl(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
profilePhotoPath: json['profile_photo_path'] as String?,
profilePhotoUrl: json['profile_photo_url'] as String?,
);
Map<String, dynamic> _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$ChatUserModelImplToJson(_$ChatUserModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'profile_photo_path': instance.profilePhotoPath,

View File

@@ -21,38 +21,39 @@ WebsocketInfoModel _$WebsocketInfoModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$WebsocketInfoModel {
String get key => throw _privateConstructorUsedError;
String get host => throw _privateConstructorUsedError;
String get port => throw _privateConstructorUsedError;
String get cluster => throw _privateConstructorUsedError;
@JsonKey(name: 'user_id')
int get userId => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith => throw _privateConstructorUsedError;
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $WebsocketInfoModelCopyWith<$Res> {
factory $WebsocketInfoModelCopyWith(WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) =
factory $WebsocketInfoModelCopyWith(
WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) =
_$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>;
@useResult
$Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId});
$Res call(
{String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId});
}
/// @nodoc
class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> implements $WebsocketInfoModelCopyWith<$Res> {
class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
implements $WebsocketInfoModelCopyWith<$Res> {
_$WebsocketInfoModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@@ -91,19 +92,28 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel> im
}
/// @nodoc
abstract class _$$WebsocketInfoModelImplCopyWith<$Res> implements $WebsocketInfoModelCopyWith<$Res> {
factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value, $Res Function(_$WebsocketInfoModelImpl) then) =
abstract class _$$WebsocketInfoModelImplCopyWith<$Res>
implements $WebsocketInfoModelCopyWith<$Res> {
factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value,
$Res Function(_$WebsocketInfoModelImpl) then) =
__$$WebsocketInfoModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String key, String host, String port, String cluster, @JsonKey(name: 'user_id') int userId});
$Res call(
{String key,
String host,
String port,
String cluster,
@JsonKey(name: 'user_id') int userId});
}
/// @nodoc
class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl>
class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
extends _$WebsocketInfoModelCopyWithImpl<$Res, _$WebsocketInfoModelImpl>
implements _$$WebsocketInfoModelImplCopyWith<$Res> {
__$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value, $Res Function(_$WebsocketInfoModelImpl) _then) : super(_value, _then);
__$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value,
$Res Function(_$WebsocketInfoModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -143,9 +153,14 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res> extends _$WebsocketInfoModelC
@JsonSerializable()
class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
const _$WebsocketInfoModelImpl(
{required this.key, required this.host, required this.port, required this.cluster, @JsonKey(name: 'user_id') required this.userId});
{required this.key,
required this.host,
required this.port,
required this.cluster,
@JsonKey(name: 'user_id') required this.userId});
factory _$WebsocketInfoModelImpl.fromJson(Map<String, dynamic> json) => _$$WebsocketInfoModelImplFromJson(json);
factory _$WebsocketInfoModelImpl.fromJson(Map<String, dynamic> json) =>
_$$WebsocketInfoModelImplFromJson(json);
@override
final String key;
@@ -178,13 +193,15 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, key, host, port, cluster, userId);
int get hashCode =>
Object.hash(runtimeType, key, host, port, cluster, userId);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
__$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(this, _$identity);
__$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -196,31 +213,29 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
abstract class _WebsocketInfoModel implements WebsocketInfoModel {
const factory _WebsocketInfoModel(
{required final String key,
required final String host,
required final String port,
required final String cluster,
@JsonKey(name: 'user_id') required final int userId}) = _$WebsocketInfoModelImpl;
{required final String key,
required final String host,
required final String port,
required final String cluster,
@JsonKey(name: 'user_id') required final int userId}) =
_$WebsocketInfoModelImpl;
factory _WebsocketInfoModel.fromJson(Map<String, dynamic> json) = _$WebsocketInfoModelImpl.fromJson;
factory _WebsocketInfoModel.fromJson(Map<String, dynamic> json) =
_$WebsocketInfoModelImpl.fromJson;
@override
String get key;
@override
String get host;
@override
String get port;
@override
String get cluster;
@override
@JsonKey(name: 'user_id')
int get userId;
@override
@JsonKey(ignore: true)
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith => throw _privateConstructorUsedError;
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -6,7 +6,9 @@ part of 'websocket_info_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map<String, dynamic> json) => _$WebsocketInfoModelImpl(
_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(
Map<String, dynamic> json) =>
_$WebsocketInfoModelImpl(
key: json['key'] as String,
host: json['host'] as String,
port: json['port'] as String,
@@ -14,7 +16,9 @@ _$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(Map<String, dynamic>
userId: (json['user_id'] as num).toInt(),
);
Map<String, dynamic> _$$WebsocketInfoModelImplToJson(_$WebsocketInfoModelImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$WebsocketInfoModelImplToJson(
_$WebsocketInfoModelImpl instance) =>
<String, dynamic>{
'key': instance.key,
'host': instance.host,
'port': instance.port,

View File

@@ -98,6 +98,7 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
privateChatChannel.subscribe();
privateChatChannel.bind('App\\Events\\ChatMessageUpdated').listen((event) {
print(jsonDecode(event.data));
List<ChatMessageModel> messagesList = [
ChatMessageModel.fromJson(jsonDecode(event.data)['message']),
...(state as ChatRoomStateLoaded).chatMessages,
@@ -138,10 +139,14 @@ class ChatRoomCubit extends Cubit<ChatRoomState> {
sendMessage({
required String chatId,
required String data,
required List<File> filesList,
String? data,
List<File>? files,
}) async {
await chatRepository.sendMessage(chatId: chatId, data: data);
await chatRepository.sendMessage(
chatId: chatId,
data: data,
files: files,
);
}
@override

View File

@@ -20,16 +20,19 @@ mixin _$ChatRoomState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading) loaded,
required TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult? Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@@ -37,7 +40,9 @@ mixin _$ChatRoomState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
@@ -71,28 +76,36 @@ mixin _$ChatRoomState {
/// @nodoc
abstract class $ChatRoomStateCopyWith<$Res> {
factory $ChatRoomStateCopyWith(ChatRoomState value, $Res Function(ChatRoomState) then) = _$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>;
factory $ChatRoomStateCopyWith(
ChatRoomState value, $Res Function(ChatRoomState) then) =
_$ChatRoomStateCopyWithImpl<$Res, ChatRoomState>;
}
/// @nodoc
class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState> implements $ChatRoomStateCopyWith<$Res> {
class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState>
implements $ChatRoomStateCopyWith<$Res> {
_$ChatRoomStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$ChatRoomStateImplCopyWith<$Res> {
factory _$$ChatRoomStateImplCopyWith(_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) = __$$ChatRoomStateImplCopyWithImpl<$Res>;
factory _$$ChatRoomStateImplCopyWith(
_$ChatRoomStateImpl value, $Res Function(_$ChatRoomStateImpl) then) =
__$$ChatRoomStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ChatRoomStateImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl> implements _$$ChatRoomStateImplCopyWith<$Res> {
__$$ChatRoomStateImplCopyWithImpl(_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then) : super(_value, _then);
class __$$ChatRoomStateImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateImpl>
implements _$$ChatRoomStateImplCopyWith<$Res> {
__$$ChatRoomStateImplCopyWithImpl(
_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -107,7 +120,8 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$ChatRoomStateImpl);
}
@override
@@ -118,7 +132,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading) loaded,
required TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -129,7 +145,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult? Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -140,7 +158,9 @@ class _$ChatRoomStateImpl implements _ChatRoomState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -194,14 +214,18 @@ abstract class _ChatRoomState implements ChatRoomState {
/// @nodoc
abstract class _$$ChatRoomStateLoadingImplCopyWith<$Res> {
factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value, $Res Function(_$ChatRoomStateLoadingImpl) then) =
factory _$$ChatRoomStateLoadingImplCopyWith(_$ChatRoomStateLoadingImpl value,
$Res Function(_$ChatRoomStateLoadingImpl) then) =
__$$ChatRoomStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl>
class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadingImpl>
implements _$$ChatRoomStateLoadingImplCopyWith<$Res> {
__$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value, $Res Function(_$ChatRoomStateLoadingImpl) _then) : super(_value, _then);
__$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value,
$Res Function(_$ChatRoomStateLoadingImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -216,7 +240,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChatRoomStateLoadingImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatRoomStateLoadingImpl);
}
@override
@@ -227,7 +253,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading) loaded,
required TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loading();
@@ -238,7 +266,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult? Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loading?.call();
@@ -249,7 +279,9 @@ class _$ChatRoomStateLoadingImpl implements ChatRoomStateLoading {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -303,19 +335,26 @@ abstract class ChatRoomStateLoading implements ChatRoomState {
/// @nodoc
abstract class _$$ChatRoomStateLoadedImplCopyWith<$Res> {
factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value, $Res Function(_$ChatRoomStateLoadedImpl) then) =
factory _$$ChatRoomStateLoadedImplCopyWith(_$ChatRoomStateLoadedImpl value,
$Res Function(_$ChatRoomStateLoadedImpl) then) =
__$$ChatRoomStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading});
$Res call(
{ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages,
bool isTyping,
bool isLoading});
$ChatRoomModelCopyWith<$Res> get chatRoom;
}
/// @nodoc
class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl>
class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateLoadedImpl>
implements _$$ChatRoomStateLoadedImplCopyWith<$Res> {
__$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value, $Res Function(_$ChatRoomStateLoadedImpl) _then) : super(_value, _then);
__$$ChatRoomStateLoadedImplCopyWithImpl(_$ChatRoomStateLoadedImpl _value,
$Res Function(_$ChatRoomStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -357,13 +396,16 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyW
/// @nodoc
class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
const _$ChatRoomStateLoadedImpl({required this.chatRoom, required final List<ChatMessageModel> chatMessages, required this.isTyping, required this.isLoading})
const _$ChatRoomStateLoadedImpl(
{required this.chatRoom,
required final List<ChatMessageModel> chatMessages,
required this.isTyping,
required this.isLoading})
: _chatMessages = chatMessages;
@override
final ChatRoomModel chatRoom;
final List<ChatMessageModel> _chatMessages;
@override
List<ChatMessageModel> get chatMessages {
if (_chatMessages is EqualUnmodifiableListView) return _chatMessages;
@@ -386,27 +428,35 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatRoomStateLoadedImpl &&
(identical(other.chatRoom, chatRoom) || other.chatRoom == chatRoom) &&
const DeepCollectionEquality().equals(other._chatMessages, _chatMessages) &&
(identical(other.isTyping, isTyping) || other.isTyping == isTyping) &&
(identical(other.isLoading, isLoading) || other.isLoading == isLoading));
(identical(other.chatRoom, chatRoom) ||
other.chatRoom == chatRoom) &&
const DeepCollectionEquality()
.equals(other._chatMessages, _chatMessages) &&
(identical(other.isTyping, isTyping) ||
other.isTyping == isTyping) &&
(identical(other.isLoading, isLoading) ||
other.isLoading == isLoading));
}
@override
int get hashCode => Object.hash(runtimeType, chatRoom, const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading);
int get hashCode => Object.hash(runtimeType, chatRoom,
const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
__$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(this, _$identity);
__$$ChatRoomStateLoadedImplCopyWithImpl<_$ChatRoomStateLoadedImpl>(
this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading) loaded,
required TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(chatRoom, chatMessages, isTyping, isLoading);
@@ -417,7 +467,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult? Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(chatRoom, chatMessages, isTyping, isLoading);
@@ -428,7 +480,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -484,30 +538,30 @@ abstract class ChatRoomStateLoaded implements ChatRoomState {
required final bool isLoading}) = _$ChatRoomStateLoadedImpl;
ChatRoomModel get chatRoom;
List<ChatMessageModel> get chatMessages;
bool get isTyping;
bool get isLoading;
@JsonKey(ignore: true)
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$ChatRoomStateErrorImplCopyWith<$Res> {
factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value, $Res Function(_$ChatRoomStateErrorImpl) then) =
factory _$$ChatRoomStateErrorImplCopyWith(_$ChatRoomStateErrorImpl value,
$Res Function(_$ChatRoomStateErrorImpl) then) =
__$$ChatRoomStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$ChatRoomStateErrorImplCopyWithImpl<$Res> extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl>
class __$$ChatRoomStateErrorImplCopyWithImpl<$Res>
extends _$ChatRoomStateCopyWithImpl<$Res, _$ChatRoomStateErrorImpl>
implements _$$ChatRoomStateErrorImplCopyWith<$Res> {
__$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value, $Res Function(_$ChatRoomStateErrorImpl) _then) : super(_value, _then);
__$$ChatRoomStateErrorImplCopyWithImpl(_$ChatRoomStateErrorImpl _value,
$Res Function(_$ChatRoomStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -541,7 +595,8 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatRoomStateErrorImpl &&
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
@@ -551,14 +606,17 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
__$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(this, _$identity);
__$$ChatRoomStateErrorImplCopyWithImpl<_$ChatRoomStateErrorImpl>(
this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading) loaded,
required TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -569,7 +627,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult? Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -580,7 +640,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(ChatRoomModel chatRoom, List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)? loaded,
TResult Function(ChatRoomModel chatRoom,
List<ChatMessageModel> chatMessages, bool isTyping, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -629,10 +691,11 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
}
abstract class ChatRoomStateError implements ChatRoomState {
const factory ChatRoomStateError({required final String errorMessage}) = _$ChatRoomStateErrorImpl;
const factory ChatRoomStateError({required final String errorMessage}) =
_$ChatRoomStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -1,8 +1,11 @@
import 'dart:io';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';
@@ -124,6 +127,7 @@ class _ChatScreenState extends State<ChatScreen> {
(context, index) {
if (index < state.chatMessages.length) {
return ChatBubbleWidget(
sendTime: state.chatMessages[index].updatedAt,
text: state.chatMessages[index].data.trim(),
isCurrentUser: state.chatRoom.users['to_chat_user']!.id != state.chatMessages[index].authorId,
mediaData: state.chatMessages[index].mediaData ?? [],
@@ -144,14 +148,33 @@ class _ChatScreenState extends State<ChatScreen> {
),
),
),
Padding(
Container(
padding: EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Colors.black.withOpacity(0.1),
),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SizedBox(width: 8),
InkWell(
onTap: () {},
onTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
File file = File(result.files.single.path!);
context.read<ChatRoomCubit>().sendMessage(
chatId: widget.chatId,
files: [file],
);
} else {
// User canceled the picker
}
},
borderRadius: BorderRadius.circular(16),
child: Ink(
height: 32,
@@ -171,17 +194,15 @@ class _ChatScreenState extends State<ChatScreen> {
maxLines: 5,
minLines: 1,
keyboardType: TextInputType.multiline,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.black,
),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
hintText: 'Сообщение',
hintStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
height: 1,
color: Color(0xFFAEAEB2),
),
filled: true,
@@ -217,7 +238,6 @@ class _ChatScreenState extends State<ChatScreen> {
context.read<ChatRoomCubit>().sendMessage(
chatId: widget.chatId,
data: textEditingController.text.trim(),
filesList: [],
);
setState(() {
textEditingController.clear();

View File

@@ -9,11 +9,13 @@ import 'package:url_launcher/url_launcher.dart';
class ChatBubbleWidget extends StatelessWidget {
const ChatBubbleWidget({
super.key,
required this.sendTime,
required this.text,
required this.isCurrentUser,
required this.mediaData,
});
final String sendTime;
final String text;
final bool isCurrentUser;
final List<dynamic> mediaData;

View File

@@ -15,13 +15,13 @@ class ChatRepository {
Future<void> sendMessage({
required String chatId,
String? data,
List<File>? filesList,
List<File>? files,
}) async {
try {
await chatService.sendMessage(
id: chatId,
data: data,
filesList: filesList,
media_data: files,
);
} catch (e) {
print(e);

View File

@@ -18,10 +18,11 @@ abstract class ChatService {
});
@POST('/api/chat/{id}/message/send')
@MultiPart()
Future<void> sendMessage({
@Path() required String id,
@Part() String? data,
@Part() List<File>? filesList,
@Part() List<File>? media_data,
});
@GET('/api/chat/show/{id}/messages?page={page}')

View File

@@ -12,37 +12,46 @@ class _ChatService implements ChatService {
_ChatService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<Map<String, ChatRoomModel>> getChatRoom({required String id}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, ChatRoomModel>>(Options(
final _options = _setStreamType<Map<String, ChatRoomModel>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/chat/show/${id}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
var _value = _result.data!.map((k, dynamic v) =>
MapEntry(k, ChatRoomModel.fromJson(v as Map<String, dynamic>)));
.compose(
_dio.options,
'/api/chat/show/${id}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, ChatRoomModel> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, ChatRoomModel.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -50,7 +59,7 @@ class _ChatService implements ChatService {
Future<void> sendMessage({
required String id,
String? data,
List<File>? filesList,
List<File>? media_data,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
@@ -63,18 +72,19 @@ class _ChatService implements ChatService {
data,
));
}
if (filesList != null) {
_data.files.addAll(filesList.map((i) => MapEntry(
'filesList',
if (media_data != null) {
_data.files.addAll(media_data.map((i) => MapEntry(
'media_data',
MultipartFile.fromFileSync(
i.path,
filename: i.path.split(Platform.pathSeparator).last,
))));
}
await _dio.fetch<void>(_setStreamType<void>(Options(
final _options = _setStreamType<void>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
@@ -86,7 +96,8 @@ class _ChatService implements ChatService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
await _dio.fetch<void>(_options);
}
@override
@@ -98,24 +109,30 @@ class _ChatService implements ChatService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<ChatMessagesModel>(Options(
final _options = _setStreamType<ChatMessagesModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/chat/show/${id}/messages?page=${page}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = ChatMessagesModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/chat/show/${id}/messages?page=${page}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late ChatMessagesModel _value;
try {
_value = ChatMessagesModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -125,24 +142,30 @@ class _ChatService implements ChatService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<WebsocketInfoModel>(Options(
final _options = _setStreamType<WebsocketInfoModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/ws/params',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = WebsocketInfoModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/profile/ws/params',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late WebsocketInfoModel _value;
try {
_value = WebsocketInfoModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}

View File

@@ -12,36 +12,45 @@ class _DiaryService implements DiaryService {
_DiaryService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<Map<String, int>> getDiaryID() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<Map<String, int>>(Options(
final _options = _setStreamType<Map<String, int>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = _result.data!.cast<String, int>();
.compose(
_dio.options,
'/api/diary/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, int> _value;
try {
_value = _result.data!.cast<String, int>();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -51,25 +60,31 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, DiaryModel>>(Options(
final _options = _setStreamType<Map<String, DiaryModel>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${id}/show/',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
var _value = _result.data!.map((k, dynamic v) =>
MapEntry(k, DiaryModel.fromJson(v as Map<String, dynamic>)));
.compose(
_dio.options,
'/api/diary/${id}/show/',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, DiaryModel> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, DiaryModel.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -79,7 +94,7 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch(_setStreamType<dynamic>(Options(
final _options = _setStreamType<dynamic>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
@@ -94,7 +109,8 @@ class _DiaryService implements DiaryService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
final _result = await _dio.fetch(_options);
final _value = _result.data;
return _value;
}
@@ -105,28 +121,34 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{r'name': name};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, List<Product>>>(Options(
final _options = _setStreamType<Map<String, List<Product>>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/product_nutritional_values/filter',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
var _value = _result.data!.map((k, dynamic v) => MapEntry(
k,
(v as List)
.map((i) => Product.fromJson(i as Map<String, dynamic>))
.toList()));
.compose(
_dio.options,
'/api/diary/product_nutritional_values/filter',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, List<Product>> _value;
try {
_value = _result.data!.map((k, dynamic v) => MapEntry(
k,
(v as List)
.map((i) => Product.fromJson(i as Map<String, dynamic>))
.toList()));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -140,24 +162,30 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{r'satiety': satiety};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<Map<String, int>>(Options(
final _options = _setStreamType<Map<String, int>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/satiety/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = _result.data!.cast<String, int>();
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/satiety/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, int> _value;
try {
_value = _result.data!.cast<String, int>();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -171,24 +199,30 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{r'mood': mood};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<Map<String, int>>(Options(
final _options = _setStreamType<Map<String, int>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/mood/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = _result.data!.cast<String, int>();
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/mood/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, int> _value;
try {
_value = _result.data!.cast<String, int>();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -201,24 +235,30 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{r'wakeup': wakeup};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<DiaryModel>(Options(
final _options = _setStreamType<DiaryModel>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${diary_id}/wakeup/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = DiaryModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/diary/${diary_id}/wakeup/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late DiaryModel _value;
try {
_value = DiaryModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -231,24 +271,30 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{r'retire': retire};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<DiaryModel>(Options(
final _options = _setStreamType<DiaryModel>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${diary_id}/retire/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = DiaryModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/diary/${diary_id}/retire/fill',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late DiaryModel _value;
try {
_value = DiaryModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -268,25 +314,31 @@ class _DiaryService implements DiaryService {
};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, Portion>>(Options(
final _options = _setStreamType<Map<String, Portion>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/portions/create',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
var _value = _result.data!.map((k, dynamic v) =>
MapEntry(k, Portion.fromJson(v as Map<String, dynamic>)));
.compose(
_dio.options,
'/api/diary/${diary_id}/meal/${meal_id}/portions/create',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, Portion> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, Portion.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -307,7 +359,7 @@ class _DiaryService implements DiaryService {
filename: photo.path.split(Platform.pathSeparator).last,
),
));
await _dio.fetch<void>(_setStreamType<void>(Options(
final _options = _setStreamType<void>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
@@ -322,7 +374,8 @@ class _DiaryService implements DiaryService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
await _dio.fetch<void>(_options);
}
@override
@@ -343,24 +396,30 @@ class _DiaryService implements DiaryService {
};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, String>>(Options(
final _options = _setStreamType<Map<String, String>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diary/product_nutritional_values/sendToModeration',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = _result.data!.cast<String, String>();
.compose(
_dio.options,
'/api/diary/product_nutritional_values/sendToModeration',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, String> _value;
try {
_value = _result.data!.cast<String, String>();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -370,7 +429,7 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
await _dio.fetch<void>(_setStreamType<void>(Options(
final _options = _setStreamType<void>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
@@ -385,7 +444,8 @@ class _DiaryService implements DiaryService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
await _dio.fetch<void>(_options);
}
@override
@@ -398,7 +458,7 @@ class _DiaryService implements DiaryService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
await _dio.fetch<void>(_setStreamType<void>(Options(
final _options = _setStreamType<void>(Options(
method: 'DELETE',
headers: _headers,
extra: _extra,
@@ -413,7 +473,8 @@ class _DiaryService implements DiaryService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
await _dio.fetch<void>(_options);
}
@override
@@ -430,7 +491,7 @@ class _DiaryService implements DiaryService {
};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
await _dio.fetch<void>(_setStreamType<void>(Options(
final _options = _setStreamType<void>(Options(
method: 'DELETE',
headers: _headers,
extra: _extra,
@@ -445,7 +506,8 @@ class _DiaryService implements DiaryService {
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
)));
await _dio.fetch<void>(_options);
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {

File diff suppressed because it is too large Load Diff

View File

@@ -6,13 +6,19 @@ part of 'diets_pagination_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$DietsPaginationImpl _$$DietsPaginationImplFromJson(Map<String, dynamic> json) => _$DietsPaginationImpl(
data: (json['data'] as List<dynamic>).map((e) => Datum.fromJson(e as Map<String, dynamic>)).toList(),
_$DietsPaginationImpl _$$DietsPaginationImplFromJson(
Map<String, dynamic> json) =>
_$DietsPaginationImpl(
data: (json['data'] as List<dynamic>)
.map((e) => Datum.fromJson(e as Map<String, dynamic>))
.toList(),
links: Links.fromJson(json['links'] as Map<String, dynamic>),
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$DietsPaginationImplToJson(_$DietsPaginationImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$DietsPaginationImplToJson(
_$DietsPaginationImpl instance) =>
<String, dynamic>{
'data': instance.data,
'links': instance.links,
'meta': instance.meta,
@@ -27,7 +33,11 @@ _$DatumImpl _$$DatumImplFromJson(Map<String, dynamic> json) => _$DatumImpl(
type: Type.fromJson(json['type'] as Map<String, dynamic>),
details: json['details'] as String,
dailySchedule: (json['daily_schedule'] as List<dynamic>)
.map((e) => (e as List<dynamic>).map((e) => (e as List<dynamic>).map((e) => DailySchedule.fromJson(e as Map<String, dynamic>)).toList()).toList())
.map((e) => (e as List<dynamic>)
.map((e) => (e as List<dynamic>)
.map((e) => DailySchedule.fromJson(e as Map<String, dynamic>))
.toList())
.toList())
.toList(),
author: Author.fromJson(json['author'] as Map<String, dynamic>),
totalLikes: (json['total_likes'] as num).toInt(),
@@ -35,7 +45,8 @@ _$DatumImpl _$$DatumImplFromJson(Map<String, dynamic> json) => _$DatumImpl(
totalComments: (json['total_comments'] as num).toInt(),
);
Map<String, dynamic> _$$DatumImplToJson(_$DatumImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$DatumImplToJson(_$DatumImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'image': instance.image,
@@ -57,21 +68,24 @@ _$AuthorImpl _$$AuthorImplFromJson(Map<String, dynamic> json) => _$AuthorImpl(
authorIsMe: json['author_is_me'] as bool,
);
Map<String, dynamic> _$$AuthorImplToJson(_$AuthorImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$AuthorImplToJson(_$AuthorImpl instance) =>
<String, dynamic>{
'author_slug': instance.authorSlug,
'author_name': instance.authorName,
'author_profile_icon': instance.authorProfileIcon,
'author_is_me': instance.authorIsMe,
};
_$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map<String, dynamic> json) => _$DailyScheduleImpl(
_$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map<String, dynamic> json) =>
_$DailyScheduleImpl(
name: json['name'] as String,
uniq: json['uniq'] as String,
portion: $enumDecode(_$PortionEnumMap, json['portion']),
quantity: (json['quantity'] as num).toInt(),
);
Map<String, dynamic> _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) =>
<String, dynamic>{
'name': instance.name,
'uniq': instance.uniq,
'portion': _$PortionEnumMap[instance.portion]!,
@@ -91,7 +105,8 @@ _$TypeImpl _$$TypeImplFromJson(Map<String, dynamic> json) => _$TypeImpl(
meat: json['meat'] as bool?,
);
Map<String, dynamic> _$$TypeImplToJson(_$TypeImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$TypeImplToJson(_$TypeImpl instance) =>
<String, dynamic>{
'alko': instance.alko,
'veg': instance.veg,
'corb': instance.corb,
@@ -105,7 +120,8 @@ _$LinksImpl _$$LinksImplFromJson(Map<String, dynamic> json) => _$LinksImpl(
next: json['next'],
);
Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$LinksImplToJson(_$LinksImpl instance) =>
<String, dynamic>{
'first': instance.first,
'last': instance.last,
'prev': instance.prev,
@@ -116,14 +132,17 @@ _$MetaImpl _$$MetaImplFromJson(Map<String, dynamic> json) => _$MetaImpl(
currentPage: (json['current_page'] as num).toInt(),
from: (json['from'] as num).toInt(),
lastPage: (json['last_page'] as num).toInt(),
links: (json['links'] as List<dynamic>).map((e) => Link.fromJson(e as Map<String, dynamic>)).toList(),
links: (json['links'] as List<dynamic>)
.map((e) => Link.fromJson(e as Map<String, dynamic>))
.toList(),
path: json['path'] as String,
perPage: (json['per_page'] as num).toInt(),
to: (json['to'] as num).toInt(),
total: (json['total'] as num).toInt(),
);
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$MetaImplToJson(_$MetaImpl instance) =>
<String, dynamic>{
'current_page': instance.currentPage,
'from': instance.from,
'last_page': instance.lastPage,
@@ -140,7 +159,8 @@ _$LinkImpl _$$LinkImplFromJson(Map<String, dynamic> json) => _$LinkImpl(
active: json['active'] as bool,
);
Map<String, dynamic> _$$LinkImplToJson(_$LinkImpl instance) => <String, dynamic>{
Map<String, dynamic> _$$LinkImplToJson(_$LinkImpl instance) =>
<String, dynamic>{
'url': instance.url,
'label': instance.label,
'active': instance.active,

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -8,6 +9,7 @@ part 'feed_blog_post_settings_model.g.dart';
class FeedBlogPostSettingsModel with _$FeedBlogPostSettingsModel {
const factory FeedBlogPostSettingsModel({
@JsonKey(name: 'data') required List<FeedBlogPostModel> feedBlogPostList,
required Meta meta,
}) = _FeedBlogPostSettingsModel;
factory FeedBlogPostSettingsModel.fromJson(Map<String, Object?> json) => _$FeedBlogPostSettingsModelFromJson(json);

View File

@@ -24,6 +24,7 @@ mixin _$FeedBlogPostSettingsModel {
@JsonKey(name: 'data')
List<FeedBlogPostModel> get feedBlogPostList =>
throw _privateConstructorUsedError;
Meta get meta => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
@@ -37,7 +38,11 @@ abstract class $FeedBlogPostSettingsModelCopyWith<$Res> {
$Res Function(FeedBlogPostSettingsModel) then) =
_$FeedBlogPostSettingsModelCopyWithImpl<$Res, FeedBlogPostSettingsModel>;
@useResult
$Res call({@JsonKey(name: 'data') List<FeedBlogPostModel> feedBlogPostList});
$Res call(
{@JsonKey(name: 'data') List<FeedBlogPostModel> feedBlogPostList,
Meta meta});
$MetaCopyWith<$Res> get meta;
}
/// @nodoc
@@ -55,14 +60,27 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res,
@override
$Res call({
Object? feedBlogPostList = null,
Object? meta = null,
}) {
return _then(_value.copyWith(
feedBlogPostList: null == feedBlogPostList
? _value.feedBlogPostList
: feedBlogPostList // ignore: cast_nullable_to_non_nullable
as List<FeedBlogPostModel>,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
return $MetaCopyWith<$Res>(_value.meta, (value) {
return _then(_value.copyWith(meta: value) as $Val);
});
}
}
/// @nodoc
@@ -74,7 +92,12 @@ abstract class _$$FeedBlogPostSettingsModelImplCopyWith<$Res>
__$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: 'data') List<FeedBlogPostModel> feedBlogPostList});
$Res call(
{@JsonKey(name: 'data') List<FeedBlogPostModel> feedBlogPostList,
Meta meta});
@override
$MetaCopyWith<$Res> get meta;
}
/// @nodoc
@@ -91,12 +114,17 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>
@override
$Res call({
Object? feedBlogPostList = null,
Object? meta = null,
}) {
return _then(_$FeedBlogPostSettingsModelImpl(
feedBlogPostList: null == feedBlogPostList
? _value._feedBlogPostList
: feedBlogPostList // ignore: cast_nullable_to_non_nullable
as List<FeedBlogPostModel>,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
));
}
}
@@ -106,7 +134,8 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>
class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
const _$FeedBlogPostSettingsModelImpl(
{@JsonKey(name: 'data')
required final List<FeedBlogPostModel> feedBlogPostList})
required final List<FeedBlogPostModel> feedBlogPostList,
required this.meta})
: _feedBlogPostList = feedBlogPostList;
factory _$FeedBlogPostSettingsModelImpl.fromJson(Map<String, dynamic> json) =>
@@ -122,9 +151,12 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
return EqualUnmodifiableListView(_feedBlogPostList);
}
@override
final Meta meta;
@override
String toString() {
return 'FeedBlogPostSettingsModel(feedBlogPostList: $feedBlogPostList)';
return 'FeedBlogPostSettingsModel(feedBlogPostList: $feedBlogPostList, meta: $meta)';
}
@override
@@ -133,13 +165,14 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
(other.runtimeType == runtimeType &&
other is _$FeedBlogPostSettingsModelImpl &&
const DeepCollectionEquality()
.equals(other._feedBlogPostList, _feedBlogPostList));
.equals(other._feedBlogPostList, _feedBlogPostList) &&
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList));
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), meta);
@JsonKey(ignore: true)
@override
@@ -158,9 +191,9 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel {
const factory _FeedBlogPostSettingsModel(
{@JsonKey(name: 'data')
required final List<FeedBlogPostModel> feedBlogPostList}) =
_$FeedBlogPostSettingsModelImpl;
{@JsonKey(name: 'data')
required final List<FeedBlogPostModel> feedBlogPostList,
required final Meta meta}) = _$FeedBlogPostSettingsModelImpl;
factory _FeedBlogPostSettingsModel.fromJson(Map<String, dynamic> json) =
_$FeedBlogPostSettingsModelImpl.fromJson;
@@ -169,6 +202,8 @@ abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel {
@JsonKey(name: 'data')
List<FeedBlogPostModel> get feedBlogPostList;
@override
Meta get meta;
@override
@JsonKey(ignore: true)
_$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;

View File

@@ -12,10 +12,12 @@ _$FeedBlogPostSettingsModelImpl _$$FeedBlogPostSettingsModelImplFromJson(
feedBlogPostList: (json['data'] as List<dynamic>)
.map((e) => FeedBlogPostModel.fromJson(e as Map<String, dynamic>))
.toList(),
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$FeedBlogPostSettingsModelImplToJson(
_$FeedBlogPostSettingsModelImpl instance) =>
<String, dynamic>{
'data': instance.feedBlogPostList,
'meta': instance.meta,
};

View File

@@ -24,7 +24,6 @@ mixin _$DietsState {
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
@@ -71,28 +70,36 @@ mixin _$DietsState {
/// @nodoc
abstract class $DietsStateCopyWith<$Res> {
factory $DietsStateCopyWith(DietsState value, $Res Function(DietsState) then) = _$DietsStateCopyWithImpl<$Res, DietsState>;
factory $DietsStateCopyWith(
DietsState value, $Res Function(DietsState) then) =
_$DietsStateCopyWithImpl<$Res, DietsState>;
}
/// @nodoc
class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState> implements $DietsStateCopyWith<$Res> {
class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState>
implements $DietsStateCopyWith<$Res> {
_$DietsStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$DietsStateImplCopyWith<$Res> {
factory _$$DietsStateImplCopyWith(_$DietsStateImpl value, $Res Function(_$DietsStateImpl) then) = __$$DietsStateImplCopyWithImpl<$Res>;
factory _$$DietsStateImplCopyWith(
_$DietsStateImpl value, $Res Function(_$DietsStateImpl) then) =
__$$DietsStateImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$DietsStateImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateImpl> implements _$$DietsStateImplCopyWith<$Res> {
__$$DietsStateImplCopyWithImpl(_$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then) : super(_value, _then);
class __$$DietsStateImplCopyWithImpl<$Res>
extends _$DietsStateCopyWithImpl<$Res, _$DietsStateImpl>
implements _$$DietsStateImplCopyWith<$Res> {
__$$DietsStateImplCopyWithImpl(
_$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -107,7 +114,8 @@ class _$DietsStateImpl implements _DietsState {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$DietsStateImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$DietsStateImpl);
}
@override
@@ -194,14 +202,18 @@ abstract class _DietsState implements DietsState {
/// @nodoc
abstract class _$$DietsStateLoadingImplCopyWith<$Res> {
factory _$$DietsStateLoadingImplCopyWith(_$DietsStateLoadingImpl value, $Res Function(_$DietsStateLoadingImpl) then) =
factory _$$DietsStateLoadingImplCopyWith(_$DietsStateLoadingImpl value,
$Res Function(_$DietsStateLoadingImpl) then) =
__$$DietsStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$DietsStateLoadingImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadingImpl>
class __$$DietsStateLoadingImplCopyWithImpl<$Res>
extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadingImpl>
implements _$$DietsStateLoadingImplCopyWith<$Res> {
__$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value, $Res Function(_$DietsStateLoadingImpl) _then) : super(_value, _then);
__$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value,
$Res Function(_$DietsStateLoadingImpl) _then)
: super(_value, _then);
}
/// @nodoc
@@ -216,7 +228,8 @@ class _$DietsStateLoadingImpl implements DietsStateLoading {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType && other is _$DietsStateLoadingImpl);
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$DietsStateLoadingImpl);
}
@override
@@ -303,9 +316,9 @@ abstract class DietsStateLoading implements DietsState {
/// @nodoc
abstract class _$$DietsStateLoadedImplCopyWith<$Res> {
factory _$$DietsStateLoadedImplCopyWith(_$DietsStateLoadedImpl value, $Res Function(_$DietsStateLoadedImpl) then) =
factory _$$DietsStateLoadedImplCopyWith(_$DietsStateLoadedImpl value,
$Res Function(_$DietsStateLoadedImpl) then) =
__$$DietsStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({DietsPagination diets});
@@ -313,9 +326,12 @@ abstract class _$$DietsStateLoadedImplCopyWith<$Res> {
}
/// @nodoc
class __$$DietsStateLoadedImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadedImpl>
class __$$DietsStateLoadedImplCopyWithImpl<$Res>
extends _$DietsStateCopyWithImpl<$Res, _$DietsStateLoadedImpl>
implements _$$DietsStateLoadedImplCopyWith<$Res> {
__$$DietsStateLoadedImplCopyWithImpl(_$DietsStateLoadedImpl _value, $Res Function(_$DietsStateLoadedImpl) _then) : super(_value, _then);
__$$DietsStateLoadedImplCopyWithImpl(_$DietsStateLoadedImpl _value,
$Res Function(_$DietsStateLoadedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -355,7 +371,9 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded {
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$DietsStateLoadedImpl && (identical(other.diets, diets) || other.diets == diets));
(other.runtimeType == runtimeType &&
other is _$DietsStateLoadedImpl &&
(identical(other.diets, diets) || other.diets == diets));
}
@override
@@ -364,7 +382,9 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => __$$DietsStateLoadedImplCopyWithImpl<_$DietsStateLoadedImpl>(this, _$identity);
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
__$$DietsStateLoadedImplCopyWithImpl<_$DietsStateLoadedImpl>(
this, _$identity);
@override
@optionalTypeArgs
@@ -442,25 +462,31 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded {
}
abstract class DietsStateLoaded implements DietsState {
const factory DietsStateLoaded({required final DietsPagination diets}) = _$DietsStateLoadedImpl;
const factory DietsStateLoaded({required final DietsPagination diets}) =
_$DietsStateLoadedImpl;
DietsPagination get diets;
@JsonKey(ignore: true)
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$DietsStateErrorImplCopyWith<$Res> {
factory _$$DietsStateErrorImplCopyWith(_$DietsStateErrorImpl value, $Res Function(_$DietsStateErrorImpl) then) = __$$DietsStateErrorImplCopyWithImpl<$Res>;
factory _$$DietsStateErrorImplCopyWith(_$DietsStateErrorImpl value,
$Res Function(_$DietsStateErrorImpl) then) =
__$$DietsStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
/// @nodoc
class __$$DietsStateErrorImplCopyWithImpl<$Res> extends _$DietsStateCopyWithImpl<$Res, _$DietsStateErrorImpl> implements _$$DietsStateErrorImplCopyWith<$Res> {
__$$DietsStateErrorImplCopyWithImpl(_$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then) : super(_value, _then);
class __$$DietsStateErrorImplCopyWithImpl<$Res>
extends _$DietsStateCopyWithImpl<$Res, _$DietsStateErrorImpl>
implements _$$DietsStateErrorImplCopyWith<$Res> {
__$$DietsStateErrorImplCopyWithImpl(
_$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
@@ -494,7 +520,8 @@ class _$DietsStateErrorImpl implements DietsStateError {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DietsStateErrorImpl &&
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage));
}
@override
@@ -503,7 +530,9 @@ class _$DietsStateErrorImpl implements DietsStateError {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => __$$DietsStateErrorImplCopyWithImpl<_$DietsStateErrorImpl>(this, _$identity);
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
__$$DietsStateErrorImplCopyWithImpl<_$DietsStateErrorImpl>(
this, _$identity);
@override
@optionalTypeArgs
@@ -581,10 +610,11 @@ class _$DietsStateErrorImpl implements DietsStateError {
}
abstract class DietsStateError implements DietsState {
const factory DietsStateError({required final String errorMessage}) = _$DietsStateErrorImpl;
const factory DietsStateError({required final String errorMessage}) =
_$DietsStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -4,15 +4,47 @@ import 'package:eatvio_app/features/feed/repositories/feed_repository.dart';
class FeedCubit extends Cubit<FeedState> {
final FeedRepository feedRepository;
int currentPage = 1;
final int lastPage = 7;
bool isLoading = false;
FeedCubit({required this.feedRepository}) : super(const FeedState.loading());
loadFeedBlogPostList() async {
try {
final feedBlogPostList = await feedRepository.getFeedBlogPostList();
emit(FeedState.loaded(feedBlogPostList: feedBlogPostList));
final feedBlogPosts = await feedRepository.getFeedBlogPosts();
emit(
FeedState.loaded(
feedBlogPostList: feedBlogPosts.feedBlogPostList,
isLoading: false,
),
);
} catch (e) {
emit(FeedState.error(errorMessage: e.toString()));
}
}
loadNextPage() async {
print('start');
try {
if (lastPage < currentPage) {
currentPage++;
final feedBlogPosts = await feedRepository.getFeedBlogPosts(page: currentPage);
emit(
FeedState.loaded(
feedBlogPostList: [
...(state as FeedStateLoaded).feedBlogPostList,
...feedBlogPosts.feedBlogPostList,
],
isLoading: false,
),
);
}
} catch (e) {
print('error bro');
print(e.toString());
} finally {
print('end');
}
}
}

View File

@@ -11,6 +11,7 @@ abstract class FeedState with _$FeedState {
const factory FeedState.loaded({
required List<FeedBlogPostModel> feedBlogPostList,
required bool isLoading,
}) = FeedStateLoaded;
const factory FeedState.error({

View File

@@ -20,7 +20,9 @@ mixin _$FeedState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(List<FeedBlogPostModel> feedBlogPostList) loaded,
required TResult Function(
List<FeedBlogPostModel> feedBlogPostList, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) =>
throw _privateConstructorUsedError;
@@ -28,7 +30,8 @@ mixin _$FeedState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
throw _privateConstructorUsedError;
@@ -36,7 +39,8 @@ mixin _$FeedState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) =>
@@ -125,7 +129,9 @@ class _$FeedStateImpl implements _FeedState {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(List<FeedBlogPostModel> feedBlogPostList) loaded,
required TResult Function(
List<FeedBlogPostModel> feedBlogPostList, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return $default();
@@ -136,7 +142,8 @@ class _$FeedStateImpl implements _FeedState {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return $default?.call();
@@ -147,7 +154,8 @@ class _$FeedStateImpl implements _FeedState {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -239,7 +247,9 @@ class _$FeedStateLoadingImpl implements FeedStateLoading {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(List<FeedBlogPostModel> feedBlogPostList) loaded,
required TResult Function(
List<FeedBlogPostModel> feedBlogPostList, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loading();
@@ -250,7 +260,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loading?.call();
@@ -261,7 +272,8 @@ class _$FeedStateLoadingImpl implements FeedStateLoading {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
@@ -319,7 +331,7 @@ abstract class _$$FeedStateLoadedImplCopyWith<$Res> {
$Res Function(_$FeedStateLoadedImpl) then) =
__$$FeedStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({List<FeedBlogPostModel> feedBlogPostList});
$Res call({List<FeedBlogPostModel> feedBlogPostList, bool isLoading});
}
/// @nodoc
@@ -334,12 +346,17 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res>
@override
$Res call({
Object? feedBlogPostList = null,
Object? isLoading = null,
}) {
return _then(_$FeedStateLoadedImpl(
feedBlogPostList: null == feedBlogPostList
? _value._feedBlogPostList
: feedBlogPostList // ignore: cast_nullable_to_non_nullable
as List<FeedBlogPostModel>,
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
@@ -348,7 +365,8 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res>
class _$FeedStateLoadedImpl implements FeedStateLoaded {
const _$FeedStateLoadedImpl(
{required final List<FeedBlogPostModel> feedBlogPostList})
{required final List<FeedBlogPostModel> feedBlogPostList,
required this.isLoading})
: _feedBlogPostList = feedBlogPostList;
final List<FeedBlogPostModel> _feedBlogPostList;
@@ -360,9 +378,12 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
return EqualUnmodifiableListView(_feedBlogPostList);
}
@override
final bool isLoading;
@override
String toString() {
return 'FeedState.loaded(feedBlogPostList: $feedBlogPostList)';
return 'FeedState.loaded(feedBlogPostList: $feedBlogPostList, isLoading: $isLoading)';
}
@override
@@ -371,12 +392,14 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
(other.runtimeType == runtimeType &&
other is _$FeedStateLoadedImpl &&
const DeepCollectionEquality()
.equals(other._feedBlogPostList, _feedBlogPostList));
.equals(other._feedBlogPostList, _feedBlogPostList) &&
(identical(other.isLoading, isLoading) ||
other.isLoading == isLoading));
}
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_feedBlogPostList));
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), isLoading);
@JsonKey(ignore: true)
@override
@@ -390,10 +413,12 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(List<FeedBlogPostModel> feedBlogPostList) loaded,
required TResult Function(
List<FeedBlogPostModel> feedBlogPostList, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(feedBlogPostList);
return loaded(feedBlogPostList, isLoading);
}
@override
@@ -401,10 +426,11 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(feedBlogPostList);
return loaded?.call(feedBlogPostList, isLoading);
}
@override
@@ -412,12 +438,13 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(feedBlogPostList);
return loaded(feedBlogPostList, isLoading);
}
return orElse();
}
@@ -462,10 +489,11 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
abstract class FeedStateLoaded implements FeedState {
const factory FeedStateLoaded(
{required final List<FeedBlogPostModel> feedBlogPostList}) =
_$FeedStateLoadedImpl;
{required final List<FeedBlogPostModel> feedBlogPostList,
required final bool isLoading}) = _$FeedStateLoadedImpl;
List<FeedBlogPostModel> get feedBlogPostList;
bool get isLoading;
@JsonKey(ignore: true)
_$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
@@ -539,7 +567,9 @@ class _$FeedStateErrorImpl implements FeedStateError {
TResult when<TResult extends Object?>(
TResult Function() $default, {
required TResult Function() loading,
required TResult Function(List<FeedBlogPostModel> feedBlogPostList) loaded,
required TResult Function(
List<FeedBlogPostModel> feedBlogPostList, bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return error(errorMessage);
@@ -550,7 +580,8 @@ class _$FeedStateErrorImpl implements FeedStateError {
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult? Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return error?.call(errorMessage);
@@ -561,7 +592,8 @@ class _$FeedStateErrorImpl implements FeedStateError {
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<FeedBlogPostModel> feedBlogPostList)? loaded,
TResult Function(List<FeedBlogPostModel> feedBlogPostList, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {

View File

@@ -94,6 +94,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else if (state is DietsStateError) {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
@@ -103,6 +104,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
),
@@ -133,6 +135,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else if (state is FeedStateError) {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
@@ -142,6 +145,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
),
@@ -172,6 +176,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else if (state is RecipesStateError) {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
@@ -181,6 +186,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
} else {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
),

View File

@@ -4,7 +4,9 @@ import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
class BlogPostWidget extends StatefulWidget {
final FeedBlogPostModel feedBlogPostModel;
@@ -70,12 +72,15 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
if (widget.feedBlogPostModel.title.isNotEmpty && widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
widget.feedBlogPostModel.description,
style: TextStyle(
color: Colors.black87,
),
child: Html(
data: widget.feedBlogPostModel.description,
),
// child: Text(
// widget.feedBlogPostModel.description,
// style: TextStyle(
// color: Colors.black87,
// ),
// ),
),
if (widget.feedBlogPostModel.title.isNotEmpty || widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8),
GestureDetector(
@@ -92,6 +97,7 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
tag: baseUrl + '/storage/' + widget.feedBlogPostModel.image,
child: CachedNetworkImage(
imageUrl: baseUrl + '/storage/' + widget.feedBlogPostModel.image,
errorWidget: (context, str, object) => SizedBox.shrink(),
),
),
),
@@ -100,18 +106,25 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
children: [
_iconButton(Icons.favorite_border_rounded, widget.feedBlogPostModel.totalLikes.toString()),
_iconButton(icon: Icons.favorite_border_rounded, text: widget.feedBlogPostModel.totalLikes.toString()),
SizedBox(width: 8),
_iconButton(
Icons.mode_comment_outlined,
widget.feedBlogPostModel.totalComments.toString(),
() => GoRouter.of(context).pushNamed(
icon: Icons.mode_comment_outlined,
text: widget.feedBlogPostModel.totalComments.toString(),
onTap: () => GoRouter.of(context).pushNamed(
'blogPostScreen',
extra: widget.feedBlogPostModel,
),
),
SizedBox(width: 8),
_iconButton(Icons.reply_rounded),
_iconButton(
icon: Icons.reply_rounded,
onTap: () => Share.shareUri(
Uri.parse(
baseUrl + '/ru/blog_post/' + widget.feedBlogPostModel.id.toString(),
),
),
),
Spacer(),
Icon(
Icons.visibility_rounded,
@@ -137,7 +150,7 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
);
}
_iconButton(IconData icon, [String? text, Function()? onTap]) {
_iconButton({required IconData icon, String? text, Function()? onTap}) {
return InkWell(
onTap: onTap ?? () {},
borderRadius: BorderRadius.circular(16),

View File

@@ -1,5 +1,5 @@
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/features/feed/services/feed_service.dart';
@@ -8,9 +8,9 @@ class FeedRepository {
FeedRepository({required this.feedService});
Future<List<FeedBlogPostModel>> getFeedBlogPostList() async {
Future<FeedBlogPostSettingsModel> getFeedBlogPosts({int page = 1}) async {
try {
return (await feedService.getBlocPostList()).feedBlogPostList;
return (await feedService.getBlocPostList(page: page));
} catch (e) {
rethrow;
}

View File

@@ -10,8 +10,10 @@ part 'feed_service.g.dart';
abstract class FeedService {
factory FeedService(Dio dio, {String baseUrl}) = _FeedService;
@GET('/api/blogPosts/index')
Future<FeedBlogPostSettingsModel> getBlocPostList();
@GET('/api/blogPosts/index?page={page}')
Future<FeedBlogPostSettingsModel> getBlocPostList({
@Path() required int page,
});
@GET('/api/recipes/index')
Future<RecipesPagination> getRecipes();

View File

@@ -12,36 +12,45 @@ class _FeedService implements FeedService {
_FeedService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<FeedBlogPostSettingsModel> getBlocPostList() async {
Future<FeedBlogPostSettingsModel> getBlocPostList({required int page}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<FeedBlogPostSettingsModel>(Options(
final _options = _setStreamType<FeedBlogPostSettingsModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/blogPosts/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = FeedBlogPostSettingsModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/blogPosts/index?page=${page}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late FeedBlogPostSettingsModel _value;
try {
_value = FeedBlogPostSettingsModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -51,24 +60,30 @@ class _FeedService implements FeedService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<RecipesPagination>(Options(
final _options = _setStreamType<RecipesPagination>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/recipes/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = RecipesPagination.fromJson(_result.data!);
.compose(
_dio.options,
'/api/recipes/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late RecipesPagination _value;
try {
_value = RecipesPagination.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -78,24 +93,30 @@ class _FeedService implements FeedService {
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<DietsPagination>(Options(
final _options = _setStreamType<DietsPagination>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/diets/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = DietsPagination.fromJson(_result.data!);
.compose(
_dio.options,
'/api/diets/index',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late DietsPagination _value;
try {
_value = DietsPagination.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}

View File

@@ -12,36 +12,45 @@ class _ProfileService implements ProfileService {
_ProfileService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<Profile> getProfileBySlug({required String slug}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result =
await _dio.fetch<Map<String, dynamic>>(_setStreamType<Profile>(Options(
final _options = _setStreamType<Profile>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/show/${slug}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = Profile.fromJson(_result.data!);
.compose(
_dio.options,
'/api/profile/show/${slug}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Profile _value;
try {
_value = Profile.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}

View File

@@ -0,0 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ImageImpl _$$ImageImplFromJson(Map<String, dynamic> json) => _$ImageImpl(
path: json['path'] as String,
);
Map<String, dynamic> _$$ImageImplToJson(_$ImageImpl instance) => <String, dynamic>{
'path': instance.path,
};

View File

@@ -12,12 +12,15 @@ class _RegistrationService implements RegistrationService {
_RegistrationService(
this._dio, {
this.baseUrl,
this.errorLogger,
});
final Dio _dio;
String? baseUrl;
final ParseErrorLogger? errorLogger;
@override
Future<Map<String, String>> register(
{required Map<String, dynamic> sheet}) async {
@@ -26,24 +29,30 @@ class _RegistrationService implements RegistrationService {
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(sheet);
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<Map<String, String>>(Options(
final _options = _setStreamType<Map<String, String>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/register',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = _result.data!.cast<String, String>();
.compose(
_dio.options,
'/api/register',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, String> _value;
try {
_value = _result.data!.cast<String, String>();
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -53,24 +62,30 @@ class _RegistrationService implements RegistrationService {
final queryParameters = <String, dynamic>{r'user_address': query};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
final _options = _setStreamType<LocationModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/location_by_address',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = LocationModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/location_by_address',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late LocationModel _value;
try {
_value = LocationModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@@ -86,24 +101,30 @@ class _RegistrationService implements RegistrationService {
};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
final _options = _setStreamType<LocationModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/location_by_coordinate',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final _value = LocationModel.fromJson(_result.data!);
.compose(
_dio.options,
'/api/location_by_coordinate',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late LocationModel _value;
try {
_value = LocationModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}

View File

@@ -73,7 +73,6 @@ class MyApp extends StatelessWidget {
],
child: MaterialApp.router(
theme: theme,
title: 'Eatvio',
routerConfig: AppRouter.appRouter,
debugShowCheckedModeBanner: false,
localizationsDelegates: [
@@ -85,7 +84,6 @@ class MyApp extends StatelessWidget {
supportedLocales: [
Locale(
'ru',
'',
),
],
),

View File

@@ -44,10 +44,13 @@ dependencies:
lazy_load_scrollview: ^1.3.0
badges: ^3.1.2
google_fonts: ^6.2.1
location: ^7.0.0
location: 6.0.2
syncfusion_flutter_charts: ^26.2.8
table_calendar: ^3.1.2
flutter_keyboard_visibility: ^6.0.0
share_plus: ^10.0.0
flutter_html: 3.0.0-beta.2
file_picker: ^8.1.1
dev_dependencies:
build_runner: ^2.4.11