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

Side by Side Diff: samples/pop_pop_win/lib/platform_target.dart

Issue 242443008: samples/pop_pop_win: now based on StageXL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tiny nit Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/pop_pop_win/LICENSE ('k') | samples/pop_pop_win/lib/pop_pop_win.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library ppw_platform; 1 library ppw_platform;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 4
5 abstract class PlatformTarget { 5 abstract class PlatformTarget {
6 bool _initialized = false; 6 bool _initialized = false;
7 7
8 factory PlatformTarget() => new _DefaultPlatform(); 8 factory PlatformTarget() => new _DefaultPlatform();
9 9
10 PlatformTarget.base(); 10 PlatformTarget.base();
11 11
12 bool get initialized => _initialized; 12 bool get initialized => _initialized;
13 13
14 void initialize() { 14 void initialize() {
15 assert(!_initialized); 15 assert(!_initialized);
16 _initialized = true; 16 _initialized = true;
17 } 17 }
18 18
19 Future clearValues(); 19 Future clearValues();
20 20
21 Future setValue(String key, String value); 21 Future setValue(String key, String value);
22 22
23 Future<String> getValue(String key); 23 Future<String> getValue(String key);
24 24
25 bool get renderBig; 25 int get size;
26 26
27 bool get showAbout; 27 bool get showAbout;
28 28
29 void toggleAbout([bool value]); 29 void toggleAbout([bool value]);
30 30
31 Stream get aboutChanged; 31 Stream get aboutChanged;
32 } 32 }
33 33
34 class _DefaultPlatform extends PlatformTarget { 34 class _DefaultPlatform extends PlatformTarget {
35 final Map<String, String> _values = new Map<String, String>(); 35 final Map<String, String> _values = new Map<String, String>();
36 final StreamController _aboutController = new StreamController(sync: true); 36 final StreamController _aboutController = new StreamController(sync: true);
37 bool _about = false; 37 bool _about = false;
38 38
39 _DefaultPlatform(): super.base(); 39 _DefaultPlatform() : super.base();
40 40
41 @override 41 @override
42 Future clearValues() => new Future(_values.clear); 42 Future clearValues() => new Future(_values.clear);
43 43
44 @override 44 @override
45 Future setValue(String key, String value) => 45 Future setValue(String key, String value) =>
46 new Future(() { _values[key] = value; }); 46 new Future(() { _values[key] = value; });
47 47
48 @override 48 @override
49 Future<String> getValue(String key) => new Future(() => _values[key]); 49 Future<String> getValue(String key) => new Future(() => _values[key]);
50 50
51 bool get renderBig => false; 51 int get size => 7;
52 52
53 void toggleAbout([bool value]) { 53 void toggleAbout([bool value]) {
54 assert(_about != null); 54 assert(_about != null);
55 if (value == null) { 55 if (value == null) {
56 value = !_about; 56 value = !_about;
57 } 57 }
58 _about = value; 58 _about = value;
59 _aboutController.add(null); 59 _aboutController.add(null);
60 } 60 }
61 61
62 bool get showAbout => _about; 62 bool get showAbout => _about;
63 63
64 Stream get aboutChanged => _aboutController.stream; 64 Stream get aboutChanged => _aboutController.stream;
65 } 65 }
OLDNEW
« no previous file with comments | « samples/pop_pop_win/LICENSE ('k') | samples/pop_pop_win/lib/pop_pop_win.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698