Files
PinePods-nix/PinePods-0.8.2/mobile/lib/ui/widgets/tile_image.dart
2026-03-03 10:57:43 -05:00

52 lines
1.4 KiB
Dart

// Copyright 2020 Ben Hills and the project contributors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:pinepods_mobile/ui/widgets/placeholder_builder.dart';
import 'package:pinepods_mobile/ui/widgets/podcast_image.dart';
import 'package:flutter/material.dart';
class TileImage extends StatelessWidget {
const TileImage({
super.key,
required this.url,
required this.size,
this.highlight = false,
});
/// The URL of the image to display.
final String url;
/// The size of the image container; both height and width.
final double size;
final bool highlight;
@override
Widget build(BuildContext context) {
final placeholderBuilder = PlaceholderBuilder.of(context);
return PodcastImage(
key: Key('tile$url'),
highlight: highlight,
url: url,
height: size,
width: size,
borderRadius: 4.0,
fit: BoxFit.contain,
placeholder: placeholderBuilder != null
? placeholderBuilder.builder()(context)
: const Image(
fit: BoxFit.contain,
image: AssetImage('assets/images/favicon.png'),
),
errorPlaceholder: placeholderBuilder != null
? placeholderBuilder.errorBuilder()(context)
: const Image(
fit: BoxFit.contain,
image: AssetImage('assets/images/favicon.png'),
),
);
}
}