Skip to content

Commit 1d1c98f

Browse files
authored
Settings page, Dart Debugger panel, and Flutter Inspector panel match DevTools styles (#1815)
1 parent a9b8887 commit 1d1c98f

17 files changed

+271
-38
lines changed

dwds/debug_extension_mv3/build.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ builders:
1919
build_extensions:
2020
{
2121
"web/{{}}.dart.js": ["compiled/{{}}.dart.js"],
22-
"web/{{}}.png": ["compiled/{{}}.png"],
23-
"web/{{}}.html": ["compiled/{{}}.html"],
22+
"web/static_assets/{{}}.png": ["compiled/static_assets/{{}}.png"],
23+
"web/static_assets/{{}}.html": ["compiled/static_assets/{{}}.html"],
24+
"web/static_assets/{{}}.css": ["compiled/static_assets/{{}}.css"],
2425
"web/manifest.json": ["compiled/manifest.json"],
2526
}
2627
auto_apply: none

dwds/debug_extension_mv3/tool/copy_builder.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ class _CopyBuilder extends Builder {
1111
@override
1212
Map<String, List<String>> get buildExtensions => {
1313
"web/{{}}.dart.js": ["compiled/{{}}.dart.js"],
14-
"web/{{}}.png": ["compiled/{{}}.png"],
15-
"web/{{}}.html": ["compiled/{{}}.html"],
14+
"web/static_assets/{{}}.png": ["compiled/static_assets/{{}}.png"],
15+
"web/static_assets/{{}}.html": ["compiled/static_assets/{{}}.html"],
16+
"web/static_assets/{{}}.css": ["compiled/static_assets/{{}}.css"],
1617
"web/manifest.json": ["compiled/manifest.json"],
1718
};
1819

dwds/debug_extension_mv3/web/background.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ void _updateIcon(int activeTabId) async {
140140
}
141141

142142
void _setDebuggableIcon() {
143-
chrome.action.setIcon(IconInfo(path: 'dart.png'), /*callback*/ null);
143+
chrome.action
144+
.setIcon(IconInfo(path: 'static_assets/dart.png'), /*callback*/ null);
144145
}
145146

146147
void _setDefaultIcon() {
147-
final iconPath = isDevMode() ? 'dart_dev.png' : 'dart_grey.png';
148+
final iconPath = isDevMode()
149+
? 'static_assets/dart_dev.png'
150+
: 'static_assets/dart_grey.png';
148151
chrome.action.setIcon(IconInfo(path: iconPath), /*callback*/ null);
149152
}
150153

@@ -161,7 +164,7 @@ void _showWarningNotification(String message) {
161164
NotificationOptions(
162165
title: '[Error] Dart Debug Extension',
163166
message: message,
164-
iconUrl: 'dart.png',
167+
iconUrl: 'static_assets/dart.png',
165168
type: 'basic',
166169
),
167170
/*callback*/ null,

dwds/debug_extension_mv3/web/devtools.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void _maybeCreatePanels() async {
4545
chrome.devtools.panels.create(
4646
isDevMode() ? '[DEV] Dart Debugger' : 'Dart Debugger',
4747
'',
48-
'panel.html',
48+
'static_assets/debugger_panel.html',
4949
allowInterop((ExtensionPanel panel) => _onPanelAdded(panel, debugInfo)),
5050
);
5151
// Create an inspector panel for internal Flutter apps:
@@ -54,7 +54,7 @@ void _maybeCreatePanels() async {
5454
chrome.devtools.panels.create(
5555
isDevMode() ? '[DEV] Flutter Inspector' : 'Flutter Inspector',
5656
'',
57-
'panel.html',
57+
'static_assets/inspector_panel.html',
5858
allowInterop((ExtensionPanel panel) => _onPanelAdded(panel, debugInfo)),
5959
);
6060
}

dwds/debug_extension_mv3/web/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "MV3 Dart Debug Extension",
33
"version": "1.0",
44
"manifest_version": 3,
5-
"devtools_page": "devtools.html",
5+
"devtools_page": "static_assets/devtools.html",
66
"action": {
7-
"default_icon": "dart_dev.png"
7+
"default_icon": "static_assets/dart_dev.png"
88
},
99
"permissions": [
1010
"debugger",
@@ -31,5 +31,5 @@
3131
"run_at": "document_end"
3232
}
3333
],
34-
"options_page": "settings.html"
34+
"options_page": "static_assets/settings.html"
3535
}

dwds/debug_extension_mv3/web/panel.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

dwds/debug_extension_mv3/web/settings.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ void _updateSettingsFromStorage(Event _) async {
3333

3434
void _saveSettingsToStorage(Event event) async {
3535
event.preventDefault();
36+
_maybeHideSavedMsg();
3637
final form = document.querySelector("form") as FormElement;
3738
final data = FormData(form);
3839
final devToolsOpenerValue = data.get('devToolsOpener') as String;
@@ -44,16 +45,20 @@ void _saveSettingsToStorage(Event event) async {
4445
}
4546

4647
void _showSavedMsg() {
47-
final msgContainer = document.getElementById('savedMsgEmpty');
48-
if (msgContainer == null) return;
49-
msgContainer.id = 'savedMsg';
50-
msgContainer.innerHtml = 'Saved!';
48+
final snackbar = document.getElementById('savedSnackbar');
49+
if (snackbar == null) return;
50+
snackbar.classes.add('show');
5151
Timer(Duration(seconds: 3), () {
52-
msgContainer.id = 'savedMsgEmpty';
53-
msgContainer.innerHtml = '';
52+
_maybeHideSavedMsg();
5453
});
5554
}
5655

56+
void _maybeHideSavedMsg() {
57+
final snackbar = document.getElementById('savedSnackbar');
58+
if (snackbar == null) return;
59+
snackbar.classes.remove('show');
60+
}
61+
5762
RadioButtonInputElement _getRadioButton(String id) {
5863
return document.getElementById(id) as RadioButtonInputElement;
5964
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)