Skip to content

Commit

Permalink
Update models to setup default images
Browse files Browse the repository at this point in the history
  • Loading branch information
MillerAdulu committed Aug 27, 2024
1 parent 9759a90 commit b172a1e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/common/data/models/feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Feed with _$Feed {
required String body,
required String topic,
required String url,
required String? image,
@JsonKey(name: 'created_at') required DateTime createdAt,
@Default('https://via.placeholder.com/150') String image,
}) = _Feed;

factory Feed.fromJson(Map<String, Object?> json) => _$FeedFromJson(json);
Expand Down
4 changes: 2 additions & 2 deletions lib/common/data/models/local/local_feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LocalFeedEntry {
required this.topic,
required this.url,
required this.createdAt,
this.image,
required this.image,
});

Id id = Isar.autoIncrement;
Expand All @@ -19,6 +19,6 @@ class LocalFeedEntry {
late String body;
late String topic;
late String url;
String? image;
late String image;
late DateTime createdAt;
}
4 changes: 2 additions & 2 deletions lib/common/data/models/local/local_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LocalSession {
required this.isServiceSession,
required this.speakers,
required this.rooms,
this.sessionImage,
required this.sessionImage,
});
Id id = Isar.autoIncrement;
@Index(unique: true, replace: true)
Expand All @@ -39,7 +39,7 @@ class LocalSession {
late bool isKeynote;
late bool isBookmarked;
late bool isServiceSession;
String? sessionImage;
late String sessionImage;
late List<EmbeddedSpeaker> speakers;
late List<LocalRoom> rooms;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/common/data/models/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Session with _$Session {
@JsonKey(name: 'is_keynote') required bool isKeynote,
@JsonKey(name: 'is_bookmarked') required bool isBookmarked,
@JsonKey(name: 'is_serviceSession') required bool isServiceSession,
@JsonKey(name: 'session_image') String? sessionImage,
@Default('https://via.placeholder.com/150')
@JsonKey(name: 'session_image')
String sessionImage,
@Default([]) List<Speaker> speakers,
@Default([]) List<Room> rooms,
}) = _Session;
Expand Down
3 changes: 1 addition & 2 deletions lib/features/home/widgets/sessions_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ class _SessionsCardState extends State<SessionsCard> {
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: CachedNetworkImage(
imageUrl: session.sessionImage ??
'https://via.placeholder.com/150',
imageUrl: session.sessionImage,
height: 150,
width: double.infinity,
fit: BoxFit.cover,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ class SessionDetailsPage extends StatelessWidget {
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: CachedNetworkImage(
imageUrl:
session.sessionImage ?? 'https://via.placeholder.com/150',
imageUrl: session.sessionImage,
height: 170,
fit: BoxFit.fitHeight,
placeholder: (_, __) => const SizedBox(
Expand Down
3 changes: 1 addition & 2 deletions lib/features/sessions/ui/widgets/schedule_view_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class ScheduleViewCard extends StatelessWidget {
ClipRRect(
borderRadius: BorderRadius.circular(10),
child: CachedNetworkImage(
imageUrl:
session.sessionImage ?? 'https://via.placeholder.com/150',
imageUrl: session.sessionImage,
height: 150,
width: double.infinity,
fit: BoxFit.cover,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: fluttercon
description: "A new Flutter project."
publish_to: 'none'
version: 1.13.01+11301
version: 1.13.02+11302

environment:
sdk: ">=3.5.0 <4.0.0"
Expand Down

0 comments on commit b172a1e

Please sign in to comment.