mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make Icon work using space-aged base-url technology.
I also moved Icon back to using int, since double doesn't actually make sense for an icon pixel size. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1164023005
This commit is contained in:
parent
05a7ed066c
commit
8d52fb51dc
@ -5,15 +5,15 @@
|
||||
#include "sky/engine/config.h"
|
||||
#include "sky/engine/core/loader/CanvasImageLoader.h"
|
||||
#include "sky/engine/core/painting/CanvasImage.h"
|
||||
#include "sky/engine/platform/image-decoders/ImageDecoder.h"
|
||||
#include "sky/engine/core/script/dom_dart_state.h"
|
||||
#include "sky/engine/platform/SharedBuffer.h"
|
||||
#include "sky/engine/platform/image-decoders/ImageDecoder.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
CanvasImageLoader::CanvasImageLoader(const String& src, PassOwnPtr<ImageLoaderCallback> callback)
|
||||
: callback_(callback) {
|
||||
// TODO(jackson): Figure out how to determine the proper base URL here
|
||||
KURL url = KURL(KURL(), src);
|
||||
KURL url = KURL(DOMDartState::Current()->url(), src);
|
||||
fetcher_ = adoptPtr(new MojoFetcher(this, url));
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import '../rendering/box.dart';
|
||||
const String kAssetBase = '/packages/sky/assets/material-design-icons';
|
||||
|
||||
class Icon extends Component {
|
||||
double size;
|
||||
int size;
|
||||
String type;
|
||||
|
||||
Icon({
|
||||
@ -28,7 +28,7 @@ class Icon extends Component {
|
||||
subtype = parts[1];
|
||||
}
|
||||
return new Image(
|
||||
size: new sky.Size(size, size),
|
||||
size: new sky.Size(size.toDouble(), size.toDouble()),
|
||||
src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png'
|
||||
);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ class IconButton extends Component {
|
||||
UINode build() {
|
||||
return new EventListenerNode(
|
||||
new Padding(
|
||||
child: new Icon(type: icon, size: 24.0),
|
||||
child: new Icon(type: icon, size: 24),
|
||||
padding: const EdgeDims.all(8.0)),
|
||||
onGestureTap: onGestureTap);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ class MenuItem extends ButtonBase {
|
||||
children: [
|
||||
new StyleNode(
|
||||
new Icon(
|
||||
size: 24.0,
|
||||
size: 24,
|
||||
type: "${icon}_grey600"
|
||||
),
|
||||
_iconStyle
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user