Commit 91b6319a authored by Collin Jackson's avatar Collin Jackson Committed by GitHub

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

parent 09e68c33
...@@ -26,9 +26,14 @@ final ThemeData _kGalleryDarkTheme = new ThemeData( ...@@ -26,9 +26,14 @@ final ThemeData _kGalleryDarkTheme = new ThemeData(
); );
class GalleryApp extends StatefulWidget { 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 UpdateUrlFetcher updateUrlFetcher;
final bool enablePerformanceOverlay;
@override @override
GalleryAppState createState() => new GalleryAppState(); GalleryAppState createState() => new GalleryAppState();
...@@ -56,11 +61,11 @@ class GalleryAppState extends State<GalleryApp> { ...@@ -56,11 +61,11 @@ class GalleryAppState extends State<GalleryApp> {
}); });
}, },
showPerformanceOverlay: _showPerformanceOverlay, showPerformanceOverlay: _showPerformanceOverlay,
onShowPerformanceOverlayChanged: (bool value) { onShowPerformanceOverlayChanged: config.enablePerformanceOverlay ? (bool value) {
setState(() { setState(() {
_showPerformanceOverlay = value; _showPerformanceOverlay = value;
}); });
}, } : null,
timeDilation: timeDilation, timeDilation: timeDilation,
onTimeDilationChanged: (double value) { onTimeDilationChanged: (double value) {
setState(() { setState(() {
......
...@@ -162,7 +162,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -162,7 +162,7 @@ class GalleryDrawer extends StatelessWidget {
] ]
) )
), ),
new DrawerItem( onShowPerformanceOverlayChanged == null ? new Container(height: 0.0) : new DrawerItem(
icon: new Icon(Icons.assessment), icon: new Icon(Icons.assessment),
onPressed: () { onShowPerformanceOverlayChanged(!showPerformanceOverlay); }, onPressed: () { onShowPerformanceOverlayChanged(!showPerformanceOverlay); },
selected: showPerformanceOverlay, selected: showPerformanceOverlay,
......
...@@ -80,7 +80,6 @@ class GalleryHome extends StatefulWidget { ...@@ -80,7 +80,6 @@ class GalleryHome extends StatefulWidget {
}) : super(key: key) { }) : super(key: key) {
assert(onThemeChanged != null); assert(onThemeChanged != null);
assert(onTimeDilationChanged != null); assert(onTimeDilationChanged != null);
assert(onShowPerformanceOverlayChanged != null);
} }
final bool useLightTheme; final bool useLightTheme;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment