debug.dart 2.76 KB
Newer Older
1 2 3 4
// 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.

5
import 'package:flutter/painting.dart';
Devon Carew's avatar
Devon Carew committed
6
import 'package:flutter/rendering.dart';
7

8
export 'package:flutter/foundation.dart' show debugPrint;
9

10 11
/// Causes each RenderBox to paint a box around its bounds, and some extra
/// boxes, such as RenderPadding, to draw construction lines.
12
bool debugPaintSizeEnabled = false;
Adam Barth's avatar
Adam Barth committed
13 14

/// The color to use when painting RenderObject bounds.
15
Color debugPaintSizeColor = const Color(0xFF00FFFF);
16

17 18
/// The color to use when painting some boxes that just add space (e.g. an empty
/// RenderConstrainedBox or RenderPadding).
19
Color debugPaintSpacingColor = const Color(0x90909090);
20 21

/// The color to use when painting RenderPadding edges.
22
Color debugPaintPaddingColor = const Color(0x900090FF);
23 24

/// The color to use when painting RenderPadding edges.
25
Color debugPaintPaddingInnerEdgeColor = const Color(0xFF0090FF);
26 27

/// The color to use when painting the arrows used to show RenderPositionedBox alignment.
28
Color debugPaintArrowColor = const Color(0xFFFFFF00);
29

Adam Barth's avatar
Adam Barth committed
30
/// Causes each RenderBox to paint a line at each of its baselines.
31
bool debugPaintBaselinesEnabled = false;
Adam Barth's avatar
Adam Barth committed
32 33

/// The color to use when painting alphabetic baselines.
34
Color debugPaintAlphabeticBaselineColor = const Color(0xFF00FF00);
Adam Barth's avatar
Adam Barth committed
35 36

/// The color ot use when painting ideographic baselines.
37
Color debugPaintIdeographicBaselineColor = const Color(0xFFFFD000);
38

Adam Barth's avatar
Adam Barth committed
39
/// Causes each Layer to paint a box around its bounds.
40
bool debugPaintLayerBordersEnabled = false;
Adam Barth's avatar
Adam Barth committed
41 42

/// The color to use when painting Layer borders.
43
Color debugPaintLayerBordersColor = const Color(0xFFFF9800);
44

Hixie's avatar
Hixie committed
45
/// Causes RenderBox objects to flash while they are being tapped.
46 47 48 49 50
bool debugPaintPointersEnabled = false;

/// The color to use when reporting pointers.
int debugPaintPointersColorValue = 0x00BBBB;

51
/// Overlay a rotating set of colors when repainting layers in checked mode.
52
bool debugRepaintRainbowEnabled = false;
53 54 55 56 57

/// The current color to overlay when repainting a layer.
HSVColor debugCurrentRepaintColor = const HSVColor.fromAHSV(0.4, 60.0, 1.0, 1.0);

/// The amount to increment the hue of the current repaint color.
58
double debugRepaintRainbowHueIncrement = 2.0;
59

60 61 62 63 64 65
/// Log the call stacks that mark render objects as needing paint.
bool debugPrintMarkNeedsPaintStacks = false;

/// Log the call stacks that mark render objects as needing layout.
bool debugPrintMarkNeedsLayoutStacks = false;

66 67 68
/// Check the intrinsic sizes of each [RenderBox] during layout.
bool debugCheckIntrinsicSizes = false;

69 70 71 72 73
List<String> debugDescribeTransform(Matrix4 transform) {
  List<String> matrix = transform.toString().split('\n').map((String s) => '  $s').toList();
  matrix.removeLast();
  return matrix;
}