75 lines
2.2 KiB
Dart
75 lines
2.2 KiB
Dart
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:responsive_sizer/responsive_sizer.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
import 'package:text_scroll/text_scroll.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: CachedNetworkImage(
|
|
imageUrl: imageUrl,
|
|
placeholder: (c, d) => Shimmer.fromColors(
|
|
baseColor: Colors.grey.shade300,
|
|
highlightColor: Colors.grey.shade100,
|
|
child: Container(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
errorWidget: (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,
|
|
),
|
|
AutoSizeText(
|
|
description,
|
|
overflowReplacement: TextScroll(description),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|