consume image sizes from cms, surface course plan activity locations apis (#4187)
This commit is contained in:
parent
740bf6da79
commit
1c20c683c2
7 changed files with 264 additions and 15 deletions
70
lib/pangea/payload_client/image_sizes.dart
Normal file
70
lib/pangea/payload_client/image_sizes.dart
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
class ImageSizes {
|
||||
final ImageSize? thumbnail;
|
||||
final ImageSize? medium;
|
||||
final ImageSize? large;
|
||||
|
||||
const ImageSizes({
|
||||
this.thumbnail,
|
||||
this.medium,
|
||||
this.large,
|
||||
});
|
||||
|
||||
factory ImageSizes.fromJson(Map<String, dynamic> json) {
|
||||
return ImageSizes(
|
||||
thumbnail: json['thumbnail'] != null
|
||||
? ImageSize.fromJson(json['thumbnail'])
|
||||
: null,
|
||||
medium:
|
||||
json['medium'] != null ? ImageSize.fromJson(json['medium']) : null,
|
||||
large: json['large'] != null ? ImageSize.fromJson(json['large']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'thumbnail': thumbnail?.toJson(),
|
||||
'medium': medium?.toJson(),
|
||||
'large': large?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class ImageSize {
|
||||
final String? url;
|
||||
final int? width;
|
||||
final int? height;
|
||||
final String? mimeType;
|
||||
final int? filesize;
|
||||
final String? filename;
|
||||
|
||||
const ImageSize({
|
||||
this.url,
|
||||
this.width,
|
||||
this.height,
|
||||
this.mimeType,
|
||||
this.filesize,
|
||||
this.filename,
|
||||
});
|
||||
|
||||
factory ImageSize.fromJson(Map<String, dynamic> json) {
|
||||
return ImageSize(
|
||||
url: json['url'],
|
||||
width: json['width'],
|
||||
height: json['height'],
|
||||
mimeType: json['mimeType'],
|
||||
filesize: json['filesize'],
|
||||
filename: json['filename'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'url': url,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'mimeType': mimeType,
|
||||
'filesize': filesize,
|
||||
'filename': filename,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
import 'package:fluffychat/pangea/payload_client/join_field.dart';
|
||||
import 'package:fluffychat/pangea/payload_client/polymorphic_relationship.dart';
|
||||
|
||||
/// Represents a course plan activity location from the CMS API
|
||||
class CmsCoursePlanActivityLocation {
|
||||
static const String slug = "course-plan-activity-locations";
|
||||
final String id;
|
||||
final String name;
|
||||
// [longitude, latitude] - minItems: 2, maxItems: 2
|
||||
final List<double>? coordinates;
|
||||
final JoinField? coursePlanActivityLocationMedia;
|
||||
final List<String> coursePlanActivities;
|
||||
final PolymorphicRelationship? createdBy;
|
||||
final PolymorphicRelationship? updatedBy;
|
||||
final String updatedAt;
|
||||
final String createdAt;
|
||||
|
||||
CmsCoursePlanActivityLocation({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.coordinates,
|
||||
this.coursePlanActivityLocationMedia,
|
||||
required this.coursePlanActivities,
|
||||
this.createdBy,
|
||||
this.updatedBy,
|
||||
required this.updatedAt,
|
||||
required this.createdAt,
|
||||
});
|
||||
|
||||
factory CmsCoursePlanActivityLocation.fromJson(Map<String, dynamic> json) {
|
||||
return CmsCoursePlanActivityLocation(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
coordinates: (json['coordinates'] as List<dynamic>?)
|
||||
?.map((coord) => (coord as num).toDouble())
|
||||
.toList(),
|
||||
coursePlanActivityLocationMedia:
|
||||
json['coursePlanActivityLocationMedia'] != null
|
||||
? JoinField.fromJson(json['coursePlanActivityLocationMedia'])
|
||||
: null,
|
||||
coursePlanActivities: List<String>.from(json['coursePlanActivities']),
|
||||
createdBy: json['createdBy'] != null
|
||||
? PolymorphicRelationship.fromJson(json['createdBy'])
|
||||
: null,
|
||||
updatedBy: json['updatedBy'] != null
|
||||
? PolymorphicRelationship.fromJson(json['updatedBy'])
|
||||
: null,
|
||||
updatedAt: json['updatedAt'] as String,
|
||||
createdAt: json['createdAt'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'coordinates': coordinates,
|
||||
'coursePlanActivities': coursePlanActivities,
|
||||
'coursePlanActivityLocationMedia':
|
||||
coursePlanActivityLocationMedia?.toJson(),
|
||||
'createdBy': createdBy?.toJson(),
|
||||
'updatedBy': updatedBy?.toJson(),
|
||||
'updatedAt': updatedAt,
|
||||
'createdAt': createdAt,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
import 'package:fluffychat/pangea/payload_client/image_sizes.dart';
|
||||
import 'package:fluffychat/pangea/payload_client/polymorphic_relationship.dart';
|
||||
|
||||
/// Represents a course plan activity location media from the CMS API
|
||||
class CmsCoursePlanActivityLocationMedia {
|
||||
static const String slug = "course-plan-activity-location-media";
|
||||
final String id;
|
||||
final String? alt;
|
||||
final List<String> coursePlanActivityLocations;
|
||||
final PolymorphicRelationship? createdBy;
|
||||
final PolymorphicRelationship? updatedBy;
|
||||
final String? prefix;
|
||||
final String updatedAt;
|
||||
final String createdAt;
|
||||
final String? url;
|
||||
final String? thumbnailURL;
|
||||
final String? filename;
|
||||
final String? mimeType;
|
||||
final int? filesize;
|
||||
final int? width;
|
||||
final int? height;
|
||||
final double? focalX;
|
||||
final double? focalY;
|
||||
final ImageSizes? sizes;
|
||||
|
||||
CmsCoursePlanActivityLocationMedia({
|
||||
required this.id,
|
||||
this.alt,
|
||||
required this.coursePlanActivityLocations,
|
||||
this.createdBy,
|
||||
this.updatedBy,
|
||||
this.prefix,
|
||||
required this.updatedAt,
|
||||
required this.createdAt,
|
||||
this.url,
|
||||
this.thumbnailURL,
|
||||
this.filename,
|
||||
this.mimeType,
|
||||
this.filesize,
|
||||
this.width,
|
||||
this.height,
|
||||
this.focalX,
|
||||
this.focalY,
|
||||
this.sizes,
|
||||
});
|
||||
|
||||
factory CmsCoursePlanActivityLocationMedia.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
) {
|
||||
return CmsCoursePlanActivityLocationMedia(
|
||||
id: json['id'],
|
||||
alt: json['alt'],
|
||||
coursePlanActivityLocations:
|
||||
List<String>.from(json['coursePlanActivityLocations'] as List),
|
||||
createdBy: json['createdBy'] != null
|
||||
? PolymorphicRelationship.fromJson(json['createdBy'])
|
||||
: null,
|
||||
updatedBy: json['updatedBy'] != null
|
||||
? PolymorphicRelationship.fromJson(json['updatedBy'])
|
||||
: null,
|
||||
prefix: json['prefix'],
|
||||
updatedAt: json['updatedAt'],
|
||||
createdAt: json['createdAt'],
|
||||
url: json['url'],
|
||||
thumbnailURL: json['thumbnailURL'],
|
||||
filename: json['filename'],
|
||||
mimeType: json['mimeType'],
|
||||
filesize: json['filesize'],
|
||||
width: json['width'],
|
||||
height: json['height'],
|
||||
focalX: json['focalX']?.toDouble(),
|
||||
focalY: json['focalY']?.toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'alt': alt,
|
||||
'coursePlanActivityLocations': coursePlanActivityLocations,
|
||||
'createdBy': createdBy?.toJson(),
|
||||
'updatedBy': updatedBy?.toJson(),
|
||||
'prefix': prefix,
|
||||
'updatedAt': updatedAt,
|
||||
'createdAt': createdAt,
|
||||
'url': url,
|
||||
'thumbnailURL': thumbnailURL,
|
||||
'filename': filename,
|
||||
'mimeType': mimeType,
|
||||
'filesize': filesize,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'focalX': focalX,
|
||||
'focalY': focalY,
|
||||
'sizes': sizes?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:fluffychat/pangea/payload_client/image_sizes.dart';
|
||||
import 'package:fluffychat/pangea/payload_client/polymorphic_relationship.dart';
|
||||
|
||||
/// Represents course plan activity media from the CMS API
|
||||
|
|
@ -21,6 +22,7 @@ class CmsCoursePlanActivityMedia {
|
|||
final int? height;
|
||||
final double? focalX;
|
||||
final double? focalY;
|
||||
final ImageSizes? sizes;
|
||||
|
||||
CmsCoursePlanActivityMedia({
|
||||
required this.id,
|
||||
|
|
@ -40,6 +42,7 @@ class CmsCoursePlanActivityMedia {
|
|||
this.height,
|
||||
this.focalX,
|
||||
this.focalY,
|
||||
this.sizes,
|
||||
});
|
||||
|
||||
factory CmsCoursePlanActivityMedia.fromJson(Map<String, dynamic> json) {
|
||||
|
|
@ -65,6 +68,7 @@ class CmsCoursePlanActivityMedia {
|
|||
height: json['height'] as int?,
|
||||
focalX: (json['focalX'] as num?)?.toDouble(),
|
||||
focalY: (json['focalY'] as num?)?.toDouble(),
|
||||
sizes: json['sizes'] != null ? ImageSizes.fromJson(json['sizes']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -87,6 +91,7 @@ class CmsCoursePlanActivityMedia {
|
|||
'height': height,
|
||||
'focalX': focalX,
|
||||
'focalY': focalY,
|
||||
'sizes': sizes?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:fluffychat/pangea/payload_client/image_sizes.dart';
|
||||
import 'package:fluffychat/pangea/payload_client/polymorphic_relationship.dart';
|
||||
|
||||
/// Represents course plan media from the CMS API
|
||||
|
|
@ -20,6 +21,7 @@ class CmsCoursePlanMedia {
|
|||
final int? height;
|
||||
final double? focalX;
|
||||
final double? focalY;
|
||||
final ImageSizes? sizes;
|
||||
|
||||
CmsCoursePlanMedia({
|
||||
required this.id,
|
||||
|
|
@ -39,6 +41,7 @@ class CmsCoursePlanMedia {
|
|||
this.height,
|
||||
this.focalX,
|
||||
this.focalY,
|
||||
this.sizes,
|
||||
});
|
||||
|
||||
factory CmsCoursePlanMedia.fromJson(Map<String, dynamic> json) {
|
||||
|
|
@ -64,6 +67,7 @@ class CmsCoursePlanMedia {
|
|||
height: json['height'],
|
||||
focalX: json['focalX']?.toDouble(),
|
||||
focalY: json['focalY']?.toDouble(),
|
||||
sizes: json['sizes'] != null ? ImageSizes.fromJson(json['sizes']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +90,7 @@ class CmsCoursePlanMedia {
|
|||
'height': height,
|
||||
'focalX': focalX,
|
||||
'focalY': focalY,
|
||||
'sizes': sizes?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:fluffychat/pangea/payload_client/image_sizes.dart';
|
||||
import 'package:fluffychat/pangea/payload_client/polymorphic_relationship.dart';
|
||||
|
||||
/// Represents a course plan topic location from the CMS API
|
||||
|
|
@ -20,6 +21,7 @@ class CmsCoursePlanTopicLocationMedia {
|
|||
final int? height;
|
||||
final double? focalX;
|
||||
final double? focalY;
|
||||
final ImageSizes? sizes;
|
||||
|
||||
CmsCoursePlanTopicLocationMedia({
|
||||
required this.id,
|
||||
|
|
@ -39,6 +41,7 @@ class CmsCoursePlanTopicLocationMedia {
|
|||
this.height,
|
||||
this.focalX,
|
||||
this.focalY,
|
||||
this.sizes,
|
||||
});
|
||||
|
||||
factory CmsCoursePlanTopicLocationMedia.fromJson(Map<String, dynamic> json) {
|
||||
|
|
@ -87,6 +90,7 @@ class CmsCoursePlanTopicLocationMedia {
|
|||
'height': height,
|
||||
'focalX': focalX,
|
||||
'focalY': focalY,
|
||||
'sizes': sizes?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
pubspec.lock
30
pubspec.lock
|
|
@ -1434,26 +1434,26 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
|
||||
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "11.0.2"
|
||||
version: "10.0.9"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
|
||||
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.10"
|
||||
version: "3.0.9"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
version: "3.0.1"
|
||||
license_checker:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -2480,26 +2480,26 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb"
|
||||
sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.26.2"
|
||||
version: "1.25.15"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
||||
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.6"
|
||||
version: "0.7.4"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a"
|
||||
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.11"
|
||||
version: "0.6.8"
|
||||
timezone:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -2704,10 +2704,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.1.4"
|
||||
video_compress:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -2901,5 +2901,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.8.0-0 <4.0.0"
|
||||
dart: ">=3.7.0 <4.0.0"
|
||||
flutter: ">=3.29.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue