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

Unified Diff: sky/sdk/example/demo_launcher/lib/main.dart

Issue 1212343009: SkyDemo.apk should show thumbmails when offline (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/example/demo_launcher/lib/main.dart
diff --git a/sky/sdk/example/demo_launcher/lib/main.dart b/sky/sdk/example/demo_launcher/lib/main.dart
index 77eb51e3a5430b4cd2c86d89869022551a5483e0..458f204c87827736cb8072a01e525823afb4b2cf 100644
--- a/sky/sdk/example/demo_launcher/lib/main.dart
+++ b/sky/sdk/example/demo_launcher/lib/main.dart
@@ -5,6 +5,7 @@
import 'dart:sky';
import 'package:mojom/intents/intents.mojom.dart';
+import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/mojo/shell.dart' as shell;
import 'package:sky/painting/box_painter.dart';
import 'package:sky/theme/colors.dart' as colors;
@@ -18,6 +19,15 @@ import 'package:sky/widgets/scaffold.dart';
import 'package:sky/widgets/theme.dart';
import 'package:sky/widgets/tool_bar.dart';
+AssetBundle _initBundle() {
+ if (rootBundle != null)
+ return rootBundle;
+ const String _kAssetBase = '..';
+ return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
+}
+
+final AssetBundle _bundle = _initBundle();
+
void launch(String relativeUrl, String bundle) {
Uri url = Uri.base.resolve(relativeUrl);
@@ -60,7 +70,7 @@ List<Widget> demos = [
textTheme: typography.black,
decoration: new BoxDecoration(
backgroundImage: new BackgroundImage(
- src: '../assets/stocks_thumbnail.png',
+ image: _bundle.loadImage('assets/stocks_thumbnail.png'),
fit: BackgroundFit.cover
)
)
@@ -72,7 +82,7 @@ List<Widget> demos = [
textTheme: typography.white,
decoration: new BoxDecoration(
backgroundImage: new BackgroundImage(
- src: '../assets/game_thumbnail.png',
+ image: _bundle.loadImage('assets/game_thumbnail.png'),
fit: BackgroundFit.cover
)
)
@@ -96,7 +106,7 @@ List<Widget> demos = [
decoration: new BoxDecoration(
backgroundColor: colors.Black,
backgroundImage: new BackgroundImage(
- src: '../assets/sector_thumbnail.png',
+ image: _bundle.loadImage('assets/sector_thumbnail.png'),
fit: BackgroundFit.cover
)
)
« no previous file with comments | « no previous file | sky/sdk/lib/painting/box_painter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698