ocarina2/lib/widgets/hero_banner.dart

71 lines
2 KiB
Dart
Raw Normal View History

2024-05-23 19:14:08 +02:00
import 'package:fast_cached_network_image/fast_cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:responsive_sizer/responsive_sizer.dart';
import 'package:shimmer/shimmer.dart';
class HeroBanner extends StatelessWidget {
const HeroBanner({
required this.imageUrl,
required this.title,
required this.description,
this.heroTag = "NotAHero",
super.key,
});
final String imageUrl;
final String title;
final String description;
final String heroTag;
@override
Widget build(BuildContext context) {
return SizedBox(
height: 30.h,
width: 95.w,
child: Row(
children: [
SizedBox(
height: 180,
width: 180,
child: Hero(
tag: heroTag,
child: FastCachedImage(
url: imageUrl,
loadingBuilder: (c, d) => Shimmer.fromColors(
baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100,
child: Container(
color: Colors.grey,
),
),
errorBuilder: (c, _, __) {
return ColoredBox(
color: Theme.of(context).colorScheme.primaryContainer,
child: Center(
child: Icon(
Icons.music_note,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
);
},
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(
height: 5,
),
Text(description),
],
)
],
),
);
}
}