enable lint prefer_single_quotes (#12665)
This commit is contained in:
committed by
GitHub
parent
b07ea41954
commit
1fce14a31c
@@ -57,7 +57,7 @@ String expandTemplate(String template, Map<String, String> values) {
|
||||
if (match.groupCount != 1)
|
||||
throw new SampleError('bad template keyword $match[0]');
|
||||
final String keyword = match[1];
|
||||
return (values[keyword] ?? "");
|
||||
return (values[keyword] ?? '');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import '../lib/animated_list.dart' as animated_list_sample;
|
||||
|
||||
void main() {
|
||||
testWidgets("animated_list sample app smoke test", (WidgetTester tester) async {
|
||||
testWidgets('animated_list sample app smoke test', (WidgetTester tester) async {
|
||||
animated_list_sample.main();
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Finder findChoiceCard(IconData icon) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets("basic_app_bar sample smoke test", (WidgetTester tester) async {
|
||||
testWidgets('basic_app_bar sample smoke test', (WidgetTester tester) async {
|
||||
basic_app_bar_sample.main();
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import '../lib/expansion_tile_sample.dart' as expansion_tile_sample;
|
||||
import '../lib/expansion_tile_sample.dart' show Entry;
|
||||
|
||||
void main() {
|
||||
testWidgets("expansion_tile sample smoke test", (WidgetTester tester) async {
|
||||
testWidgets('expansion_tile sample smoke test', (WidgetTester tester) async {
|
||||
expansion_tile_sample.main();
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Finder findTab(IconData icon) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets("tabbed_app_bar sample smoke test", (WidgetTester tester) async {
|
||||
testWidgets('tabbed_app_bar sample smoke test', (WidgetTester tester) async {
|
||||
tabbed_app_bar_sample.main();
|
||||
await tester.pump();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,9 +26,9 @@ class MyHomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
static const String _channel = "increment";
|
||||
static const String _pong = "pong";
|
||||
static const String _emptyMessage = "";
|
||||
static const String _channel = 'increment';
|
||||
static const String _pong = 'pong';
|
||||
static const String _emptyMessage = '';
|
||||
static const BasicMessageChannel<String> platform =
|
||||
const BasicMessageChannel<String>(_channel, const StringCodec());
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import '../lib/main.dart' as hello_world;
|
||||
|
||||
void main() {
|
||||
testWidgets("Hello world smoke test", (WidgetTester tester) async {
|
||||
testWidgets('Hello world smoke test', (WidgetTester tester) async {
|
||||
hello_world.main(); // builds the app and schedules a frame but doesn't trigger one
|
||||
await tester.pump(); // triggers a frame
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ void main() {
|
||||
final RenderParagraph paragraph = new RenderParagraph(
|
||||
const TextSpan(
|
||||
style: const TextStyle(color: Colors.black87),
|
||||
text: "Touch me!",
|
||||
text: 'Touch me!',
|
||||
),
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
|
||||
@@ -46,21 +46,21 @@ class Calculator {
|
||||
try {
|
||||
final List<dynamic> result = decoder.convert(_data);
|
||||
final int n = result.length;
|
||||
onResultListener("Decoded $n results");
|
||||
onResultListener('Decoded $n results');
|
||||
} catch (e, stack) {
|
||||
print("Invalid JSON file: $e");
|
||||
print('Invalid JSON file: $e');
|
||||
print(stack);
|
||||
}
|
||||
}
|
||||
|
||||
static String _replicateJson(String data, int count) {
|
||||
final StringBuffer buffer = new StringBuffer()..write("[");
|
||||
final StringBuffer buffer = new StringBuffer()..write('[');
|
||||
for (int i = 0; i < count; i++) {
|
||||
buffer.write(data);
|
||||
if (i < count - 1)
|
||||
buffer.write(',');
|
||||
}
|
||||
buffer.write("]");
|
||||
buffer.write(']');
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ final List<List<String>> _kNameLines = _kDialogText
|
||||
.toList();
|
||||
|
||||
final TextStyle _kDaveStyle = new TextStyle(color: Colors.indigo.shade400, height: 1.8);
|
||||
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: "monospace");
|
||||
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
|
||||
final TextStyle _kBold = const TextStyle(fontWeight: FontWeight.bold);
|
||||
final TextStyle _kUnderline = const TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
@@ -33,7 +33,7 @@ final TextStyle _kUnderline = const TextStyle(
|
||||
);
|
||||
|
||||
Widget toStyledText(String name, String text) {
|
||||
final TextStyle lineStyle = (name == "Dave") ? _kDaveStyle : _kHalStyle;
|
||||
final TextStyle lineStyle = (name == 'Dave') ? _kDaveStyle : _kHalStyle;
|
||||
return new RichText(
|
||||
key: new Key(text),
|
||||
text: new TextSpan(
|
||||
@@ -55,7 +55,7 @@ Widget toStyledText(String name, String text) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget toPlainText(String name, String text) => new Text(name + ":" + text);
|
||||
Widget toPlainText(String name, String text) => new Text(name + ':' + text);
|
||||
|
||||
class SpeakerSeparator extends StatelessWidget {
|
||||
@override
|
||||
|
||||
@@ -27,7 +27,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
final int result = await methodChannel.invokeMethod('getBatteryLevel');
|
||||
batteryLevel = 'Battery level: $result%.';
|
||||
} on PlatformException {
|
||||
batteryLevel = "Failed to get battery level.";
|
||||
batteryLevel = 'Failed to get battery level.';
|
||||
}
|
||||
setState(() {
|
||||
_batteryLevel = batteryLevel;
|
||||
@@ -49,7 +49,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
|
||||
void _onError(PlatformException error) {
|
||||
setState(() {
|
||||
_chargingStatus = "Battery status: unknown.";
|
||||
_chargingStatus = 'Battery status: unknown.';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
final int result = await methodChannel.invokeMethod('getBatteryLevel');
|
||||
batteryLevel = 'Battery level: $result%.';
|
||||
} on PlatformException {
|
||||
batteryLevel = "Failed to get battery level.";
|
||||
batteryLevel = 'Failed to get battery level.';
|
||||
}
|
||||
setState(() {
|
||||
_batteryLevel = batteryLevel;
|
||||
@@ -49,7 +49,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
|
||||
void _onError(PlatformException error) {
|
||||
setState(() {
|
||||
_chargingStatus = "Battery status: unknown.";
|
||||
_chargingStatus = 'Battery status: unknown.';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class MyHomePage extends StatefulWidget {
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
static const MethodChannel _methodChannel =
|
||||
const MethodChannel("samples.flutter.io/platform_view");
|
||||
const MethodChannel('samples.flutter.io/platform_view');
|
||||
|
||||
int _counter = 0;
|
||||
|
||||
@@ -47,7 +47,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
|
||||
Future<Null> _launchPlatformCount() async {
|
||||
final int platformCounter =
|
||||
await _methodChannel.invokeMethod("switchView", _counter);
|
||||
await _methodChannel.invokeMethod('switchView', _counter);
|
||||
setState(() {
|
||||
_counter = platformCounter;
|
||||
});
|
||||
|
||||
@@ -245,9 +245,9 @@ class StockHomeState extends State<StockHome> {
|
||||
stock.lastSale += 1.0;
|
||||
});
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text("Purchased ${stock.symbol} for ${stock.lastSale}"),
|
||||
content: new Text('Purchased ${stock.symbol} for ${stock.lastSale}'),
|
||||
action: new SnackBarAction(
|
||||
label: "BUY MORE",
|
||||
label: 'BUY MORE',
|
||||
onPressed: () {
|
||||
_buyStock(stock);
|
||||
},
|
||||
@@ -278,7 +278,7 @@ class StockHomeState extends State<StockHome> {
|
||||
);
|
||||
}
|
||||
|
||||
static const List<String> portfolioSymbols = const <String>["AAPL","FIZZ", "FIVE", "FLAT", "ZINC", "ZNGA"];
|
||||
static const List<String> portfolioSymbols = const <String>['AAPL','FIZZ', 'FIVE', 'FLAT', 'ZINC', 'ZNGA'];
|
||||
|
||||
Widget buildSearchBar() {
|
||||
return new AppBar(
|
||||
|
||||
@@ -30,10 +30,10 @@ class StockRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
|
||||
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
|
||||
final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}';
|
||||
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
|
||||
if (stock.percentChange > 0)
|
||||
changeInPrice = "+" + changeInPrice;
|
||||
changeInPrice = '+' + changeInPrice;
|
||||
return new InkWell(
|
||||
onTap: _getHandler(onPressed),
|
||||
onDoubleTap: _getHandler(onDoubleTap),
|
||||
|
||||
@@ -68,8 +68,8 @@ class StockSettingsState extends State<StockSettings> {
|
||||
showDialog<bool>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
title: const Text("Change mode?"),
|
||||
content: const Text("Optimistic mode means everything is awesome. Are you sure you can handle that?"),
|
||||
title: const Text('Change mode?'),
|
||||
content: const Text('Optimistic mode means everything is awesome. Are you sure you can handle that?'),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
child: const Text('NO THANKS'),
|
||||
|
||||
@@ -16,10 +16,10 @@ class _StockSymbolView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assert(stock != null);
|
||||
final String lastSale = "\$${stock.lastSale.toStringAsFixed(2)}";
|
||||
String changeInPrice = "${stock.percentChange.toStringAsFixed(2)}%";
|
||||
final String lastSale = '\$${stock.lastSale.toStringAsFixed(2)}';
|
||||
String changeInPrice = '${stock.percentChange.toStringAsFixed(2)}%';
|
||||
if (stock.percentChange > 0)
|
||||
changeInPrice = "+" + changeInPrice;
|
||||
changeInPrice = '+' + changeInPrice;
|
||||
|
||||
final TextStyle headings = Theme.of(context).textTheme.body2;
|
||||
return new Container(
|
||||
|
||||
Reference in New Issue
Block a user