forked from eatvio/eatvio_app
feat(profile): add profile charts models, requests. Max length of description in posts, recipes, diets = 200
This commit is contained in:
19
lib/features/profile/models/circumference_model.dart
Normal file
19
lib/features/profile/models/circumference_model.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'circumference_model.freezed.dart';
|
||||
part 'circumference_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class CircumferenceModel with _$CircumferenceModel {
|
||||
const factory CircumferenceModel({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "user_id") required int userId,
|
||||
@JsonKey(name: "chest_circumference") required int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference") required int waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") required int hipCircumference,
|
||||
@JsonKey(name: "created_at") required DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required DateTime updatedAt,
|
||||
}) = _CircumferenceModel;
|
||||
|
||||
factory CircumferenceModel.fromJson(Map<String, dynamic> json) => _$CircumferenceModelFromJson(json);
|
||||
}
|
||||
319
lib/features/profile/models/circumference_model.freezed.dart
Normal file
319
lib/features/profile/models/circumference_model.freezed.dart
Normal file
@@ -0,0 +1,319 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'circumference_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
CircumferenceModel _$CircumferenceModelFromJson(Map<String, dynamic> json) {
|
||||
return _CircumferenceModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CircumferenceModel {
|
||||
@JsonKey(name: "id")
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "user_id")
|
||||
int get userId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "chest_circumference")
|
||||
int get chestCircumference => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "waist_circumference")
|
||||
int get waistCircumference => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "hip_circumference")
|
||||
int get hipCircumference => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this CircumferenceModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CircumferenceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CircumferenceModelCopyWith<CircumferenceModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CircumferenceModelCopyWith<$Res> {
|
||||
factory $CircumferenceModelCopyWith(
|
||||
CircumferenceModel value, $Res Function(CircumferenceModel) then) =
|
||||
_$CircumferenceModelCopyWithImpl<$Res, CircumferenceModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "id") int id,
|
||||
@JsonKey(name: "user_id") int userId,
|
||||
@JsonKey(name: "chest_circumference") int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference") int waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") int hipCircumference,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CircumferenceModelCopyWithImpl<$Res, $Val extends CircumferenceModel>
|
||||
implements $CircumferenceModelCopyWith<$Res> {
|
||||
_$CircumferenceModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CircumferenceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? userId = null,
|
||||
Object? chestCircumference = null,
|
||||
Object? waistCircumference = null,
|
||||
Object? hipCircumference = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
chestCircumference: null == chestCircumference
|
||||
? _value.chestCircumference
|
||||
: chestCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
waistCircumference: null == waistCircumference
|
||||
? _value.waistCircumference
|
||||
: waistCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
hipCircumference: null == hipCircumference
|
||||
? _value.hipCircumference
|
||||
: hipCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CircumferenceModelImplCopyWith<$Res>
|
||||
implements $CircumferenceModelCopyWith<$Res> {
|
||||
factory _$$CircumferenceModelImplCopyWith(_$CircumferenceModelImpl value,
|
||||
$Res Function(_$CircumferenceModelImpl) then) =
|
||||
__$$CircumferenceModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "id") int id,
|
||||
@JsonKey(name: "user_id") int userId,
|
||||
@JsonKey(name: "chest_circumference") int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference") int waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") int hipCircumference,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CircumferenceModelImplCopyWithImpl<$Res>
|
||||
extends _$CircumferenceModelCopyWithImpl<$Res, _$CircumferenceModelImpl>
|
||||
implements _$$CircumferenceModelImplCopyWith<$Res> {
|
||||
__$$CircumferenceModelImplCopyWithImpl(_$CircumferenceModelImpl _value,
|
||||
$Res Function(_$CircumferenceModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CircumferenceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? userId = null,
|
||||
Object? chestCircumference = null,
|
||||
Object? waistCircumference = null,
|
||||
Object? hipCircumference = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
}) {
|
||||
return _then(_$CircumferenceModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
chestCircumference: null == chestCircumference
|
||||
? _value.chestCircumference
|
||||
: chestCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
waistCircumference: null == waistCircumference
|
||||
? _value.waistCircumference
|
||||
: waistCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
hipCircumference: null == hipCircumference
|
||||
? _value.hipCircumference
|
||||
: hipCircumference // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$CircumferenceModelImpl implements _CircumferenceModel {
|
||||
const _$CircumferenceModelImpl(
|
||||
{@JsonKey(name: "id") required this.id,
|
||||
@JsonKey(name: "user_id") required this.userId,
|
||||
@JsonKey(name: "chest_circumference") required this.chestCircumference,
|
||||
@JsonKey(name: "waist_circumference") required this.waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") required this.hipCircumference,
|
||||
@JsonKey(name: "created_at") required this.createdAt,
|
||||
@JsonKey(name: "updated_at") required this.updatedAt});
|
||||
|
||||
factory _$CircumferenceModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$CircumferenceModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: "user_id")
|
||||
final int userId;
|
||||
@override
|
||||
@JsonKey(name: "chest_circumference")
|
||||
final int chestCircumference;
|
||||
@override
|
||||
@JsonKey(name: "waist_circumference")
|
||||
final int waistCircumference;
|
||||
@override
|
||||
@JsonKey(name: "hip_circumference")
|
||||
final int hipCircumference;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
final DateTime updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CircumferenceModel(id: $id, userId: $userId, chestCircumference: $chestCircumference, waistCircumference: $waistCircumference, hipCircumference: $hipCircumference, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CircumferenceModelImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.userId, userId) || other.userId == userId) &&
|
||||
(identical(other.chestCircumference, chestCircumference) ||
|
||||
other.chestCircumference == chestCircumference) &&
|
||||
(identical(other.waistCircumference, waistCircumference) ||
|
||||
other.waistCircumference == waistCircumference) &&
|
||||
(identical(other.hipCircumference, hipCircumference) ||
|
||||
other.hipCircumference == hipCircumference) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, userId, chestCircumference,
|
||||
waistCircumference, hipCircumference, createdAt, updatedAt);
|
||||
|
||||
/// Create a copy of CircumferenceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CircumferenceModelImplCopyWith<_$CircumferenceModelImpl> get copyWith =>
|
||||
__$$CircumferenceModelImplCopyWithImpl<_$CircumferenceModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$CircumferenceModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _CircumferenceModel implements CircumferenceModel {
|
||||
const factory _CircumferenceModel(
|
||||
{@JsonKey(name: "id") required final int id,
|
||||
@JsonKey(name: "user_id") required final int userId,
|
||||
@JsonKey(name: "chest_circumference")
|
||||
required final int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference")
|
||||
required final int waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") required final int hipCircumference,
|
||||
@JsonKey(name: "created_at") required final DateTime createdAt,
|
||||
@JsonKey(name: "updated_at")
|
||||
required final DateTime updatedAt}) = _$CircumferenceModelImpl;
|
||||
|
||||
factory _CircumferenceModel.fromJson(Map<String, dynamic> json) =
|
||||
_$CircumferenceModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: "user_id")
|
||||
int get userId;
|
||||
@override
|
||||
@JsonKey(name: "chest_circumference")
|
||||
int get chestCircumference;
|
||||
@override
|
||||
@JsonKey(name: "waist_circumference")
|
||||
int get waistCircumference;
|
||||
@override
|
||||
@JsonKey(name: "hip_circumference")
|
||||
int get hipCircumference;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime get updatedAt;
|
||||
|
||||
/// Create a copy of CircumferenceModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CircumferenceModelImplCopyWith<_$CircumferenceModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
31
lib/features/profile/models/circumference_model.g.dart
Normal file
31
lib/features/profile/models/circumference_model.g.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'circumference_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$CircumferenceModelImpl _$$CircumferenceModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CircumferenceModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
userId: (json['user_id'] as num).toInt(),
|
||||
chestCircumference: (json['chest_circumference'] as num).toInt(),
|
||||
waistCircumference: (json['waist_circumference'] as num).toInt(),
|
||||
hipCircumference: (json['hip_circumference'] as num).toInt(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$CircumferenceModelImplToJson(
|
||||
_$CircumferenceModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'user_id': instance.userId,
|
||||
'chest_circumference': instance.chestCircumference,
|
||||
'waist_circumference': instance.waistCircumference,
|
||||
'hip_circumference': instance.hipCircumference,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
};
|
||||
@@ -22,28 +22,20 @@ ProfileModel _$ProfileModelFromJson(Map<String, dynamic> json) {
|
||||
mixin _$ProfileModel {
|
||||
@JsonKey(name: "id")
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "name")
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "email")
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "email_verified_at")
|
||||
DateTime? get emailVerifiedAt => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime? get createdAt => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "is_public_profile")
|
||||
bool get isPublicProfile => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "slug")
|
||||
String get slug => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "profile_photo_url")
|
||||
String get profilePhotoUrl => throw _privateConstructorUsedError;
|
||||
|
||||
@@ -53,13 +45,15 @@ mixin _$ProfileModel {
|
||||
/// Create a copy of ProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProfileModelCopyWith<ProfileModel> get copyWith => throw _privateConstructorUsedError;
|
||||
$ProfileModelCopyWith<ProfileModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfileModelCopyWith<$Res> {
|
||||
factory $ProfileModelCopyWith(ProfileModel value, $Res Function(ProfileModel) then) = _$ProfileModelCopyWithImpl<$Res, ProfileModel>;
|
||||
|
||||
factory $ProfileModelCopyWith(
|
||||
ProfileModel value, $Res Function(ProfileModel) then) =
|
||||
_$ProfileModelCopyWithImpl<$Res, ProfileModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "id") int id,
|
||||
@@ -74,12 +68,12 @@ abstract class $ProfileModelCopyWith<$Res> {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel> implements $ProfileModelCopyWith<$Res> {
|
||||
class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel>
|
||||
implements $ProfileModelCopyWith<$Res> {
|
||||
_$ProfileModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -140,9 +134,11 @@ class _$ProfileModelCopyWithImpl<$Res, $Val extends ProfileModel> implements $Pr
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileModelImplCopyWith<$Res> implements $ProfileModelCopyWith<$Res> {
|
||||
factory _$$ProfileModelImplCopyWith(_$ProfileModelImpl value, $Res Function(_$ProfileModelImpl) then) = __$$ProfileModelImplCopyWithImpl<$Res>;
|
||||
|
||||
abstract class _$$ProfileModelImplCopyWith<$Res>
|
||||
implements $ProfileModelCopyWith<$Res> {
|
||||
factory _$$ProfileModelImplCopyWith(
|
||||
_$ProfileModelImpl value, $Res Function(_$ProfileModelImpl) then) =
|
||||
__$$ProfileModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -158,8 +154,12 @@ abstract class _$$ProfileModelImplCopyWith<$Res> implements $ProfileModelCopyWit
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileModelImplCopyWithImpl<$Res> extends _$ProfileModelCopyWithImpl<$Res, _$ProfileModelImpl> implements _$$ProfileModelImplCopyWith<$Res> {
|
||||
__$$ProfileModelImplCopyWithImpl(_$ProfileModelImpl _value, $Res Function(_$ProfileModelImpl) _then) : super(_value, _then);
|
||||
class __$$ProfileModelImplCopyWithImpl<$Res>
|
||||
extends _$ProfileModelCopyWithImpl<$Res, _$ProfileModelImpl>
|
||||
implements _$$ProfileModelImplCopyWith<$Res> {
|
||||
__$$ProfileModelImplCopyWithImpl(
|
||||
_$ProfileModelImpl _value, $Res Function(_$ProfileModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -231,7 +231,8 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
@JsonKey(name: "slug") required this.slug,
|
||||
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl});
|
||||
|
||||
factory _$ProfileModelImpl.fromJson(Map<String, dynamic> json) => _$$ProfileModelImplFromJson(json);
|
||||
factory _$ProfileModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ProfileModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
@@ -274,24 +275,31 @@ class _$ProfileModelImpl implements _ProfileModel {
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.emailVerifiedAt, emailVerifiedAt) || other.emailVerifiedAt == emailVerifiedAt) &&
|
||||
(identical(other.createdAt, createdAt) || other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) &&
|
||||
(identical(other.isPublicProfile, isPublicProfile) || other.isPublicProfile == isPublicProfile) &&
|
||||
(identical(other.emailVerifiedAt, emailVerifiedAt) ||
|
||||
other.emailVerifiedAt == emailVerifiedAt) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt) &&
|
||||
(identical(other.isPublicProfile, isPublicProfile) ||
|
||||
other.isPublicProfile == isPublicProfile) &&
|
||||
(identical(other.slug, slug) || other.slug == slug) &&
|
||||
(identical(other.profilePhotoUrl, profilePhotoUrl) || other.profilePhotoUrl == profilePhotoUrl));
|
||||
(identical(other.profilePhotoUrl, profilePhotoUrl) ||
|
||||
other.profilePhotoUrl == profilePhotoUrl));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, id, name, email, emailVerifiedAt, createdAt, updatedAt, isPublicProfile, slug, profilePhotoUrl);
|
||||
int get hashCode => Object.hash(runtimeType, id, name, email, emailVerifiedAt,
|
||||
createdAt, updatedAt, isPublicProfile, slug, profilePhotoUrl);
|
||||
|
||||
/// Create a copy of ProfileModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileModelImplCopyWith<_$ProfileModelImpl> get copyWith => __$$ProfileModelImplCopyWithImpl<_$ProfileModelImpl>(this, _$identity);
|
||||
_$$ProfileModelImplCopyWith<_$ProfileModelImpl> get copyWith =>
|
||||
__$$ProfileModelImplCopyWithImpl<_$ProfileModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -311,42 +319,36 @@ abstract class _ProfileModel implements ProfileModel {
|
||||
@JsonKey(name: "updated_at") final DateTime? updatedAt,
|
||||
@JsonKey(name: "is_public_profile") required final bool isPublicProfile,
|
||||
@JsonKey(name: "slug") required final String slug,
|
||||
@JsonKey(name: "profile_photo_url") required final String profilePhotoUrl}) = _$ProfileModelImpl;
|
||||
@JsonKey(name: "profile_photo_url")
|
||||
required final String profilePhotoUrl}) = _$ProfileModelImpl;
|
||||
|
||||
factory _ProfileModel.fromJson(Map<String, dynamic> json) = _$ProfileModelImpl.fromJson;
|
||||
factory _ProfileModel.fromJson(Map<String, dynamic> json) =
|
||||
_$ProfileModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
int get id;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "name")
|
||||
String get name;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "email")
|
||||
String get email;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "email_verified_at")
|
||||
DateTime? get emailVerifiedAt;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime? get createdAt;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime? get updatedAt;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "is_public_profile")
|
||||
bool get isPublicProfile;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "slug")
|
||||
String get slug;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "profile_photo_url")
|
||||
String get profilePhotoUrl;
|
||||
@@ -355,7 +357,8 @@ abstract class _ProfileModel implements ProfileModel {
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfileModelImplCopyWith<_$ProfileModelImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
_$$ProfileModelImplCopyWith<_$ProfileModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
ProfileDetailsModel _$ProfileDetailsModelFromJson(Map<String, dynamic> json) {
|
||||
@@ -366,82 +369,56 @@ ProfileDetailsModel _$ProfileDetailsModelFromJson(Map<String, dynamic> json) {
|
||||
mixin _$ProfileDetailsModel {
|
||||
@JsonKey(name: "first_name")
|
||||
String get firstName => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "last_name")
|
||||
String get lastName => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "birthdate")
|
||||
String get birthdate => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "gender")
|
||||
String get gender => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "country")
|
||||
String get country => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "city")
|
||||
String get city => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "lang")
|
||||
String get lang => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "weight")
|
||||
double get weight => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "height")
|
||||
int get height => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "chest_circumference")
|
||||
int get chestCircumference => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "waist_circumference")
|
||||
int get waistCircumference => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "hip_circumference")
|
||||
int get hipCircumference => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "blood_pressure_up")
|
||||
int get bloodPressureUp => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "blood_pressure_down")
|
||||
int get bloodPressureDown => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "has_hypo")
|
||||
bool get hasHypo => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "has_hyper")
|
||||
bool get hasHyper => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "about_alergy")
|
||||
String get aboutAlergy => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "about_taking_pils")
|
||||
String get aboutTakingPils => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "about_sport_hobbies")
|
||||
String get aboutSportHobbies => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "favorite_foods")
|
||||
String get favoriteFoods => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "unfavorite_foods")
|
||||
String get unfavoriteFoods => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "additional_info")
|
||||
String get additionalInfo => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime? get createdAt => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "is_mood_fillable")
|
||||
bool get isMoodFillable => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "is_bedtime_fillable")
|
||||
bool get isBedtimeFillable => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(name: "activity_coefficient")
|
||||
double get activityCoefficient => throw _privateConstructorUsedError;
|
||||
|
||||
@@ -451,14 +428,15 @@ mixin _$ProfileDetailsModel {
|
||||
/// Create a copy of ProfileDetailsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProfileDetailsModelCopyWith<ProfileDetailsModel> get copyWith => throw _privateConstructorUsedError;
|
||||
$ProfileDetailsModelCopyWith<ProfileDetailsModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfileDetailsModelCopyWith<$Res> {
|
||||
factory $ProfileDetailsModelCopyWith(ProfileDetailsModel value, $Res Function(ProfileDetailsModel) then) =
|
||||
factory $ProfileDetailsModelCopyWith(
|
||||
ProfileDetailsModel value, $Res Function(ProfileDetailsModel) then) =
|
||||
_$ProfileDetailsModelCopyWithImpl<$Res, ProfileDetailsModel>;
|
||||
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "first_name") String firstName,
|
||||
@@ -491,12 +469,12 @@ abstract class $ProfileDetailsModelCopyWith<$Res> {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfileDetailsModelCopyWithImpl<$Res, $Val extends ProfileDetailsModel> implements $ProfileDetailsModelCopyWith<$Res> {
|
||||
class _$ProfileDetailsModelCopyWithImpl<$Res, $Val extends ProfileDetailsModel>
|
||||
implements $ProfileDetailsModelCopyWith<$Res> {
|
||||
_$ProfileDetailsModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -647,10 +625,11 @@ class _$ProfileDetailsModelCopyWithImpl<$Res, $Val extends ProfileDetailsModel>
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileDetailsModelImplCopyWith<$Res> implements $ProfileDetailsModelCopyWith<$Res> {
|
||||
factory _$$ProfileDetailsModelImplCopyWith(_$ProfileDetailsModelImpl value, $Res Function(_$ProfileDetailsModelImpl) then) =
|
||||
abstract class _$$ProfileDetailsModelImplCopyWith<$Res>
|
||||
implements $ProfileDetailsModelCopyWith<$Res> {
|
||||
factory _$$ProfileDetailsModelImplCopyWith(_$ProfileDetailsModelImpl value,
|
||||
$Res Function(_$ProfileDetailsModelImpl) then) =
|
||||
__$$ProfileDetailsModelImplCopyWithImpl<$Res>;
|
||||
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
@@ -684,9 +663,12 @@ abstract class _$$ProfileDetailsModelImplCopyWith<$Res> implements $ProfileDetai
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileDetailsModelImplCopyWithImpl<$Res> extends _$ProfileDetailsModelCopyWithImpl<$Res, _$ProfileDetailsModelImpl>
|
||||
class __$$ProfileDetailsModelImplCopyWithImpl<$Res>
|
||||
extends _$ProfileDetailsModelCopyWithImpl<$Res, _$ProfileDetailsModelImpl>
|
||||
implements _$$ProfileDetailsModelImplCopyWith<$Res> {
|
||||
__$$ProfileDetailsModelImplCopyWithImpl(_$ProfileDetailsModelImpl _value, $Res Function(_$ProfileDetailsModelImpl) _then) : super(_value, _then);
|
||||
__$$ProfileDetailsModelImplCopyWithImpl(_$ProfileDetailsModelImpl _value,
|
||||
$Res Function(_$ProfileDetailsModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileDetailsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -864,9 +846,11 @@ class _$ProfileDetailsModelImpl implements _ProfileDetailsModel {
|
||||
@JsonKey(name: "updated_at") this.updatedAt,
|
||||
@JsonKey(name: "is_mood_fillable") required this.isMoodFillable,
|
||||
@JsonKey(name: "is_bedtime_fillable") required this.isBedtimeFillable,
|
||||
@JsonKey(name: "activity_coefficient") required this.activityCoefficient});
|
||||
@JsonKey(name: "activity_coefficient")
|
||||
required this.activityCoefficient});
|
||||
|
||||
factory _$ProfileDetailsModelImpl.fromJson(Map<String, dynamic> json) => _$$ProfileDetailsModelImplFromJson(json);
|
||||
factory _$ProfileDetailsModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ProfileDetailsModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "first_name")
|
||||
@@ -960,33 +944,53 @@ class _$ProfileDetailsModelImpl implements _ProfileDetailsModel {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileDetailsModelImpl &&
|
||||
(identical(other.firstName, firstName) || other.firstName == firstName) &&
|
||||
(identical(other.lastName, lastName) || other.lastName == lastName) &&
|
||||
(identical(other.birthdate, birthdate) || other.birthdate == birthdate) &&
|
||||
(identical(other.firstName, firstName) ||
|
||||
other.firstName == firstName) &&
|
||||
(identical(other.lastName, lastName) ||
|
||||
other.lastName == lastName) &&
|
||||
(identical(other.birthdate, birthdate) ||
|
||||
other.birthdate == birthdate) &&
|
||||
(identical(other.gender, gender) || other.gender == gender) &&
|
||||
(identical(other.country, country) || other.country == country) &&
|
||||
(identical(other.city, city) || other.city == city) &&
|
||||
(identical(other.lang, lang) || other.lang == lang) &&
|
||||
(identical(other.weight, weight) || other.weight == weight) &&
|
||||
(identical(other.height, height) || other.height == height) &&
|
||||
(identical(other.chestCircumference, chestCircumference) || other.chestCircumference == chestCircumference) &&
|
||||
(identical(other.waistCircumference, waistCircumference) || other.waistCircumference == waistCircumference) &&
|
||||
(identical(other.hipCircumference, hipCircumference) || other.hipCircumference == hipCircumference) &&
|
||||
(identical(other.bloodPressureUp, bloodPressureUp) || other.bloodPressureUp == bloodPressureUp) &&
|
||||
(identical(other.bloodPressureDown, bloodPressureDown) || other.bloodPressureDown == bloodPressureDown) &&
|
||||
(identical(other.chestCircumference, chestCircumference) ||
|
||||
other.chestCircumference == chestCircumference) &&
|
||||
(identical(other.waistCircumference, waistCircumference) ||
|
||||
other.waistCircumference == waistCircumference) &&
|
||||
(identical(other.hipCircumference, hipCircumference) ||
|
||||
other.hipCircumference == hipCircumference) &&
|
||||
(identical(other.bloodPressureUp, bloodPressureUp) ||
|
||||
other.bloodPressureUp == bloodPressureUp) &&
|
||||
(identical(other.bloodPressureDown, bloodPressureDown) ||
|
||||
other.bloodPressureDown == bloodPressureDown) &&
|
||||
(identical(other.hasHypo, hasHypo) || other.hasHypo == hasHypo) &&
|
||||
(identical(other.hasHyper, hasHyper) || other.hasHyper == hasHyper) &&
|
||||
(identical(other.aboutAlergy, aboutAlergy) || other.aboutAlergy == aboutAlergy) &&
|
||||
(identical(other.aboutTakingPils, aboutTakingPils) || other.aboutTakingPils == aboutTakingPils) &&
|
||||
(identical(other.aboutSportHobbies, aboutSportHobbies) || other.aboutSportHobbies == aboutSportHobbies) &&
|
||||
(identical(other.favoriteFoods, favoriteFoods) || other.favoriteFoods == favoriteFoods) &&
|
||||
(identical(other.unfavoriteFoods, unfavoriteFoods) || other.unfavoriteFoods == unfavoriteFoods) &&
|
||||
(identical(other.additionalInfo, additionalInfo) || other.additionalInfo == additionalInfo) &&
|
||||
(identical(other.createdAt, createdAt) || other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt) &&
|
||||
(identical(other.isMoodFillable, isMoodFillable) || other.isMoodFillable == isMoodFillable) &&
|
||||
(identical(other.isBedtimeFillable, isBedtimeFillable) || other.isBedtimeFillable == isBedtimeFillable) &&
|
||||
(identical(other.activityCoefficient, activityCoefficient) || other.activityCoefficient == activityCoefficient));
|
||||
(identical(other.hasHyper, hasHyper) ||
|
||||
other.hasHyper == hasHyper) &&
|
||||
(identical(other.aboutAlergy, aboutAlergy) ||
|
||||
other.aboutAlergy == aboutAlergy) &&
|
||||
(identical(other.aboutTakingPils, aboutTakingPils) ||
|
||||
other.aboutTakingPils == aboutTakingPils) &&
|
||||
(identical(other.aboutSportHobbies, aboutSportHobbies) ||
|
||||
other.aboutSportHobbies == aboutSportHobbies) &&
|
||||
(identical(other.favoriteFoods, favoriteFoods) ||
|
||||
other.favoriteFoods == favoriteFoods) &&
|
||||
(identical(other.unfavoriteFoods, unfavoriteFoods) ||
|
||||
other.unfavoriteFoods == unfavoriteFoods) &&
|
||||
(identical(other.additionalInfo, additionalInfo) ||
|
||||
other.additionalInfo == additionalInfo) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt) &&
|
||||
(identical(other.isMoodFillable, isMoodFillable) ||
|
||||
other.isMoodFillable == isMoodFillable) &&
|
||||
(identical(other.isBedtimeFillable, isBedtimeFillable) ||
|
||||
other.isBedtimeFillable == isBedtimeFillable) &&
|
||||
(identical(other.activityCoefficient, activityCoefficient) ||
|
||||
other.activityCoefficient == activityCoefficient));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -1028,7 +1032,8 @@ class _$ProfileDetailsModelImpl implements _ProfileDetailsModel {
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileDetailsModelImplCopyWith<_$ProfileDetailsModelImpl> get copyWith =>
|
||||
__$$ProfileDetailsModelImplCopyWithImpl<_$ProfileDetailsModelImpl>(this, _$identity);
|
||||
__$$ProfileDetailsModelImplCopyWithImpl<_$ProfileDetailsModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -1049,131 +1054,112 @@ abstract class _ProfileDetailsModel implements ProfileDetailsModel {
|
||||
@JsonKey(name: "lang") required final String lang,
|
||||
@JsonKey(name: "weight") required final double weight,
|
||||
@JsonKey(name: "height") required final int height,
|
||||
@JsonKey(name: "chest_circumference") required final int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference") required final int waistCircumference,
|
||||
@JsonKey(name: "chest_circumference")
|
||||
required final int chestCircumference,
|
||||
@JsonKey(name: "waist_circumference")
|
||||
required final int waistCircumference,
|
||||
@JsonKey(name: "hip_circumference") required final int hipCircumference,
|
||||
@JsonKey(name: "blood_pressure_up") required final int bloodPressureUp,
|
||||
@JsonKey(name: "blood_pressure_down") required final int bloodPressureDown,
|
||||
@JsonKey(name: "blood_pressure_down")
|
||||
required final int bloodPressureDown,
|
||||
@JsonKey(name: "has_hypo") required final bool hasHypo,
|
||||
@JsonKey(name: "has_hyper") required final bool hasHyper,
|
||||
@JsonKey(name: "about_alergy") required final String aboutAlergy,
|
||||
@JsonKey(name: "about_taking_pils") required final String aboutTakingPils,
|
||||
@JsonKey(name: "about_sport_hobbies") required final String aboutSportHobbies,
|
||||
@JsonKey(name: "about_sport_hobbies")
|
||||
required final String aboutSportHobbies,
|
||||
@JsonKey(name: "favorite_foods") required final String favoriteFoods,
|
||||
@JsonKey(name: "unfavorite_foods") required final String unfavoriteFoods,
|
||||
@JsonKey(name: "additional_info") required final String additionalInfo,
|
||||
@JsonKey(name: "created_at") final DateTime? createdAt,
|
||||
@JsonKey(name: "updated_at") final DateTime? updatedAt,
|
||||
@JsonKey(name: "is_mood_fillable") required final bool isMoodFillable,
|
||||
@JsonKey(name: "is_bedtime_fillable") required final bool isBedtimeFillable,
|
||||
@JsonKey(name: "activity_coefficient") required final double activityCoefficient}) = _$ProfileDetailsModelImpl;
|
||||
@JsonKey(name: "is_bedtime_fillable")
|
||||
required final bool isBedtimeFillable,
|
||||
@JsonKey(name: "activity_coefficient")
|
||||
required final double activityCoefficient}) = _$ProfileDetailsModelImpl;
|
||||
|
||||
factory _ProfileDetailsModel.fromJson(Map<String, dynamic> json) = _$ProfileDetailsModelImpl.fromJson;
|
||||
factory _ProfileDetailsModel.fromJson(Map<String, dynamic> json) =
|
||||
_$ProfileDetailsModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "first_name")
|
||||
String get firstName;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "last_name")
|
||||
String get lastName;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "birthdate")
|
||||
String get birthdate;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "gender")
|
||||
String get gender;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "country")
|
||||
String get country;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "city")
|
||||
String get city;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "lang")
|
||||
String get lang;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "weight")
|
||||
double get weight;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "height")
|
||||
int get height;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "chest_circumference")
|
||||
int get chestCircumference;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "waist_circumference")
|
||||
int get waistCircumference;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "hip_circumference")
|
||||
int get hipCircumference;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "blood_pressure_up")
|
||||
int get bloodPressureUp;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "blood_pressure_down")
|
||||
int get bloodPressureDown;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "has_hypo")
|
||||
bool get hasHypo;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "has_hyper")
|
||||
bool get hasHyper;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "about_alergy")
|
||||
String get aboutAlergy;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "about_taking_pils")
|
||||
String get aboutTakingPils;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "about_sport_hobbies")
|
||||
String get aboutSportHobbies;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "favorite_foods")
|
||||
String get favoriteFoods;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "unfavorite_foods")
|
||||
String get unfavoriteFoods;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "additional_info")
|
||||
String get additionalInfo;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime? get createdAt;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime? get updatedAt;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "is_mood_fillable")
|
||||
bool get isMoodFillable;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "is_bedtime_fillable")
|
||||
bool get isBedtimeFillable;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "activity_coefficient")
|
||||
double get activityCoefficient;
|
||||
@@ -1182,5 +1168,6 @@ abstract class _ProfileDetailsModel implements ProfileDetailsModel {
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfileDetailsModelImplCopyWith<_$ProfileDetailsModelImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
_$$ProfileDetailsModelImplCopyWith<_$ProfileDetailsModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -6,19 +6,27 @@ part of 'profile_model.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ProfileModelImpl _$$ProfileModelImplFromJson(Map<String, dynamic> json) => _$ProfileModelImpl(
|
||||
_$ProfileModelImpl _$$ProfileModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProfileModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
name: json['name'] as String,
|
||||
email: json['email'] as String,
|
||||
emailVerifiedAt: json['email_verified_at'] == null ? null : DateTime.parse(json['email_verified_at'] as String),
|
||||
createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String),
|
||||
emailVerifiedAt: json['email_verified_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['email_verified_at'] as String),
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
isPublicProfile: json['is_public_profile'] as bool,
|
||||
slug: json['slug'] as String,
|
||||
profilePhotoUrl: json['profile_photo_url'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'email': instance.email,
|
||||
@@ -30,7 +38,9 @@ Map<String, dynamic> _$$ProfileModelImplToJson(_$ProfileModelImpl instance) => <
|
||||
'profile_photo_url': instance.profilePhotoUrl,
|
||||
};
|
||||
|
||||
_$ProfileDetailsModelImpl _$$ProfileDetailsModelImplFromJson(Map<String, dynamic> json) => _$ProfileDetailsModelImpl(
|
||||
_$ProfileDetailsModelImpl _$$ProfileDetailsModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$ProfileDetailsModelImpl(
|
||||
firstName: json['first_name'] as String,
|
||||
lastName: json['last_name'] as String,
|
||||
birthdate: json['birthdate'] as String,
|
||||
@@ -53,14 +63,20 @@ _$ProfileDetailsModelImpl _$$ProfileDetailsModelImplFromJson(Map<String, dynamic
|
||||
favoriteFoods: json['favorite_foods'] as String,
|
||||
unfavoriteFoods: json['unfavorite_foods'] as String,
|
||||
additionalInfo: json['additional_info'] as String,
|
||||
createdAt: json['created_at'] == null ? null : DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: json['updated_at'] == null ? null : DateTime.parse(json['updated_at'] as String),
|
||||
createdAt: json['created_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: json['updated_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updated_at'] as String),
|
||||
isMoodFillable: json['is_mood_fillable'] as bool,
|
||||
isBedtimeFillable: json['is_bedtime_fillable'] as bool,
|
||||
activityCoefficient: (json['activity_coefficient'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProfileDetailsModelImplToJson(_$ProfileDetailsModelImpl instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$$ProfileDetailsModelImplToJson(
|
||||
_$ProfileDetailsModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'first_name': instance.firstName,
|
||||
'last_name': instance.lastName,
|
||||
'birthdate': instance.birthdate,
|
||||
|
||||
18
lib/features/profile/models/weight_model.dart
Normal file
18
lib/features/profile/models/weight_model.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'weight_model.freezed.dart';
|
||||
part 'weight_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class WeightModel with _$WeightModel {
|
||||
const factory WeightModel({
|
||||
@JsonKey(name: "id") required int id,
|
||||
@JsonKey(name: "user_id") required int userId,
|
||||
@JsonKey(name: "weight") required int weight,
|
||||
@JsonKey(name: "created_at") required DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required DateTime updatedAt,
|
||||
@JsonKey(name: "bmi") required double bmi,
|
||||
}) = _WeightModel;
|
||||
|
||||
factory WeightModel.fromJson(Map<String, dynamic> json) => _$WeightModelFromJson(json);
|
||||
}
|
||||
289
lib/features/profile/models/weight_model.freezed.dart
Normal file
289
lib/features/profile/models/weight_model.freezed.dart
Normal file
@@ -0,0 +1,289 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'weight_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
WeightModel _$WeightModelFromJson(Map<String, dynamic> json) {
|
||||
return _WeightModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$WeightModel {
|
||||
@JsonKey(name: "id")
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "user_id")
|
||||
int get userId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "weight")
|
||||
int get weight => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime get updatedAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "bmi")
|
||||
double get bmi => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this WeightModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of WeightModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$WeightModelCopyWith<WeightModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $WeightModelCopyWith<$Res> {
|
||||
factory $WeightModelCopyWith(
|
||||
WeightModel value, $Res Function(WeightModel) then) =
|
||||
_$WeightModelCopyWithImpl<$Res, WeightModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "id") int id,
|
||||
@JsonKey(name: "user_id") int userId,
|
||||
@JsonKey(name: "weight") int weight,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt,
|
||||
@JsonKey(name: "bmi") double bmi});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$WeightModelCopyWithImpl<$Res, $Val extends WeightModel>
|
||||
implements $WeightModelCopyWith<$Res> {
|
||||
_$WeightModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of WeightModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? userId = null,
|
||||
Object? weight = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
Object? bmi = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
weight: null == weight
|
||||
? _value.weight
|
||||
: weight // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
bmi: null == bmi
|
||||
? _value.bmi
|
||||
: bmi // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$WeightModelImplCopyWith<$Res>
|
||||
implements $WeightModelCopyWith<$Res> {
|
||||
factory _$$WeightModelImplCopyWith(
|
||||
_$WeightModelImpl value, $Res Function(_$WeightModelImpl) then) =
|
||||
__$$WeightModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "id") int id,
|
||||
@JsonKey(name: "user_id") int userId,
|
||||
@JsonKey(name: "weight") int weight,
|
||||
@JsonKey(name: "created_at") DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") DateTime updatedAt,
|
||||
@JsonKey(name: "bmi") double bmi});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$WeightModelImplCopyWithImpl<$Res>
|
||||
extends _$WeightModelCopyWithImpl<$Res, _$WeightModelImpl>
|
||||
implements _$$WeightModelImplCopyWith<$Res> {
|
||||
__$$WeightModelImplCopyWithImpl(
|
||||
_$WeightModelImpl _value, $Res Function(_$WeightModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of WeightModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? userId = null,
|
||||
Object? weight = null,
|
||||
Object? createdAt = null,
|
||||
Object? updatedAt = null,
|
||||
Object? bmi = null,
|
||||
}) {
|
||||
return _then(_$WeightModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
userId: null == userId
|
||||
? _value.userId
|
||||
: userId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
weight: null == weight
|
||||
? _value.weight
|
||||
: weight // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
createdAt: null == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
updatedAt: null == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
bmi: null == bmi
|
||||
? _value.bmi
|
||||
: bmi // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$WeightModelImpl implements _WeightModel {
|
||||
const _$WeightModelImpl(
|
||||
{@JsonKey(name: "id") required this.id,
|
||||
@JsonKey(name: "user_id") required this.userId,
|
||||
@JsonKey(name: "weight") required this.weight,
|
||||
@JsonKey(name: "created_at") required this.createdAt,
|
||||
@JsonKey(name: "updated_at") required this.updatedAt,
|
||||
@JsonKey(name: "bmi") required this.bmi});
|
||||
|
||||
factory _$WeightModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$WeightModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
final int id;
|
||||
@override
|
||||
@JsonKey(name: "user_id")
|
||||
final int userId;
|
||||
@override
|
||||
@JsonKey(name: "weight")
|
||||
final int weight;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
final DateTime updatedAt;
|
||||
@override
|
||||
@JsonKey(name: "bmi")
|
||||
final double bmi;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WeightModel(id: $id, userId: $userId, weight: $weight, createdAt: $createdAt, updatedAt: $updatedAt, bmi: $bmi)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$WeightModelImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.userId, userId) || other.userId == userId) &&
|
||||
(identical(other.weight, weight) || other.weight == weight) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt) &&
|
||||
(identical(other.bmi, bmi) || other.bmi == bmi));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, userId, weight, createdAt, updatedAt, bmi);
|
||||
|
||||
/// Create a copy of WeightModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$WeightModelImplCopyWith<_$WeightModelImpl> get copyWith =>
|
||||
__$$WeightModelImplCopyWithImpl<_$WeightModelImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$WeightModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _WeightModel implements WeightModel {
|
||||
const factory _WeightModel(
|
||||
{@JsonKey(name: "id") required final int id,
|
||||
@JsonKey(name: "user_id") required final int userId,
|
||||
@JsonKey(name: "weight") required final int weight,
|
||||
@JsonKey(name: "created_at") required final DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required final DateTime updatedAt,
|
||||
@JsonKey(name: "bmi") required final double bmi}) = _$WeightModelImpl;
|
||||
|
||||
factory _WeightModel.fromJson(Map<String, dynamic> json) =
|
||||
_$WeightModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
int get id;
|
||||
@override
|
||||
@JsonKey(name: "user_id")
|
||||
int get userId;
|
||||
@override
|
||||
@JsonKey(name: "weight")
|
||||
int get weight;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
DateTime get createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
DateTime get updatedAt;
|
||||
@override
|
||||
@JsonKey(name: "bmi")
|
||||
double get bmi;
|
||||
|
||||
/// Create a copy of WeightModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$WeightModelImplCopyWith<_$WeightModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
27
lib/features/profile/models/weight_model.g.dart
Normal file
27
lib/features/profile/models/weight_model.g.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'weight_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$WeightModelImpl _$$WeightModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$WeightModelImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
userId: (json['user_id'] as num).toInt(),
|
||||
weight: (json['weight'] as num).toInt(),
|
||||
createdAt: DateTime.parse(json['created_at'] as String),
|
||||
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||
bmi: (json['bmi'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$WeightModelImplToJson(_$WeightModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'user_id': instance.userId,
|
||||
'weight': instance.weight,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
'bmi': instance.bmi,
|
||||
};
|
||||
@@ -15,6 +15,8 @@ class ProfileCubit extends Cubit<ProfileState> {
|
||||
profile: await profileRepository.getProfileBySlug(slug),
|
||||
profileDetails: await profileRepository.getMyProfileDetails(),
|
||||
blogPosts: await profileRepository.getBlogPostsByAuthorSlug(slug: slug),
|
||||
weightPoints: await profileRepository.getWeight(period: '1', slug: slug),
|
||||
circumferencePoints: await profileRepository.getCircumferences(period: '1', slug: slug),
|
||||
));
|
||||
} catch (e) {
|
||||
emit(ProfileState.error(errorMessage: e.toString()));
|
||||
@@ -29,6 +31,8 @@ class ProfileCubit extends Cubit<ProfileState> {
|
||||
profile: profile,
|
||||
profileDetails: await profileRepository.getMyProfileDetails(),
|
||||
blogPosts: await profileRepository.getBlogPostsByAuthorSlug(slug: profile.slug),
|
||||
weightPoints: await profileRepository.getWeight(period: '1'),
|
||||
circumferencePoints: await profileRepository.getCircumferences(period: '1'),
|
||||
));
|
||||
} catch (e) {
|
||||
emit(ProfileState.error(errorMessage: e.toString()));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'profile_state.freezed.dart';
|
||||
@@ -14,6 +16,8 @@ abstract class ProfileState with _$ProfileState {
|
||||
required ProfileModel profile,
|
||||
required ProfileDetailsModel profileDetails,
|
||||
required List<FeedBlogPostModel> blogPosts,
|
||||
required List<WeightModel> weightPoints,
|
||||
required List<CircumferenceModel> circumferencePoints,
|
||||
}) = ProfileStateLoaded;
|
||||
|
||||
const factory ProfileState.error({
|
||||
|
||||
@@ -20,16 +20,27 @@ mixin _$ProfileState {
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts) loaded,
|
||||
required TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult? Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@@ -37,7 +48,13 @@ mixin _$ProfileState {
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
@@ -71,16 +88,18 @@ mixin _$ProfileState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfileStateCopyWith<$Res> {
|
||||
factory $ProfileStateCopyWith(ProfileState value, $Res Function(ProfileState) then) = _$ProfileStateCopyWithImpl<$Res, ProfileState>;
|
||||
factory $ProfileStateCopyWith(
|
||||
ProfileState value, $Res Function(ProfileState) then) =
|
||||
_$ProfileStateCopyWithImpl<$Res, ProfileState>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState> implements $ProfileStateCopyWith<$Res> {
|
||||
class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState>
|
||||
implements $ProfileStateCopyWith<$Res> {
|
||||
_$ProfileStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@@ -90,12 +109,18 @@ class _$ProfileStateCopyWithImpl<$Res, $Val extends ProfileState> implements $Pr
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileStateImplCopyWith<$Res> {
|
||||
factory _$$ProfileStateImplCopyWith(_$ProfileStateImpl value, $Res Function(_$ProfileStateImpl) then) = __$$ProfileStateImplCopyWithImpl<$Res>;
|
||||
factory _$$ProfileStateImplCopyWith(
|
||||
_$ProfileStateImpl value, $Res Function(_$ProfileStateImpl) then) =
|
||||
__$$ProfileStateImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileStateImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateImpl> implements _$$ProfileStateImplCopyWith<$Res> {
|
||||
__$$ProfileStateImplCopyWithImpl(_$ProfileStateImpl _value, $Res Function(_$ProfileStateImpl) _then) : super(_value, _then);
|
||||
class __$$ProfileStateImplCopyWithImpl<$Res>
|
||||
extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateImpl>
|
||||
implements _$$ProfileStateImplCopyWith<$Res> {
|
||||
__$$ProfileStateImplCopyWithImpl(
|
||||
_$ProfileStateImpl _value, $Res Function(_$ProfileStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -113,7 +138,8 @@ class _$ProfileStateImpl implements _ProfileState {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType && other is _$ProfileStateImpl);
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$ProfileStateImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -124,7 +150,13 @@ class _$ProfileStateImpl implements _ProfileState {
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts) loaded,
|
||||
required TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return $default();
|
||||
@@ -135,7 +167,13 @@ class _$ProfileStateImpl implements _ProfileState {
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult? Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return $default?.call();
|
||||
@@ -146,7 +184,13 @@ class _$ProfileStateImpl implements _ProfileState {
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
@@ -200,14 +244,18 @@ abstract class _ProfileState implements ProfileState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileStateLoadingImplCopyWith<$Res> {
|
||||
factory _$$ProfileStateLoadingImplCopyWith(_$ProfileStateLoadingImpl value, $Res Function(_$ProfileStateLoadingImpl) then) =
|
||||
factory _$$ProfileStateLoadingImplCopyWith(_$ProfileStateLoadingImpl value,
|
||||
$Res Function(_$ProfileStateLoadingImpl) then) =
|
||||
__$$ProfileStateLoadingImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileStateLoadingImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadingImpl>
|
||||
class __$$ProfileStateLoadingImplCopyWithImpl<$Res>
|
||||
extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadingImpl>
|
||||
implements _$$ProfileStateLoadingImplCopyWith<$Res> {
|
||||
__$$ProfileStateLoadingImplCopyWithImpl(_$ProfileStateLoadingImpl _value, $Res Function(_$ProfileStateLoadingImpl) _then) : super(_value, _then);
|
||||
__$$ProfileStateLoadingImplCopyWithImpl(_$ProfileStateLoadingImpl _value,
|
||||
$Res Function(_$ProfileStateLoadingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -225,7 +273,9 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType && other is _$ProfileStateLoadingImpl);
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileStateLoadingImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -236,7 +286,13 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts) loaded,
|
||||
required TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loading();
|
||||
@@ -247,7 +303,13 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult? Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loading?.call();
|
||||
@@ -258,7 +320,13 @@ class _$ProfileStateLoadingImpl implements ProfileStateLoading {
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
@@ -312,21 +380,28 @@ abstract class ProfileStateLoading implements ProfileState {
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileStateLoadedImplCopyWith<$Res> {
|
||||
factory _$$ProfileStateLoadedImplCopyWith(_$ProfileStateLoadedImpl value, $Res Function(_$ProfileStateLoadedImpl) then) =
|
||||
factory _$$ProfileStateLoadedImplCopyWith(_$ProfileStateLoadedImpl value,
|
||||
$Res Function(_$ProfileStateLoadedImpl) then) =
|
||||
__$$ProfileStateLoadedImplCopyWithImpl<$Res>;
|
||||
|
||||
@useResult
|
||||
$Res call({ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts});
|
||||
$Res call(
|
||||
{ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints});
|
||||
|
||||
$ProfileModelCopyWith<$Res> get profile;
|
||||
|
||||
$ProfileDetailsModelCopyWith<$Res> get profileDetails;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileStateLoadedImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadedImpl>
|
||||
class __$$ProfileStateLoadedImplCopyWithImpl<$Res>
|
||||
extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateLoadedImpl>
|
||||
implements _$$ProfileStateLoadedImplCopyWith<$Res> {
|
||||
__$$ProfileStateLoadedImplCopyWithImpl(_$ProfileStateLoadedImpl _value, $Res Function(_$ProfileStateLoadedImpl) _then) : super(_value, _then);
|
||||
__$$ProfileStateLoadedImplCopyWithImpl(_$ProfileStateLoadedImpl _value,
|
||||
$Res Function(_$ProfileStateLoadedImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -336,6 +411,8 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res> extends _$ProfileStateCopyWit
|
||||
Object? profile = null,
|
||||
Object? profileDetails = null,
|
||||
Object? blogPosts = null,
|
||||
Object? weightPoints = null,
|
||||
Object? circumferencePoints = null,
|
||||
}) {
|
||||
return _then(_$ProfileStateLoadedImpl(
|
||||
profile: null == profile
|
||||
@@ -350,6 +427,14 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res> extends _$ProfileStateCopyWit
|
||||
? _value._blogPosts
|
||||
: blogPosts // ignore: cast_nullable_to_non_nullable
|
||||
as List<FeedBlogPostModel>,
|
||||
weightPoints: null == weightPoints
|
||||
? _value._weightPoints
|
||||
: weightPoints // ignore: cast_nullable_to_non_nullable
|
||||
as List<WeightModel>,
|
||||
circumferencePoints: null == circumferencePoints
|
||||
? _value._circumferencePoints
|
||||
: circumferencePoints // ignore: cast_nullable_to_non_nullable
|
||||
as List<CircumferenceModel>,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -377,15 +462,21 @@ class __$$ProfileStateLoadedImplCopyWithImpl<$Res> extends _$ProfileStateCopyWit
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
const _$ProfileStateLoadedImpl({required this.profile, required this.profileDetails, required final List<FeedBlogPostModel> blogPosts})
|
||||
: _blogPosts = blogPosts;
|
||||
const _$ProfileStateLoadedImpl(
|
||||
{required this.profile,
|
||||
required this.profileDetails,
|
||||
required final List<FeedBlogPostModel> blogPosts,
|
||||
required final List<WeightModel> weightPoints,
|
||||
required final List<CircumferenceModel> circumferencePoints})
|
||||
: _blogPosts = blogPosts,
|
||||
_weightPoints = weightPoints,
|
||||
_circumferencePoints = circumferencePoints;
|
||||
|
||||
@override
|
||||
final ProfileModel profile;
|
||||
@override
|
||||
final ProfileDetailsModel profileDetails;
|
||||
final List<FeedBlogPostModel> _blogPosts;
|
||||
|
||||
@override
|
||||
List<FeedBlogPostModel> get blogPosts {
|
||||
if (_blogPosts is EqualUnmodifiableListView) return _blogPosts;
|
||||
@@ -393,9 +484,26 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
return EqualUnmodifiableListView(_blogPosts);
|
||||
}
|
||||
|
||||
final List<WeightModel> _weightPoints;
|
||||
@override
|
||||
List<WeightModel> get weightPoints {
|
||||
if (_weightPoints is EqualUnmodifiableListView) return _weightPoints;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_weightPoints);
|
||||
}
|
||||
|
||||
final List<CircumferenceModel> _circumferencePoints;
|
||||
@override
|
||||
List<CircumferenceModel> get circumferencePoints {
|
||||
if (_circumferencePoints is EqualUnmodifiableListView)
|
||||
return _circumferencePoints;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_circumferencePoints);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfileState.loaded(profile: $profile, profileDetails: $profileDetails, blogPosts: $blogPosts)';
|
||||
return 'ProfileState.loaded(profile: $profile, profileDetails: $profileDetails, blogPosts: $blogPosts, weightPoints: $weightPoints, circumferencePoints: $circumferencePoints)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -404,12 +512,24 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileStateLoadedImpl &&
|
||||
(identical(other.profile, profile) || other.profile == profile) &&
|
||||
(identical(other.profileDetails, profileDetails) || other.profileDetails == profileDetails) &&
|
||||
const DeepCollectionEquality().equals(other._blogPosts, _blogPosts));
|
||||
(identical(other.profileDetails, profileDetails) ||
|
||||
other.profileDetails == profileDetails) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._blogPosts, _blogPosts) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._weightPoints, _weightPoints) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._circumferencePoints, _circumferencePoints));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, profile, profileDetails, const DeepCollectionEquality().hash(_blogPosts));
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
profile,
|
||||
profileDetails,
|
||||
const DeepCollectionEquality().hash(_blogPosts),
|
||||
const DeepCollectionEquality().hash(_weightPoints),
|
||||
const DeepCollectionEquality().hash(_circumferencePoints));
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -417,17 +537,25 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith =>
|
||||
__$$ProfileStateLoadedImplCopyWithImpl<_$ProfileStateLoadedImpl>(this, _$identity);
|
||||
__$$ProfileStateLoadedImplCopyWithImpl<_$ProfileStateLoadedImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts) loaded,
|
||||
required TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return loaded(profile, profileDetails, blogPosts);
|
||||
return loaded(
|
||||
profile, profileDetails, blogPosts, weightPoints, circumferencePoints);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -435,10 +563,17 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult? Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return loaded?.call(profile, profileDetails, blogPosts);
|
||||
return loaded?.call(
|
||||
profile, profileDetails, blogPosts, weightPoints, circumferencePoints);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -446,12 +581,19 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (loaded != null) {
|
||||
return loaded(profile, profileDetails, blogPosts);
|
||||
return loaded(profile, profileDetails, blogPosts, weightPoints,
|
||||
circumferencePoints);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
@@ -496,35 +638,42 @@ class _$ProfileStateLoadedImpl implements ProfileStateLoaded {
|
||||
|
||||
abstract class ProfileStateLoaded implements ProfileState {
|
||||
const factory ProfileStateLoaded(
|
||||
{required final ProfileModel profile,
|
||||
required final ProfileDetailsModel profileDetails,
|
||||
required final List<FeedBlogPostModel> blogPosts}) = _$ProfileStateLoadedImpl;
|
||||
{required final ProfileModel profile,
|
||||
required final ProfileDetailsModel profileDetails,
|
||||
required final List<FeedBlogPostModel> blogPosts,
|
||||
required final List<WeightModel> weightPoints,
|
||||
required final List<CircumferenceModel> circumferencePoints}) =
|
||||
_$ProfileStateLoadedImpl;
|
||||
|
||||
ProfileModel get profile;
|
||||
|
||||
ProfileDetailsModel get profileDetails;
|
||||
|
||||
List<FeedBlogPostModel> get blogPosts;
|
||||
List<WeightModel> get weightPoints;
|
||||
List<CircumferenceModel> get circumferencePoints;
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
_$$ProfileStateLoadedImplCopyWith<_$ProfileStateLoadedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfileStateErrorImplCopyWith<$Res> {
|
||||
factory _$$ProfileStateErrorImplCopyWith(_$ProfileStateErrorImpl value, $Res Function(_$ProfileStateErrorImpl) then) =
|
||||
factory _$$ProfileStateErrorImplCopyWith(_$ProfileStateErrorImpl value,
|
||||
$Res Function(_$ProfileStateErrorImpl) then) =
|
||||
__$$ProfileStateErrorImplCopyWithImpl<$Res>;
|
||||
|
||||
@useResult
|
||||
$Res call({String errorMessage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfileStateErrorImplCopyWithImpl<$Res> extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateErrorImpl>
|
||||
class __$$ProfileStateErrorImplCopyWithImpl<$Res>
|
||||
extends _$ProfileStateCopyWithImpl<$Res, _$ProfileStateErrorImpl>
|
||||
implements _$$ProfileStateErrorImplCopyWith<$Res> {
|
||||
__$$ProfileStateErrorImplCopyWithImpl(_$ProfileStateErrorImpl _value, $Res Function(_$ProfileStateErrorImpl) _then) : super(_value, _then);
|
||||
__$$ProfileStateErrorImplCopyWithImpl(_$ProfileStateErrorImpl _value,
|
||||
$Res Function(_$ProfileStateErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -560,7 +709,8 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfileStateErrorImpl &&
|
||||
(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
(identical(other.errorMessage, errorMessage) ||
|
||||
other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -571,14 +721,22 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith => __$$ProfileStateErrorImplCopyWithImpl<_$ProfileStateErrorImpl>(this, _$identity);
|
||||
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith =>
|
||||
__$$ProfileStateErrorImplCopyWithImpl<_$ProfileStateErrorImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function() $default, {
|
||||
required TResult Function() loading,
|
||||
required TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts) loaded,
|
||||
required TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)
|
||||
loaded,
|
||||
required TResult Function(String errorMessage) error,
|
||||
}) {
|
||||
return error(errorMessage);
|
||||
@@ -589,7 +747,13 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function()? $default, {
|
||||
TResult? Function()? loading,
|
||||
TResult? Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult? Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult? Function(String errorMessage)? error,
|
||||
}) {
|
||||
return error?.call(errorMessage);
|
||||
@@ -600,7 +764,13 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function()? $default, {
|
||||
TResult Function()? loading,
|
||||
TResult Function(ProfileModel profile, ProfileDetailsModel profileDetails, List<FeedBlogPostModel> blogPosts)? loaded,
|
||||
TResult Function(
|
||||
ProfileModel profile,
|
||||
ProfileDetailsModel profileDetails,
|
||||
List<FeedBlogPostModel> blogPosts,
|
||||
List<WeightModel> weightPoints,
|
||||
List<CircumferenceModel> circumferencePoints)?
|
||||
loaded,
|
||||
TResult Function(String errorMessage)? error,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
@@ -649,12 +819,14 @@ class _$ProfileStateErrorImpl implements ProfileStateError {
|
||||
}
|
||||
|
||||
abstract class ProfileStateError implements ProfileState {
|
||||
const factory ProfileStateError({required final String errorMessage}) = _$ProfileStateErrorImpl;
|
||||
const factory ProfileStateError({required final String errorMessage}) =
|
||||
_$ProfileStateErrorImpl;
|
||||
|
||||
String get errorMessage;
|
||||
|
||||
/// Create a copy of ProfileState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith => throw _privateConstructorUsedError;
|
||||
_$$ProfileStateErrorImplCopyWith<_$ProfileStateErrorImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_state.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/widgets/circumference_chart_widget.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widget.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -21,8 +26,8 @@ class ProfileScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
// List<Circumference> chartData = [];
|
||||
// List<ChartPointModel> chartPoints = [];
|
||||
List<CircumferenceModel> circumferencePoints = [];
|
||||
List<WeightModel> weightPoints = [];
|
||||
final List<String> chipsLabelList = ['Вес', 'Замеры', 'ИМТ'];
|
||||
final List<String> chipsIntervalLabelList = ['1М', '3М', '6М', '1Г', 'ВСЁ ВРЕМЯ'];
|
||||
int _selectedChipIndex = 0;
|
||||
@@ -40,8 +45,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
child: BlocBuilder<ProfileCubit, ProfileState>(
|
||||
builder: (BuildContext context, ProfileState state) {
|
||||
if (state is ProfileStateLoaded) {
|
||||
// chartData = state.profile.circumferences;
|
||||
// chartPoints = state.profile.chartPoints;
|
||||
circumferencePoints = state.circumferencePoints;
|
||||
weightPoints = state.weightPoints;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
appBar: widget.author == null ? AppBar(toolbarHeight: 0) : AppBar(),
|
||||
@@ -209,25 +214,27 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Builder(
|
||||
// builder: (context) {
|
||||
// switch (_selectedChipIndex) {
|
||||
// case 0:
|
||||
// return WeightChartWidget(
|
||||
// chartPoints: chartPoints,
|
||||
// profileCubit: context.read<ProfileCubit>(),
|
||||
// );
|
||||
// case 1:
|
||||
// return CircumferenceChartWidget(
|
||||
// chartData: chartData,
|
||||
// profileCubit: context.read<ProfileCubit>(),
|
||||
// );
|
||||
// case 2:
|
||||
// return ImtChartWidget(chartPoints: chartPoints);
|
||||
// }
|
||||
// return SizedBox.shrink();
|
||||
// },
|
||||
// ),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
switch (_selectedChipIndex) {
|
||||
case 0:
|
||||
return WeightChartWidget(
|
||||
weightPoints: weightPoints,
|
||||
profileCubit: context.read<ProfileCubit>(),
|
||||
);
|
||||
case 1:
|
||||
return CircumferenceChartWidget(
|
||||
circumferencePoints: circumferencePoints,
|
||||
profileCubit: context.read<ProfileCubit>(),
|
||||
);
|
||||
case 2:
|
||||
return ImtChartWidget(
|
||||
weightPoints: weightPoints,
|
||||
);
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
|
||||
@@ -1,374 +1,374 @@
|
||||
//
|
||||
// import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
// import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
// import 'package:flutter/cupertino.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
// import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
//
|
||||
// class CircumferenceChartWidget extends StatefulWidget {
|
||||
// final List<Circumference> chartData;
|
||||
// final ProfileCubit profileCubit;
|
||||
//
|
||||
// const CircumferenceChartWidget({
|
||||
// super.key,
|
||||
// required this.chartData,
|
||||
// required this.profileCubit,
|
||||
// });
|
||||
//
|
||||
// @override
|
||||
// State<CircumferenceChartWidget> createState() => _CircumferenceChartWidgetState();
|
||||
// }
|
||||
//
|
||||
// class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
|
||||
// late FixedExtentScrollController chestController;
|
||||
// late FixedExtentScrollController waistController;
|
||||
// late FixedExtentScrollController hipController;
|
||||
// late int chest;
|
||||
// late int waist;
|
||||
// late int hip;
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Column(
|
||||
// children: [
|
||||
// if (widget.chartData.isNotEmpty)
|
||||
// Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// '${widget.chartData.last.chestCircumference}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontSize: 40,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length == 1)
|
||||
// Container(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
// width: 8,
|
||||
// height: 8,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black12,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length > 1)
|
||||
// widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference
|
||||
// ? Icon(
|
||||
// Icons.arrow_drop_up,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.arrow_drop_down,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// Text(
|
||||
// '${widget.chartData.last.waistCircumference}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontSize: 40,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length == 1)
|
||||
// Container(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
// width: 8,
|
||||
// height: 8,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black12,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length > 1)
|
||||
// widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference
|
||||
// ? Icon(
|
||||
// Icons.arrow_drop_up,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.arrow_drop_down,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// Text(
|
||||
// '${widget.chartData.last.hipCircumference}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontSize: 40,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length == 1)
|
||||
// Container(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
// width: 8,
|
||||
// height: 8,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black12,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartData.length > 1)
|
||||
// widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference
|
||||
// ? Icon(
|
||||
// Icons.arrow_drop_up,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.arrow_drop_down,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Stack(
|
||||
// alignment: Alignment.bottomRight,
|
||||
// children: [
|
||||
// SfCartesianChart(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
// enableAxisAnimation: true,
|
||||
// plotAreaBorderWidth: 0,
|
||||
// trackballBehavior: TrackballBehavior(
|
||||
// enable: true,
|
||||
// activationMode: ActivationMode.singleTap,
|
||||
// tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
// tooltipSettings: InteractiveTooltip(),
|
||||
// lineType: TrackballLineType.vertical,
|
||||
// ),
|
||||
// primaryXAxis: DateTimeCategoryAxis(
|
||||
// tickPosition: TickPosition.inside,
|
||||
// majorTickLines: MajorTickLines(
|
||||
// size: 0,
|
||||
// ),
|
||||
// edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
// dateFormat: DateFormat.MMMd('ru'),
|
||||
// labelStyle: TextStyle(
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
// axisLine: AxisLine(
|
||||
// color: Colors.grey.withOpacity(0.3),
|
||||
// width: 0.4,
|
||||
// ),
|
||||
// ),
|
||||
// primaryYAxis: NumericAxis(
|
||||
// isVisible: false,
|
||||
// labelFormat: '{value} см',
|
||||
// axisLine: AxisLine(
|
||||
// width: 1,
|
||||
// ),
|
||||
// majorTickLines: MajorTickLines(size: 0),
|
||||
// ),
|
||||
// series: _getSplineSeries(),
|
||||
// tooltipBehavior: TooltipBehavior(enable: true),
|
||||
// ),
|
||||
// FloatingActionButton.small(
|
||||
// heroTag: 'addCircumference',
|
||||
// onPressed: () {
|
||||
// if (widget.chartData.isNotEmpty) {
|
||||
// chest = widget.chartData.last.chestCircumference;
|
||||
// waist = widget.chartData.last.waistCircumference;
|
||||
// hip = widget.chartData.last.hipCircumference;
|
||||
// chestController = FixedExtentScrollController(initialItem: chest - 20);
|
||||
// waistController = FixedExtentScrollController(initialItem: waist - 20);
|
||||
// hipController = FixedExtentScrollController(initialItem: hip - 20);
|
||||
// } else {
|
||||
// chestController = FixedExtentScrollController();
|
||||
// waistController = FixedExtentScrollController();
|
||||
// hipController = FixedExtentScrollController();
|
||||
// }
|
||||
// showModalBottomSheet(
|
||||
// useRootNavigator: true,
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return Column(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: CupertinoPicker(
|
||||
// magnification: 1.22,
|
||||
// squeeze: 1.2,
|
||||
// useMagnifier: true,
|
||||
// scrollController: chestController,
|
||||
// itemExtent: 24,
|
||||
// onSelectedItemChanged: (int value) {
|
||||
// chest = value;
|
||||
// },
|
||||
// children: [
|
||||
// for (int i = 20; i < 200; i++) Text('$i'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: CupertinoPicker(
|
||||
// magnification: 1.22,
|
||||
// squeeze: 1.2,
|
||||
// useMagnifier: true,
|
||||
// scrollController: waistController,
|
||||
// itemExtent: 24,
|
||||
// onSelectedItemChanged: (int value) {
|
||||
// waist = value;
|
||||
// },
|
||||
// children: [
|
||||
// for (int i = 20; i < 200; i++) Text('$i'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: CupertinoPicker(
|
||||
// magnification: 1.22,
|
||||
// squeeze: 1.2,
|
||||
// useMagnifier: true,
|
||||
// scrollController: hipController,
|
||||
// itemExtent: 24,
|
||||
// onSelectedItemChanged: (int value) {
|
||||
// hip = value;
|
||||
// },
|
||||
// children: [
|
||||
// for (int i = 20; i < 200; i++) Text('$i'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// widget.profileCubit.addCircumference(
|
||||
// chestCircumference: chest,
|
||||
// waistCircumference: waist,
|
||||
// hipCircumference: hip,
|
||||
// );
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// borderRadius: BorderRadius.circular(16),
|
||||
// child: Ink(
|
||||
// width: MediaQuery.of(context).size.width - 32,
|
||||
// padding: EdgeInsets.all(16),
|
||||
// decoration: BoxDecoration(
|
||||
// color: appTheme.blueA400,
|
||||
// borderRadius: BorderRadius.circular(16),
|
||||
// ),
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// 'Сохранить',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// backgroundColor: Colors.red,
|
||||
// shape: CircleBorder(),
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// List<CartesianSeries<Circumference, DateTime>> _getSplineSeries() {
|
||||
// final Color seriesColor1 = Colors.red;
|
||||
// final Color seriesColor2 = appTheme.blueA400;
|
||||
// final Color seriesColor3 = Colors.green;
|
||||
//
|
||||
// return <CartesianSeries<Circumference, DateTime>>[
|
||||
// SplineAreaSeries<Circumference, DateTime>(
|
||||
// markerSettings: MarkerSettings(
|
||||
// isVisible: true,
|
||||
// color: seriesColor1,
|
||||
// height: 8,
|
||||
// width: 8,
|
||||
// ),
|
||||
// dataLabelSettings: DataLabelSettings(
|
||||
// labelAlignment: ChartDataLabelAlignment.top,
|
||||
// isVisible: true,
|
||||
// ),
|
||||
// dataSource: widget.chartData,
|
||||
// borderColor: seriesColor1,
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// seriesColor1.withOpacity(0.14),
|
||||
// Colors.transparent,
|
||||
// ],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment(0, 0.6),
|
||||
// ),
|
||||
// name: 'Грудь',
|
||||
// xValueMapper: (Circumference value, int index) => value.createdAt,
|
||||
// yValueMapper: (Circumference value, int index) => value.chestCircumference,
|
||||
// ),
|
||||
// SplineAreaSeries<Circumference, DateTime>(
|
||||
// markerSettings: MarkerSettings(
|
||||
// isVisible: true,
|
||||
// color: seriesColor2,
|
||||
// height: 8,
|
||||
// width: 8,
|
||||
// ),
|
||||
// dataLabelSettings: DataLabelSettings(
|
||||
// labelAlignment: ChartDataLabelAlignment.top,
|
||||
// isVisible: true,
|
||||
// ),
|
||||
// dataSource: widget.chartData,
|
||||
// borderColor: seriesColor2,
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// seriesColor2.withOpacity(0.14),
|
||||
// Colors.transparent,
|
||||
// ],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment(0, 0.6),
|
||||
// ),
|
||||
// name: 'Талия',
|
||||
// xValueMapper: (Circumference value, int index) => value.createdAt,
|
||||
// yValueMapper: (Circumference value, int index) => value.waistCircumference,
|
||||
// ),
|
||||
// SplineAreaSeries<Circumference, DateTime>(
|
||||
// markerSettings: MarkerSettings(
|
||||
// isVisible: true,
|
||||
// color: seriesColor3,
|
||||
// height: 8,
|
||||
// width: 8,
|
||||
// ),
|
||||
// dataLabelSettings: DataLabelSettings(
|
||||
// labelAlignment: ChartDataLabelAlignment.top,
|
||||
// isVisible: true,
|
||||
// ),
|
||||
// dataSource: widget.chartData,
|
||||
// borderColor: seriesColor3,
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// seriesColor3.withOpacity(0.14),
|
||||
// Colors.transparent,
|
||||
// ],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment(0, 0.6),
|
||||
// ),
|
||||
// name: 'Бёдра',
|
||||
// xValueMapper: (Circumference value, int index) => value.createdAt,
|
||||
// yValueMapper: (Circumference value, int index) => value.hipCircumference,
|
||||
// ),
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
|
||||
class CircumferenceChartWidget extends StatefulWidget {
|
||||
final List<CircumferenceModel> circumferencePoints;
|
||||
final ProfileCubit profileCubit;
|
||||
|
||||
const CircumferenceChartWidget({
|
||||
super.key,
|
||||
required this.circumferencePoints,
|
||||
required this.profileCubit,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CircumferenceChartWidget> createState() => _CircumferenceChartWidgetState();
|
||||
}
|
||||
|
||||
class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
|
||||
late FixedExtentScrollController chestController;
|
||||
late FixedExtentScrollController waistController;
|
||||
late FixedExtentScrollController hipController;
|
||||
late int chest;
|
||||
late int waist;
|
||||
late int hip;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
if (widget.circumferencePoints.isNotEmpty)
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${widget.circumferencePoints.last.chestCircumference}',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length == 1)
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length > 1)
|
||||
widget.circumferencePoints.last.chestCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].chestCircumference
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Text(
|
||||
'${widget.circumferencePoints.last.waistCircumference}',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length == 1)
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length > 1)
|
||||
widget.circumferencePoints.last.waistCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].waistCircumference
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Text(
|
||||
'${widget.circumferencePoints.last.hipCircumference}',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length == 1)
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
if (widget.circumferencePoints.length > 1)
|
||||
widget.circumferencePoints.last.hipCircumference > widget.circumferencePoints[widget.circumferencePoints.length - 2].hipCircumference
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Stack(
|
||||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
SfCartesianChart(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
enableAxisAnimation: true,
|
||||
plotAreaBorderWidth: 0,
|
||||
trackballBehavior: TrackballBehavior(
|
||||
enable: true,
|
||||
activationMode: ActivationMode.singleTap,
|
||||
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
tooltipSettings: InteractiveTooltip(),
|
||||
lineType: TrackballLineType.vertical,
|
||||
),
|
||||
primaryXAxis: DateTimeCategoryAxis(
|
||||
tickPosition: TickPosition.inside,
|
||||
majorTickLines: MajorTickLines(
|
||||
size: 0,
|
||||
),
|
||||
edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
dateFormat: DateFormat.MMMd('ru'),
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
axisLine: AxisLine(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
width: 0.4,
|
||||
),
|
||||
),
|
||||
primaryYAxis: NumericAxis(
|
||||
isVisible: false,
|
||||
labelFormat: '{value} см',
|
||||
axisLine: AxisLine(
|
||||
width: 1,
|
||||
),
|
||||
majorTickLines: MajorTickLines(size: 0),
|
||||
),
|
||||
series: _getSplineSeries(),
|
||||
tooltipBehavior: TooltipBehavior(enable: true),
|
||||
),
|
||||
FloatingActionButton.small(
|
||||
heroTag: 'addCircumference',
|
||||
onPressed: () {
|
||||
if (widget.circumferencePoints.isNotEmpty) {
|
||||
chest = widget.circumferencePoints.last.chestCircumference;
|
||||
waist = widget.circumferencePoints.last.waistCircumference;
|
||||
hip = widget.circumferencePoints.last.hipCircumference;
|
||||
chestController = FixedExtentScrollController(initialItem: chest - 20);
|
||||
waistController = FixedExtentScrollController(initialItem: waist - 20);
|
||||
hipController = FixedExtentScrollController(initialItem: hip - 20);
|
||||
} else {
|
||||
chestController = FixedExtentScrollController();
|
||||
waistController = FixedExtentScrollController();
|
||||
hipController = FixedExtentScrollController();
|
||||
}
|
||||
showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
scrollController: chestController,
|
||||
itemExtent: 24,
|
||||
onSelectedItemChanged: (int value) {
|
||||
chest = value;
|
||||
},
|
||||
children: [
|
||||
for (int i = 20; i < 200; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
scrollController: waistController,
|
||||
itemExtent: 24,
|
||||
onSelectedItemChanged: (int value) {
|
||||
waist = value;
|
||||
},
|
||||
children: [
|
||||
for (int i = 20; i < 200; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
scrollController: hipController,
|
||||
itemExtent: 24,
|
||||
onSelectedItemChanged: (int value) {
|
||||
hip = value;
|
||||
},
|
||||
children: [
|
||||
for (int i = 20; i < 200; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.profileCubit.addCircumference(
|
||||
chestCircumference: chest,
|
||||
waistCircumference: waist,
|
||||
hipCircumference: hip,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Ink(
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
shape: CircleBorder(),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<CartesianSeries<CircumferenceModel, DateTime>> _getSplineSeries() {
|
||||
final Color seriesColor1 = Colors.red;
|
||||
final Color seriesColor2 = appTheme.blueA400;
|
||||
final Color seriesColor3 = Colors.green;
|
||||
|
||||
return <CartesianSeries<CircumferenceModel, DateTime>>[
|
||||
SplineAreaSeries<CircumferenceModel, DateTime>(
|
||||
markerSettings: MarkerSettings(
|
||||
isVisible: true,
|
||||
color: seriesColor1,
|
||||
height: 8,
|
||||
width: 8,
|
||||
),
|
||||
dataLabelSettings: DataLabelSettings(
|
||||
labelAlignment: ChartDataLabelAlignment.top,
|
||||
isVisible: true,
|
||||
),
|
||||
dataSource: widget.circumferencePoints,
|
||||
borderColor: seriesColor1,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
seriesColor1.withOpacity(0.14),
|
||||
Colors.transparent,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment(0, 0.6),
|
||||
),
|
||||
name: 'Грудь',
|
||||
xValueMapper: (CircumferenceModel value, int index) => value.createdAt,
|
||||
yValueMapper: (CircumferenceModel value, int index) => value.chestCircumference,
|
||||
),
|
||||
SplineAreaSeries<CircumferenceModel, DateTime>(
|
||||
markerSettings: MarkerSettings(
|
||||
isVisible: true,
|
||||
color: seriesColor2,
|
||||
height: 8,
|
||||
width: 8,
|
||||
),
|
||||
dataLabelSettings: DataLabelSettings(
|
||||
labelAlignment: ChartDataLabelAlignment.top,
|
||||
isVisible: true,
|
||||
),
|
||||
dataSource: widget.circumferencePoints,
|
||||
borderColor: seriesColor2,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
seriesColor2.withOpacity(0.14),
|
||||
Colors.transparent,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment(0, 0.6),
|
||||
),
|
||||
name: 'Талия',
|
||||
xValueMapper: (CircumferenceModel value, int index) => value.createdAt,
|
||||
yValueMapper: (CircumferenceModel value, int index) => value.waistCircumference,
|
||||
),
|
||||
SplineAreaSeries<CircumferenceModel, DateTime>(
|
||||
markerSettings: MarkerSettings(
|
||||
isVisible: true,
|
||||
color: seriesColor3,
|
||||
height: 8,
|
||||
width: 8,
|
||||
),
|
||||
dataLabelSettings: DataLabelSettings(
|
||||
labelAlignment: ChartDataLabelAlignment.top,
|
||||
isVisible: true,
|
||||
),
|
||||
dataSource: widget.circumferencePoints,
|
||||
borderColor: seriesColor3,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
seriesColor3.withOpacity(0.14),
|
||||
Colors.transparent,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment(0, 0.6),
|
||||
),
|
||||
name: 'Бёдра',
|
||||
xValueMapper: (CircumferenceModel value, int index) => value.createdAt,
|
||||
yValueMapper: (CircumferenceModel value, int index) => value.hipCircumference,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,114 +1,114 @@
|
||||
// import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
// import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
//
|
||||
// class ImtChartWidget extends StatelessWidget {
|
||||
// final List<ChartPointModel> chartPoints;
|
||||
//
|
||||
// const ImtChartWidget({
|
||||
// super.key,
|
||||
// required this.chartPoints,
|
||||
// });
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// '${chartPoints.last.bmi.toStringAsFixed(2)}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontSize: 40,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// chartPoints.last.bmi > chartPoints[chartPoints.length - 2].bmi
|
||||
// ? Icon(
|
||||
// Icons.arrow_drop_up,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.arrow_drop_down,
|
||||
// size: 40,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// SfCartesianChart(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
// enableAxisAnimation: true,
|
||||
// plotAreaBorderWidth: 0,
|
||||
// trackballBehavior: TrackballBehavior(
|
||||
// enable: true,
|
||||
// activationMode: ActivationMode.singleTap,
|
||||
// tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
// tooltipSettings: InteractiveTooltip(),
|
||||
// lineType: TrackballLineType.vertical,
|
||||
// ),
|
||||
// primaryXAxis: DateTimeCategoryAxis(
|
||||
// initialVisibleMinimum: chartPoints.first.createdAt,
|
||||
// initialVisibleMaximum: chartPoints.last.createdAt,
|
||||
// tickPosition: TickPosition.inside,
|
||||
// majorTickLines: MajorTickLines(
|
||||
// size: 0,
|
||||
// ),
|
||||
// edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
// dateFormat: DateFormat.MMMd('ru'),
|
||||
// labelStyle: TextStyle(
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
// axisLine: AxisLine(
|
||||
// color: Colors.grey.withOpacity(0.3),
|
||||
// width: 0.4,
|
||||
// ),
|
||||
// ),
|
||||
// primaryYAxis: NumericAxis(
|
||||
// isVisible: false,
|
||||
// ),
|
||||
// series: _getSplineSeries(),
|
||||
// tooltipBehavior: TooltipBehavior(enable: true),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// List<CartesianSeries<ChartPointModel, DateTime>> _getSplineSeries() {
|
||||
// return <CartesianSeries<ChartPointModel, DateTime>>[
|
||||
// SplineAreaSeries<ChartPointModel, DateTime>(
|
||||
// markerSettings: MarkerSettings(
|
||||
// isVisible: true,
|
||||
// color: appTheme.blueA400,
|
||||
// height: 8,
|
||||
// width: 8,
|
||||
// ),
|
||||
// dataLabelSettings: DataLabelSettings(
|
||||
// labelAlignment: ChartDataLabelAlignment.top,
|
||||
// isVisible: true,
|
||||
// ),
|
||||
// dataSource: chartPoints,
|
||||
// borderColor: appTheme.blueA400,
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// appTheme.blueA400.withOpacity(0.14),
|
||||
// Colors.transparent,
|
||||
// ],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment(0, 0.6),
|
||||
// ),
|
||||
// name: 'ИМТ',
|
||||
// xValueMapper: (ChartPointModel value, int index) => value.createdAt,
|
||||
// yValueMapper: (ChartPointModel value, int index) => double.parse(value.bmi.toStringAsFixed(2)),
|
||||
// ),
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class ImtChartWidget extends StatelessWidget {
|
||||
final List<WeightModel> weightPoints;
|
||||
|
||||
const ImtChartWidget({
|
||||
super.key,
|
||||
required this.weightPoints,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${weightPoints.last.bmi.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
weightPoints.last.bmi > weightPoints[weightPoints.length - 2].bmi
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 40,
|
||||
color: Colors.grey,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SfCartesianChart(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
enableAxisAnimation: true,
|
||||
plotAreaBorderWidth: 0,
|
||||
trackballBehavior: TrackballBehavior(
|
||||
enable: true,
|
||||
activationMode: ActivationMode.singleTap,
|
||||
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
tooltipSettings: InteractiveTooltip(),
|
||||
lineType: TrackballLineType.vertical,
|
||||
),
|
||||
primaryXAxis: DateTimeCategoryAxis(
|
||||
initialVisibleMinimum: weightPoints.first.createdAt,
|
||||
initialVisibleMaximum: weightPoints.last.createdAt,
|
||||
tickPosition: TickPosition.inside,
|
||||
majorTickLines: MajorTickLines(
|
||||
size: 0,
|
||||
),
|
||||
edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
dateFormat: DateFormat.MMMd('ru'),
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
axisLine: AxisLine(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
width: 0.4,
|
||||
),
|
||||
),
|
||||
primaryYAxis: NumericAxis(
|
||||
isVisible: false,
|
||||
),
|
||||
series: _getSplineSeries(),
|
||||
tooltipBehavior: TooltipBehavior(enable: true),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<CartesianSeries<WeightModel, DateTime>> _getSplineSeries() {
|
||||
return <CartesianSeries<WeightModel, DateTime>>[
|
||||
SplineAreaSeries<WeightModel, DateTime>(
|
||||
markerSettings: MarkerSettings(
|
||||
isVisible: true,
|
||||
color: appTheme.blueA400,
|
||||
height: 8,
|
||||
width: 8,
|
||||
),
|
||||
dataLabelSettings: DataLabelSettings(
|
||||
labelAlignment: ChartDataLabelAlignment.top,
|
||||
isVisible: true,
|
||||
),
|
||||
dataSource: weightPoints,
|
||||
borderColor: appTheme.blueA400,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
appTheme.blueA400.withOpacity(0.14),
|
||||
Colors.transparent,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment(0, 0.6),
|
||||
),
|
||||
name: 'ИМТ',
|
||||
xValueMapper: (WeightModel value, int index) => value.createdAt,
|
||||
yValueMapper: (WeightModel value, int index) => double.parse(value.bmi.toStringAsFixed(2)),
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,237 +1,237 @@
|
||||
//
|
||||
// import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
// import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
// import 'package:flutter/cupertino.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
// import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
//
|
||||
// class WeightChartWidget extends StatefulWidget {
|
||||
// final List<ChartPointModel> chartPoints;
|
||||
// final ProfileCubit profileCubit;
|
||||
//
|
||||
// const WeightChartWidget({
|
||||
// super.key,
|
||||
// required this.chartPoints,
|
||||
// required this.profileCubit,
|
||||
// });
|
||||
//
|
||||
// @override
|
||||
// State<WeightChartWidget> createState() => _WeightChartWidgetState();
|
||||
// }
|
||||
//
|
||||
// class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
// late FixedExtentScrollController weightKiloController;
|
||||
// late FixedExtentScrollController weightGramsController;
|
||||
// late int weightKilo;
|
||||
// late int weightGrams;
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// if (widget.chartPoints.isNotEmpty)
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// '${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black,
|
||||
// fontSize: 40,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartPoints.length == 1)
|
||||
// Container(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
// width: 8,
|
||||
// height: 8,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black12,
|
||||
// ),
|
||||
// ),
|
||||
// if (widget.chartPoints.length > 1) widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
|
||||
// ? Icon(
|
||||
// Icons.arrow_drop_up,
|
||||
// size: 40,
|
||||
// color: Colors.grey.withOpacity(0.4),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.arrow_drop_down,
|
||||
// size: 40,
|
||||
// color: Colors.grey.withOpacity(0.4),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Stack(
|
||||
// alignment: Alignment.bottomRight,
|
||||
// children: [
|
||||
// SfCartesianChart(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
// enableAxisAnimation: true,
|
||||
// plotAreaBorderWidth: 0,
|
||||
// trackballBehavior: TrackballBehavior(
|
||||
// enable: true,
|
||||
// activationMode: ActivationMode.singleTap,
|
||||
// tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
// tooltipSettings: InteractiveTooltip(),
|
||||
// lineType: TrackballLineType.vertical,
|
||||
// ),
|
||||
// primaryXAxis: DateTimeCategoryAxis(
|
||||
// tickPosition: TickPosition.inside,
|
||||
// majorTickLines: MajorTickLines(
|
||||
// size: 0,
|
||||
// ),
|
||||
// edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
// dateFormat: DateFormat.MMMd('ru'),
|
||||
// labelStyle: TextStyle(
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
// axisLine: AxisLine(
|
||||
// color: Colors.grey.withOpacity(0.3),
|
||||
// width: 0.4,
|
||||
// ),
|
||||
// ),
|
||||
// primaryYAxis: NumericAxis(
|
||||
// isVisible: false,
|
||||
// labelFormat: '{value} кг',
|
||||
// majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
|
||||
// axisLine: AxisLine(
|
||||
// width: 1,
|
||||
// ),
|
||||
// majorTickLines: MajorTickLines(size: 0),
|
||||
// ),
|
||||
// series: _getSplineSeries(),
|
||||
// tooltipBehavior: TooltipBehavior(enable: true),
|
||||
// ),
|
||||
// FloatingActionButton.small(
|
||||
// heroTag: 'addWeight',
|
||||
// onPressed: () {
|
||||
// if (widget.chartPoints.isNotEmpty) {
|
||||
// weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
|
||||
// weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
|
||||
// weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
|
||||
// weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
|
||||
// } else {
|
||||
// weightKiloController = FixedExtentScrollController();
|
||||
// weightGramsController = FixedExtentScrollController();
|
||||
// }
|
||||
// showModalBottomSheet(
|
||||
// useRootNavigator: true,
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return Column(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: CupertinoPicker(
|
||||
// magnification: 1.22,
|
||||
// squeeze: 1.2,
|
||||
// useMagnifier: true,
|
||||
// scrollController: weightKiloController,
|
||||
// itemExtent: 24,
|
||||
// onSelectedItemChanged: (int value) {
|
||||
// weightKilo = value + 20;
|
||||
// },
|
||||
// children: [
|
||||
// for (int i = 20; i < 300; i++) Text('$i'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: CupertinoPicker(
|
||||
// magnification: 1.22,
|
||||
// squeeze: 1.2,
|
||||
// useMagnifier: true,
|
||||
// scrollController: weightGramsController,
|
||||
// itemExtent: 24,
|
||||
// onSelectedItemChanged: (int value) {
|
||||
// weightGrams = value;
|
||||
// },
|
||||
// children: [
|
||||
// for (int i = 0; i < 10; i++) Text('$i'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// widget.profileCubit.addWeight(weight: double.parse('$weightKilo.$weightGrams'));
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// borderRadius: BorderRadius.circular(16),
|
||||
// child: Ink(
|
||||
// width: MediaQuery.of(context).size.width - 32,
|
||||
// padding: EdgeInsets.all(16),
|
||||
// decoration: BoxDecoration(
|
||||
// color: appTheme.blueA400,
|
||||
// borderRadius: BorderRadius.circular(16),
|
||||
// ),
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// 'Сохранить',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// backgroundColor: Colors.red,
|
||||
// shape: CircleBorder(),
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// List<CartesianSeries<ChartPointModel, DateTime>> _getSplineSeries() {
|
||||
// return <CartesianSeries<ChartPointModel, DateTime>>[
|
||||
// SplineAreaSeries<ChartPointModel, DateTime>(
|
||||
// markerSettings: MarkerSettings(
|
||||
// isVisible: true,
|
||||
// color: appTheme.blueA400,
|
||||
// height: 8,
|
||||
// width: 8,
|
||||
// ),
|
||||
// dataLabelSettings: DataLabelSettings(
|
||||
// labelAlignment: ChartDataLabelAlignment.top,
|
||||
// isVisible: true,
|
||||
// ),
|
||||
// dataSource: widget.chartPoints,
|
||||
// borderColor: appTheme.blueA400,
|
||||
// gradient: LinearGradient(
|
||||
// colors: [
|
||||
// appTheme.blueA400.withOpacity(0.14),
|
||||
// Colors.transparent,
|
||||
// ],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment(0, 0.6),
|
||||
// ),
|
||||
// name: 'Вес',
|
||||
// xValueMapper: (ChartPointModel value, int index) => value.createdAt,
|
||||
// yValueMapper: (ChartPointModel value, int index) => value.weight,
|
||||
// ),
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
|
||||
class WeightChartWidget extends StatefulWidget {
|
||||
final List<WeightModel> weightPoints;
|
||||
final ProfileCubit profileCubit;
|
||||
|
||||
const WeightChartWidget({
|
||||
super.key,
|
||||
required this.weightPoints,
|
||||
required this.profileCubit,
|
||||
});
|
||||
|
||||
@override
|
||||
State<WeightChartWidget> createState() => _WeightChartWidgetState();
|
||||
}
|
||||
|
||||
class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
late FixedExtentScrollController weightKiloController;
|
||||
late FixedExtentScrollController weightGramsController;
|
||||
late int weightKilo;
|
||||
late int weightGrams;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (widget.weightPoints.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${widget.weightPoints.last.weight.toStringAsFixed(1)} кг',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (widget.weightPoints.length == 1)
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 12),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
if (widget.weightPoints.length > 1) widget.weightPoints.last.weight > widget.weightPoints[widget.weightPoints.length - 2].weight
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 40,
|
||||
color: Colors.grey.withOpacity(0.4),
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 40,
|
||||
color: Colors.grey.withOpacity(0.4),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Stack(
|
||||
alignment: Alignment.bottomRight,
|
||||
children: [
|
||||
SfCartesianChart(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
enableAxisAnimation: true,
|
||||
plotAreaBorderWidth: 0,
|
||||
trackballBehavior: TrackballBehavior(
|
||||
enable: true,
|
||||
activationMode: ActivationMode.singleTap,
|
||||
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
|
||||
tooltipSettings: InteractiveTooltip(),
|
||||
lineType: TrackballLineType.vertical,
|
||||
),
|
||||
primaryXAxis: DateTimeCategoryAxis(
|
||||
tickPosition: TickPosition.inside,
|
||||
majorTickLines: MajorTickLines(
|
||||
size: 0,
|
||||
),
|
||||
edgeLabelPlacement: EdgeLabelPlacement.shift,
|
||||
dateFormat: DateFormat.MMMd('ru'),
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
|
||||
axisLine: AxisLine(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
width: 0.4,
|
||||
),
|
||||
),
|
||||
primaryYAxis: NumericAxis(
|
||||
isVisible: false,
|
||||
labelFormat: '{value} кг',
|
||||
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
|
||||
axisLine: AxisLine(
|
||||
width: 1,
|
||||
),
|
||||
majorTickLines: MajorTickLines(size: 0),
|
||||
),
|
||||
series: _getSplineSeries(),
|
||||
tooltipBehavior: TooltipBehavior(enable: true),
|
||||
),
|
||||
FloatingActionButton.small(
|
||||
heroTag: 'addWeight',
|
||||
onPressed: () {
|
||||
if (widget.weightPoints.isNotEmpty) {
|
||||
weightKilo = int.parse(widget.weightPoints.last.weight.toString().split('.')[0]);
|
||||
weightGrams = int.parse(widget.weightPoints.last.weight.toString().split('.')[1][0]);
|
||||
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
|
||||
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
|
||||
} else {
|
||||
weightKiloController = FixedExtentScrollController();
|
||||
weightGramsController = FixedExtentScrollController();
|
||||
}
|
||||
showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
scrollController: weightKiloController,
|
||||
itemExtent: 24,
|
||||
onSelectedItemChanged: (int value) {
|
||||
weightKilo = value + 20;
|
||||
},
|
||||
children: [
|
||||
for (int i = 20; i < 300; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
scrollController: weightGramsController,
|
||||
itemExtent: 24,
|
||||
onSelectedItemChanged: (int value) {
|
||||
weightGrams = value;
|
||||
},
|
||||
children: [
|
||||
for (int i = 0; i < 10; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.profileCubit.addWeight(weight: double.parse('$weightKilo.$weightGrams'));
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Ink(
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
shape: CircleBorder(),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<CartesianSeries<WeightModel, DateTime>> _getSplineSeries() {
|
||||
return <CartesianSeries<WeightModel, DateTime>>[
|
||||
SplineAreaSeries<WeightModel, DateTime>(
|
||||
markerSettings: MarkerSettings(
|
||||
isVisible: true,
|
||||
color: appTheme.blueA400,
|
||||
height: 8,
|
||||
width: 8,
|
||||
),
|
||||
dataLabelSettings: DataLabelSettings(
|
||||
labelAlignment: ChartDataLabelAlignment.top,
|
||||
isVisible: true,
|
||||
),
|
||||
dataSource: widget.weightPoints,
|
||||
borderColor: appTheme.blueA400,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
appTheme.blueA400.withOpacity(0.14),
|
||||
Colors.transparent,
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment(0, 0.6),
|
||||
),
|
||||
name: 'Вес',
|
||||
xValueMapper: (WeightModel value, int index) => value.createdAt,
|
||||
yValueMapper: (WeightModel value, int index) => value.weight,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
||||
|
||||
class ProfileRepository {
|
||||
@@ -69,4 +71,44 @@ class ProfileRepository {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<WeightModel>> getWeight({
|
||||
required String period,
|
||||
String? slug,
|
||||
}) async {
|
||||
try {
|
||||
if (slug != null) {
|
||||
return (await profileService.getWeightBySlug(
|
||||
period: period,
|
||||
slug: slug,
|
||||
));
|
||||
} else {
|
||||
return (await profileService.getWeight(
|
||||
period: period,
|
||||
));
|
||||
}
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<CircumferenceModel>> getCircumferences({
|
||||
required String period,
|
||||
String? slug,
|
||||
}) async {
|
||||
try {
|
||||
if (slug != null) {
|
||||
return (await profileService.getCircumferencesBySlug(
|
||||
period: period,
|
||||
slug: slug,
|
||||
));
|
||||
} else {
|
||||
return (await profileService.getCircumferences(
|
||||
period: period,
|
||||
));
|
||||
}
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
part 'profile_service.g.dart';
|
||||
@@ -36,4 +38,26 @@ abstract class ProfileService {
|
||||
Future<FeedBlogPostSettingsModel> getBlogPostByAuthorSlug({
|
||||
@Path() required String slug,
|
||||
});
|
||||
|
||||
@GET('/api/profile/measure/weight/{period}')
|
||||
Future<List<WeightModel>> getWeight({
|
||||
@Path() required String period,
|
||||
});
|
||||
|
||||
@GET('/api/profile/measure/weight/{period}/{slug}')
|
||||
Future<List<WeightModel>> getWeightBySlug({
|
||||
@Path() required String period,
|
||||
@Path() required String slug,
|
||||
});
|
||||
|
||||
@GET('/api/profile/measure/circumferences/{period}')
|
||||
Future<List<CircumferenceModel>> getCircumferences({
|
||||
@Path() required String period,
|
||||
});
|
||||
|
||||
@GET('/api/profile/measure/circumferences/{period}/{user}')
|
||||
Future<List<CircumferenceModel>> getCircumferencesBySlug({
|
||||
@Path() required String period,
|
||||
@Path() required String slug,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -191,7 +191,8 @@ class _ProfileService implements ProfileService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FeedBlogPostSettingsModel> getBlogPostByAuthorSlug({required String slug}) async {
|
||||
Future<FeedBlogPostSettingsModel> getBlogPostByAuthorSlug(
|
||||
{required String slug}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
@@ -223,8 +224,159 @@ class _ProfileService implements ProfileService {
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<WeightModel>> getWeight({required String period}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<WeightModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<WeightModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<WeightModel>> getWeightBySlug({
|
||||
required String period,
|
||||
required String slug,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<WeightModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/weight/${period}/${slug}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<WeightModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) => WeightModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<CircumferenceModel>> getCircumferences(
|
||||
{required String period}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<CircumferenceModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<CircumferenceModel>> getCircumferencesBySlug({
|
||||
required String period,
|
||||
required String slug,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<List<CircumferenceModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/profile/measure/circumferences/${period}/{user}',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<CircumferenceModel> _value;
|
||||
try {
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
CircumferenceModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
|
||||
if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T != dynamic &&
|
||||
!(requestOptions.responseType == ResponseType.bytes ||
|
||||
requestOptions.responseType == ResponseType.stream)) {
|
||||
if (T == String) {
|
||||
requestOptions.responseType = ResponseType.plain;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user