Commit ff8e4061 authored by Adam Barth's avatar Adam Barth

Merge pull request #1912 from aghassemi/master

Adding RawImage component
parents c44dd17d 1dce2c85
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -9,6 +10,7 @@ import 'package:flutter/services.dart'; ...@@ -9,6 +10,7 @@ import 'package:flutter/services.dart';
import 'framework.dart'; import 'framework.dart';
export 'dart:typed_data' show Uint8List;
export 'package:flutter/rendering.dart' show export 'package:flutter/rendering.dart' show
BackgroundImage, BackgroundImage,
BlockDirection, BlockDirection,
...@@ -1095,6 +1097,40 @@ class DefaultAssetBundle extends InheritedWidget { ...@@ -1095,6 +1097,40 @@ class DefaultAssetBundle extends InheritedWidget {
bool updateShouldNotify(DefaultAssetBundle old) => bundle != old.bundle; bool updateShouldNotify(DefaultAssetBundle old) => bundle != old.bundle;
} }
class RawImage extends StatelessComponent {
RawImage({
Key key,
this.bytes,
this.width,
this.height,
this.colorFilter,
this.fit,
this.repeat: ImageRepeat.noRepeat,
this.centerSlice
}) : super(key: key);
final Uint8List bytes;
final double width;
final double height;
final ColorFilter colorFilter;
final ImageFit fit;
final ImageRepeat repeat;
final Rect centerSlice;
Widget build(BuildContext context) {
ImageResource image = new ImageResource(decodeImageFromList(bytes));
return new ImageListener(
image: image,
width: width,
height: height,
colorFilter: colorFilter,
fit: fit,
repeat: repeat,
centerSlice: centerSlice
);
}
}
class AssetImage extends StatelessComponent { class AssetImage extends StatelessComponent {
AssetImage({ AssetImage({
Key key, Key key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment