mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
50 lines
1.5 KiB
Dart
50 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fladder/models/item_base_model.dart';
|
|
import 'package:fladder/util/fladder_image.dart';
|
|
|
|
class ItemLogo extends StatelessWidget {
|
|
final ItemBaseModel item;
|
|
final Alignment imageAlignment;
|
|
final TextStyle? textStyle;
|
|
const ItemLogo({
|
|
required this.item,
|
|
this.imageAlignment = Alignment.bottomCenter,
|
|
this.textStyle,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final logo = item.getPosters?.logo;
|
|
final size = MediaQuery.sizeOf(context);
|
|
final maxHeight = size.height * 0.25;
|
|
final textWidget = ConstrainedBox(
|
|
constraints: BoxConstraints(maxHeight: maxHeight),
|
|
child: Text(
|
|
item.parentBaseModel.name,
|
|
textAlign: TextAlign.start,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.fade,
|
|
style: textStyle ??
|
|
Theme.of(context).textTheme.headlineLarge?.copyWith(
|
|
fontSize: 55,
|
|
),
|
|
),
|
|
);
|
|
return logo != null
|
|
? ConstrainedBox(
|
|
constraints: BoxConstraints(maxWidth: size.width * 0.25, maxHeight: maxHeight),
|
|
child: FladderImage(
|
|
image: logo,
|
|
disableBlur: true,
|
|
stackFit: StackFit.passthrough,
|
|
alignment: Alignment.bottomLeft,
|
|
imageErrorBuilder: (context, object, stack) => textWidget,
|
|
placeHolder: textWidget,
|
|
fit: BoxFit.contain,
|
|
),
|
|
)
|
|
: textWidget;
|
|
}
|
|
}
|