enable always_put_control_body_on_new_line lint (#9950)

This commit is contained in:
Alexandre Ardhuin
2017-05-10 09:41:55 +02:00
committed by GitHub
parent e4546584d1
commit 9b56c1c58c
5 changed files with 32 additions and 17 deletions

View File

@@ -206,19 +206,23 @@ class _UsNumberTextInputFormatter extends TextInputFormatter {
final StringBuffer newText = new StringBuffer();
if (newTextLength >= 1) {
newText.write('(');
if (newValue.selection.end >= 1) selectionIndex++;
if (newValue.selection.end >= 1)
selectionIndex++;
}
if (newTextLength >= 4) {
newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') ');
if (newValue.selection.end >= 3) selectionIndex += 2;
if (newValue.selection.end >= 3)
selectionIndex += 2;
}
if (newTextLength >= 7) {
newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-');
if (newValue.selection.end >= 6) selectionIndex++;
if (newValue.selection.end >= 6)
selectionIndex++;
}
if (newTextLength >= 11) {
newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' ');
if (newValue.selection.end >= 10) selectionIndex++;
if (newValue.selection.end >= 10)
selectionIndex++;
}
// Dump the rest.
if (newTextLength >= usedSubstringIndex)

View File

@@ -14,7 +14,8 @@ void main() {
});
tearDownAll(() async {
if (driver != null) driver.close();
if (driver != null)
driver.close();
});
test('tap on the button, verify result', () async {