enable lint prefer_single_quotes (#12665)
This commit is contained in:
committed by
GitHub
parent
b07ea41954
commit
1fce14a31c
@@ -13,11 +13,11 @@ enum DialogDemoAction {
|
||||
agree,
|
||||
}
|
||||
|
||||
const String _alertWithoutTitleText = "Discard draft?";
|
||||
const String _alertWithoutTitleText = 'Discard draft?';
|
||||
|
||||
const String _alertWithTitleText =
|
||||
"Let Google help apps determine location. This means sending anyonmous location "
|
||||
"data to Google, even when no apps are running.";
|
||||
'Let Google help apps determine location. This means sending anyonmous location '
|
||||
'data to Google, even when no apps are running.';
|
||||
|
||||
class DialogDemoItem extends StatelessWidget {
|
||||
const DialogDemoItem({ Key key, this.icon, this.color, this.text, this.onPressed }) : super(key: key);
|
||||
|
||||
@@ -225,7 +225,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
|
||||
name: 'Location',
|
||||
value: _Location.Bahamas,
|
||||
hint: 'Select location',
|
||||
valueToString: (_Location location) => location.toString().split(".")[1],
|
||||
valueToString: (_Location location) => location.toString().split('.')[1],
|
||||
builder: (DemoItem<_Location> item) {
|
||||
void close() {
|
||||
setState(() {
|
||||
|
||||
@@ -172,10 +172,10 @@ class _ListDemoState extends State<ListDemo> {
|
||||
Widget buildListTile(BuildContext context, String item) {
|
||||
Widget secondary;
|
||||
if (_itemType == _MaterialListType.twoLine) {
|
||||
secondary = const Text("Additional item information.");
|
||||
secondary = const Text('Additional item information.');
|
||||
} else if (_itemType == _MaterialListType.threeLine) {
|
||||
secondary = const Text(
|
||||
"Even more additional list item information appears on line three.",
|
||||
'Even more additional list item information appears on line three.',
|
||||
);
|
||||
}
|
||||
return new MergeSemantics(
|
||||
@@ -192,7 +192,7 @@ class _ListDemoState extends State<ListDemo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String layoutText = _dense ? " \u2013 Dense" : "";
|
||||
final String layoutText = _dense ? ' \u2013 Dense' : '';
|
||||
String itemTypeText;
|
||||
switch (_itemType) {
|
||||
case _MaterialListType.oneLine:
|
||||
|
||||
@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
|
||||
new Timer(const Duration(seconds: 3), () { completer.complete(null); });
|
||||
return completer.future.then((_) {
|
||||
_scaffoldKey.currentState?.showSnackBar(new SnackBar(
|
||||
content: const Text("Refresh complete"),
|
||||
content: const Text('Refresh complete'),
|
||||
action: new SnackBarAction(
|
||||
label: 'RETRY',
|
||||
onPressed: () {
|
||||
|
||||
@@ -7,21 +7,21 @@ import 'package:flutter/material.dart';
|
||||
import '../../gallery/demo.dart';
|
||||
|
||||
const String _checkboxText =
|
||||
"Checkboxes allow the user to select multiple options from a set.";
|
||||
'Checkboxes allow the user to select multiple options from a set.';
|
||||
|
||||
const String _checkboxCode = 'selectioncontrols_checkbox';
|
||||
|
||||
const String _radioText =
|
||||
"Radio buttons allow the user to select one option from a set. Use radio "
|
||||
"buttons for exclusive selection if you think that the user needs to see "
|
||||
"all available options side-by-side.";
|
||||
'Radio buttons allow the user to select one option from a set. Use radio '
|
||||
'buttons for exclusive selection if you think that the user needs to see '
|
||||
'all available options side-by-side.';
|
||||
|
||||
const String _radioCode = 'selectioncontrols_radio';
|
||||
|
||||
const String _switchText =
|
||||
"On/off switches toggle the state of a single settings option. The option "
|
||||
"that the switch controls, as well as the state it’s in, should be made "
|
||||
"clear from the corresponding inline label.";
|
||||
'On/off switches toggle the state of a single settings option. The option '
|
||||
'that the switch controls, as well as the state it’s in, should be made '
|
||||
'clear from the corresponding inline label.';
|
||||
|
||||
const String _switchCode = 'selectioncontrols_switch';
|
||||
|
||||
@@ -37,19 +37,19 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
final List<ComponentDemoTabData> demos = <ComponentDemoTabData>[
|
||||
new ComponentDemoTabData(
|
||||
tabName: "CHECKBOX",
|
||||
tabName: 'CHECKBOX',
|
||||
description: _checkboxText,
|
||||
demoWidget: buildCheckbox(),
|
||||
exampleCodeTag: _checkboxCode
|
||||
),
|
||||
new ComponentDemoTabData(
|
||||
tabName: "RADIO",
|
||||
tabName: 'RADIO',
|
||||
description: _radioText,
|
||||
demoWidget: buildRadio(),
|
||||
exampleCodeTag: _radioCode
|
||||
),
|
||||
new ComponentDemoTabData(
|
||||
tabName: "SWITCH",
|
||||
tabName: 'SWITCH',
|
||||
description: _switchText,
|
||||
demoWidget: buildSwitch(),
|
||||
exampleCodeTag: _switchCode
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const String _text1 =
|
||||
"Snackbars provide lightweight feedback about an operation by "
|
||||
"showing a brief message at the bottom of the screen. Snackbars "
|
||||
"can contain an action.";
|
||||
'Snackbars provide lightweight feedback about an operation by '
|
||||
'showing a brief message at the bottom of the screen. Snackbars '
|
||||
'can contain an action.';
|
||||
|
||||
const String _text2 =
|
||||
"Snackbars should contain a single line of text directly related "
|
||||
"to the operation performed. They cannot contain icons.";
|
||||
'Snackbars should contain a single line of text directly related '
|
||||
'to the operation performed. They cannot contain icons.';
|
||||
|
||||
const String _text3 =
|
||||
"By default snackbars automatically disappear after a few seconds ";
|
||||
'By default snackbars automatically disappear after a few seconds ';
|
||||
|
||||
class SnackBarDemo extends StatefulWidget {
|
||||
const SnackBarDemo({ Key key }) : super(key: key);
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
const String _explanatoryText =
|
||||
"When the Scaffold's floating action button changes, the new button fades and "
|
||||
"turns into view. In this demo, changing tabs can cause the app to be rebuilt "
|
||||
"with a FloatingActionButton that the Scaffold distinguishes from the others "
|
||||
"by its key.";
|
||||
'turns into view. In this demo, changing tabs can cause the app to be rebuilt '
|
||||
'with a FloatingActionButton that the Scaffold distinguishes from the others '
|
||||
'by its key.';
|
||||
|
||||
class _Page {
|
||||
_Page({ this.label, this.colors, this.icon });
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const String _introText =
|
||||
"Tooltips are short identifying messages that briefly appear in response to "
|
||||
"a long press. Tooltip messages are also used by services that make Flutter "
|
||||
"apps accessible, like screen readers.";
|
||||
'Tooltips are short identifying messages that briefly appear in response to '
|
||||
'a long press. Tooltip messages are also used by services that make Flutter '
|
||||
'apps accessible, like screen readers.';
|
||||
|
||||
class TooltipDemo extends StatelessWidget {
|
||||
|
||||
|
||||
@@ -162,14 +162,14 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
|
||||
|
||||
void showFavoritesPage(BuildContext context) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
settings: const RouteSettings(name: "/pesto/favorites"),
|
||||
settings: const RouteSettings(name: '/pesto/favorites'),
|
||||
builder: (BuildContext context) => new PestoFavorites(),
|
||||
));
|
||||
}
|
||||
|
||||
void showRecipePage(BuildContext context, Recipe recipe) {
|
||||
Navigator.push(context, new MaterialPageRoute<Null>(
|
||||
settings: const RouteSettings(name: "/pesto/recipe"),
|
||||
settings: const RouteSettings(name: '/pesto/recipe'),
|
||||
builder: (BuildContext context) {
|
||||
return new Theme(
|
||||
data: _kTheme.copyWith(platform: Theme.of(context).platform),
|
||||
|
||||
@@ -118,10 +118,10 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
|
||||
while (!_scanner.isDone) {
|
||||
// Skip White space
|
||||
_scanner.scan(new RegExp(r"\s+"));
|
||||
_scanner.scan(new RegExp(r'\s+'));
|
||||
|
||||
// Block comments
|
||||
if (_scanner.scan(new RegExp(r"/\*(.|\n)*\*/"))) {
|
||||
if (_scanner.scan(new RegExp(r'/\*(.|\n)*\*/'))) {
|
||||
_spans.add(new _HighlightSpan(
|
||||
_HighlightType.comment,
|
||||
_scanner.lastMatch.start,
|
||||
@@ -131,12 +131,12 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Line comments
|
||||
if (_scanner.scan("//")) {
|
||||
if (_scanner.scan('//')) {
|
||||
final int startComment = _scanner.lastMatch.start;
|
||||
|
||||
bool eof = false;
|
||||
int endComment;
|
||||
if (_scanner.scan(new RegExp(r".*\n"))) {
|
||||
if (_scanner.scan(new RegExp(r'.*\n'))) {
|
||||
endComment = _scanner.lastMatch.end - 1;
|
||||
} else {
|
||||
eof = true;
|
||||
@@ -216,7 +216,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Double
|
||||
if (_scanner.scan(new RegExp(r"\d+\.\d+"))) {
|
||||
if (_scanner.scan(new RegExp(r'\d+\.\d+'))) {
|
||||
_spans.add(new _HighlightSpan(
|
||||
_HighlightType.number,
|
||||
_scanner.lastMatch.start,
|
||||
@@ -226,7 +226,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Integer
|
||||
if (_scanner.scan(new RegExp(r"\d+"))) {
|
||||
if (_scanner.scan(new RegExp(r'\d+'))) {
|
||||
_spans.add(new _HighlightSpan(
|
||||
_HighlightType.number,
|
||||
_scanner.lastMatch.start,
|
||||
@@ -236,7 +236,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Punctuation
|
||||
if (_scanner.scan(new RegExp(r"[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]"))) {
|
||||
if (_scanner.scan(new RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) {
|
||||
_spans.add(new _HighlightSpan(
|
||||
_HighlightType.punctuation,
|
||||
_scanner.lastMatch.start,
|
||||
@@ -246,7 +246,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Meta data
|
||||
if (_scanner.scan(new RegExp(r"@\w+"))) {
|
||||
if (_scanner.scan(new RegExp(r'@\w+'))) {
|
||||
_spans.add(new _HighlightSpan(
|
||||
_HighlightType.keyword,
|
||||
_scanner.lastMatch.start,
|
||||
@@ -256,11 +256,11 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
}
|
||||
|
||||
// Words
|
||||
if (_scanner.scan(new RegExp(r"\w+"))) {
|
||||
if (_scanner.scan(new RegExp(r'\w+'))) {
|
||||
_HighlightType type;
|
||||
|
||||
String word = _scanner.lastMatch[0];
|
||||
if (word.startsWith("_"))
|
||||
if (word.startsWith('_'))
|
||||
word = word.substring(1);
|
||||
|
||||
if (_kKeywords.contains(word))
|
||||
@@ -269,7 +269,7 @@ class DartSyntaxHighlighter extends SyntaxHighlighter {
|
||||
type = _HighlightType.keyword;
|
||||
else if (_firstLetterIsUpperCase(word))
|
||||
type = _HighlightType.klass;
|
||||
else if (word.length >= 2 && word.startsWith("k") && _firstLetterIsUpperCase(word.substring(1)))
|
||||
else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1)))
|
||||
type = _HighlightType.constant;
|
||||
|
||||
if (type != null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ void main() {
|
||||
expression = expression.appendDigit(4);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("24"));
|
||||
expect(expression.toString(), equals('24'));
|
||||
});
|
||||
|
||||
test('Test floating point 0.1 + 0.2 = 0.3', () {
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
expression = expression.appendDigit(2);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("0.3"));
|
||||
expect(expression.toString(), equals('0.3'));
|
||||
});
|
||||
|
||||
test('Test floating point 1.0/10.0 = 0.1', () {
|
||||
@@ -45,7 +45,7 @@ void main() {
|
||||
expression = expression.appendDigit(0);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("0.1"));
|
||||
expect(expression.toString(), equals('0.1'));
|
||||
});
|
||||
|
||||
test('Test 1/0 = Infinity', () {
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
expression = expression.appendDigit(0);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("Infinity"));
|
||||
expect(expression.toString(), equals('Infinity'));
|
||||
});
|
||||
|
||||
test('Test use result in next calculation: 1 + 1 = 2 + 1 = 3 + 1 = 4', () {
|
||||
@@ -71,7 +71,7 @@ void main() {
|
||||
expression = expression.appendDigit(1);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("4"));
|
||||
expect(expression.toString(), equals('4'));
|
||||
});
|
||||
|
||||
test('Test minus -3 - -2 = -1', () {
|
||||
@@ -83,6 +83,6 @@ void main() {
|
||||
expression = expression.appendDigit(2);
|
||||
expression = expression.computeResult();
|
||||
expect(expression.state, equals(ExpressionState.Result));
|
||||
expect(expression.toString(), equals("-1"));
|
||||
expect(expression.toString(), equals('-1'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,21 +51,21 @@ void main() {
|
||||
expect(app.theme.platform, equals(TargetPlatform.iOS));
|
||||
|
||||
// Verify the font scale.
|
||||
final Size origTextSize = tester.getSize(find.text("Small"));
|
||||
final Size origTextSize = tester.getSize(find.text('Small'));
|
||||
expect(origTextSize, equals(const Size(176.0, 14.0)));
|
||||
|
||||
// Switch font scale.
|
||||
await tester.tap(find.text('Small'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
|
||||
final Size textSize = tester.getSize(find.text("Small"));
|
||||
final Size textSize = tester.getSize(find.text('Small'));
|
||||
expect(textSize, equals(const Size(176.0, 11.0)));
|
||||
|
||||
// Set font scale back to default.
|
||||
await tester.tap(find.text('System Default'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1)); // Wait until it's changed.
|
||||
final Size newTextSize = tester.getSize(find.text("Small"));
|
||||
final Size newTextSize = tester.getSize(find.text('Small'));
|
||||
expect(newTextSize, equals(origTextSize));
|
||||
|
||||
// Scroll to the bottom of the menu.
|
||||
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
const String testCodeFile = """// A fake test file
|
||||
const String testCodeFile = '''// A fake test file
|
||||
// START test_0
|
||||
test 0 0
|
||||
test 0 1
|
||||
@@ -32,7 +32,7 @@ test 0 1
|
||||
test 1 0
|
||||
test 1 1
|
||||
// END
|
||||
""";
|
||||
''';
|
||||
|
||||
class TestAssetBundle extends AssetBundle {
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user