Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ca4d10d3
Commit
ca4d10d3
authored
Feb 13, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1820 from Hixie/rainbox
Expose more debugging tools in Stocks
parents
19e51b96
a95c866b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
113 additions
and
7 deletions
+113
-7
flutter.yaml
examples/stocks/flutter.yaml
+4
-0
main.dart
examples/stocks/lib/main.dart
+14
-1
stock_settings.dart
examples/stocks/lib/stock_settings.dart
+70
-1
stock_types.dart
examples/stocks/lib/stock_types.dart
+20
-0
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+2
-2
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-1
view.dart
packages/flutter/lib/src/rendering/view.dart
+2
-2
No files found.
examples/stocks/flutter.yaml
View file @
ca4d10d3
...
...
@@ -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
examples/stocks/lib/main.dart
View file @
ca4d10d3
...
...
@@ -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<StocksApp> {
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<StocksApp> {
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
(
...
...
examples/stocks/lib/stock_settings.dart
View file @
ca4d10d3
...
...
@@ -33,6 +33,23 @@ class StockSettingsState extends State<StockSettings> {
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<StockSettings> {
),
]
)
)
),
new
DrawerItem
(
icon:
'editor/format_color_text'
,
onPressed:
()
{
_handleShowBaselinesChanged
(!
config
.
configuration
.
debugShowBaselines
);
},
child:
new
Row
(
children:
<
Widget
>[
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:
<
Widget
>[
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:
<
Widget
>[
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:
<
Widget
>[
new
Flexible
(
child:
new
Text
(
'Show repaint rainbow (for debugging)'
)),
new
Switch
(
value:
config
.
configuration
.
debugShowRainbow
,
onChanged:
_handleShowRainbowChanged
),
]
)
),
]);
return
true
;
});
...
...
examples/stocks/lib/stock_types.dart
View file @
ca4d10d3
...
...
@@ -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
);
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
ca4d10d3
...
...
@@ -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
debug
EnableRepaintRainbox
=
false
;
bool
debug
RepaintRainbowEnabled
=
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
debugRepaintRainbo
x
HueIncrement
=
2.0
;
double
debugRepaintRainbo
w
HueIncrement
=
2.0
;
/// Log the call stacks that mark render objects as needing paint.
bool
debugPrintMarkNeedsPaintStacks
=
false
;
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
ca4d10d3
...
...
@@ -159,7 +159,7 @@ class PaintingContext {
if
(!
_isRecording
)
return
;
assert
(()
{
if
(
debug
EnableRepaintRainbox
)
if
(
debug
RepaintRainbowEnabled
)
canvas
.
drawRect
(
_paintBounds
,
new
Paint
()..
color
=
debugCurrentRepaintColor
.
toColor
());
if
(
debugPaintLayerBordersEnabled
)
{
Paint
paint
=
new
Paint
()
...
...
packages/flutter/lib/src/rendering/view.dart
View file @
ca4d10d3
...
...
@@ -130,8 +130,8 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
ui
.
window
.
render
(
scene
);
scene
.
dispose
();
assert
(()
{
if
(
debug
EnableRepaintRainbox
)
debugCurrentRepaintColor
=
debugCurrentRepaintColor
.
withHue
(
debugCurrentRepaintColor
.
hue
+
debugRepaintRainbo
x
HueIncrement
);
if
(
debug
RepaintRainbowEnabled
)
debugCurrentRepaintColor
=
debugCurrentRepaintColor
.
withHue
(
debugCurrentRepaintColor
.
hue
+
debugRepaintRainbo
w
HueIncrement
);
return
true
;
});
}
finally
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment