release_schedule/lib/view/movie_item.dart

38 lines
1.0 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:release_schedule/model/movie.dart';
import 'package:release_schedule/view/movie_page.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),
2024-01-09 13:24:35 +01:00
subtitle: Text(movie.genres?.join(", ") ?? ""),
trailing: IconButton(
icon: Icon(movie.bookmarked
2024-01-08 12:57:36 +01:00
? Icons.bookmark_added
: Icons.bookmark_border),
onPressed: () => movie.setDetails(bookmarked: !movie.bookmarked),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return MoviePage(movie);
},
),
);
},
2024-01-08 12:57:36 +01:00
);
},
);
}
}