2023-11-06 10:38:26 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2023-11-11 15:05:11 +01:00
|
|
|
import 'package:release_schedule/model/date_format.dart';
|
2023-11-06 10:38:26 +01:00
|
|
|
import 'package:release_schedule/model/movie.dart';
|
|
|
|
|
|
|
|
class MovieItem extends StatelessWidget {
|
|
|
|
final MovieData movie;
|
|
|
|
const MovieItem(this.movie, {super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AnimatedBuilder(
|
|
|
|
animation: movie,
|
|
|
|
builder: (context, widget) {
|
|
|
|
return ListTile(
|
2024-01-08 12:57:36 +01:00
|
|
|
title: Text(movie.title),
|
|
|
|
subtitle: Text(
|
|
|
|
"${dateRelativeToNow(movie.releaseDate.date)}, ${movie.releaseDate.toString()}, ${movie.genres?.join(", ") ?? ""}"),
|
|
|
|
trailing: TextButton(
|
|
|
|
child: Icon(movie.bookmarked
|
|
|
|
? Icons.bookmark_added
|
|
|
|
: Icons.bookmark_border),
|
|
|
|
onPressed: () => movie.setDetails(bookmarked: !movie.bookmarked),
|
|
|
|
),
|
|
|
|
);
|
2023-11-06 10:38:26 +01:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|