Skip to content

Commit

Permalink
Fix: null 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinyshin committed Nov 22, 2023
1 parent 3160969 commit 4bcc789
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 7 additions & 4 deletions unibond/lib/domain/letter/letter.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
class Letter {
final int? id;
final int? receiverId;
final String? title;
final String? content;
final String title;
bool? isliked;
final String content;

Letter({
this.id,
this.receiverId,
this.title,
this.content,
required this.title,
this.isliked,
required this.content,
});

Letter.fromJson(Map<String, dynamic> json)
: id = json["id"],
receiverId = json["receiverId"],
title = json["title"],
isliked = json["liked"],
content = json["content"];
}
6 changes: 2 additions & 4 deletions unibond/lib/view/screens/letter/letter_read_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ class _LetterReadScreenState extends State<LetterReadScreen> {
actions: [
IconButton(
icon: Icon(
widget.letter.isBookmarked
? Icons.bookmark
: Icons.bookmark_border,
widget.letter.isliked! ? Icons.bookmark : Icons.bookmark_border,
),
onPressed: () {
setState(() {
widget.letter.isBookmarked = !widget.letter.isBookmarked;
widget.letter.isliked = !widget.letter.isliked!;
});
// 북마크 상태->db저장 필요
},
Expand Down

0 comments on commit 4bcc789

Please sign in to comment.