Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1020)

Unified Diff: sky/sdk/lib/widgets/icon.dart

Issue 1217593004: Teach Icon to use an AssetBundle (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: upload again Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/icon.dart
diff --git a/sky/sdk/lib/widgets/icon.dart b/sky/sdk/lib/widgets/icon.dart
index 5bb3fac8032b8fd7f47fe15b873d8370f531e76c..3709ca4bc507324068ea1d2a93c92910351584a9 100644
--- a/sky/sdk/lib/widgets/icon.dart
+++ b/sky/sdk/lib/widgets/icon.dart
@@ -2,18 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import '../mojo/asset_bundle.dart';
import 'basic.dart';
-// TODO(eseidel): This should use package:.
-const String kAssetBase = '/packages/sky/assets/material-design-icons';
+const String _kAssetBase = '/packages/sky/assets/material-design-icons/';
+final AssetBundle _iconBundle = new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
class Icon extends Component {
-
- Icon({
- String key,
- this.size,
- this.type: ''
- }) : super(key: key);
+ Icon({ String key, this.size, this.type: '' }) : super(key: key);
final int size;
final String type;
@@ -29,10 +25,10 @@ class Icon extends Component {
// TODO(eseidel): This clearly isn't correct. Not sure what would be.
// Should we use the ios images on ios?
String density = 'drawable-xxhdpi';
- return new NetworkImage(
- size: new Size(size.toDouble(), size.toDouble()),
- src: '${kAssetBase}/${category}/${density}/ic_${subtype}_${size}dp.png'
+ return new AssetImage(
+ bundle: _iconBundle,
+ name: '${category}/${density}/ic_${subtype}_${size}dp.png',
+ size: new Size(size.toDouble(), size.toDouble())
);
}
-
}
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698