Skip to content

Split the configuration for selecting an image from the configuration of its painting #4500

@Hixie

Description

@Hixie

Right now, you pick the image using AssetImage or RawImageResource or whatever, and at the same time you specify its dimensions.

This makes it hard for other widgets to accept images in general from any source, but then additionally apply an opinion regarding how the image should be displayed (e.g. dimensions, fit, or repetition).

Proposal: We should instead have a single image-displaying widget, which you configure by passing an object that knows how to get the image (from a context).

e.g. instead of:

   new AssetImage(name: 'foo', width: 24.0)
   new RawImage(image: bar, width: 24.0)
   new NetworImage(src: 'http://baz', width: 24.0)

...have:

   new Image(image: AssetImage('foo'), width: 24.0)
   new Image(image: RawImage(bar), width: 24.0)
   new Image(image: NetworkImage('http://baz'), width: 24.0)

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions