Baseflow / octo_image

A multifunctional Flutter image widget
https://baseflow.com/
MIT License
156 stars 23 forks source link

Size is infinite although width and or height are set. #7

Closed renefloor closed 4 years ago

renefloor commented 4 years ago

🐛 Bug Report

Size is infinite although width and or height are set.

Expected behavior

I expect the widget to adhere to the width and height that are set.

Reproduction steps

Leading widget consumes entire tile width. Please use a sized widget.
'package:flutter/src/material/list_tile.dart':
Failed assertion: line 1353 pos 7: 'tileWidth != leadingSize.width'

I have the image inside a ListTile like this:

ListTile(
                      contentPadding: EdgeInsets.only(
                          left: 4.0, right: 8.0, top: 4.0, bottom: 4.0),
                      leading: CachedNetworkImage(
                        imageUrl:
                            "https://www.themealdb.com/images/ingredients/" +
                                Uri.encodeComponent(item.title) +
                                ".png",
                        placeholder: (context, url) =>
                            CircularProgressIndicator(),
                        errorWidget: (context, url, error) => Icon(Icons.error),
                        fit: BoxFit.fill,
                        width: 32,
                        height: 32,
                      ),
                      title: Text(item.title, style: Styles.listText),
                      trailing: Icon(Icons.add),
                      onTap: () {
                        Navigator.of(context).pop();
                      }),

From: https://github.com/Baseflow/flutter_cached_network_image/issues/273#issuecomment-635806477

Configuration

Version: 0.2.0

Platform:

renefloor commented 4 years ago

Size should be set on this stack: https://github.com/Baseflow/octo_image/blob/develop/lib/src/image.dart#L355 Perhaps also on the placeholders and error widgets.

renefloor commented 4 years ago

@netgfx This should fix your problem with cachednetworkimage, will release this as 0.2.1 today, so a simple pub upgrade should resolve the issue for you.

netgfx commented 4 years ago

@renefloor Awesome, thank you!