mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
[Bugfix] Fix poster child count clipping large numbers(#8)
Fix the error when display large numbers #5 Example:  The numbers in the example image was random generated.
This commit is contained in:
parent
41ec72017c
commit
5e882b2177
3 changed files with 16 additions and 6 deletions
|
|
@ -361,13 +361,14 @@ class _PosterImageState extends ConsumerState<PosterImage> {
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: StatusCard(
|
child: StatusCard(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
useFittedBox: widget.poster.unPlayedItemCount != 0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(6),
|
padding: const EdgeInsets.all(6),
|
||||||
child: widget.poster.unPlayedItemCount != 0
|
child: widget.poster.unPlayedItemCount != 0
|
||||||
? Container(
|
? Container(
|
||||||
constraints: const BoxConstraints(minWidth: 18),
|
constraints: const BoxConstraints(minWidth: 16),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.poster.userData.unPlayedItemCount.toString(),
|
widget.poster.userData.unPlayedItemCount.toString(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ class SeasonPoster extends ConsumerWidget {
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: StatusCard(
|
child: StatusCard(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
useFittedBox: true,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
season.userData.unPlayedItemCount.toString(),
|
season.userData.unPlayedItemCount.toString(),
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,17 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
class StatusCard extends ConsumerWidget {
|
class StatusCard extends ConsumerWidget {
|
||||||
final Color? color;
|
final Color? color;
|
||||||
|
final bool useFittedBox;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
const StatusCard({this.color, required this.child, super.key});
|
const StatusCard({this.color, this.useFittedBox = false, required this.child, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(5),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 33,
|
width: 40,
|
||||||
height: 33,
|
height: 33,
|
||||||
child: Card(
|
child: Card(
|
||||||
elevation: 10,
|
elevation: 10,
|
||||||
|
|
@ -22,7 +23,14 @@ class StatusCard extends ConsumerWidget {
|
||||||
data: IconThemeData(
|
data: IconThemeData(
|
||||||
color: color,
|
color: color,
|
||||||
),
|
),
|
||||||
child: Center(child: child),
|
child: Center(
|
||||||
|
child: useFittedBox
|
||||||
|
? FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
child: child,
|
||||||
|
)
|
||||||
|
: child,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue