pmu_flutter/lec4/lib/view/home_page/home_card_image.dart

52 lines
1.4 KiB
Dart

part of 'home_card.dart';
class _CardImage extends StatelessWidget {
final String imageUrl;
const _CardImage(this.imageUrl);
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20),
topLeft: Radius.circular(20),
),
child: SizedBox(
height: double.infinity,
width: 115,
child: Stack(
children: [
Positioned.fill(
child: Image.network(
imageUrl,
fit: BoxFit.cover,
errorBuilder: (_, __, ___) => const Placeholder(),
),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
decoration: const BoxDecoration(
color: Colors.orangeAccent,
borderRadius: BorderRadius.only(
topRight: Radius.circular(20),
),
),
padding: const EdgeInsets.fromLTRB(8, 2, 8, 2),
child: Text(
'скидка 20%',
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: Colors.black),
),
),
)
],
),
),
);
}
}