fix: Standardize precision used in communityRating (#424)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
Ulises M 2025-08-01 23:40:07 -07:00 committed by GitHub
parent d421bb13e6
commit ca7cd827e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 31 deletions

View file

@ -68,32 +68,28 @@ class ItemBaseModel with ItemBaseModelMappable {
}
Widget? subTitle(SortingOptions options) => switch (options) {
SortingOptions.parentalRating => overview.parentalRating != null
? Row(
children: [
const Icon(
IconsaxPlusBold.star_1,
size: 14,
color: Colors.yellowAccent,
),
const SizedBox(width: 6),
Text((overview.parentalRating ?? 0.0).toString())
],
)
: null,
SortingOptions.communityRating => overview.communityRating != null
? Row(
children: [
const Icon(
IconsaxPlusBold.star_1,
size: 14,
color: Colors.yellowAccent,
),
const SizedBox(width: 6),
Text((overview.communityRating ?? 0.0).toString())
],
)
: null,
SortingOptions.parentalRating => Row(
children: [
const Icon(
IconsaxPlusBold.star_1,
size: 14,
color: Colors.yellowAccent,
),
const SizedBox(width: 6),
Text(overview.parentalRating?.toString() ?? "--"),
],
),
SortingOptions.communityRating => Row(
children: [
const Icon(
IconsaxPlusBold.star_1,
size: 14,
color: Colors.yellowAccent,
),
const SizedBox(width: 6),
Text(overview.communityRating?.toStringAsFixed(2) ?? "--"),
],
),
_ => null,
};

View file

@ -130,7 +130,7 @@ class OverviewHeader extends ConsumerWidget {
color: Theme.of(context).colorScheme.primary,
),
Text(
communityRating?.toStringAsFixed(1) ?? "",
communityRating?.toStringAsFixed(2) ?? "",
style: subStyle,
),
],

View file

@ -83,13 +83,15 @@ class PosterWidget extends ConsumerWidget {
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (subTitle != null) ...[
Opacity(
opacity: opacity,
child: subTitle!,
Flexible(
child: Opacity(
opacity: opacity,
child: subTitle!,
),
),
const Spacer()
],
if (poster.subText?.isNotEmpty ?? false)
Flexible(