Commit 527fddc6 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Port EditableText to Scrollable2 (#8167)

parent 3985ddbc
...@@ -28,7 +28,7 @@ export 'src/rendering/block.dart'; ...@@ -28,7 +28,7 @@ export 'src/rendering/block.dart';
export 'src/rendering/box.dart'; export 'src/rendering/box.dart';
export 'src/rendering/custom_layout.dart'; export 'src/rendering/custom_layout.dart';
export 'src/rendering/debug.dart'; export 'src/rendering/debug.dart';
export 'src/rendering/editable_line.dart'; export 'src/rendering/editable.dart';
export 'src/rendering/error.dart'; export 'src/rendering/error.dart';
export 'src/rendering/flex.dart'; export 'src/rendering/flex.dart';
export 'src/rendering/flow.dart'; export 'src/rendering/flow.dart';
......
...@@ -147,7 +147,6 @@ class _InputFieldState extends State<InputField> { ...@@ -147,7 +147,6 @@ class _InputFieldState extends State<InputField> {
cursorColor: themeData.textSelectionColor, cursorColor: themeData.textSelectionColor,
selectionColor: themeData.textSelectionColor, selectionColor: themeData.textSelectionColor,
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
platform: Theme.of(context).platform,
keyboardType: config.keyboardType, keyboardType: config.keyboardType,
onChanged: config.onChanged, onChanged: config.onChanged,
onSubmitted: config.onSubmitted, onSubmitted: config.onSubmitted,
......
...@@ -184,13 +184,13 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix ...@@ -184,13 +184,13 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
@override @override
bool get isRepaintBoundary => true; bool get isRepaintBoundary => true;
double get _effectiveExtent { double get _viewportExtent {
assert(hasSize); assert(hasSize);
switch (axis) { switch (axis) {
case Axis.vertical:
return size.height;
case Axis.horizontal: case Axis.horizontal:
return size.width; return size.width;
case Axis.vertical:
return size.height;
} }
return null; return null;
} }
...@@ -265,7 +265,7 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix ...@@ -265,7 +265,7 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
size = constraints.constrain(child.size); size = constraints.constrain(child.size);
} }
offset.applyViewportDimension(_effectiveExtent); offset.applyViewportDimension(_viewportExtent);
offset.applyContentDimensions(_minScrollExtent, _maxScrollExtent); offset.applyContentDimensions(_minScrollExtent, _maxScrollExtent);
} }
......
...@@ -581,7 +581,6 @@ void main() { ...@@ -581,7 +581,6 @@ void main() {
expect(inputValue.text, cutValue); expect(inputValue.text, cutValue);
}, skip: Platform.isMacOS); // Skip due to https://github.com/flutter/flutter/issues/6961 }, skip: Platform.isMacOS); // Skip due to https://github.com/flutter/flutter/issues/6961
testWidgets('Can scroll multiline input', (WidgetTester tester) async { testWidgets('Can scroll multiline input', (WidgetTester tester) async {
GlobalKey inputKey = new GlobalKey(); GlobalKey inputKey = new GlobalKey();
InputValue inputValue = InputValue.empty; InputValue inputValue = InputValue.empty;
...@@ -640,6 +639,7 @@ void main() { ...@@ -640,6 +639,7 @@ void main() {
// Now the first line is scrolled up, and the fourth line is visible. // Now the first line is scrolled up, and the fourth line is visible.
Point newFirstPos = textOffsetToPosition(tester, kFourLines.indexOf('First')); Point newFirstPos = textOffsetToPosition(tester, kFourLines.indexOf('First'));
Point newFourthPos = textOffsetToPosition(tester, kFourLines.indexOf('Fourth')); Point newFourthPos = textOffsetToPosition(tester, kFourLines.indexOf('Fourth'));
expect(newFirstPos.y, lessThan(firstPos.y)); expect(newFirstPos.y, lessThan(firstPos.y));
expect(inputBox.hitTest(new HitTestResult(), position: inputBox.globalToLocal(newFirstPos)), isFalse); expect(inputBox.hitTest(new HitTestResult(), position: inputBox.globalToLocal(newFirstPos)), isFalse);
expect(inputBox.hitTest(new HitTestResult(), position: inputBox.globalToLocal(newFourthPos)), isTrue); expect(inputBox.hitTest(new HitTestResult(), position: inputBox.globalToLocal(newFourthPos)), isTrue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment