diff --git a/lib/views/gallery.dart b/lib/views/gallery.dart index f40c04f..edf6381 100644 --- a/lib/views/gallery.dart +++ b/lib/views/gallery.dart @@ -1,12 +1,10 @@ import 'package:flutter/material.dart'; import 'package:open_media_server_app/apis/inventory_api.dart'; import 'package:open_media_server_app/apis/metadata_api.dart'; -import 'package:open_media_server_app/globals/globals.dart'; import 'package:open_media_server_app/models/internal/grid_item_model.dart'; import 'package:open_media_server_app/models/metadata/metadata_model.dart'; -import 'package:open_media_server_app/widgets/gallery_item.dart'; +import 'package:open_media_server_app/widgets/grid_item.dart'; import 'package:open_media_server_app/views/detail_views/movie_detail.dart'; -import 'package:open_media_server_app/views/player.dart'; import 'package:open_media_server_app/views/detail_views/show_detail.dart'; class Gallery extends StatelessWidget { @@ -48,7 +46,10 @@ class Gallery extends StatelessWidget { ), itemBuilder: (context, index) { return InkWell( - child: GridItem(item: items[index]), + child: GridItem( + item: items[index], + desiredItemWidth: desiredItemWidth, + ), onTap: () { Navigator.push( context, diff --git a/lib/widgets/custom_image.dart b/lib/widgets/custom_image.dart index e6f39a5..e17e203 100644 --- a/lib/widgets/custom_image.dart +++ b/lib/widgets/custom_image.dart @@ -18,8 +18,14 @@ class CustomImage extends StatelessWidget { @override Widget build(BuildContext context) { + String addon = ""; + + if (width?.isFinite ?? false) { + addon = "?width=${width?.floor()}"; + } + return CachedNetworkImage( - imageUrl: imageUrl, + imageUrl: "$imageUrl$addon", fit: fit, width: width, height: height, diff --git a/lib/widgets/gallery_item.dart b/lib/widgets/grid_item.dart similarity index 84% rename from lib/widgets/gallery_item.dart rename to lib/widgets/grid_item.dart index e8ba099..ee989ec 100644 --- a/lib/widgets/gallery_item.dart +++ b/lib/widgets/grid_item.dart @@ -6,7 +6,9 @@ import 'package:open_media_server_app/widgets/custom_image.dart'; class GridItem extends StatelessWidget { final GridItemModel item; - const GridItem({Key? key, required this.item}) : super(key: key); + const GridItem({Key? key, required this.item, required this.desiredItemWidth}) : super(key: key); + + final double desiredItemWidth; @override Widget build(BuildContext context) { @@ -19,7 +21,7 @@ class GridItem extends StatelessWidget { child: CustomImage( imageUrl: item.posterUrl ?? Globals.PictureNotFoundUrl, fit: BoxFit.cover, - width: double.infinity, + width: desiredItemWidth + 150, ), ), ),