123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import 'package:flyinsono/lab/color/lab_colors.dart';
- import 'package:flutter/material.dart';
- class USImageThumbnail extends StatelessWidget {
- const USImageThumbnail({
- super.key,
- required this.imageUrl,
- required this.description,
- this.labelBuilder,
- this.isVideo = false,
- });
- final String imageUrl;
- final String description;
- final Widget? labelBuilder;
- final bool isVideo;
- @override
- Widget build(BuildContext context) {
- return Container(
- decoration: BoxDecoration(
- color: Colors.black,
- borderRadius: BorderRadius.circular(5),
- ),
- clipBehavior: Clip.antiAlias,
- child: Stack(
- children: [
- Center(
- child: Image.network(
- imageUrl,
- fit: BoxFit.contain,
- errorBuilder:
- (BuildContext context, Object error, StackTrace? stackTrace) {
- return Center(
- child: Icon(
- Icons.image_outlined,
- size: 60,
- color: LabColors.text400,
- ),
- );
- },
- ),
- ),
- if (isVideo) ...[
- Center(
- child: Icon(
- Icons.play_circle_outline,
- color: Colors.white,
- size: 40,
- ),
- ),
- ],
- Align(
- alignment: Alignment.bottomLeft,
- child: Container(
- color: Colors.black,
- width: double.maxFinite,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 5),
- child: Text(
- description,
- style: TextStyle(
- color: LabColors.text400,
- fontSize: 12,
- ),
- ),
- ),
- ),
- ),
- if (labelBuilder != null)
- Align(
- alignment: Alignment.bottomRight,
- child: Container(
- padding: EdgeInsets.symmetric(vertical: 2, horizontal: 5),
- margin: EdgeInsets.all(5),
- decoration: BoxDecoration(
- color: Colors.black,
- borderRadius: BorderRadius.circular(5),
- border: Border.all(
- color: LabColors.base800,
- width: 1,
- ),
- ),
- child: labelBuilder!,
- ),
- ),
- ],
- ),
- );
- }
- }
|