Skip to content

Misc cleanup #1728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2021
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
2 changes: 1 addition & 1 deletion lib/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'dart:async';
import 'services/dartservices.dart';

abstract class Context {
List<AnalysisIssue> issues = [];
final List<AnalysisIssue> issues = [];

String get focusedEditor;

Expand Down
4 changes: 2 additions & 2 deletions lib/core/keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ String makeKeyPresentable(String key) {

bool isMac() => _isMac;

final Map _codeMap = {
const Map _codeMap = {
KeyCode.ZERO: '0',
KeyCode.ONE: '1',
KeyCode.TWO: '2',
Expand Down Expand Up @@ -234,7 +234,7 @@ final Map _codeMap = {
KeyCode.SHIFT: '', //
};

final Map _unicodeMac = {
const Map _unicodeMac = {
'macctrl': '\u2303',
'alt': '\u2325',
'shift': '\u21E7',
Expand Down
6 changes: 3 additions & 3 deletions lib/dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class AboutDialog extends DDialog {
}

class SharingDialog extends DDialog {
final String home = 'dartpad.dev';
final String _dartThumbnail = 'pictures/embed-dart.png';
final String _htmlThumbnail = 'pictures/embed-html.png';
static const String home = 'dartpad.dev';
static const String _dartThumbnail = 'pictures/embed-dart.png';
static const String _htmlThumbnail = 'pictures/embed-html.png';
final GistContainer gistContainer;
final GistController gistController;

Expand Down
8 changes: 4 additions & 4 deletions lib/documentation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DocHandler {
if (a is AnchorElement) a.target = 'docs';
}
for (final h in docPanel.querySelectorAll('h1')) {
h.classes.add('type-${docResult.entitykind}');
h.classes.add('type-${docResult.entityKind}');
}
});
}
Expand Down Expand Up @@ -109,7 +109,7 @@ class DocHandler {
if (a is AnchorElement) a.target = 'docs';
}
for (final h in docPanel.querySelectorAll('h1')) {
h.classes.add('type-${docResult.entitykind}');
h.classes.add('type-${docResult.entityKind}');
}
});
}
Expand Down Expand Up @@ -174,9 +174,9 @@ ${libraryName == null ? '' : apiLink}\n\n''';

class _DocResult {
final String html;
final String entitykind;
final String entityKind;

_DocResult(this.html, [this.entitykind]);
_DocResult(this.html, [this.entityKind]);
}

class InlineBracketsColon extends markdown.InlineSyntax {
Expand Down
2 changes: 1 addition & 1 deletion lib/editing/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Position {
final int line;
final int char;

Position(this.line, this.char);
const Position(this.line, this.char);

@override
String toString() => '[$line,$char]';
Expand Down
2 changes: 1 addition & 1 deletion lib/editing/editor_codemirror.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CodeMirrorFactory extends EditorFactory {
List<String> get themes => CodeMirror.THEMES;

@override
Editor createFromElement(html.Element element, {Map options}) {
Editor createFromElement(html.Element element, {Map /*?*/ options}) {
options ??= {
'continueComments': {'continueLineComment': false},
'autofocus': false,
Expand Down
6 changes: 3 additions & 3 deletions lib/elements/analysis_results_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class AnalysisResultsController {
'error': ['issuelabel', 'error'],
};

DElement flash;
DElement message;
DElement toggle;
final DElement flash;
final DElement message;
final DElement toggle;
bool _flashHidden;

final StreamController<AnalysisIssue> _onClickController =
Expand Down
4 changes: 2 additions & 2 deletions lib/elements/counter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'dart:html';

/// Displays a counter that is only visible if the count is greater than zero.
class Counter {
Counter(this.element);

final SpanElement element;

int _itemCount = 0;

Counter(this.element);

void increment() {
_itemCount++;
element.text = '$_itemCount';
Expand Down
7 changes: 3 additions & 4 deletions lib/elements/elements.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ button.close:hover {
border-radius: 2px;
background-color: #3a3a3a;
padding: 8px 16px;
box-shadow: 3px 3px 4px 0px rgba(15, 14, 14, 0.7);
box-shadow: 3px 3px 4px 0 rgba(15, 14, 14, 0.7);
}

/* issues css */
Expand Down Expand Up @@ -276,8 +276,7 @@ button.close:hover {
position: absolute;
padding: 10px;
background-color: #444;
border: 1px solid;
border-color: rgba(0, 0, 0, 0.5);
border: 1px solid rgba(0, 0, 0, 0.5);
border-radius: 4px;
box-shadow: rgba(255, 255, 255, 0.1) 0 0 0, rgba(0, 0, 0, 0.4) 0 1px 7px 0;

Expand Down Expand Up @@ -348,7 +347,7 @@ button.close:hover {
/* style the <select> element */

select {
-webkit-border-radius: 0px;
-webkit-border-radius: 0;

color: #aaa;
fill: #aaa;
Expand Down
10 changes: 5 additions & 5 deletions lib/elements/elements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ class DButton extends DElement {

DButton.close() : super.tag('button', classes: 'close');

ButtonElement get belement => element as ButtonElement;
ButtonElement get buttonElement => element as ButtonElement;

bool get disabled => belement.disabled;
bool get disabled => buttonElement.disabled;

set disabled(bool value) {
belement.disabled = value;
buttonElement.disabled = value;
}
}

Expand Down Expand Up @@ -470,7 +470,7 @@ abstract class DDialog extends DElement {
DElement content;
DElement buttonArea;

DDialog({String title}) : super.tag('div') {
DDialog({String /*?*/ title}) : super.tag('div') {
element.classes.addAll(['dialog', 'dialog-position']);
setAttr('layout');
setAttr('vertical');
Expand Down Expand Up @@ -580,7 +580,7 @@ class TabController {

class TabElement extends DElement {
final String name;
final Function onSelect;
final Function /*?*/ onSelect;

TabElement(Element element, {this.name, this.onSelect}) : super(element);

Expand Down
2 changes: 1 addition & 1 deletion lib/scss/shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

// Enabled features (e.g. null safety)
#feature-message {
font-family: Roboto;
font-family: Roboto, sans-serif;
font-weight: bolder;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/sharing/exercise_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum ExerciseMode {
flutter,
}

final exerciseModeNames = <String, ExerciseMode>{
const exerciseModeNames = <String, ExerciseMode>{
'dart': ExerciseMode.dart,
'html': ExerciseMode.html,
'flutter': ExerciseMode.flutter,
Expand Down
8 changes: 4 additions & 4 deletions lib/src/sample.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

library dart_pad.sample;

final String dartCode = r'''
const String dartCode = r'''
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
''';

final String dartCodeHtml = r'''
const String dartCodeHtml = r'''
import 'dart:html';

void main() {
Expand All @@ -21,11 +21,11 @@ void main() {
}
''';

final String htmlCode = r'''
const String htmlCode = r'''
<h1 id="header"></h1>
''';

final String cssCode = r'''
const String cssCode = r'''
body {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PermissiveNodeValidator implements NodeValidator {

/// Text to be displayed to DartPad users. The associated title should be
/// 'About DartPad' (or equivalent).
final String privacyText = '''
const String privacyText = '''
DartPad is a free, open-source service to help developers learn about the Dart
language and libraries. Source code entered into DartPad may be sent to servers
running in Google Cloud Platform to be analyzed for errors/warnings, compiled
Expand Down