Skip to content

Commit

Permalink
chore: add name of book on list rating (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahnitam authored Nov 8, 2022
1 parent a410b90 commit fc0078e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
38 changes: 29 additions & 9 deletions lib/components/cards/rating_card.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import 'package:flutter/material.dart';
import 'package:livrodin/components/profile_icon.dart';
import 'package:livrodin/components/rating_info.dart';
import 'package:livrodin/models/book.dart';
import 'package:livrodin/models/rating.dart';

class RatingCard extends StatelessWidget {
const RatingCard({super.key, required this.rating, this.margin});
const RatingCard({super.key, required this.rating, this.margin, this.book});

final Rating rating;
final EdgeInsetsGeometry? margin;
final Book? book;
@override
Widget build(BuildContext context) {
return Container(
margin: margin,
width: double.infinity,
height: 150,
constraints: const BoxConstraints(minHeight: 150),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.white,
Expand All @@ -35,6 +37,7 @@ class RatingCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 15),
ProfileIcon(
image: rating.user.profilePictureUrl,
size: ProfileSize.lg,
Expand All @@ -60,14 +63,31 @@ class RatingCard extends StatelessWidget {
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(10),
child: Text(
rating.comment,
style: const TextStyle(
fontSize: 14,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
book != null
? Padding(
padding:
const EdgeInsets.only(top: 10, left: 10, right: 10),
child: Text(
book?.title ?? "",
style: const TextStyle(
fontWeight: FontWeight.w800,
),
),
)
: const SizedBox.shrink(),
Padding(
padding: const EdgeInsets.all(10),
child: Text(
rating.comment,
style: const TextStyle(
fontSize: 14,
),
),
),
),
],
),
),
],
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/user_list_rating.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class UserListRatingDialig extends StatelessWidget {
"/book/detail/${ratings[index].id}",
),
child: RatingCard(
book: ratings[index],
margin: const EdgeInsets.only(bottom: 10),
rating: ratings[index].ratings[0],
),
Expand Down

0 comments on commit fc0078e

Please sign in to comment.