Delete the example conditional screen (#8730)
* Delete the example conditional screen
* fix dart doc
diff --git a/packages/devtools_app/lib/src/app.dart b/packages/devtools_app/lib/src/app.dart
index cd7e737..c09266d 100644
--- a/packages/devtools_app/lib/src/app.dart
+++ b/packages/devtools_app/lib/src/app.dart
@@ -12,7 +12,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
-import 'example/conditional_screen.dart';
import 'extensions/extension_screen.dart';
import 'framework/disconnect_observer.dart';
import 'framework/framework_core.dart';
@@ -59,10 +58,6 @@
import 'shared/utils/utils.dart';
import 'standalone_ui/standalone_screen.dart';
-// Assign to true to use a sample implementation of a conditional screen.
-// WARNING: Do not check in this file if debugEnableSampleScreen is true.
-const debugEnableSampleScreen = false;
-
/// Top-level configuration for the app.
@immutable
class DevToolsApp extends StatefulWidget {
@@ -684,12 +679,6 @@
VMDeveloperToolsScreen(),
createController: (_) => VMDeveloperToolsController(),
),
- // Show the sample DevTools screen.
- if (debugEnableSampleScreen && (kDebugMode || kProfileMode))
- DevToolsScreen<ExampleController>(
- const ExampleConditionalScreen(),
- createController: (_) => ExampleController(),
- ),
];
}
diff --git a/packages/devtools_app/lib/src/example/conditional_screen.dart b/packages/devtools_app/lib/src/example/conditional_screen.dart
deleted file mode 100644
index d68009f..0000000
--- a/packages/devtools_app/lib/src/example/conditional_screen.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright 2020 The Flutter Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
-
-import 'dart:async';
-
-import 'package:devtools_app_shared/utils.dart';
-import 'package:flutter/material.dart';
-
-import '../shared/framework/screen.dart';
-import '../shared/globals.dart';
-import '../shared/offline/offline_data.dart';
-import '../shared/utils/utils.dart';
-
-/// This is an example implementation of a conditional screen that supports
-/// offline mode and uses a provided controller [ExampleController].
-///
-/// This class exists solely as an example and should not be used in the
-/// DevTools app.
-class ExampleConditionalScreen extends Screen {
- const ExampleConditionalScreen()
- : super.conditional(
- id: id,
- requiresLibrary: 'package:flutter/',
- title: 'Example',
- icon: Icons.palette,
- worksWithOfflineData: true,
- );
-
- static const id = 'example';
-
- @override
- Widget buildScreenBody(BuildContext context) {
- return const _ExampleConditionalScreenBody();
- }
-}
-
-class _ExampleConditionalScreenBody extends StatefulWidget {
- const _ExampleConditionalScreenBody();
-
- @override
- _ExampleConditionalScreenBodyState createState() =>
- _ExampleConditionalScreenBodyState();
-}
-
-class _ExampleConditionalScreenBodyState
- extends State<_ExampleConditionalScreenBody>
- with
- ProvidedControllerMixin<
- ExampleController,
- _ExampleConditionalScreenBody
- > {
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- initController();
- }
-
- @override
- Widget build(BuildContext context) {
- return ValueListenableBuilder<ExampleScreenData>(
- valueListenable: controller.data,
- builder: (context, data, _) {
- return Center(child: Text(data.title));
- },
- );
- }
-}
-
-class ExampleController extends DisposableController
- with
- AutoDisposeControllerMixin,
- OfflineScreenControllerMixin<ExampleScreenData> {
- ExampleController() {
- unawaited(_init());
- }
-
- final data = ValueNotifier<ExampleScreenData>(
- ExampleScreenData('Example screen'),
- );
-
- final _initialized = Completer<void>();
-
- Future<void> get initialized => _initialized.future;
-
- Future<void> _init() async {
- await _initHelper();
- _initialized.complete();
- }
-
- Future<void> _initHelper() async {
- if (!offlineDataController.showingOfflineData.value) {
- // Do some initialization for online mode.
- } else {
- await maybeLoadOfflineData(
- ExampleConditionalScreen.id,
- createData: (json) => ExampleScreenData.fromJson(json),
- shouldLoad: (data) => data.title.isNotEmpty,
- loadData: (data) => this.data.value = data,
- );
- }
- }
-
- // Overrides for [OfflineScreenControllerMixin]
-
- @override
- OfflineScreenData prepareOfflineScreenData() {
- return OfflineScreenData(
- screenId: ExampleConditionalScreen.id,
- data: data.value.json,
- );
- }
-}
-
-class ExampleScreenData {
- ExampleScreenData(this.title);
-
- factory ExampleScreenData.fromJson(Map<String, Object?> json) {
- return ExampleScreenData(json[_titleKey] as String);
- }
-
- static const _titleKey = 'title';
-
- final String title;
-
- Map<String, Object?> get json => {_titleKey: title};
-}
diff --git a/packages/devtools_app/lib/src/shared/framework/screen.dart b/packages/devtools_app/lib/src/shared/framework/screen.dart
index e43b1af..a30d7f1 100644
--- a/packages/devtools_app/lib/src/shared/framework/screen.dart
+++ b/packages/devtools_app/lib/src/shared/framework/screen.dart
@@ -156,14 +156,12 @@
}
}
-/// Defines a page shown in the DevTools [TabBar].
+/// Defines a screen shown in the top-level DevTools [TabBar].
///
-/// A devtools screen can be in three modes:
-/// * offline-data
-/// * connected
-/// * not-connected
-///
-/// See [devToolsMode].
+/// A DevTools screen can be in three modes:
+/// * showing offline-data
+/// * connected to an application
+/// * not connected to an application
///
/// A screen may support any combination of modes.
///