Commit 2ec02c33 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Remove Scrollable2.initialScrollOffset (#7842)

This property is wired up to anything and it isn't used. We'll need to find a
better way for clients to control the scroll offset.
parent acc7d110
...@@ -20,14 +20,12 @@ class ScrollView extends StatelessWidget { ...@@ -20,14 +20,12 @@ class ScrollView extends StatelessWidget {
this.scrollDirection: Axis.vertical, this.scrollDirection: Axis.vertical,
this.reverse: false, this.reverse: false,
this.padding, this.padding,
this.initialScrollOffset: 0.0,
this.itemExtent, this.itemExtent,
this.physics, this.physics,
this.shrinkWrap: false, this.shrinkWrap: false,
this.children: const <Widget>[], this.children: const <Widget>[],
}) : super(key: key) { }) : super(key: key) {
assert(reverse != null); assert(reverse != null);
assert(initialScrollOffset != null);
assert(shrinkWrap != null); assert(shrinkWrap != null);
} }
...@@ -37,8 +35,6 @@ class ScrollView extends StatelessWidget { ...@@ -37,8 +35,6 @@ class ScrollView extends StatelessWidget {
final EdgeInsets padding; final EdgeInsets padding;
final double initialScrollOffset;
final double itemExtent; final double itemExtent;
final ScrollPhysics physics; final ScrollPhysics physics;
...@@ -80,7 +76,6 @@ class ScrollView extends StatelessWidget { ...@@ -80,7 +76,6 @@ class ScrollView extends StatelessWidget {
AxisDirection axisDirection = getDirection(context); AxisDirection axisDirection = getDirection(context);
return new Scrollable2( return new Scrollable2(
axisDirection: axisDirection, axisDirection: axisDirection,
initialScrollOffset: initialScrollOffset,
physics: physics, physics: physics,
viewportBuilder: (BuildContext context, ViewportOffset offset) { viewportBuilder: (BuildContext context, ViewportOffset offset) {
if (shrinkWrap) { if (shrinkWrap) {
...@@ -106,8 +101,6 @@ class ScrollView extends StatelessWidget { ...@@ -106,8 +101,6 @@ class ScrollView extends StatelessWidget {
description.add('$scrollDirection'); description.add('$scrollDirection');
if (padding != null) if (padding != null)
description.add('padding: $padding'); description.add('padding: $padding');
if (initialScrollOffset != 0.0)
description.add('initialScrollOffset: ${initialScrollOffset.toStringAsFixed(1)}');
if (itemExtent != null) if (itemExtent != null)
description.add('itemExtent: $itemExtent'); description.add('itemExtent: $itemExtent');
if (shrinkWrap) if (shrinkWrap)
...@@ -120,7 +113,6 @@ class ScrollGrid extends ScrollView { ...@@ -120,7 +113,6 @@ class ScrollGrid extends ScrollView {
Key key, Key key,
Axis scrollDirection: Axis.vertical, Axis scrollDirection: Axis.vertical,
EdgeInsets padding, EdgeInsets padding,
double initialScrollOffset: 0.0,
bool shrinkWrap: false, bool shrinkWrap: false,
this.gridDelegate, this.gridDelegate,
List<Widget> children: const <Widget>[], List<Widget> children: const <Widget>[],
...@@ -130,7 +122,6 @@ class ScrollGrid extends ScrollView { ...@@ -130,7 +122,6 @@ class ScrollGrid extends ScrollView {
Key key, Key key,
Axis scrollDirection: Axis.vertical, Axis scrollDirection: Axis.vertical,
EdgeInsets padding, EdgeInsets padding,
double initialScrollOffset: 0.0,
bool shrinkWrap: false, bool shrinkWrap: false,
@required int crossAxisCount, @required int crossAxisCount,
double mainAxisSpacing: 0.0, double mainAxisSpacing: 0.0,
...@@ -148,7 +139,6 @@ class ScrollGrid extends ScrollView { ...@@ -148,7 +139,6 @@ class ScrollGrid extends ScrollView {
Key key, Key key,
Axis scrollDirection: Axis.vertical, Axis scrollDirection: Axis.vertical,
EdgeInsets padding, EdgeInsets padding,
double initialScrollOffset: 0.0,
bool shrinkWrap: false, bool shrinkWrap: false,
@required double maxCrossAxisExtent, @required double maxCrossAxisExtent,
double mainAxisSpacing: 0.0, double mainAxisSpacing: 0.0,
......
...@@ -405,19 +405,15 @@ typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position); ...@@ -405,19 +405,15 @@ typedef Widget ViewportBuilder(BuildContext context, ViewportOffset position);
class Scrollable2 extends StatefulWidget { class Scrollable2 extends StatefulWidget {
Scrollable2({ Scrollable2({
Key key, Key key,
this.initialScrollOffset: 0.0,
this.axisDirection: AxisDirection.down, this.axisDirection: AxisDirection.down,
this.physics, this.physics,
this.scrollBehavior, this.scrollBehavior,
@required this.viewportBuilder, @required this.viewportBuilder,
}) : super (key: key) { }) : super (key: key) {
assert(axisDirection != null); assert(axisDirection != null);
assert(initialScrollOffset != null);
assert(viewportBuilder != null); assert(viewportBuilder != null);
} }
final double initialScrollOffset;
final AxisDirection axisDirection; final AxisDirection axisDirection;
final ScrollPhysics physics; final ScrollPhysics physics;
...@@ -453,8 +449,8 @@ class Scrollable2 extends StatefulWidget { ...@@ -453,8 +449,8 @@ class Scrollable2 extends StatefulWidget {
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
description.add('$axisDirection'); description.add('$axisDirection');
if (initialScrollOffset != 0.0) if (physics != null)
description.add('initialScrollOffset: ${initialScrollOffset.toStringAsFixed(1)}'); description.add('physics: $physics');
if (scrollBehavior != null) { if (scrollBehavior != null) {
description.add('scrollBehavior: $scrollBehavior'); description.add('scrollBehavior: $scrollBehavior');
} else { } else {
......
...@@ -22,19 +22,15 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -22,19 +22,15 @@ class SingleChildScrollView extends StatelessWidget {
Key key, Key key,
this.scrollDirection: Axis.vertical, this.scrollDirection: Axis.vertical,
this.padding, this.padding,
this.initialScrollOffset: 0.0,
this.child, this.child,
}) : super(key: key) { }) : super(key: key) {
assert(scrollDirection != null); assert(scrollDirection != null);
assert(initialScrollOffset != null);
} }
final Axis scrollDirection; final Axis scrollDirection;
final EdgeInsets padding; final EdgeInsets padding;
final double initialScrollOffset;
final Widget child; final Widget child;
AxisDirection _getDirection(BuildContext context) { AxisDirection _getDirection(BuildContext context) {
...@@ -56,7 +52,6 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -56,7 +52,6 @@ class SingleChildScrollView extends StatelessWidget {
contents = new Padding(padding: padding, child: contents); contents = new Padding(padding: padding, child: contents);
return new Scrollable2( return new Scrollable2(
axisDirection: axisDirection, axisDirection: axisDirection,
initialScrollOffset: initialScrollOffset,
viewportBuilder: (BuildContext context, ViewportOffset offset) { viewportBuilder: (BuildContext context, ViewportOffset offset) {
return new _SingleChildViewport( return new _SingleChildViewport(
key: key, key: key,
......
...@@ -61,7 +61,6 @@ void flipStatefulWidget(WidgetTester tester) { ...@@ -61,7 +61,6 @@ void flipStatefulWidget(WidgetTester tester) {
class TestScrollable extends StatelessWidget { class TestScrollable extends StatelessWidget {
TestScrollable({ TestScrollable({
Key key, Key key,
this.initialScrollOffset: 0.0,
this.axisDirection: AxisDirection.down, this.axisDirection: AxisDirection.down,
this.physics, this.physics,
this.anchor: 0.0, this.anchor: 0.0,
...@@ -72,8 +71,6 @@ class TestScrollable extends StatelessWidget { ...@@ -72,8 +71,6 @@ class TestScrollable extends StatelessWidget {
assert(slivers != null); assert(slivers != null);
} }
final double initialScrollOffset;
final AxisDirection axisDirection; final AxisDirection axisDirection;
final ScrollPhysics physics; final ScrollPhysics physics;
...@@ -91,7 +88,6 @@ class TestScrollable extends StatelessWidget { ...@@ -91,7 +88,6 @@ class TestScrollable extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scrollable2( return new Scrollable2(
initialScrollOffset: initialScrollOffset,
axisDirection: axisDirection, axisDirection: axisDirection,
physics: physics, physics: physics,
scrollBehavior: scrollBehavior, scrollBehavior: scrollBehavior,
......
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