forked from eatvio/eatvio_app
feat(profile): add education, social links
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:eatvio_app/features/profile/models/badge_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'profile_model.freezed.dart';
|
||||
@@ -18,7 +17,7 @@ class ProfileModel with _$ProfileModel {
|
||||
@JsonKey(name: "slug") required String slug,
|
||||
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
|
||||
@JsonKey(name: "role") required String role,
|
||||
@JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
// @JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions") required List<ProfilePreviewModel> subscriptions,
|
||||
@JsonKey(name: "subscribers") required List<ProfilePreviewModel> subscribers,
|
||||
}) = _ProfileModel;
|
||||
|
||||
@@ -39,9 +39,8 @@ mixin _$ProfileModel {
|
||||
@JsonKey(name: "profile_photo_url")
|
||||
String get profilePhotoUrl => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "role")
|
||||
String get role => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "badges")
|
||||
List<BadgeModel> get badges => throw _privateConstructorUsedError;
|
||||
String get role =>
|
||||
throw _privateConstructorUsedError; // @JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions")
|
||||
List<ProfilePreviewModel> get subscriptions =>
|
||||
throw _privateConstructorUsedError;
|
||||
@@ -76,7 +75,6 @@ abstract class $ProfileModelCopyWith<$Res> {
|
||||
@JsonKey(name: "slug") String slug,
|
||||
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
|
||||
@JsonKey(name: "role") String role,
|
||||
@JsonKey(name: "badges") List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions") List<ProfilePreviewModel> subscriptions,
|
||||
@JsonKey(name: "subscribers") List<ProfilePreviewModel> subscribers});
|
||||
}
|
||||
@@ -106,7 +104,6 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
|
||||
Object? slug = null,
|
||||
Object? profilePhotoUrl = null,
|
||||
Object? role = null,
|
||||
Object? badges = null,
|
||||
Object? subscriptions = null,
|
||||
Object? subscribers = null,
|
||||
}) {
|
||||
@@ -151,10 +148,6 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
badges: null == badges
|
||||
? _value.badges
|
||||
: badges // ignore: cast_nullable_to_non_nullable
|
||||
as List<BadgeModel>,
|
||||
subscriptions: null == subscriptions
|
||||
? _value.subscriptions
|
||||
: subscriptions // ignore: cast_nullable_to_non_nullable
|
||||
@@ -186,7 +179,6 @@ abstract class _$$ProfileModelImplCopyWith<$Res>
|
||||
@JsonKey(name: "slug") String slug,
|
||||
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
|
||||
@JsonKey(name: "role") String role,
|
||||
@JsonKey(name: "badges") List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions") List<ProfilePreviewModel> subscriptions,
|
||||
@JsonKey(name: "subscribers") List<ProfilePreviewModel> subscribers});
|
||||
}
|
||||
@@ -214,7 +206,6 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
|
||||
Object? slug = null,
|
||||
Object? profilePhotoUrl = null,
|
||||
Object? role = null,
|
||||
Object? badges = null,
|
||||
Object? subscriptions = null,
|
||||
Object? subscribers = null,
|
||||
}) {
|
||||
@@ -259,10 +250,6 @@ class __$$ProfileModelImplCopyWithImpl<$Res>
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
badges: null == badges
|
||||
? _value._badges
|
||||
: badges // ignore: cast_nullable_to_non_nullable
|
||||
as List<BadgeModel>,
|
||||
subscriptions: null == subscriptions
|
||||
? _value._subscriptions
|
||||
: subscriptions // ignore: cast_nullable_to_non_nullable
|
||||
@@ -289,13 +276,11 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
@JsonKey(name: "slug") required this.slug,
|
||||
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl,
|
||||
@JsonKey(name: "role") required this.role,
|
||||
@JsonKey(name: "badges") required final List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions")
|
||||
required final List<ProfilePreviewModel> subscriptions,
|
||||
@JsonKey(name: "subscribers")
|
||||
required final List<ProfilePreviewModel> subscribers})
|
||||
: _badges = badges,
|
||||
_subscriptions = subscriptions,
|
||||
: _subscriptions = subscriptions,
|
||||
_subscribers = subscribers;
|
||||
|
||||
factory _$ProfileModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -331,16 +316,9 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
@override
|
||||
@JsonKey(name: "role")
|
||||
final String role;
|
||||
final List<BadgeModel> _badges;
|
||||
@override
|
||||
@JsonKey(name: "badges")
|
||||
List<BadgeModel> get badges {
|
||||
if (_badges is EqualUnmodifiableListView) return _badges;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_badges);
|
||||
}
|
||||
|
||||
// @JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
final List<ProfilePreviewModel> _subscriptions;
|
||||
// @JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
@override
|
||||
@JsonKey(name: "subscriptions")
|
||||
List<ProfilePreviewModel> get subscriptions {
|
||||
@@ -360,7 +338,7 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl, role: $role, badges: $badges, subscriptions: $subscriptions, subscribers: $subscribers)';
|
||||
return 'ProfileModel(id: $id, name: $name, email: $email, emailVerifiedAt: $emailVerifiedAt, createdAt: $createdAt, updatedAt: $updatedAt, isPublicProfile: $isPublicProfile, slug: $slug, profilePhotoUrl: $profilePhotoUrl, role: $role, subscriptions: $subscriptions, subscribers: $subscribers)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -383,7 +361,6 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
|
||||
other.profilePhotoUrl == profilePhotoUrl) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
const DeepCollectionEquality().equals(other._badges, _badges) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._subscriptions, _subscriptions) &&
|
||||
const DeepCollectionEquality()
|
||||
@@ -404,7 +381,6 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
slug,
|
||||
profilePhotoUrl,
|
||||
role,
|
||||
const DeepCollectionEquality().hash(_badges),
|
||||
const DeepCollectionEquality().hash(_subscriptions),
|
||||
const DeepCollectionEquality().hash(_subscribers));
|
||||
|
||||
@@ -436,7 +412,6 @@ abstract class _ProfileModel implements ProfileModel {
|
||||
@JsonKey(name: "slug") required final String slug,
|
||||
@JsonKey(name: "profile_photo_url") required final String profilePhotoUrl,
|
||||
@JsonKey(name: "role") required final String role,
|
||||
@JsonKey(name: "badges") required final List<BadgeModel> badges,
|
||||
@JsonKey(name: "subscriptions")
|
||||
required final List<ProfilePreviewModel> subscriptions,
|
||||
@JsonKey(name: "subscribers")
|
||||
@@ -475,10 +450,7 @@ abstract class _ProfileModel implements ProfileModel {
|
||||
String get profilePhotoUrl;
|
||||
@override
|
||||
@JsonKey(name: "role")
|
||||
String get role;
|
||||
@override
|
||||
@JsonKey(name: "badges")
|
||||
List<BadgeModel> get badges;
|
||||
String get role; // @JsonKey(name: "badges") required List<BadgeModel> badges,
|
||||
@override
|
||||
@JsonKey(name: "subscriptions")
|
||||
List<ProfilePreviewModel> get subscriptions;
|
||||
|
||||
@@ -24,9 +24,6 @@ _$ProfileModelImpl _$$ProfileModelImplFromJson(Map<String, dynamic> json) =>
|
||||
slug: json['slug'] as String,
|
||||
profilePhotoUrl: json['profile_photo_url'] as String,
|
||||
role: json['role'] as String,
|
||||
badges: (json['badges'] as List<dynamic>)
|
||||
.map((e) => BadgeModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
subscriptions: (json['subscriptions'] as List<dynamic>)
|
||||
.map((e) => ProfilePreviewModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
@@ -47,7 +44,6 @@ Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) =>
|
||||
'slug': instance.slug,
|
||||
'profile_photo_url': instance.profilePhotoUrl,
|
||||
'role': instance.role,
|
||||
'badges': instance.badges,
|
||||
'subscriptions': instance.subscriptions,
|
||||
'subscribers': instance.subscribers,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user