Allow disabling the performance overlay in main.dart, fixes #5580 (#5583)

This commit is contained in:
Collin Jackson
2016-08-24 15:55:00 -07:00
committed by GitHub
parent 09e68c33cc
commit 91b6319a4f
3 changed files with 9 additions and 5 deletions

View File

@@ -26,9 +26,14 @@ final ThemeData _kGalleryDarkTheme = new ThemeData(
);
class GalleryApp extends StatefulWidget {
GalleryApp({this.updateUrlFetcher, Key key}) : super(key: key);
GalleryApp({
this.updateUrlFetcher,
this.enablePerformanceOverlay: true,
Key key}
) : super(key: key);
final UpdateUrlFetcher updateUrlFetcher;
final bool enablePerformanceOverlay;
@override
GalleryAppState createState() => new GalleryAppState();
@@ -56,11 +61,11 @@ class GalleryAppState extends State<GalleryApp> {
});
},
showPerformanceOverlay: _showPerformanceOverlay,
onShowPerformanceOverlayChanged: (bool value) {
onShowPerformanceOverlayChanged: config.enablePerformanceOverlay ? (bool value) {
setState(() {
_showPerformanceOverlay = value;
});
},
} : null,
timeDilation: timeDilation,
onTimeDilationChanged: (double value) {
setState(() {

View File

@@ -162,7 +162,7 @@ class GalleryDrawer extends StatelessWidget {
]
)
),
new DrawerItem(
onShowPerformanceOverlayChanged == null ? new Container(height: 0.0) : new DrawerItem(
icon: new Icon(Icons.assessment),
onPressed: () { onShowPerformanceOverlayChanged(!showPerformanceOverlay); },
selected: showPerformanceOverlay,

View File

@@ -80,7 +80,6 @@ class GalleryHome extends StatefulWidget {
}) : super(key: key) {
assert(onThemeChanged != null);
assert(onTimeDilationChanged != null);
assert(onShowPerformanceOverlayChanged != null);
}
final bool useLightTheme;