From 2767d37c967e64830118c4133dfe2528ebbe91e7 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Mon, 3 Jun 2019 10:25:54 -0700 Subject: [PATCH] RTL caret in text fields (#33461) --- bin/flutter | 2 +- dev/bots/test.dart | 22 +++++++++---------- dev/snippets/test/snippets_test.dart | 2 +- .../lib/src/widgets/editable_text.dart | 2 +- .../lib/src/widgets/scroll_metrics.dart | 1 + .../lib/src/widgets/scroll_position.dart | 2 ++ 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/bin/flutter b/bin/flutter index 18bad48710..b8c604a958 100755 --- a/bin/flutter +++ b/bin/flutter @@ -173,7 +173,7 @@ if [[ ! -e "$FLUTTER_ROOT/.git" ]]; then fi # To debug the tool, you can uncomment the following lines to enable checked mode and set an observatory port: -# FLUTTER_TOOL_ARGS="--checked $FLUTTER_TOOL_ARGS" +# FLUTTER_TOOL_ARGS="--enable-asserts $FLUTTER_TOOL_ARGS" # FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --observe=65432" (upgrade_flutter) 3< "$PROG_NAME" diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 5b92184caa..5bd57d8781 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -637,17 +637,17 @@ Future _runFlutterTest(String workingDirectory, { } if (useFlutterTestFormatter) { - final FlutterCompactFormatter formatter = FlutterCompactFormatter(); - final Stream testOutput = runAndGetStdout( - flutter, - args, - workingDirectory: workingDirectory, - expectNonZeroExit: expectFailure, - timeout: timeout, - beforeExit: formatter.finish, - environment: environment, - ); - await _processTestOutput(formatter, testOutput, tableData); + final FlutterCompactFormatter formatter = FlutterCompactFormatter(); + final Stream testOutput = runAndGetStdout( + flutter, + args, + workingDirectory: workingDirectory, + expectNonZeroExit: expectFailure, + timeout: timeout, + beforeExit: formatter.finish, + environment: environment, + ); + await _processTestOutput(formatter, testOutput, tableData); } else { await runCommand( flutter, diff --git a/dev/snippets/test/snippets_test.dart b/dev/snippets/test/snippets_test.dart index 9b1a07bff0..6408623cac 100644 --- a/dev/snippets/test/snippets_test.dart +++ b/dev/snippets/test/snippets_test.dart @@ -19,7 +19,7 @@ void main() { File template; setUp(() { - tmpDir = Directory.systemTemp.createTempSync('snippets_test'); + tmpDir = Directory.systemTemp.createTempSync('flutter_snippets_test.'); configuration = Configuration(flutterRoot: Directory(path.join( tmpDir.absolute.path, 'flutter'))); configuration.createOutputDirectory(); diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index ec31f2f5b6..7597c8a078 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -1191,7 +1191,7 @@ class EditableTextState extends State with AutomaticKeepAliveClien if (_currentCaretRect == null || !_scrollController.hasClients) { return; } - final double scrollOffsetForCaret = _getScrollOffsetForCaret(_currentCaretRect); + final double scrollOffsetForCaret = _getScrollOffsetForCaret(_currentCaretRect); _scrollController.animateTo( scrollOffsetForCaret, duration: _caretAnimationDuration, diff --git a/packages/flutter/lib/src/widgets/scroll_metrics.dart b/packages/flutter/lib/src/widgets/scroll_metrics.dart index b5908a1238..8e0347d933 100644 --- a/packages/flutter/lib/src/widgets/scroll_metrics.dart +++ b/packages/flutter/lib/src/widgets/scroll_metrics.dart @@ -104,6 +104,7 @@ abstract class ScrollMetrics { /// /// The value is always non-negative, and less than or equal to [viewportDimension]. double get extentInside { + assert(minScrollExtent <= maxScrollExtent); return viewportDimension // "above" overscroll value - (minScrollExtent - pixels).clamp(0, viewportDimension) diff --git a/packages/flutter/lib/src/widgets/scroll_position.dart b/packages/flutter/lib/src/widgets/scroll_position.dart index 4d6a5fa8a1..d5731a00c0 100644 --- a/packages/flutter/lib/src/widgets/scroll_position.dart +++ b/packages/flutter/lib/src/widgets/scroll_position.dart @@ -447,6 +447,8 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics { @override bool applyContentDimensions(double minScrollExtent, double maxScrollExtent) { + assert(minScrollExtent != null); + assert(maxScrollExtent != null); if (!nearEqual(_minScrollExtent, minScrollExtent, Tolerance.defaultTolerance.distance) || !nearEqual(_maxScrollExtent, maxScrollExtent, Tolerance.defaultTolerance.distance) || _didChangeViewportDimensionOrReceiveCorrection) {