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

Side by Side Diff: sky/sdk/lib/rendering/flex.dart

Issue 1231203002: Make RenderFlex support taking children in the constructor. (Closed) Base URL: https://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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:math' as math; 5 import 'dart:math' as math;
6 6
7 import 'box.dart'; 7 import 'box.dart';
8 import 'object.dart'; 8 import 'object.dart';
9 9
10 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend erBox> { 10 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend erBox> {
(...skipping 24 matching lines...) Expand all
35 center, 35 center,
36 } 36 }
37 37
38 typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints) ; 38 typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints) ;
39 39
40 class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl exBoxParentData>, 40 class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl exBoxParentData>,
41 RenderBoxContainerDefaultsMixin<RenderBo x, FlexBoxParentData> { 41 RenderBoxContainerDefaultsMixin<RenderBo x, FlexBoxParentData> {
42 // lays out RenderBox children using flexible layout 42 // lays out RenderBox children using flexible layout
43 43
44 RenderFlex({ 44 RenderFlex({
45 List<RenderBox> children,
45 FlexDirection direction: FlexDirection.horizontal, 46 FlexDirection direction: FlexDirection.horizontal,
46 FlexJustifyContent justifyContent: FlexJustifyContent.start, 47 FlexJustifyContent justifyContent: FlexJustifyContent.start,
47 FlexAlignItems alignItems: FlexAlignItems.center 48 FlexAlignItems alignItems: FlexAlignItems.center
48 }) : _direction = direction, _justifyContent = justifyContent, _alignItems = a lignItems; 49 }) : _direction = direction,
50 _justifyContent = justifyContent,
51 _alignItems = alignItems {
52 addAll(children);
53 }
54
49 55
50 FlexDirection _direction; 56 FlexDirection _direction;
51 FlexDirection get direction => _direction; 57 FlexDirection get direction => _direction;
52 void set direction (FlexDirection value) { 58 void set direction (FlexDirection value) {
53 if (_direction != value) { 59 if (_direction != value) {
54 _direction = value; 60 _direction = value;
55 markNeedsLayout(); 61 markNeedsLayout();
56 } 62 }
57 } 63 }
58 64
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 396 }
391 397
392 void hitTestChildren(HitTestResult result, { Point position }) { 398 void hitTestChildren(HitTestResult result, { Point position }) {
393 defaultHitTestChildren(result, position: position); 399 defaultHitTestChildren(result, position: position);
394 } 400 }
395 401
396 void paint(PaintingCanvas canvas, Offset offset) { 402 void paint(PaintingCanvas canvas, Offset offset) {
397 defaultPaint(canvas, offset); 403 defaultPaint(canvas, offset);
398 } 404 }
399 } 405 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698