overflow.dart 1.01 KB
Newer Older
Hixie's avatar
Hixie committed
1 2 3 4 5 6 7 8 9 10 11
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'box.dart';
import 'object.dart';

/// Lays the child out as if it was in the tree, but without painting anything,
/// without making the child available for hit testing, and without taking any
/// room in the parent.
class RenderOffStage extends RenderBox with RenderObjectWithChildMixin<RenderBox> {
12
  /// Creates an off-stage render object.
Hixie's avatar
Hixie committed
13 14 15 16
  RenderOffStage({ RenderBox child }) {
    this.child = child;
  }

17
  @override
Hixie's avatar
Hixie committed
18 19
  bool get sizedByParent => true;

20
  @override
Hixie's avatar
Hixie committed
21 22 23 24
  void performResize() {
    size = constraints.smallest;
  }

25
  @override
Hixie's avatar
Hixie committed
26 27 28 29 30
  void performLayout() {
    if (child != null)
      child.layout(constraints);
  }

31
  @override
Hixie's avatar
Hixie committed
32
  bool hitTest(HitTestResult result, { Point position }) => false;
33 34

  @override
Hixie's avatar
Hixie committed
35
  void paint(PaintingContext context, Offset offset) { }
36 37

  @override
Hixie's avatar
Hixie committed
38
  void visitChildrenForSemantics(RenderObjectVisitor visitor) { }
Hixie's avatar
Hixie committed
39
}