Eliminated DrawerItem, use ListTile instead (#8992)
This commit is contained in:
@@ -116,10 +116,10 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: _drawerContents.map((String id) {
|
||||
return new DrawerItem(
|
||||
icon: new CircleAvatar(child: new Text(id)),
|
||||
child: new Text('Drawer item $id'),
|
||||
onPressed: _showNotImplementedMessage,
|
||||
return new ListTile(
|
||||
leading: new CircleAvatar(child: new Text(id)),
|
||||
title: new Text('Drawer item $id'),
|
||||
onTap: _showNotImplementedMessage,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
@@ -133,15 +133,15 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.add),
|
||||
child: new Text('Add account'),
|
||||
onPressed: _showNotImplementedMessage,
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.add),
|
||||
title: new Text('Add account'),
|
||||
onTap: _showNotImplementedMessage,
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.settings),
|
||||
child: new Text('Manage accounts'),
|
||||
onPressed: _showNotImplementedMessage,
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.settings),
|
||||
title: new Text('Manage accounts'),
|
||||
onTap: _showNotImplementedMessage,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -126,96 +126,88 @@ class GalleryDrawer extends StatelessWidget {
|
||||
final TextStyle aboutTextStyle = themeData.textTheme.body2;
|
||||
final TextStyle linkStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor);
|
||||
|
||||
final Widget lightThemeItem = new DrawerItem(
|
||||
icon: new Icon(Icons.brightness_5),
|
||||
onPressed: () { onThemeChanged(true); },
|
||||
final Widget lightThemeItem = new ListTile(
|
||||
leading: new Icon(Icons.brightness_5),
|
||||
title: new Text('Light'),
|
||||
trailing: new Radio<bool>(
|
||||
value: true,
|
||||
groupValue: useLightTheme,
|
||||
onChanged: onThemeChanged,
|
||||
),
|
||||
selected: useLightTheme,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Light')),
|
||||
new Radio<bool>(
|
||||
value: true,
|
||||
groupValue: useLightTheme,
|
||||
onChanged: onThemeChanged
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onThemeChanged(true);
|
||||
},
|
||||
);
|
||||
|
||||
final Widget darkThemeItem = new DrawerItem(
|
||||
icon: new Icon(Icons.brightness_7),
|
||||
onPressed: () { onThemeChanged(false); },
|
||||
selected: useLightTheme,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Dark')),
|
||||
new Radio<bool>(
|
||||
value: false,
|
||||
groupValue: useLightTheme,
|
||||
onChanged: onThemeChanged
|
||||
)
|
||||
]
|
||||
)
|
||||
final Widget darkThemeItem = new ListTile(
|
||||
leading: new Icon(Icons.brightness_7),
|
||||
title: new Text('Dark'),
|
||||
trailing: new Radio<bool>(
|
||||
value: false,
|
||||
groupValue: useLightTheme,
|
||||
onChanged: onThemeChanged
|
||||
),
|
||||
selected: !useLightTheme,
|
||||
onTap: () {
|
||||
onThemeChanged(false);
|
||||
},
|
||||
);
|
||||
|
||||
final Widget mountainViewItem = new DrawerItem(
|
||||
final Widget mountainViewItem = new ListTile(
|
||||
// on iOS, we don't want to show an Android phone icon
|
||||
icon: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android),
|
||||
onPressed: () { onPlatformChanged(TargetPlatform.android); },
|
||||
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star : Icons.phone_android),
|
||||
title: new Text('Android'),
|
||||
trailing: new Radio<TargetPlatform>(
|
||||
value: TargetPlatform.android,
|
||||
groupValue: Theme.of(context).platform,
|
||||
onChanged: onPlatformChanged,
|
||||
),
|
||||
selected: Theme.of(context).platform == TargetPlatform.android,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Android')),
|
||||
new Radio<TargetPlatform>(
|
||||
value: TargetPlatform.android,
|
||||
groupValue: Theme.of(context).platform,
|
||||
onChanged: onPlatformChanged,
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onPlatformChanged(TargetPlatform.android);
|
||||
},
|
||||
);
|
||||
|
||||
final Widget cupertinoItem = new DrawerItem(
|
||||
final Widget cupertinoItem = new ListTile(
|
||||
// on iOS, we don't want to show the iPhone icon
|
||||
icon: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone),
|
||||
onPressed: () { onPlatformChanged(TargetPlatform.iOS); },
|
||||
leading: new Icon(defaultTargetPlatform == TargetPlatform.iOS ? Icons.star_border : Icons.phone_iphone),
|
||||
title: new Text('iOS'),
|
||||
trailing: new Radio<TargetPlatform>(
|
||||
value: TargetPlatform.iOS,
|
||||
groupValue: Theme.of(context).platform,
|
||||
onChanged: onPlatformChanged,
|
||||
),
|
||||
selected: Theme.of(context).platform == TargetPlatform.iOS,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('iOS')),
|
||||
new Radio<TargetPlatform>(
|
||||
value: TargetPlatform.iOS,
|
||||
groupValue: Theme.of(context).platform,
|
||||
onChanged: onPlatformChanged,
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onPlatformChanged(TargetPlatform.iOS);
|
||||
},
|
||||
);
|
||||
|
||||
final Widget animateSlowlyItem = new DrawerItem(
|
||||
icon: new Icon(Icons.hourglass_empty),
|
||||
final Widget animateSlowlyItem = new ListTile(
|
||||
leading: new Icon(Icons.hourglass_empty),
|
||||
title: new Text('Animate Slowly'),
|
||||
trailing: new Checkbox(
|
||||
value: timeDilation != 1.0,
|
||||
onChanged: (bool value) {
|
||||
onTimeDilationChanged(value ? 20.0 : 1.0);
|
||||
},
|
||||
),
|
||||
selected: timeDilation != 1.0,
|
||||
onPressed: () { onTimeDilationChanged(timeDilation != 1.0 ? 1.0 : 20.0); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Animate Slowly')),
|
||||
new Checkbox(
|
||||
value: timeDilation != 1.0,
|
||||
onChanged: (bool value) { onTimeDilationChanged(value ? 20.0 : 1.0); }
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onTimeDilationChanged(timeDilation != 1.0 ? 1.0 : 20.0);
|
||||
},
|
||||
);
|
||||
|
||||
final Widget sendFeedbackItem = new DrawerItem(
|
||||
icon: new Icon(Icons.report),
|
||||
onPressed: onSendFeedback ?? () {
|
||||
final Widget sendFeedbackItem = new ListTile(
|
||||
leading: new Icon(Icons.report),
|
||||
title: new Text('Send feedback'),
|
||||
onTap: onSendFeedback ?? () {
|
||||
UrlLauncher.launch('https://github.com/flutter/flutter/issues/new');
|
||||
},
|
||||
child: new Text('Send feedback'),
|
||||
);
|
||||
|
||||
final Widget aboutItem = new AboutDrawerItem(
|
||||
final Widget aboutItem = new AboutListTile(
|
||||
icon: const FlutterLogo(),
|
||||
applicationVersion: '2016 Q3 Preview',
|
||||
applicationIcon: const FlutterLogo(),
|
||||
@@ -273,36 +265,36 @@ class GalleryDrawer extends StatelessWidget {
|
||||
];
|
||||
|
||||
if (onShowPerformanceOverlayChanged != null) {
|
||||
allDrawerItems.insert(8, new DrawerItem(
|
||||
icon: new Icon(Icons.assessment),
|
||||
onPressed: () { onShowPerformanceOverlayChanged(!showPerformanceOverlay); },
|
||||
allDrawerItems.insert(8, new ListTile(
|
||||
leading: new Icon(Icons.assessment),
|
||||
title: new Text('Performance Overlay'),
|
||||
trailing: new Checkbox(
|
||||
value: showPerformanceOverlay,
|
||||
onChanged: (bool value) {
|
||||
onShowPerformanceOverlayChanged(!showPerformanceOverlay);
|
||||
},
|
||||
),
|
||||
selected: showPerformanceOverlay,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Performance Overlay')),
|
||||
new Checkbox(
|
||||
value: showPerformanceOverlay,
|
||||
onChanged: (bool value) { onShowPerformanceOverlayChanged(!showPerformanceOverlay); }
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onShowPerformanceOverlayChanged(!showPerformanceOverlay);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
if (onCheckerboardRasterCacheImagesChanged != null) {
|
||||
allDrawerItems.insert(8, new DrawerItem(
|
||||
icon: new Icon(Icons.assessment),
|
||||
onPressed: () { onCheckerboardRasterCacheImagesChanged(!checkerboardRasterCacheImages); },
|
||||
allDrawerItems.insert(8, new ListTile(
|
||||
leading: new Icon(Icons.assessment),
|
||||
title: new Text('Checkerboard Raster Cache Images'),
|
||||
trailing: new Checkbox(
|
||||
value: checkerboardRasterCacheImages,
|
||||
onChanged: (bool value) {
|
||||
onCheckerboardRasterCacheImagesChanged(!checkerboardRasterCacheImages);
|
||||
},
|
||||
),
|
||||
selected: checkerboardRasterCacheImages,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Checkerboard Raster Cache Images')),
|
||||
new Checkbox(
|
||||
value: checkerboardRasterCacheImages,
|
||||
onChanged: (bool value) { onCheckerboardRasterCacheImagesChanged(!checkerboardRasterCacheImages); }
|
||||
)
|
||||
]
|
||||
)
|
||||
onTap: () {
|
||||
onCheckerboardRasterCacheImagesChanged(!checkerboardRasterCacheImages);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ Future<Null> runSmokeTest(WidgetTester tester) async {
|
||||
await smokeDemo(tester, routeName);
|
||||
tester.binding.debugAssertNoTransientCallbacks('A transient callback was still active after leaving route $routeName');
|
||||
}
|
||||
|
||||
expect(errors, 0);
|
||||
|
||||
final Finder navigationMenuButton = find.byTooltip('Open navigation menu');
|
||||
@@ -150,6 +149,11 @@ Future<Null> runSmokeTest(WidgetTester tester) async {
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
|
||||
|
||||
// scroll the 'Send feedback' item into view
|
||||
await tester.drag(find.text('Light'), const Offset(0.0, -200.0));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
|
||||
|
||||
// send feedback
|
||||
expect(hasFeedback, false);
|
||||
await tester.tap(find.text('Send feedback'));
|
||||
|
||||
@@ -124,19 +124,20 @@ class StockHomeState extends State<StockHome> {
|
||||
child: new ListView(
|
||||
children: <Widget>[
|
||||
new DrawerHeader(child: new Center(child: new Text('Stocks'))),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.assessment),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.assessment),
|
||||
title: new Text('Stock List'),
|
||||
selected: true,
|
||||
child: new Text('Stock List')
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.account_balance),
|
||||
onPressed: null,
|
||||
child: new Text('Account Balance')
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.account_balance),
|
||||
title: new Text('Account Balance'),
|
||||
enabled: false,
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.dvr),
|
||||
onPressed: () {
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.dvr),
|
||||
title: new Text('Dump App to Console'),
|
||||
onTap: () {
|
||||
try {
|
||||
debugDumpApp();
|
||||
debugDumpRenderTree();
|
||||
@@ -146,38 +147,43 @@ class StockHomeState extends State<StockHome> {
|
||||
debugPrint('Exception while dumping app:\n$e\n$stack');
|
||||
}
|
||||
},
|
||||
child: new Text('Dump App to Console')
|
||||
),
|
||||
new Divider(),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.thumb_up),
|
||||
onPressed: () => _handleStockModeChange(StockMode.optimistic),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Optimistic')),
|
||||
new Radio<StockMode>(value: StockMode.optimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.thumb_up),
|
||||
title: new Text('Optimistic'),
|
||||
trailing: new Radio<StockMode>(
|
||||
value: StockMode.optimistic,
|
||||
groupValue: config.configuration.stockMode,
|
||||
onChanged: _handleStockModeChange
|
||||
),
|
||||
onTap: () {
|
||||
_handleStockModeChange(StockMode.optimistic);
|
||||
},
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.thumb_down),
|
||||
onPressed: () => _handleStockModeChange(StockMode.pessimistic),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Pessimistic')),
|
||||
new Radio<StockMode>(value: StockMode.pessimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.thumb_down),
|
||||
title: new Text('Pessimistic'),
|
||||
trailing: new Radio<StockMode>(
|
||||
value: StockMode.pessimistic,
|
||||
groupValue: config.configuration.stockMode,
|
||||
onChanged: _handleStockModeChange
|
||||
),
|
||||
onTap: () {
|
||||
_handleStockModeChange(StockMode.pessimistic);
|
||||
},
|
||||
),
|
||||
new Divider(),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.settings),
|
||||
onPressed: _handleShowSettings,
|
||||
child: new Text('Settings')),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.help),
|
||||
onPressed: _handleShowAbout,
|
||||
child: new Text('About'))
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.settings),
|
||||
title: new Text('Settings'),
|
||||
onTap: _handleShowSettings,
|
||||
),
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.help),
|
||||
title: new Text('About'),
|
||||
onTap: _handleShowAbout,
|
||||
),
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
@@ -103,139 +103,99 @@ class StockSettingsState extends State<StockSettings> {
|
||||
|
||||
Widget buildSettingsPane(BuildContext context) {
|
||||
final List<Widget> rows = <Widget>[
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.thumb_up),
|
||||
onPressed: _confirmOptimismChange,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Everything is awesome')),
|
||||
new Checkbox(
|
||||
value: config.configuration.stockMode == StockMode.optimistic,
|
||||
onChanged: (bool value) => _confirmOptimismChange()
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.thumb_up),
|
||||
title: new Text('Everything is awesome'),
|
||||
onTap: _confirmOptimismChange,
|
||||
trailing: new Checkbox(
|
||||
value: config.configuration.stockMode == StockMode.optimistic,
|
||||
onChanged: (bool value) => _confirmOptimismChange(),
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.backup),
|
||||
onPressed: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Back up stock list to the cloud')),
|
||||
new Switch(
|
||||
value: config.configuration.backupMode == BackupMode.enabled,
|
||||
onChanged: _handleBackupChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.backup),
|
||||
title: new Text('Back up stock list to the cloud'),
|
||||
onTap: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.backupMode == BackupMode.enabled,
|
||||
onChanged: _handleBackupChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.picture_in_picture),
|
||||
onPressed: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show rendering performance overlay')),
|
||||
new Switch(
|
||||
value: config.configuration.showPerformanceOverlay,
|
||||
onChanged: _handleShowPerformanceOverlayChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.picture_in_picture),
|
||||
title: new Text('Show rendering performance overlay'),
|
||||
onTap: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.showPerformanceOverlay,
|
||||
onChanged: _handleShowPerformanceOverlayChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.accessibility),
|
||||
onPressed: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show semantics overlay')),
|
||||
new Switch(
|
||||
value: config.configuration.showSemanticsDebugger,
|
||||
onChanged: _handleShowSemanticsDebuggerChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.accessibility),
|
||||
title: new Text('Show semantics overlay'),
|
||||
onTap: () { _handleShowSemanticsDebuggerChanged(!config.configuration.showSemanticsDebugger); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.showSemanticsDebugger,
|
||||
onChanged: _handleShowSemanticsDebuggerChanged,
|
||||
),
|
||||
),
|
||||
];
|
||||
assert(() {
|
||||
// material grid and size construction lines are only available in checked mode
|
||||
rows.addAll(<Widget>[
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.border_clear),
|
||||
onPressed: () { _handleShowGridChanged(!config.configuration.debugShowGrid); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show material grid (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowGrid,
|
||||
onChanged: _handleShowGridChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.border_clear),
|
||||
title: new Text('Show material grid (for debugging)'),
|
||||
onTap: () { _handleShowGridChanged(!config.configuration.debugShowGrid); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowGrid,
|
||||
onChanged: _handleShowGridChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.border_all),
|
||||
onPressed: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show construction lines (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowSizes,
|
||||
onChanged: _handleShowSizesChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.border_all),
|
||||
title: new Text('Show construction lines (for debugging)'),
|
||||
onTap: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowSizes,
|
||||
onChanged: _handleShowSizesChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.format_color_text),
|
||||
onPressed: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show baselines (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowBaselines,
|
||||
onChanged: _handleShowBaselinesChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.format_color_text),
|
||||
title: new Text('Show baselines (for debugging)'),
|
||||
onTap: () { _handleShowBaselinesChanged(!config.configuration.debugShowBaselines); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowBaselines,
|
||||
onChanged: _handleShowBaselinesChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.filter_none),
|
||||
onPressed: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show layer boundaries (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowLayers,
|
||||
onChanged: _handleShowLayersChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.filter_none),
|
||||
title: new Text('Show layer boundaries (for debugging)'),
|
||||
onTap: () { _handleShowLayersChanged(!config.configuration.debugShowLayers); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowLayers,
|
||||
onChanged: _handleShowLayersChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.mouse),
|
||||
onPressed: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show pointer hit-testing (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowPointers,
|
||||
onChanged: _handleShowPointersChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.mouse),
|
||||
title: new Text('Show pointer hit-testing (for debugging)'),
|
||||
onTap: () { _handleShowPointersChanged(!config.configuration.debugShowPointers); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowPointers,
|
||||
onChanged: _handleShowPointersChanged,
|
||||
),
|
||||
),
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.gradient),
|
||||
onPressed: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); },
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Show repaint rainbow (for debugging)')),
|
||||
new Switch(
|
||||
value: config.configuration.debugShowRainbow,
|
||||
onChanged: _handleShowRainbowChanged
|
||||
),
|
||||
]
|
||||
)
|
||||
new ListTile(
|
||||
leading: new Icon(Icons.gradient),
|
||||
title: new Text('Show repaint rainbow (for debugging)'),
|
||||
onTap: () { _handleShowRainbowChanged(!config.configuration.debugShowRainbow); },
|
||||
trailing: new Switch(
|
||||
value: config.configuration.debugShowRainbow,
|
||||
onChanged: _handleShowRainbowChanged,
|
||||
),
|
||||
),
|
||||
]);
|
||||
return true;
|
||||
|
||||
@@ -38,12 +38,9 @@ Element findElementOfExactWidgetTypeGoingUp(Element node, Type targetType) {
|
||||
final RegExp materialIconAssetNameColorExtractor = new RegExp(r'[^/]+/ic_.+_(white|black)_[0-9]+dp\.png');
|
||||
|
||||
void checkIconColor(WidgetTester tester, String label, Color color) {
|
||||
// The icon is going to be in the same merged semantics box as the text
|
||||
// regardless of how the menu item is represented, so this is a good
|
||||
// way to find the menu item. I hope.
|
||||
final Element semantics = findElementOfExactWidgetTypeGoingUp(tester.element(find.text(label)), MergeSemantics);
|
||||
expect(semantics, isNotNull);
|
||||
final Element asset = findElementOfExactWidgetTypeGoingDown(semantics, RichText);
|
||||
final Element listTile = findElementOfExactWidgetTypeGoingUp(tester.element(find.text(label)), ListTile);
|
||||
expect(listTile, isNotNull);
|
||||
final Element asset = findElementOfExactWidgetTypeGoingDown(listTile, RichText);
|
||||
final RichText richText = asset.widget;
|
||||
expect(richText.text.style.color, equals(color));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user