https://github.com/ueman/drawable
Flutter plugin to load Android drawables. This helps to share graphics between Flutter and Android
https://github.com/ueman/drawable
hacktoberfest
Last synced: about 1 year ago
JSON representation
Flutter plugin to load Android drawables. This helps to share graphics between Flutter and Android
- Host: GitHub
- URL: https://github.com/ueman/drawable
- Owner: ueman
- License: mit
- Created: 2021-02-16T10:42:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:36:33.000Z (over 2 years ago)
- Last Synced: 2025-03-25T17:49:33.968Z (about 1 year ago)
- Topics: hacktoberfest
- Language: Dart
- Homepage:
- Size: 83 KB
- Stars: 8
- Watchers: 2
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# DRAWABLE
---
A Flutter plugin to share images between Flutter and Android.
For iOS please use [ios_platform_images](https://pub.dev/packages/ios_platform_images).
## Usage
```dart
import 'package:drawable/drawable.dart';
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Image(image: DrawableImage("flutter")),
),
),
);
}
```
If you want to do something different with the drawables you
receive them directly like this:
```dart
import 'package:drawable/drawable.dart';
Future main() async {
const androidDrawable = AndroidDrawable();
final drawable = await androidDrawable.loadBitmap('drawable_id');
}
```
## Supported drawables
| Drawable type | Supported | Additional notes |
|---------------|:---------:|----------------------|
| [AdaptiveIconDrawable](https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable) | ✅ | |
| [BitmapDrawable](https://developer.android.com/guide/topics/resources/drawable-resource#Bitmap) | ✅ | |
| [ColorDrawable](https://developer.android.com/reference/android/graphics/drawable/ColorDrawable) | ✅ | |
| [VectorDrawable](https://developer.android.com/reference/android/graphics/drawable/VectorDrawable) | ✅ | Because of limitations of Android, this is not a vector on the Flutter side. |
The following drawable are supported as Bitmap Drawables.
Please note, that all of these drawable are currently converted to a bitmap.
More sophisticated support is planned, but currently not available.
| Drawable type |
|---------------|
| [ColorStateListDrawable](https://developer.android.com/reference/android/graphics/drawable/ColorStateListDrawable) |
| [GradientDrawable](https://developer.android.com/reference/android/graphics/drawable/GradientDrawable) |
| [LayerDrawable](https://developer.android.com/reference/android/graphics/drawable/LayerDrawable) |
| [LevelListDrawable](https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable) |
| [PictureDrawable](https://developer.android.com/reference/android/graphics/drawable/PictureDrawable) |
| [ShapeDrawable](https://developer.android.com/reference/android/graphics/drawable/ShapeDrawable) |
| [StateListDrawable](https://developer.android.com/reference/android/graphics/drawable/StateListDrawable) |
| [TransitionDrawable](https://developer.android.com/reference/android/graphics/drawable/TransitionDrawable) |
List of currently unsupported drawables:
- [AnimatedImageDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable)
- [AnimatedStateListDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedStateListDrawable)
- [AnimatedVectorDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable)
- [AnimationDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimationDrawable)
- [ClipDrawable](https://developer.android.com/reference/android/graphics/drawable/ClipDrawable)
- [InsetDrawable](https://developer.android.com/reference/android/graphics/drawable/InsetDrawable)
- [NinePatchDrawable](https://developer.android.com/reference/android/graphics/drawable/NinePatchDrawable)
- [PaintDrawable](https://developer.android.com/reference/android/graphics/drawable/PaintDrawable)
- [RippleDrawable](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable)
- [RotateDrawable](https://developer.android.com/reference/android/graphics/drawable/RotateDrawable)
- [ScaleDrawable](https://developer.android.com/reference/android/graphics/drawable/ScaleDrawable)
## 📣 Author
- Jonas Uekötter [GitHub](https://github.com/ueman) [Twitter](https://twitter.com/ue_man)
## Sponsoring
I'm working on my packages on my spare time, but I don't have as much time as I would like.
If this package or any other package I maintain is helping you, please consider to [sponsor](https://github.com/ueman#sponsor-me) me.
By doing so, I will prioritize your issues or your pull-requests before the others.