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

Unified Diff: sky/sdk/lib/framework/components2/popup_menu.dart

Issue 1166153002: Add a basic popup menu implementation to stocks2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
Index: sky/sdk/lib/framework/components2/popup_menu.dart
diff --git a/sky/sdk/lib/framework/components2/popup_menu.dart b/sky/sdk/lib/framework/components2/popup_menu.dart
index cc32e73e49cc6e9b1c4c65044c77687d462b1361..71559a528aa9e1b7272a2a4474038325771c5c48 100644
--- a/sky/sdk/lib/framework/components2/popup_menu.dart
+++ b/sky/sdk/lib/framework/components2/popup_menu.dart
@@ -5,7 +5,7 @@
import 'animated_component.dart';
import '../animation/animated_value.dart';
import '../fn2.dart';
-import '../theme/colors.dart';
+import '../theme2/colors.dart';
import 'dart:async';
import 'dart:math' as math;
import 'material.dart';
@@ -50,24 +50,18 @@ class PopupMenuController {
}
class PopupMenu extends AnimatedComponent {
- static final Style _style = new Style('''
- border-radius: 2px;
- padding: 8px 0;
- box-sizing: border-box;
- background-color: ${Grey[50]};''');
-
List<List<UINode>> items;
int level;
PopupMenuController controller;
double _position;
- int _width;
- int _height;
+ // int _width;
+ // int _height;
PopupMenu({ Object key, this.controller, this.items, this.level })
: super(key: key) {
animateField(controller.position, #_position);
- onDidMount(_measureSize);
+ // onDidMount(_measureSize);
}
double _opacityFor(int i) {
@@ -79,23 +73,23 @@ class PopupMenu extends AnimatedComponent {
return math.max(0.0, math.min(1.0, (_position - start) / duration));
}
- String _inlineStyle() {
- if (_position == null || _position == 1.0 ||
- _height == null || _width == null)
- return null;
- return '''
- opacity: ${math.min(1.0, _position * 3.0)};
- width: ${math.min(_width, _width * (0.5 + _position * 2.0))}px;
- height: ${math.min(_height, _height * _position * 1.5)}px;''';
- }
-
- void _measureSize() {
- setState(() {
- var root = getRoot();
- _width = root.width.round();
- _height = root.height.round();
- });
- }
+ // String _inlineStyle() {
+ // if (_position == null || _position == 1.0 ||
+ // _height == null || _width == null)
+ // return null;
+ // return '''
+ // opacity: ${math.min(1.0, _position * 3.0)};
+ // width: ${math.min(_width, _width * (0.5 + _position * 2.0))}px;
+ // height: ${math.min(_height, _height * _position * 1.5)}px;''';
+ // }
+
+ // void _measureSize() {
+ // setState(() {
+ // var root = getRoot();
+ // _width = root.width.round();
+ // _height = root.height.round();
+ // });
+ // }
UINode build() {
int i = 0;
@@ -106,9 +100,11 @@ class PopupMenu extends AnimatedComponent {
return new Material(
content: new Container(
- style: _style,
- inlineStyle: _inlineStyle(),
- children: children
+ padding: const EdgeDims.all(8.0),
+ // border-radius: 2px
+ decoration: new BoxDecoration(backgroundColor: Grey[50]),
+ // inlineStyle: _inlineStyle(),
+ child: new BlockContainer(children: children)
),
level: level);
}
« no previous file with comments | « sky/sdk/lib/framework/components2/modal_overlay.dart ('k') | sky/sdk/lib/framework/components2/popup_menu_item.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698