2024-06-24 16:24:57 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
2024-08-06 16:20:27 +02:00
|
|
|
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
2024-06-24 16:24:57 +02:00
|
|
|
|
|
|
|
class ThumbnailWithInfoContainer extends StatelessWidget {
|
|
|
|
const ThumbnailWithInfoContainer({
|
|
|
|
super.key,
|
|
|
|
this.onTap,
|
|
|
|
this.borderRadius = 10,
|
|
|
|
required this.label,
|
|
|
|
required this.child,
|
|
|
|
});
|
|
|
|
|
|
|
|
final VoidCallback? onTap;
|
|
|
|
final double borderRadius;
|
|
|
|
final String label;
|
|
|
|
final Widget child;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.bottomLeft,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
2024-08-06 16:20:27 +02:00
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [
|
|
|
|
context.colorScheme.surfaceContainer,
|
|
|
|
context.colorScheme.surfaceContainer.darken(amount: .1),
|
|
|
|
],
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
end: Alignment.bottomCenter,
|
|
|
|
),
|
2024-06-24 16:24:57 +02:00
|
|
|
),
|
|
|
|
foregroundDecoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
|
|
color: Colors.white,
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: FractionalOffset.topCenter,
|
|
|
|
end: FractionalOffset.bottomCenter,
|
|
|
|
colors: [
|
2024-08-06 16:20:27 +02:00
|
|
|
Colors.transparent,
|
2024-06-24 16:24:57 +02:00
|
|
|
label == ''
|
|
|
|
? Colors.black.withOpacity(0.1)
|
|
|
|
: Colors.black.withOpacity(0.5),
|
|
|
|
],
|
|
|
|
stops: const [0.0, 1.0],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8) +
|
|
|
|
const EdgeInsets.only(bottom: 8),
|
|
|
|
child: Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 14,
|
|
|
|
),
|
|
|
|
maxLines: 2,
|
|
|
|
softWrap: false,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|