refactor: profile model

This commit is contained in:
mso7nueh
2024-09-09 18:18:35 +03:00
parent 3ccf5b6d92
commit 8ea819c5bc
77 changed files with 2735 additions and 2950 deletions

View File

@@ -29,8 +29,12 @@ mixin _$ChatMessageModel {
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
/// Serializes this ChatMessageModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatMessageModelCopyWith<ChatMessageModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -59,6 +63,8 @@ class _$ChatMessageModelCopyWithImpl<$Res, $Val extends ChatMessageModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -117,6 +123,8 @@ class __$$ChatMessageModelImplCopyWithImpl<$Res>
$Res Function(_$ChatMessageModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -207,12 +215,14 @@ class _$ChatMessageModelImpl implements _ChatMessageModel {
other.updatedAt == updatedAt));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, data,
const DeepCollectionEquality().hash(_mediaData), authorId, updatedAt);
@JsonKey(ignore: true)
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
@@ -252,8 +262,11 @@ abstract class _ChatMessageModel implements ChatMessageModel {
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
/// Create a copy of ChatMessageModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatMessageModelImplCopyWith<_$ChatMessageModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -24,8 +24,12 @@ mixin _$ChatMessagesModel {
List<ChatMessageModel> get messagesList => throw _privateConstructorUsedError;
ChatMetaModel get meta => throw _privateConstructorUsedError;
/// Serializes this ChatMessagesModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatMessagesModelCopyWith<ChatMessagesModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -53,6 +57,8 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -71,6 +77,8 @@ class _$ChatMessagesModelCopyWithImpl<$Res, $Val extends ChatMessagesModel>
) as $Val);
}
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatMetaModelCopyWith<$Res> get meta {
@@ -104,6 +112,8 @@ class __$$ChatMessagesModelImplCopyWithImpl<$Res>
$Res Function(_$ChatMessagesModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -162,12 +172,14 @@ class _$ChatMessagesModelImpl implements _ChatMessagesModel {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_messagesList), meta);
@JsonKey(ignore: true)
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith =>
@@ -196,8 +208,11 @@ abstract class _ChatMessagesModel implements ChatMessagesModel {
List<ChatMessageModel> get messagesList;
@override
ChatMetaModel get meta;
/// Create a copy of ChatMessagesModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatMessagesModelImplCopyWith<_$ChatMessagesModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,8 +23,12 @@ mixin _$ChatMetaModel {
@JsonKey(name: "last_page")
int get lastPage => throw _privateConstructorUsedError;
/// Serializes this ChatMetaModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatMetaModelCopyWith<ChatMetaModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -48,6 +52,8 @@ class _$ChatMetaModelCopyWithImpl<$Res, $Val extends ChatMetaModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -81,6 +87,8 @@ class __$$ChatMetaModelImplCopyWithImpl<$Res>
_$ChatMetaModelImpl _value, $Res Function(_$ChatMetaModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -122,11 +130,13 @@ class _$ChatMetaModelImpl implements _ChatMetaModel {
other.lastPage == lastPage));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, lastPage);
@JsonKey(ignore: true)
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
@@ -151,8 +161,11 @@ abstract class _ChatMetaModel implements ChatMetaModel {
@override
@JsonKey(name: "last_page")
int get lastPage;
/// Create a copy of ChatMetaModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatMetaModelImplCopyWith<_$ChatMetaModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -26,8 +26,12 @@ mixin _$ChatRoomModel {
throw _privateConstructorUsedError;
Map<String, ChatUserModel> get users => throw _privateConstructorUsedError;
/// Serializes this ChatRoomModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomModelCopyWith<ChatRoomModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -57,6 +61,8 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -80,6 +86,8 @@ class _$ChatRoomModelCopyWithImpl<$Res, $Val extends ChatRoomModel>
) as $Val);
}
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatRoomSettingsModelCopyWith<$Res> get chatRoomSettings {
@@ -116,6 +124,8 @@ class __$$ChatRoomModelImplCopyWithImpl<$Res>
_$ChatRoomModelImpl _value, $Res Function(_$ChatRoomModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -181,12 +191,14 @@ class _$ChatRoomModelImpl implements _ChatRoomModel {
const DeepCollectionEquality().equals(other._users, _users));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, chatRoomSettings,
const DeepCollectionEquality().hash(_users));
@JsonKey(ignore: true)
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
@@ -217,8 +229,11 @@ abstract class _ChatRoomModel implements ChatRoomModel {
ChatRoomSettingsModel get chatRoomSettings;
@override
Map<String, ChatUserModel> get users;
/// Create a copy of ChatRoomModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomModelImplCopyWith<_$ChatRoomModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,8 +23,12 @@ mixin _$ChatRoomPreviewModel {
@JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms => throw _privateConstructorUsedError;
/// Serializes this ChatRoomPreviewModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomPreviewModelCopyWith<ChatRoomPreviewModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -49,6 +53,8 @@ class _$ChatRoomPreviewModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -82,6 +88,8 @@ class __$$ChatRoomPreviewModelImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomPreviewModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -129,12 +137,14 @@ class _$ChatRoomPreviewModelImpl implements _ChatRoomPreviewModel {
.equals(other._chatRooms, _chatRooms));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(_chatRooms));
@JsonKey(ignore: true)
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl>
@@ -161,8 +171,11 @@ abstract class _ChatRoomPreviewModel implements ChatRoomPreviewModel {
@override
@JsonKey(name: "chatRooms")
List<ChatRoom> get chatRooms;
/// Create a copy of ChatRoomPreviewModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomPreviewModelImplCopyWith<_$ChatRoomPreviewModelImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -182,8 +195,12 @@ mixin _$ChatRoom {
@JsonKey(name: "users")
Users get users => throw _privateConstructorUsedError;
/// Serializes this ChatRoom to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomCopyWith<ChatRoom> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -212,6 +229,8 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -240,6 +259,8 @@ class _$ChatRoomCopyWithImpl<$Res, $Val extends ChatRoom>
) as $Val);
}
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UsersCopyWith<$Res> get users {
@@ -275,6 +296,8 @@ class __$$ChatRoomImplCopyWithImpl<$Res>
_$ChatRoomImpl _value, $Res Function(_$ChatRoomImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -347,12 +370,14 @@ class _$ChatRoomImpl implements _ChatRoom {
(identical(other.users, users) || other.users == users));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, roomName,
const DeepCollectionEquality().hash(lastMessage), users);
@JsonKey(ignore: true)
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomImplCopyWith<_$ChatRoomImpl> get copyWith =>
@@ -388,8 +413,11 @@ abstract class _ChatRoom implements ChatRoom {
@override
@JsonKey(name: "users")
Users get users;
/// Create a copy of ChatRoom
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomImplCopyWith<_$ChatRoomImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -415,8 +443,12 @@ mixin _$LastMessageClass {
@JsonKey(name: "updated_at")
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Serializes this LastMessageClass to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$LastMessageClassCopyWith<LastMessageClass> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -448,6 +480,8 @@ class _$LastMessageClassCopyWithImpl<$Res, $Val extends LastMessageClass>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -519,6 +553,8 @@ class __$$LastMessageClassImplCopyWithImpl<$Res>
$Res Function(_$LastMessageClassImpl) _then)
: super(_value, _then);
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -633,7 +669,7 @@ class _$LastMessageClassImpl implements _LastMessageClass {
other.updatedAt == updatedAt));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -645,7 +681,9 @@ class _$LastMessageClassImpl implements _LastMessageClass {
readByToUser,
updatedAt);
@JsonKey(ignore: true)
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$LastMessageClassImplCopyWith<_$LastMessageClassImpl> get copyWith =>
@@ -696,8 +734,11 @@ abstract class _LastMessageClass implements LastMessageClass {
@override
@JsonKey(name: "updated_at")
DateTime get updatedAt;
/// Create a copy of LastMessageClass
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$LastMessageClassImplCopyWith<_$LastMessageClassImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -713,8 +754,12 @@ mixin _$Users {
@JsonKey(name: "to_chat_user")
ChatUser get toChatUser => throw _privateConstructorUsedError;
/// Serializes this Users to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UsersCopyWith<Users> get copyWith => throw _privateConstructorUsedError;
}
@@ -741,6 +786,8 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -759,6 +806,8 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
) as $Val);
}
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserCopyWith<$Res> get fromChatUser {
@@ -767,6 +816,8 @@ class _$UsersCopyWithImpl<$Res, $Val extends Users>
});
}
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatUserCopyWith<$Res> get toChatUser {
@@ -801,6 +852,8 @@ class __$$UsersImplCopyWithImpl<$Res>
_$UsersImpl _value, $Res Function(_$UsersImpl) _then)
: super(_value, _then);
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -853,11 +906,13 @@ class _$UsersImpl implements _Users {
other.toChatUser == toChatUser));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, fromChatUser, toChatUser);
@JsonKey(ignore: true)
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
@@ -885,8 +940,11 @@ abstract class _Users implements Users {
@override
@JsonKey(name: "to_chat_user")
ChatUser get toChatUser;
/// Create a copy of Users
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UsersImplCopyWith<_$UsersImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -906,8 +964,12 @@ mixin _$ChatUser {
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
/// Serializes this ChatUser to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatUserCopyWith<ChatUser> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -934,6 +996,8 @@ class _$ChatUserCopyWithImpl<$Res, $Val extends ChatUser>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -986,6 +1050,8 @@ class __$$ChatUserImplCopyWithImpl<$Res>
_$ChatUserImpl _value, $Res Function(_$ChatUserImpl) _then)
: super(_value, _then);
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1058,12 +1124,14 @@ class _$ChatUserImpl implements _ChatUser {
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
@JsonKey(ignore: true)
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatUserImplCopyWith<_$ChatUserImpl> get copyWith =>
@@ -1101,8 +1169,11 @@ abstract class _ChatUser implements ChatUser {
@override
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
/// Create a copy of ChatUser
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatUserImplCopyWith<_$ChatUserImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -30,8 +30,12 @@ mixin _$ChatRoomSettingsModel {
@JsonKey(name: 'updated_at')
String get updatedAt => throw _privateConstructorUsedError;
/// Serializes this ChatRoomSettingsModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatRoomSettingsModelCopyWith<ChatRoomSettingsModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -61,6 +65,8 @@ class _$ChatRoomSettingsModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -121,6 +127,8 @@ class __$$ChatRoomSettingsModelImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomSettingsModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -202,12 +210,14 @@ class _$ChatRoomSettingsModelImpl implements _ChatRoomSettingsModel {
other.updatedAt == updatedAt));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, id, roomName, state, accessLevel, updatedAt);
@JsonKey(ignore: true)
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
@@ -247,8 +257,11 @@ abstract class _ChatRoomSettingsModel implements ChatRoomSettingsModel {
@override
@JsonKey(name: 'updated_at')
String get updatedAt;
/// Create a copy of ChatRoomSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomSettingsModelImplCopyWith<_$ChatRoomSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -27,8 +27,12 @@ mixin _$ChatUserModel {
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl => throw _privateConstructorUsedError;
/// Serializes this ChatUserModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ChatUserModelCopyWith<ChatUserModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -56,6 +60,8 @@ class _$ChatUserModelCopyWithImpl<$Res, $Val extends ChatUserModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -108,6 +114,8 @@ class __$$ChatUserModelImplCopyWithImpl<$Res>
_$ChatUserModelImpl _value, $Res Function(_$ChatUserModelImpl) _then)
: super(_value, _then);
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -178,12 +186,14 @@ class _$ChatUserModelImpl implements _ChatUserModel {
other.profilePhotoUrl == profilePhotoUrl));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, id, name, profilePhotoPath, profilePhotoUrl);
@JsonKey(ignore: true)
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
@@ -218,8 +228,11 @@ abstract class _ChatUserModel implements ChatUserModel {
@override
@JsonKey(name: 'profile_photo_url')
String? get profilePhotoUrl;
/// Create a copy of ChatUserModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatUserModelImplCopyWith<_$ChatUserModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -27,8 +27,12 @@ mixin _$WebsocketInfoModel {
@JsonKey(name: 'user_id')
int get userId => throw _privateConstructorUsedError;
/// Serializes this WebsocketInfoModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -57,6 +61,8 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -115,6 +121,8 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
$Res Function(_$WebsocketInfoModelImpl) _then)
: super(_value, _then);
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -191,12 +199,14 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
(identical(other.userId, userId) || other.userId == userId));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode =>
Object.hash(runtimeType, key, host, port, cluster, userId);
@JsonKey(ignore: true)
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
@@ -234,8 +244,11 @@ abstract class _WebsocketInfoModel implements WebsocketInfoModel {
@override
@JsonKey(name: 'user_id')
int get userId;
/// Create a copy of WebsocketInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -90,6 +90,9 @@ class _$ChatRoomStateCopyWithImpl<$Res, $Val extends ChatRoomState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -106,6 +109,9 @@ class __$$ChatRoomStateImplCopyWithImpl<$Res>
__$$ChatRoomStateImplCopyWithImpl(
_$ChatRoomStateImpl _value, $Res Function(_$ChatRoomStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -226,6 +232,9 @@ class __$$ChatRoomStateLoadingImplCopyWithImpl<$Res>
__$$ChatRoomStateLoadingImplCopyWithImpl(_$ChatRoomStateLoadingImpl _value,
$Res Function(_$ChatRoomStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -356,6 +365,8 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -384,6 +395,8 @@ class __$$ChatRoomStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ChatRoomModelCopyWith<$Res> get chatRoom {
@@ -442,7 +455,9 @@ class _$ChatRoomStateLoadedImpl implements ChatRoomStateLoaded {
int get hashCode => Object.hash(runtimeType, chatRoom,
const DeepCollectionEquality().hash(_chatMessages), isTyping, isLoading);
@JsonKey(ignore: true)
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
@@ -541,7 +556,10 @@ abstract class ChatRoomStateLoaded implements ChatRoomState {
List<ChatMessageModel> get chatMessages;
bool get isTyping;
bool get isLoading;
@JsonKey(ignore: true)
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomStateLoadedImplCopyWith<_$ChatRoomStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -563,6 +581,8 @@ class __$$ChatRoomStateErrorImplCopyWithImpl<$Res>
$Res Function(_$ChatRoomStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -602,7 +622,9 @@ class _$ChatRoomStateErrorImpl implements ChatRoomStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
@@ -695,7 +717,10 @@ abstract class ChatRoomStateError implements ChatRoomState {
_$ChatRoomStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of ChatRoomState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatRoomStateErrorImplCopyWith<_$ChatRoomStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,6 +84,9 @@ class _$ChatSelectStateCopyWithImpl<$Res, $Val extends ChatSelectState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -100,6 +103,9 @@ class __$$ChatSelectStateImplCopyWithImpl<$Res>
__$$ChatSelectStateImplCopyWithImpl(
_$ChatSelectStateImpl _value, $Res Function(_$ChatSelectStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -216,6 +222,9 @@ class __$$ChatSelectStateLoadingImplCopyWithImpl<$Res>
_$ChatSelectStateLoadingImpl _value,
$Res Function(_$ChatSelectStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -334,6 +343,8 @@ class __$$ChatSelectStateErrorImplCopyWithImpl<$Res>
$Res Function(_$ChatSelectStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -373,7 +384,9 @@ class _$ChatSelectStateErrorImpl implements ChatSelectStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatSelectStateErrorImplCopyWith<_$ChatSelectStateErrorImpl>
@@ -461,7 +474,10 @@ abstract class ChatSelectStateError implements ChatSelectState {
_$ChatSelectStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatSelectStateErrorImplCopyWith<_$ChatSelectStateErrorImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -484,6 +500,8 @@ class __$$ChatSelectStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$ChatSelectStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -530,7 +548,9 @@ class _$ChatSelectStateLoadedImpl implements ChatSelectStateLoaded {
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(_chatRooms));
@JsonKey(ignore: true)
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatSelectStateLoadedImplCopyWith<_$ChatSelectStateLoadedImpl>
@@ -617,7 +637,10 @@ abstract class ChatSelectStateLoaded implements ChatSelectState {
{required final List<ChatRoom> chatRooms}) = _$ChatSelectStateLoadedImpl;
List<ChatRoom> get chatRooms;
@JsonKey(ignore: true)
/// Create a copy of ChatSelectState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatSelectStateLoadedImplCopyWith<_$ChatSelectStateLoadedImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -1,12 +1,11 @@
import 'dart:io';
import 'package:intl/intl.dart';
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';
class ChatScreen extends StatefulWidget {
@@ -60,7 +59,7 @@ class _ChatScreenState extends State<ChatScreen> {
} else {
return Scaffold(
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
}
@@ -145,16 +144,25 @@ class _ChatScreenState extends State<ChatScreen> {
delegate: SliverChildBuilderDelegate(
(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 ?? [],
return Column(
children: [
if ((index + 1 != state.chatMessages.length &&
DateTime.parse(state.chatMessages[index].updatedAt).day !=
DateTime.parse(state.chatMessages[index + 1].updatedAt).day) ||
index + 1 == state.chatMessages.length)
_messageDate(state.chatMessages[index].updatedAt),
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 ?? [],
),
],
);
} else {
return Padding(
padding: const EdgeInsets.all(8),
child: Center(child: CupertinoActivityIndicator()),
child: Center(child: CircularProgressIndicator()),
);
}
},
@@ -311,4 +319,20 @@ class _ChatScreenState extends State<ChatScreen> {
),
);
}
_messageDate(String date) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(
DateFormat.MMMMd('RU').format(
DateTime.parse(date),
),
style: const TextStyle(
height: 1,
color: Color(0xFF8393A1),
fontWeight: FontWeight.w500,
),
),
);
}
}

View File

@@ -4,7 +4,7 @@ import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/cha
import 'package:eatvio_app/features/chat/presentation/bloc/chat_select_cubit/chat_select_state.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/chat_entry_widget.dart';
import 'package:eatvio_app/features/chat/presentation/widgets/chat_search_bar_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
class ChatSelectScreen extends StatefulWidget {
@@ -15,58 +15,62 @@ class ChatSelectScreen extends StatefulWidget {
}
class _ChatSelectScreenState extends State<ChatSelectScreen> {
final ChatSelectCubit chatSelectCubit = sl<ChatSelectCubit>();
final searchController = TextEditingController();
Widget build(BuildContext context) {
return BlocBuilder<ChatSelectCubit, ChatSelectState>(
builder: (context, state) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
toolbarHeight: 0,
),
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverPadding(
padding: const EdgeInsets.only(top: 8),
sliver: SliverAppBar(
automaticallyImplyLeading: false,
stretchTriggerOffset: 1,
scrolledUnderElevation: 0,
floating: true,
snap: true,
title: Padding(
padding: const EdgeInsets.only(top: 8),
child: ChatSearchBarWidget(
onSuffixIconTap: () => context.read<ChatSelectCubit>().getChatRooms(),
onChanged: (query) {
if (query.length > 2) {
EasyDebounce.debounce(
'searchChatRoom',
Duration(milliseconds: 300),
() => context.read<ChatSelectCubit>().getChatRooms(query: query),
);
} else {
context.read<ChatSelectCubit>().getChatRooms();
}
},
controller: searchController,
fillColor: Color(0xFFF0F2F5),
hintText: "Поиск",
hintStyle: TextStyle(
color: Color(0xFF7B8794),
return BlocProvider<ChatSelectCubit>(
create: (context) => chatSelectCubit..getChatRooms(),
child: BlocBuilder<ChatSelectCubit, ChatSelectState>(
builder: (context, state) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
toolbarHeight: 0,
),
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverPadding(
padding: const EdgeInsets.only(top: 8),
sliver: SliverAppBar(
automaticallyImplyLeading: false,
stretchTriggerOffset: 1,
scrolledUnderElevation: 0,
floating: true,
snap: true,
title: Padding(
padding: const EdgeInsets.only(top: 8),
child: ChatSearchBarWidget(
onSuffixIconTap: () => context.read<ChatSelectCubit>().getChatRooms(),
onChanged: (query) {
if (query.length > 2) {
EasyDebounce.debounce(
'searchChatRoom',
Duration(milliseconds: 300),
() => context.read<ChatSelectCubit>().getChatRooms(query: query),
);
} else {
context.read<ChatSelectCubit>().getChatRooms();
}
},
controller: searchController,
fillColor: Color(0xFFF0F2F5),
hintText: "Поиск",
hintStyle: TextStyle(
color: Color(0xFF7B8794),
),
),
),
),
),
),
];
},
body: stateBuilder(state),
),
);
},
];
},
body: stateBuilder(state),
),
);
},
),
);
}
@@ -74,7 +78,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
if (state is ChatSelectStateLoading) {
return Scaffold(
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
} else if (state is ChatSelectStateLoaded) {
@@ -87,7 +91,7 @@ class _ChatSelectScreenState extends State<ChatSelectScreen> {
} else {
return Scaffold(
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
}