Semantics
diff --git a/examples/stocks/flutter.yaml b/examples/stocks/flutter.yaml
index fdba0af..31027f2 100644
--- a/examples/stocks/flutter.yaml
+++ b/examples/stocks/flutter.yaml
@@ -2,6 +2,7 @@
version: 0.0.2
update-url: http://localhost:9888/
material-design-icons:
+ - name: action/accessibility
- name: action/account_balance
- name: action/assessment
- name: action/backup
diff --git a/examples/stocks/lib/main.dart b/examples/stocks/lib/main.dart
index cfc1b4a..38fe498 100644
--- a/examples/stocks/lib/main.dart
+++ b/examples/stocks/lib/main.dart
@@ -43,7 +43,8 @@
backupMode: BackupMode.enabled,
debugShowGrid: false,
debugShowSizes: false,
- showPerformanceOverlay: false
+ showPerformanceOverlay: false,
+ showSemanticsDebugger: false
);
void initState() {
@@ -110,6 +111,7 @@
theme: theme,
debugShowMaterialGrid: _configuration.debugShowGrid,
showPerformanceOverlay: _configuration.showPerformanceOverlay,
+ showSemanticsDebugger: _configuration.showSemanticsDebugger,
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
'/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater)
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index 41de259..81c93c6 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -88,16 +88,16 @@
content: new Text('This feature has not yet been implemented.'),
actions: <Widget>[
new FlatButton(
- child: new Text('USE IT'),
onPressed: () {
Navigator.pop(context, false);
- }
+ },
+ child: new Text('USE IT')
),
new FlatButton(
- child: new Text('OH WELL'),
onPressed: () {
Navigator.pop(context, false);
- }
+ },
+ child: new Text('OH WELL')
),
]
)
@@ -107,7 +107,16 @@
),
new DrawerItem(
icon: 'device/dvr',
- onPressed: () { debugDumpApp(); debugDumpRenderTree(); debugDumpLayerTree(); },
+ onPressed: () {
+ try {
+ debugDumpApp();
+ debugDumpRenderTree();
+ debugDumpLayerTree();
+ debugDumpSemanticsTree();
+ } catch (e, stack) {
+ debugPrint('Exception while dumping app:\n$e\n$stack');
+ }
+ },
child: new Text('Dump App to Console')
),
new DrawerDivider(),
diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart
index 4e83043..eea7e09 100644
--- a/examples/stocks/lib/stock_settings.dart
+++ b/examples/stocks/lib/stock_settings.dart
@@ -35,6 +35,10 @@
sendUpdates(config.configuration.copyWith(showPerformanceOverlay: value));
}
+ void _handleShowSemanticsDebuggerChanged(bool value) {
+ sendUpdates(config.configuration.copyWith(showSemanticsDebugger: value));
+ }
+
void _confirmOptimismChange() {
switch (config.configuration.stockMode) {
case StockMode.optimistic:
@@ -118,6 +122,19 @@
]
)
),
+ new DrawerItem(
+ icon: 'action/accessibility',
+ onPressed: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); },
+ child: new Row(
+ children: <Widget>[
+ new Flexible(child: new Text('Show semantics overlay')),
+ new Switch(
+ value: config.configuration.showSemanticsDebugger,
+ onChanged: _handleShowSemanticsDebuggerChanged
+ ),
+ ]
+ )
+ ),
];
assert(() {
// material grid and size construction lines are only available in checked mode
diff --git a/examples/stocks/lib/stock_types.dart b/examples/stocks/lib/stock_types.dart
index a022044..e65eff4 100644
--- a/examples/stocks/lib/stock_types.dart
+++ b/examples/stocks/lib/stock_types.dart
@@ -13,13 +13,15 @@
this.backupMode,
this.debugShowGrid,
this.debugShowSizes,
- this.showPerformanceOverlay
+ this.showPerformanceOverlay,
+ this.showSemanticsDebugger
}) {
assert(stockMode != null);
assert(backupMode != null);
assert(debugShowGrid != null);
assert(debugShowSizes != null);
assert(showPerformanceOverlay != null);
+ assert(showSemanticsDebugger != null);
}
final StockMode stockMode;
@@ -27,20 +29,23 @@
final bool debugShowGrid;
final bool debugShowSizes;
final bool showPerformanceOverlay;
+ final bool showSemanticsDebugger;
StockConfiguration copyWith({
StockMode stockMode,
BackupMode backupMode,
bool debugShowGrid,
bool debugShowSizes,
- bool showPerformanceOverlay
+ bool showPerformanceOverlay,
+ bool showSemanticsDebugger
}) {
return new StockConfiguration(
stockMode: stockMode ?? this.stockMode,
backupMode: backupMode ?? this.backupMode,
debugShowGrid: debugShowGrid ?? this.debugShowGrid,
debugShowSizes: debugShowSizes ?? this.debugShowSizes,
- showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay
+ showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay,
+ showSemanticsDebugger: showSemanticsDebugger ?? this.showSemanticsDebugger
);
}
-}
\ No newline at end of file
+}