Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brianegan/transparent_image

A transparent image in Dart code, represented as a Uint8List.
https://github.com/brianegan/transparent_image

Last synced: 1 day ago
JSON representation

A transparent image in Dart code, represented as a Uint8List.

Awesome Lists containing this project

README

        

# transparent_image

A simple transparent image. Represented as a Uint8List, which was originally
extracted from the Flutter codebase (was private in the test package).

It's a silly, simple library, but I found I needed transparent images in a few
projects and found this is the simplest way to represent it :)

## Usage

This package exports one constant: `kTransparentImage`.

### Image Widget

Displays the transparent image.

```dart
Image.memory(kTransparentImage);
```

### ImageProvider

```dart
MemoryImage(kTransparentImage);
```

### FadeInImage Widget

A more useful example, and the reason I originally extracted this from the
Flutter codebase!

A [complete
example](https://flutter.dev/docs/cookbook/images/fading-in-images#in-memory)
can be seen on the Flutter website.

```dart
FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: 'https://picsum.photos/250?image=9',
),
);
```

## Contributors

* Flutter team
* Brian Egan