diff --git a/examples/stocks/flutter.yaml b/examples/stocks/flutter.yaml index 31027f24ba..81972df9a0 100644 --- a/examples/stocks/flutter.yaml +++ b/examples/stocks/flutter.yaml @@ -19,3 +19,7 @@ material-design-icons: - name: navigation/arrow_back - name: navigation/menu - name: navigation/more_vert + - name: editor/format_color_text + - name: image/filter_none + - name: hardware/mouse + - name: image/gradient diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart index c342b4e190..977a9b7520 100644 --- a/examples/stocks/lib/main.dart +++ b/examples/stocks/lib/main.dart @@ -7,7 +7,12 @@ library stocks; import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart' show debugPaintSizeEnabled; +import 'package:flutter/rendering.dart' show + debugPaintSizeEnabled, + debugPaintBaselinesEnabled, + debugPaintLayerBordersEnabled, + debugPaintPointersEnabled, + debugRepaintRainbowEnabled; import 'package:intl/intl.dart'; import 'i18n/stock_messages_all.dart'; @@ -32,6 +37,10 @@ class StocksAppState extends State { backupMode: BackupMode.enabled, debugShowGrid: false, debugShowSizes: false, + debugShowBaselines: false, + debugShowLayers: false, + debugShowPointers: false, + debugShowRainbow: false, showPerformanceOverlay: false, showSemanticsDebugger: false ); @@ -93,6 +102,10 @@ class StocksAppState extends State { Widget build(BuildContext context) { assert(() { debugPaintSizeEnabled = _configuration.debugShowSizes; + debugPaintBaselinesEnabled = _configuration.debugShowBaselines; + debugPaintLayerBordersEnabled = _configuration.debugShowLayers; + debugPaintPointersEnabled = _configuration.debugShowPointers; + debugRepaintRainbowEnabled = _configuration.debugShowRainbow; return true; }); return new MaterialApp( diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart index 2cfcd54575..a2f9442a4a 100644 --- a/examples/stocks/lib/stock_settings.dart +++ b/examples/stocks/lib/stock_settings.dart @@ -33,6 +33,23 @@ class StockSettingsState extends State { sendUpdates(config.configuration.copyWith(debugShowSizes: value)); } + void _handleShowBaselinesChanged(bool value) { + sendUpdates(config.configuration.copyWith(debugShowBaselines: value)); + } + + void _handleShowLayersChanged(bool value) { + sendUpdates(config.configuration.copyWith(debugShowLayers: value)); + } + + void _handleShowPointersChanged(bool value) { + sendUpdates(config.configuration.copyWith(debugShowPointers: value)); + } + + void _handleShowRainbowChanged(bool value) { + sendUpdates(config.configuration.copyWith(debugShowRainbow: value)); + } + + void _handleShowPerformanceOverlayChanged(bool value) { sendUpdates(config.configuration.copyWith(showPerformanceOverlay: value)); } @@ -166,7 +183,59 @@ class StockSettingsState extends State { ), ] ) - ) + ), + new DrawerItem( + icon: 'editor/format_color_text', + onPressed: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); }, + child: new Row( + children: [ + new Flexible(child: new Text('Show baselines (for debugging)')), + new Switch( + value: config.configuration.debugShowBaselines, + onChanged: _handleShowBaselinesChanged + ), + ] + ) + ), + new DrawerItem( + icon: 'image/filter_none', + onPressed: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); }, + child: new Row( + children: [ + new Flexible(child: new Text('Show layer boundaries (for debugging)')), + new Switch( + value: config.configuration.debugShowLayers, + onChanged: _handleShowLayersChanged + ), + ] + ) + ), + new DrawerItem( + icon: 'hardware/mouse', + onPressed: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); }, + child: new Row( + children: [ + new Flexible(child: new Text('Show pointer hit-testing (for debugging)')), + new Switch( + value: config.configuration.debugShowPointers, + onChanged: _handleShowPointersChanged + ), + ] + ) + ), + new DrawerItem( + icon: 'image/gradient', + onPressed: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); }, + child: new Row( + children: [ + new Flexible(child: new Text('Show repaint rainbow (for debugging)')), + new Switch( + value: config.configuration.debugShowRainbow, + onChanged: _handleShowRainbowChanged + ), + ] + ) + ), ]); return true; }); diff --git a/examples/stocks/lib/stock_types.dart b/examples/stocks/lib/stock_types.dart index 2aa83947fc..81764e0215 100644 --- a/examples/stocks/lib/stock_types.dart +++ b/examples/stocks/lib/stock_types.dart @@ -11,6 +11,10 @@ class StockConfiguration { this.backupMode, this.debugShowGrid, this.debugShowSizes, + this.debugShowBaselines, + this.debugShowLayers, + this.debugShowPointers, + this.debugShowRainbow, this.showPerformanceOverlay, this.showSemanticsDebugger }) { @@ -18,6 +22,10 @@ class StockConfiguration { assert(backupMode != null); assert(debugShowGrid != null); assert(debugShowSizes != null); + assert(debugShowBaselines != null); + assert(debugShowLayers != null); + assert(debugShowPointers != null); + assert(debugShowRainbow != null); assert(showPerformanceOverlay != null); assert(showSemanticsDebugger != null); } @@ -26,6 +34,10 @@ class StockConfiguration { final BackupMode backupMode; final bool debugShowGrid; final bool debugShowSizes; + final bool debugShowBaselines; + final bool debugShowLayers; + final bool debugShowPointers; + final bool debugShowRainbow; final bool showPerformanceOverlay; final bool showSemanticsDebugger; @@ -34,6 +46,10 @@ class StockConfiguration { BackupMode backupMode, bool debugShowGrid, bool debugShowSizes, + bool debugShowBaselines, + bool debugShowLayers, + bool debugShowPointers, + bool debugShowRainbow, bool showPerformanceOverlay, bool showSemanticsDebugger }) { @@ -42,6 +58,10 @@ class StockConfiguration { backupMode: backupMode ?? this.backupMode, debugShowGrid: debugShowGrid ?? this.debugShowGrid, debugShowSizes: debugShowSizes ?? this.debugShowSizes, + debugShowBaselines: debugShowBaselines ?? this.debugShowBaselines, + debugShowLayers: debugShowLayers ?? this.debugShowLayers, + debugShowPointers: debugShowPointers ?? this.debugShowPointers, + debugShowRainbow: debugShowRainbow ?? this.debugShowRainbow, showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay, showSemanticsDebugger: showSemanticsDebugger ?? this.showSemanticsDebugger ); diff --git a/packages/flutter/lib/src/rendering/debug.dart b/packages/flutter/lib/src/rendering/debug.dart index a0cd3374fc..ee1a8076f2 100644 --- a/packages/flutter/lib/src/rendering/debug.dart +++ b/packages/flutter/lib/src/rendering/debug.dart @@ -57,13 +57,13 @@ int debugPaintPointersColorValue = 0x00BBBB; Color debugErrorBoxColor = const Color(0xFFFF0000); /// Overlay a rotating set of colors when repainting layers in checked mode. -bool debugEnableRepaintRainbox = false; +bool debugRepaintRainbowEnabled = false; /// 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. -double debugRepaintRainboxHueIncrement = 2.0; +double debugRepaintRainbowHueIncrement = 2.0; /// Log the call stacks that mark render objects as needing paint. bool debugPrintMarkNeedsPaintStacks = false; diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index ec8cf012a0..4a6eaf67e4 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -159,7 +159,7 @@ class PaintingContext { if (!_isRecording) return; assert(() { - if (debugEnableRepaintRainbox) + if (debugRepaintRainbowEnabled) canvas.drawRect(_paintBounds, new Paint()..color = debugCurrentRepaintColor.toColor()); if (debugPaintLayerBordersEnabled) { Paint paint = new Paint() diff --git a/packages/flutter/lib/src/rendering/view.dart b/packages/flutter/lib/src/rendering/view.dart index d12b3b741d..f87d46b0e4 100644 --- a/packages/flutter/lib/src/rendering/view.dart +++ b/packages/flutter/lib/src/rendering/view.dart @@ -130,8 +130,8 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin ui.window.render(scene); scene.dispose(); assert(() { - if (debugEnableRepaintRainbox) - debugCurrentRepaintColor = debugCurrentRepaintColor.withHue(debugCurrentRepaintColor.hue + debugRepaintRainboxHueIncrement); + if (debugRepaintRainbowEnabled) + debugCurrentRepaintColor = debugCurrentRepaintColor.withHue(debugCurrentRepaintColor.hue + debugRepaintRainbowHueIncrement); return true; }); } finally {