Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import '../../shared/analytics/constants.dart' as gac;
import '../../shared/analytics/metrics.dart';
import '../../shared/console/eval/inspector_tree.dart';
import '../../shared/globals.dart';
import '../../shared/managers/banner_messages.dart';
import '../../shared/managers/error_badge_manager.dart';
import '../../shared/primitives/blocking_action_mixin.dart';
import '../../shared/ui/common_widgets.dart';
Expand Down Expand Up @@ -111,6 +112,8 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
}

_summaryTreeController.setSearchTarget(searchTarget);

_showLegacyInspectorWarning(context);
}

@override
Expand Down Expand Up @@ -218,6 +221,12 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
_summaryTreeController.resetSearch();
}

void _showLegacyInspectorWarning(BuildContext context) {
if (context.mounted) {
pushLegacyInspectorWarning(InspectorScreen.id);
}
}

List<Widget> getServiceExtensionWidgets() {
return [
ServiceExtensionButtonGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,45 @@
import 'dart:async';

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:flutter/material.dart';
import 'package:vm_service/vm_service.dart' hide Stack;

import '../../shared/analytics/analytics.dart' as ga;
import '../../shared/analytics/constants.dart' as gac;
import '../../shared/feature_flags.dart';
import '../../shared/globals.dart';
import '../../shared/managers/banner_messages.dart';
import '../../shared/preferences/preferences.dart';
import '../../shared/primitives/simple_items.dart';
import '../../shared/ui/common_widgets.dart';
import '../../shared/ui/editable_list.dart';
import 'inspector_screen.dart';

class FlutterInspectorSettingsDialog extends StatelessWidget {
class FlutterInspectorSettingsDialog extends StatefulWidget {
const FlutterInspectorSettingsDialog({super.key});

@override
State<FlutterInspectorSettingsDialog> createState() =>
_FlutterInspectorSettingsDialogState();
}

class _FlutterInspectorSettingsDialogState
extends State<FlutterInspectorSettingsDialog>
with AutoDisposeMixin {
@override
void initState() {
super.initState();
addAutoDisposeListener(preferences.inspector.legacyInspectorEnabled, () {
if (!preferences.inspector.legacyInspectorEnabled.value) {
bannerMessages.removeMessageByKey(
LegacyInspectorWarningMessage.buildKey(InspectorScreen.id),
InspectorScreen.id,
);
}
});
}

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
Expand Down Expand Up @@ -74,7 +98,7 @@ class FlutterInspectorSettingsDialog extends StatelessWidget {
title: 'Use legacy inspector',
description:
'Disable the redesigned Flutter inspector. Please know that '
'the legacy inspector may be removed in a future release.',
'the legacy inspector will be removed in a future release.',
gaItem: gac.inspectorV2Disabled,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,34 @@ The $codeType DevTools debugger is in maintenance mode. For the best debugging e
);
}

class LegacyInspectorWarningMessage extends BannerWarning {
LegacyInspectorWarningMessage({required super.screenId})
: super(
key: buildKey(screenId),
buildTextSpans: (context) => [
const TextSpan(
text:
'The legacy inspector will be removed in a future release. '
'Please enable the new inspector in the inspector settings. '
'If there is an issue preventing you from using the new '
'inspector, please file a ',
),
GaLinkTextSpan(
link: const GaLink(
display: 'bug',
url: 'https://github.com/flutter/devtools/issues/new',
),
context: context,
style: Theme.of(context).linkTextStyle,
),
const TextSpan(text: '.'),
],
);

static Key buildKey(String screenId) =>
Key('LegacyInspectorWarningMessage - $screenId');
}

void maybePushDebugModePerformanceMessage(String screenId) {
if (offlineDataController.showingOfflineData.value) return;
if (serviceConnection.serviceManager.connectedApp?.isDebugFlutterAppNow ??
Expand Down Expand Up @@ -549,6 +577,10 @@ void pushDebuggerIdeRecommendationMessage(String screenId) {
);
}

void pushLegacyInspectorWarning(String screenId) {
bannerMessages.addMessage(LegacyInspectorWarningMessage(screenId: screenId));
}

extension BannerMessageThemeExtension on ThemeData {
TextStyle get warningMessageLinkStyle => regularTextStyle.copyWith(
decoration: TextDecoration.underline,
Expand Down
3 changes: 2 additions & 1 deletion packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ TODO: Remove this section if there are not any general updates.

## Inspector updates

TODO: Remove this section if there are not any general updates.
- Added a warning banner that the legacy inspector will be removed in a future
release. - [#9572](https://github.com/flutter/devtools/pull/9572)

## Performance updates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

import 'package:devtools_app/devtools_app.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_test/helpers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -37,6 +38,13 @@ void main() {
}
}

setUp(() async {
await env.setupEnvironment();
setGlobal(BannerMessagesController, BannerMessagesController());
// Ensure the legacy inspector is enabled:
preferences.inspector.setLegacyInspectorEnabled(true);
});

group('screenshot tests', () {
setUpAll(() {
env = FlutterTestEnvironment(
Expand All @@ -45,12 +53,6 @@ void main() {
env.afterEverySetup = resetInspectorSelection;
});

setUp(() async {
await env.setupEnvironment();
// Ensure the legacy inspector is enabled:
preferences.inspector.setLegacyInspectorEnabled(true);
});

tearDownAll(() async {
await env.tearDownEnvironment(force: true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void main() {
setGlobal(PreferencesController, PreferencesController());
setGlobal(Storage, FlutterTestStorage());
setGlobal(NotificationService, NotificationService());
setGlobal(BannerMessagesController, BannerMessagesController());
fakeServiceConnection.consoleService.ensureServiceInitialized();
// Enable the legacy inspector:
preferences.inspector.setLegacyInspectorEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:devtools_app/src/screens/inspector_v2/inspector_tree_controller.
import 'package:devtools_app/src/screens/inspector_v2/layout_explorer/ui/utils.dart';
import 'package:devtools_app/src/screens/inspector_v2/widget_properties/properties_view.dart';
import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_test/helpers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -64,6 +65,7 @@ void main() {
await env.setupEnvironment();
// Enable the V2 inspector:
preferences.inspector.setLegacyInspectorEnabled(false);
setGlobal(BannerMessagesController, BannerMessagesController());
});

tearDown(() async {
Expand Down