mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 08:38:50 +05:00
Initial commit
This commit is contained in:
54
lib/presentation/widgets/movie_grid_item.dart
Normal file
54
lib/presentation/widgets/movie_grid_item.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:neomovies_mobile/data/models/favorite.dart';
|
||||
import 'package:neomovies_mobile/presentation/screens/movie_detail/movie_detail_screen.dart';
|
||||
|
||||
class MovieGridItem extends StatelessWidget {
|
||||
final Favorite favorite;
|
||||
|
||||
const MovieGridItem({super.key, required this.favorite});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
MovieDetailScreen(movieId: favorite.mediaId, mediaType: favorite.mediaType),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 2 / 3,
|
||||
child: Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: favorite.fullPosterUrl,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const Center(child: CircularProgressIndicator()),
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: 32,
|
||||
child: Text(
|
||||
favorite.title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user