2022-04-02 19:31:53 +02:00
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
import 'package:immich_mobile/constants/hive_box.dart';
|
|
|
|
|
|
|
|
class ThumbnailWithInfo extends StatelessWidget {
|
2022-07-13 14:23:48 +02:00
|
|
|
const ThumbnailWithInfo({
|
|
|
|
Key? key,
|
|
|
|
required this.textInfo,
|
|
|
|
required this.imageUrl,
|
|
|
|
required this.onTap,
|
|
|
|
}) : super(key: key);
|
2022-04-02 19:31:53 +02:00
|
|
|
|
|
|
|
final String textInfo;
|
|
|
|
final String imageUrl;
|
|
|
|
final Function onTap;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var box = Hive.box(userInfoBox);
|
|
|
|
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap();
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
child: SizedBox(
|
|
|
|
width: MediaQuery.of(context).size.width / 2,
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
foregroundDecoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
color: Colors.black26,
|
|
|
|
),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
width: 250,
|
|
|
|
height: 250,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
imageUrl: imageUrl,
|
2022-06-25 22:12:47 +02:00
|
|
|
httpHeaders: {
|
|
|
|
"Authorization": "Bearer ${box.get(accessTokenKey)}"
|
|
|
|
},
|
2022-04-02 19:31:53 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom: 8,
|
|
|
|
left: 10,
|
|
|
|
child: SizedBox(
|
|
|
|
width: MediaQuery.of(context).size.width / 3,
|
|
|
|
child: Text(
|
2022-07-07 20:40:54 +02:00
|
|
|
textInfo,
|
2022-04-02 19:31:53 +02:00
|
|
|
style: const TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|