Add `docsUrl` method to the `Screen` class and add docs for Deep links screen (#7167)
* Add `docsUrl` method to the `Screen` class
* typo
* formatting
diff --git a/packages/devtools_app/lib/src/framework/status_line.dart b/packages/devtools_app/lib/src/framework/status_line.dart
index 5e31f37..e0330c1 100644
--- a/packages/devtools_app/lib/src/framework/status_line.dart
+++ b/packages/devtools_app/lib/src/framework/status_line.dart
@@ -216,7 +216,8 @@
icon: Icons.library_books_outlined,
link: Link(
display: screenWidth <= MediaSize.xs ? 'Docs' : 'Read docs',
- url: 'https://docs.flutter.dev/tools/devtools/$docPageId',
+ url: screen.docsUrl ??
+ 'https://docs.flutter.dev/tools/devtools/$docPageId',
gaScreenName: screen.screenId,
gaSelectedItemDescription: gac.documentationLink,
),
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
index 4e8fb23..3a6dff1 100644
--- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
+++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
@@ -22,6 +22,12 @@
// @override
// String get docPageId => id;
+ // TODO(https://github.com/flutter/devtools/issues/6013): consider removing
+ // this docs url override when documentation is written specifically for the
+ // deep links tool.
+ @override
+ String get docsUrl => 'https://docs.flutter.dev/ui/navigation/deep-linking';
+
@override
Widget build(BuildContext context) {
return const DeepLinkPage();
diff --git a/packages/devtools_app/lib/src/shared/screen.dart b/packages/devtools_app/lib/src/shared/screen.dart
index 08abcba..ee2f64b 100644
--- a/packages/devtools_app/lib/src/shared/screen.dart
+++ b/packages/devtools_app/lib/src/shared/screen.dart
@@ -293,10 +293,19 @@
ValueListenable<bool> get showIsolateSelector =>
const FixedValueListenable<bool>(false);
- /// The id to use to synthesize a help URL.
+ /// The documentation URL to use for this screen.
+ ///
+ /// If this returns a null value, [docPageId] will be used to create a
+ /// documentation URL.
+ String? get docsUrl => null;
+
+ /// The id to use to create a documentation URL for this screen.
///
/// If the screen does not have a custom documentation page, this property
/// should return `null`.
+ ///
+ /// If [docsUrl] returns a non-null value, [docsUrl] will be used instead of
+ /// creating a documentation url using [docPageId].
String? get docPageId => null;
double approximateTabWidth(