chore: linting
This commit is contained in:
@@ -678,14 +678,16 @@ class _MessageWidgetState extends State<MessageWidget>
|
||||
? Container(
|
||||
transform:
|
||||
Matrix4.translationValues(
|
||||
widget.reverse ? 12 : -12,
|
||||
0,
|
||||
0),
|
||||
widget.reverse ? 12 : -12,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 22 * 6.0,
|
||||
),
|
||||
child: _buildReactionIndicator(
|
||||
context),
|
||||
context,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
portalAnchor:
|
||||
|
||||
+5
-3
@@ -46,9 +46,11 @@ class _RegistryWidgetState extends State<RegistryWidget> {
|
||||
}
|
||||
|
||||
class _InheritedRegistryWidget extends InheritedWidget {
|
||||
const _InheritedRegistryWidget(
|
||||
{Key? key, required this.state, required Widget child})
|
||||
: super(key: key, child: child);
|
||||
const _InheritedRegistryWidget({
|
||||
Key? key,
|
||||
required this.state,
|
||||
required Widget child,
|
||||
}) : super(key: key, child: child);
|
||||
|
||||
final _RegistryWidgetState state;
|
||||
|
||||
|
||||
+6
-5
@@ -21,10 +21,11 @@ abstract class ItemPositionsListener {
|
||||
/// Position information for an item in the list.
|
||||
class ItemPosition {
|
||||
/// Create an [ItemPosition].
|
||||
const ItemPosition(
|
||||
{required this.index,
|
||||
required this.itemLeadingEdge,
|
||||
required this.itemTrailingEdge});
|
||||
const ItemPosition({
|
||||
required this.index,
|
||||
required this.itemLeadingEdge,
|
||||
required this.itemTrailingEdge,
|
||||
});
|
||||
|
||||
/// Index of the item.
|
||||
final int index;
|
||||
@@ -52,7 +53,7 @@ class ItemPosition {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
31 * (31 * (7 + index.hashCode) + itemLeadingEdge.hashCode) +
|
||||
31 * (31 * (index.hashCode + 7) + itemLeadingEdge.hashCode) +
|
||||
itemTrailingEdge.hashCode;
|
||||
|
||||
@override
|
||||
|
||||
+43
-38
@@ -187,10 +187,11 @@ class _PositionedListState extends State<PositionedList> {
|
||||
(context, index) => widget.separatorBuilder == null
|
||||
? _buildItem(widget.positionedIndex - (index + 1))
|
||||
: _buildSeparatedListElement(
|
||||
2 * widget.positionedIndex - (index + 1)),
|
||||
widget.positionedIndex * 2 - (index + 1),
|
||||
),
|
||||
childCount: widget.separatorBuilder == null
|
||||
? widget.positionedIndex
|
||||
: 2 * widget.positionedIndex,
|
||||
: widget.positionedIndex * 2,
|
||||
addSemanticIndexes: false,
|
||||
findChildIndexCallback: widget.findChildIndexCallback,
|
||||
addRepaintBoundaries: widget.addRepaintBoundaries,
|
||||
@@ -206,7 +207,8 @@ class _PositionedListState extends State<PositionedList> {
|
||||
(context, index) => widget.separatorBuilder == null
|
||||
? _buildItem(index + widget.positionedIndex)
|
||||
: _buildSeparatedListElement(
|
||||
index + 2 * widget.positionedIndex),
|
||||
index + widget.positionedIndex * 2,
|
||||
),
|
||||
childCount: widget.itemCount != 0 ? 1 : 0,
|
||||
findChildIndexCallback: widget.findChildIndexCallback,
|
||||
addSemanticIndexes: false,
|
||||
@@ -224,7 +226,8 @@ class _PositionedListState extends State<PositionedList> {
|
||||
(context, index) => widget.separatorBuilder == null
|
||||
? _buildItem(index + widget.positionedIndex + 1)
|
||||
: _buildSeparatedListElement(
|
||||
index + 2 * widget.positionedIndex + 1),
|
||||
index + widget.positionedIndex * 2 + 1,
|
||||
),
|
||||
childCount: widget.separatorBuilder == null
|
||||
? widget.itemCount - widget.positionedIndex - 1
|
||||
: 2 * (widget.itemCount - widget.positionedIndex - 1),
|
||||
@@ -270,27 +273,27 @@ class _PositionedListState extends State<PositionedList> {
|
||||
EdgeInsets get _centerSliverPadding => widget.scrollDirection == Axis.vertical
|
||||
? widget.reverse
|
||||
? widget.padding?.copyWith(
|
||||
top: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.top
|
||||
: 0,
|
||||
bottom: widget.positionedIndex == 0
|
||||
? widget.padding!.bottom
|
||||
: 0) ??
|
||||
top: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.top
|
||||
: 0,
|
||||
bottom:
|
||||
widget.positionedIndex == 0 ? widget.padding!.bottom : 0,
|
||||
) ??
|
||||
const EdgeInsets.all(0)
|
||||
: widget.padding?.copyWith(
|
||||
top: widget.positionedIndex == 0 ? widget.padding!.top : 0,
|
||||
bottom: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.bottom
|
||||
: 0) ??
|
||||
top: widget.positionedIndex == 0 ? widget.padding!.top : 0,
|
||||
bottom: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.bottom
|
||||
: 0,
|
||||
) ??
|
||||
const EdgeInsets.all(0)
|
||||
: widget.reverse
|
||||
? widget.padding?.copyWith(
|
||||
left: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.left
|
||||
: 0,
|
||||
right: widget.positionedIndex == 0
|
||||
? widget.padding!.right
|
||||
: 0) ??
|
||||
left: widget.positionedIndex == widget.itemCount - 1
|
||||
? widget.padding!.left
|
||||
: 0,
|
||||
right: widget.positionedIndex == 0 ? widget.padding!.right : 0,
|
||||
) ??
|
||||
const EdgeInsets.all(0)
|
||||
: widget.padding?.copyWith(
|
||||
left: widget.positionedIndex == 0 ? widget.padding!.left : 0,
|
||||
@@ -329,28 +332,30 @@ class _PositionedListState extends State<PositionedList> {
|
||||
viewport.offset.pixels +
|
||||
viewport.anchor * viewport.size.height;
|
||||
positions.add(ItemPosition(
|
||||
index: key.index,
|
||||
itemLeadingEdge: itemOffset.round() /
|
||||
scrollController.position.viewportDimension,
|
||||
itemTrailingEdge: (itemOffset + box.size.height).round() /
|
||||
scrollController.position.viewportDimension));
|
||||
index: key.index,
|
||||
itemLeadingEdge: itemOffset.round() /
|
||||
scrollController.position.viewportDimension,
|
||||
itemTrailingEdge: (itemOffset + box.size.height).round() /
|
||||
scrollController.position.viewportDimension,
|
||||
));
|
||||
} else {
|
||||
final itemOffset =
|
||||
box.localToGlobal(Offset.zero, ancestor: viewport).dx;
|
||||
positions.add(ItemPosition(
|
||||
index: key.index,
|
||||
itemLeadingEdge: (widget.reverse
|
||||
? scrollController.position.viewportDimension -
|
||||
(itemOffset + box.size.width)
|
||||
: itemOffset)
|
||||
.round() /
|
||||
scrollController.position.viewportDimension,
|
||||
itemTrailingEdge: (widget.reverse
|
||||
? scrollController.position.viewportDimension -
|
||||
itemOffset
|
||||
: (itemOffset + box.size.width))
|
||||
.round() /
|
||||
scrollController.position.viewportDimension));
|
||||
index: key.index,
|
||||
itemLeadingEdge: (widget.reverse
|
||||
? scrollController.position.viewportDimension -
|
||||
(itemOffset + box.size.width)
|
||||
: itemOffset)
|
||||
.round() /
|
||||
scrollController.position.viewportDimension,
|
||||
itemTrailingEdge: (widget.reverse
|
||||
? scrollController.position.viewportDimension -
|
||||
itemOffset
|
||||
: (itemOffset + box.size.width))
|
||||
.round() /
|
||||
scrollController.position.viewportDimension,
|
||||
));
|
||||
}
|
||||
}
|
||||
widget.itemPositionsNotifier?.itemPositions.value = positions;
|
||||
|
||||
+33
-33
@@ -315,20 +315,14 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
}
|
||||
|
||||
if (widget.itemCount == 0) {
|
||||
setState(() {
|
||||
primary.target = 0;
|
||||
secondary.target = 0;
|
||||
});
|
||||
primary.target = 0;
|
||||
secondary.target = 0;
|
||||
} else {
|
||||
if (primary.target > widget.itemCount - 1) {
|
||||
setState(() {
|
||||
primary.target = widget.itemCount - 1;
|
||||
});
|
||||
primary.target = widget.itemCount - 1;
|
||||
}
|
||||
if (secondary.target > widget.itemCount - 1) {
|
||||
setState(() {
|
||||
secondary.target = widget.itemCount - 1;
|
||||
});
|
||||
secondary.target = widget.itemCount - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,19 +459,21 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
required List<double> opacityAnimationWeights,
|
||||
}) async {
|
||||
final direction = index > primary.target ? 1 : -1;
|
||||
final itemPosition = primary.itemPositionsNotifier.itemPositions.value
|
||||
.firstWhereOrNull(
|
||||
(ItemPosition itemPosition) => itemPosition.index == index);
|
||||
final itemPosition =
|
||||
primary.itemPositionsNotifier.itemPositions.value.firstWhereOrNull(
|
||||
(ItemPosition itemPosition) => itemPosition.index == index,
|
||||
);
|
||||
if (itemPosition != null) {
|
||||
// Scroll directly.
|
||||
final localScrollAmount = itemPosition.itemLeadingEdge *
|
||||
primary.scrollController.position.viewportDimension;
|
||||
await primary.scrollController.animateTo(
|
||||
primary.scrollController.offset +
|
||||
localScrollAmount -
|
||||
alignment * primary.scrollController.position.viewportDimension,
|
||||
duration: duration,
|
||||
curve: curve);
|
||||
primary.scrollController.offset +
|
||||
localScrollAmount -
|
||||
alignment * primary.scrollController.position.viewportDimension,
|
||||
duration: duration,
|
||||
curve: curve,
|
||||
);
|
||||
} else {
|
||||
final scrollAmount = _screenScrollCount *
|
||||
primary.scrollController.position.viewportDimension;
|
||||
@@ -488,7 +484,8 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
startAnimationCallback = () {};
|
||||
|
||||
opacity.parent = _opacityAnimation(opacityAnimationWeights).animate(
|
||||
AnimationController(vsync: this, duration: duration)..forward());
|
||||
AnimationController(vsync: this, duration: duration)..forward(),
|
||||
);
|
||||
secondary.scrollController.jumpTo(-direction *
|
||||
(_screenScrollCount *
|
||||
primary.scrollController.position.viewportDimension -
|
||||
@@ -496,9 +493,10 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
secondary.scrollController.position.viewportDimension));
|
||||
|
||||
startCompleter.complete(primary.scrollController.animateTo(
|
||||
primary.scrollController.offset + direction * scrollAmount,
|
||||
duration: duration,
|
||||
curve: curve));
|
||||
primary.scrollController.offset + direction * scrollAmount,
|
||||
duration: duration,
|
||||
curve: curve,
|
||||
));
|
||||
endCompleter.complete(secondary.scrollController
|
||||
.animateTo(0, duration: duration, curve: curve));
|
||||
});
|
||||
@@ -548,14 +546,17 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
const endOpacity = 1.0;
|
||||
return TweenSequence<double>(<TweenSequenceItem<double>>[
|
||||
TweenSequenceItem<double>(
|
||||
tween: ConstantTween<double>(startOpacity),
|
||||
weight: opacityAnimationWeights[0]),
|
||||
tween: ConstantTween<double>(startOpacity),
|
||||
weight: opacityAnimationWeights[0],
|
||||
),
|
||||
TweenSequenceItem<double>(
|
||||
tween: Tween<double>(begin: startOpacity, end: endOpacity),
|
||||
weight: opacityAnimationWeights[1]),
|
||||
tween: Tween<double>(begin: startOpacity, end: endOpacity),
|
||||
weight: opacityAnimationWeights[1],
|
||||
),
|
||||
TweenSequenceItem<double>(
|
||||
tween: ConstantTween<double>(endOpacity),
|
||||
weight: opacityAnimationWeights[2]),
|
||||
tween: ConstantTween<double>(endOpacity),
|
||||
weight: opacityAnimationWeights[2],
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -565,11 +566,10 @@ class _ScrollablePositionedListState extends State<ScrollablePositionedList>
|
||||
position.itemLeadingEdge < 1 && position.itemTrailingEdge > 0);
|
||||
if (itemPositions.isNotEmpty) {
|
||||
PageStorage.of(context)!.writeState(
|
||||
context,
|
||||
itemPositions.reduce((value, element) =>
|
||||
value.itemLeadingEdge < element.itemLeadingEdge
|
||||
? value
|
||||
: element));
|
||||
context,
|
||||
itemPositions.reduce((value, element) =>
|
||||
value.itemLeadingEdge < element.itemLeadingEdge ? value : element),
|
||||
);
|
||||
}
|
||||
widget.itemPositionsNotifier?.itemPositions.value = itemPositions;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,14 @@ class UnboundedViewport extends Viewport {
|
||||
List<Widget> slivers = const <Widget>[],
|
||||
}) : _anchor = anchor,
|
||||
super(
|
||||
key: key,
|
||||
axisDirection: axisDirection,
|
||||
crossAxisDirection: crossAxisDirection,
|
||||
offset: offset,
|
||||
center: center,
|
||||
cacheExtent: cacheExtent,
|
||||
slivers: slivers);
|
||||
key: key,
|
||||
axisDirection: axisDirection,
|
||||
crossAxisDirection: crossAxisDirection,
|
||||
offset: offset,
|
||||
center: center,
|
||||
cacheExtent: cacheExtent,
|
||||
slivers: slivers,
|
||||
);
|
||||
|
||||
// [Viewport] enforces constraints on [Viewport.anchor], so we need our own
|
||||
// version.
|
||||
@@ -76,12 +77,13 @@ class UnboundedRenderViewport extends RenderViewport {
|
||||
double? cacheExtent,
|
||||
}) : _anchor = anchor,
|
||||
super(
|
||||
axisDirection: axisDirection,
|
||||
crossAxisDirection: crossAxisDirection,
|
||||
offset: offset,
|
||||
center: center,
|
||||
cacheExtent: cacheExtent,
|
||||
children: children);
|
||||
axisDirection: axisDirection,
|
||||
crossAxisDirection: crossAxisDirection,
|
||||
offset: offset,
|
||||
center: center,
|
||||
cacheExtent: cacheExtent,
|
||||
children: children,
|
||||
);
|
||||
|
||||
static const int _maxLayoutCycles = 10;
|
||||
|
||||
@@ -179,8 +181,11 @@ class UnboundedRenderViewport extends RenderViewport {
|
||||
double correction;
|
||||
var count = 0;
|
||||
do {
|
||||
correction = _attemptLayout(mainAxisExtent, crossAxisExtent,
|
||||
offset.pixels + centerOffsetAdjustment);
|
||||
correction = _attemptLayout(
|
||||
mainAxisExtent,
|
||||
crossAxisExtent,
|
||||
offset.pixels + centerOffsetAdjustment,
|
||||
);
|
||||
if (correction != 0.0) {
|
||||
offset.correctBy(correction);
|
||||
} else {
|
||||
@@ -200,29 +205,33 @@ class UnboundedRenderViewport extends RenderViewport {
|
||||
if (count >= _maxLayoutCycles) {
|
||||
assert(count != 1, 'count not equal to 1');
|
||||
throw FlutterError(
|
||||
'A RenderViewport exceeded its maximum number of layout cycles.\n'
|
||||
'RenderViewport render objects, during layout, can retry if either their '
|
||||
'slivers or their ViewportOffset decide that the offset should be corrected '
|
||||
'to take into account information collected during that layout.\n'
|
||||
'In the case of this RenderViewport object, however, this happened $count '
|
||||
'times and still there was no consensus on the scroll offset. This usually '
|
||||
'indicates a bug. Specifically, it means that one of the following three '
|
||||
'problems is being experienced by the RenderViewport object:\n'
|
||||
' * One of the RenderSliver children or the ViewportOffset have a bug such'
|
||||
' that they always think that they need to correct the offset regardless.\n'
|
||||
' * Some combination of the RenderSliver children and the ViewportOffset'
|
||||
' have a bad interaction such that one applies a correction then another'
|
||||
' applies a reverse correction, leading to an infinite loop of corrections.\n'
|
||||
' * There is a pathological case that would eventually resolve, but it is'
|
||||
' so complicated that it cannot be resolved in any reasonable number of'
|
||||
' layout passes.');
|
||||
'A RenderViewport exceeded its maximum number of layout cycles.\n'
|
||||
'RenderViewport render objects, during layout, can retry if either their '
|
||||
'slivers or their ViewportOffset decide that the offset should be corrected '
|
||||
'to take into account information collected during that layout.\n'
|
||||
'In the case of this RenderViewport object, however, this happened $count '
|
||||
'times and still there was no consensus on the scroll offset. This usually '
|
||||
'indicates a bug. Specifically, it means that one of the following three '
|
||||
'problems is being experienced by the RenderViewport object:\n'
|
||||
' * One of the RenderSliver children or the ViewportOffset have a bug such'
|
||||
' that they always think that they need to correct the offset regardless.\n'
|
||||
' * Some combination of the RenderSliver children and the ViewportOffset'
|
||||
' have a bad interaction such that one applies a correction then another'
|
||||
' applies a reverse correction, leading to an infinite loop of corrections.\n'
|
||||
' * There is a pathological case that would eventually resolve, but it is'
|
||||
' so complicated that it cannot be resolved in any reasonable number of'
|
||||
' layout passes.',
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}(), 'count needs to be bigger than _maxLayoutCycles');
|
||||
}
|
||||
|
||||
double _attemptLayout(
|
||||
double mainAxisExtent, double crossAxisExtent, double correctedOffset) {
|
||||
double mainAxisExtent,
|
||||
double crossAxisExtent,
|
||||
double correctedOffset,
|
||||
) {
|
||||
assert(!mainAxisExtent.isNaN, 'assert mainAxisExtent.isNaN');
|
||||
assert(mainAxisExtent >= 0.0, 'assert mainAxisExtent >= 0.0');
|
||||
assert(crossAxisExtent.isFinite, 'assert crossAxisExtent.isFinite');
|
||||
@@ -301,7 +310,9 @@ class UnboundedRenderViewport extends RenderViewport {
|
||||
|
||||
@override
|
||||
void updateOutOfBandData(
|
||||
GrowthDirection growthDirection, SliverGeometry childLayoutGeometry) {
|
||||
GrowthDirection growthDirection,
|
||||
SliverGeometry childLayoutGeometry,
|
||||
) {
|
||||
switch (growthDirection) {
|
||||
case GrowthDirection.forward:
|
||||
_maxScrollExtent += childLayoutGeometry.scrollExtent;
|
||||
|
||||
+8
-8
@@ -208,9 +208,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 1')),
|
||||
const Offset(10 + itemWidth, 10));
|
||||
const Offset(itemWidth + 10, 10));
|
||||
expect(tester.getBottomRight(find.text('Item 1')),
|
||||
const Offset(10 + 2 * itemWidth, screenHeight - 10));
|
||||
const Offset(10 + itemWidth * 2, screenHeight - 10));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 490, duration: scrollDuration));
|
||||
@@ -240,9 +240,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 2')),
|
||||
const Offset(10 + 2 * itemWidth, 10));
|
||||
const Offset(10 + itemWidth * 2, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 3')),
|
||||
const Offset(10 + 3 * itemWidth, 10));
|
||||
const Offset(10 + itemWidth * 3, 10));
|
||||
});
|
||||
|
||||
testWidgets('padding test - reversed - centered sliver at right',
|
||||
@@ -258,9 +258,9 @@ void main() {
|
||||
expect(tester.getTopRight(find.text('Item 0')),
|
||||
const Offset(screenWidth - 10, 10));
|
||||
expect(tester.getTopRight(find.text('Item 1')),
|
||||
const Offset(screenWidth - (10 + itemWidth), 10));
|
||||
const Offset(screenWidth - (itemWidth + 10), 10));
|
||||
expect(tester.getBottomLeft(find.text('Item 1')),
|
||||
const Offset(screenWidth - (10 + 2 * itemWidth), screenHeight - 10));
|
||||
const Offset(screenWidth - (10 + itemWidth * 2), screenHeight - 10));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 490, duration: scrollDuration));
|
||||
@@ -291,8 +291,8 @@ void main() {
|
||||
expect(tester.getTopRight(find.text('Item 0')),
|
||||
const Offset(screenWidth - 10, 10));
|
||||
expect(tester.getTopRight(find.text('Item 2')),
|
||||
const Offset(screenWidth - (10 + 2 * itemWidth), 10));
|
||||
const Offset(screenWidth - (10 + itemWidth * 2), 10));
|
||||
expect(tester.getTopRight(find.text('Item 3')),
|
||||
const Offset(screenWidth - (10 + 3 * itemWidth), 10));
|
||||
const Offset(screenWidth - (10 + itemWidth * 3), 10));
|
||||
});
|
||||
}
|
||||
|
||||
+3
-3
@@ -197,7 +197,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, topItem: 5);
|
||||
|
||||
await tester.drag(
|
||||
find.byType(PositionedList), const Offset(0, 2 * itemHeight));
|
||||
find.byType(PositionedList), const Offset(0, itemHeight * 2));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Item 2'), findsNothing);
|
||||
@@ -248,7 +248,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, scrollController: scrollController);
|
||||
await tester.pump();
|
||||
|
||||
scrollController.jumpTo(5 * itemHeight);
|
||||
scrollController.jumpTo(itemHeight * 5);
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -307,7 +307,7 @@ void main() {
|
||||
await setUpWidgetTest(tester,
|
||||
topItem: 5, scrollController: scrollController);
|
||||
|
||||
scrollController.jumpTo(20 * itemHeight);
|
||||
scrollController.jumpTo(itemHeight * 20);
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
|
||||
+4
-4
@@ -162,7 +162,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, topItem: 5);
|
||||
|
||||
await tester.drag(
|
||||
find.byType(PositionedList), const Offset(0, 2 * itemHeight));
|
||||
find.byType(PositionedList), const Offset(0, itemHeight * 2));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Item 6'), findsNothing);
|
||||
@@ -186,7 +186,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, scrollController: scrollController);
|
||||
await tester.pump();
|
||||
|
||||
scrollController.jumpTo(5 * itemHeight);
|
||||
scrollController.jumpTo(itemHeight * 5);
|
||||
await tester.pump();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -214,7 +214,7 @@ void main() {
|
||||
await setUpWidgetTest(tester,
|
||||
topItem: 5, scrollController: scrollController);
|
||||
|
||||
scrollController.jumpTo(2 * itemHeight);
|
||||
scrollController.jumpTo(itemHeight * 2);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Item 6'), findsNothing);
|
||||
@@ -242,7 +242,7 @@ void main() {
|
||||
testWidgets('List positioned with 5 at bottom and initial scroll offset',
|
||||
(WidgetTester tester) async {
|
||||
final scrollController =
|
||||
ScrollController(initialScrollOffset: 2 * itemHeight);
|
||||
ScrollController(initialScrollOffset: itemHeight * 2);
|
||||
await setUpWidgetTest(tester,
|
||||
topItem: 5, scrollController: scrollController);
|
||||
|
||||
|
||||
+4
-4
@@ -200,9 +200,9 @@ void main() {
|
||||
expect(tester.getBottomLeft(find.text('Item 0')),
|
||||
const Offset(10, screenHeight - 10));
|
||||
expect(tester.getBottomLeft(find.text('Item 1')),
|
||||
const Offset(10, screenHeight - (10 + itemHeight)));
|
||||
const Offset(10, screenHeight - (itemHeight + 10)));
|
||||
expect(tester.getTopRight(find.text('Item 1')),
|
||||
const Offset(screenWidth - 10, screenHeight - (10 + 2 * itemHeight)));
|
||||
const Offset(screenWidth - 10, screenHeight - (10 + itemHeight * 2)));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 490, duration: scrollDuration));
|
||||
@@ -232,8 +232,8 @@ void main() {
|
||||
expect(tester.getBottomLeft(find.text('Item 0')),
|
||||
const Offset(10, screenHeight - 10));
|
||||
expect(tester.getBottomLeft(find.text('Item 2')),
|
||||
const Offset(10, screenHeight - (10 + 2 * itemHeight)));
|
||||
const Offset(10, screenHeight - (10 + itemHeight * 2)));
|
||||
expect(tester.getBottomLeft(find.text('Item 3')),
|
||||
const Offset(10, screenHeight - (10 + 3 * itemHeight)));
|
||||
const Offset(10, screenHeight - (10 + itemHeight * 3)));
|
||||
});
|
||||
}
|
||||
|
||||
+8
-8
@@ -1211,7 +1211,7 @@ void main() {
|
||||
itemScrollController: itemScrollController, initialIndex: 5);
|
||||
|
||||
await tester.drag(
|
||||
find.byType(ScrollablePositionedList), const Offset(0, 2 * itemHeight));
|
||||
find.byType(ScrollablePositionedList), const Offset(0, itemHeight * 2));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final indexSemantics3 = tester.widget<IndexedSemantics>(find.ancestor(
|
||||
@@ -1234,7 +1234,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.drag(
|
||||
find.byType(ScrollablePositionedList), const Offset(0, 2 * itemHeight));
|
||||
find.byType(ScrollablePositionedList), const Offset(0, itemHeight * 2));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final indexSemantics3b = tester.widget<IndexedSemantics>(find.ancestor(
|
||||
@@ -1339,9 +1339,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 1')),
|
||||
const Offset(10, 10 + itemHeight));
|
||||
const Offset(10, itemHeight + 10));
|
||||
expect(tester.getTopRight(find.text('Item 1')),
|
||||
const Offset(screenWidth - 10, 10 + itemHeight));
|
||||
const Offset(screenWidth - 10, itemHeight + 10));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 490, duration: scrollDuration));
|
||||
@@ -1371,9 +1371,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 2')),
|
||||
const Offset(10, 10 + 2 * itemHeight));
|
||||
const Offset(10, 10 + itemHeight * 2));
|
||||
expect(tester.getTopLeft(find.text('Item 3')),
|
||||
const Offset(10, 10 + 3 * itemHeight));
|
||||
const Offset(10, 10 + itemHeight * 3));
|
||||
});
|
||||
|
||||
testWidgets('padding - first element centered - scroll up',
|
||||
@@ -1862,7 +1862,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Large minCacheExtent', (WidgetTester tester) async {
|
||||
await setUpWidgetTest(tester, minCacheExtent: 200 * itemHeight);
|
||||
await setUpWidgetTest(tester, minCacheExtent: itemHeight * 200);
|
||||
|
||||
expect(find.text('Item 100', skipOffstage: false), findsOneWidget);
|
||||
});
|
||||
@@ -1911,7 +1911,7 @@ void main() {
|
||||
await setUpWidgetTest(
|
||||
tester,
|
||||
itemScrollController: itemScrollController,
|
||||
minCacheExtent: 200 * itemHeight,
|
||||
minCacheExtent: itemHeight * 200,
|
||||
);
|
||||
|
||||
var fadeTransition = tester.widget<FadeTransition>(find
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, itemCount: 3, topItem: 1);
|
||||
|
||||
await tester.drag(
|
||||
find.byType(PositionedList), const Offset(0, 2 * itemHeight));
|
||||
find.byType(PositionedList), const Offset(0, itemHeight * 2));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Item 0'), findsOneWidget);
|
||||
|
||||
+3
-3
@@ -320,7 +320,7 @@ void main() {
|
||||
await setUpWidgetTest(tester, initialIndex: 5);
|
||||
|
||||
await tester.drag(
|
||||
find.byType(ScrollablePositionedList), const Offset(0, 4 * itemHeight));
|
||||
find.byType(ScrollablePositionedList), const Offset(0, itemHeight * 4));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final indexSemantics3 = tester.widget<IndexedSemantics>(find.ancestor(
|
||||
@@ -401,9 +401,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 1')),
|
||||
const Offset(10, 10 + itemHeight + separatorHeight));
|
||||
const Offset(10, itemHeight + 10 + separatorHeight));
|
||||
expect(tester.getTopRight(find.text('Item 1')),
|
||||
const Offset(screenWidth - 10, 10 + itemHeight + separatorHeight));
|
||||
const Offset(screenWidth - 10, itemHeight + 10 + separatorHeight));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 494, duration: scrollDuration));
|
||||
|
||||
+2
-2
@@ -166,9 +166,9 @@ void main() {
|
||||
|
||||
expect(tester.getTopLeft(find.text('Item 0')), const Offset(10, 10));
|
||||
expect(tester.getTopLeft(find.text('Item 1')),
|
||||
const Offset(10 + itemWidth + separatorWidth, 10));
|
||||
const Offset(itemWidth + 10 + separatorWidth, 10));
|
||||
expect(tester.getBottomRight(find.text('Item 1')),
|
||||
const Offset(10 + 2 * itemWidth + separatorWidth, screenHeight - 10));
|
||||
const Offset(10 + itemWidth * 2 + separatorWidth, screenHeight - 10));
|
||||
|
||||
unawaited(
|
||||
itemScrollController.scrollTo(index: 494, duration: scrollDuration));
|
||||
|
||||
Reference in New Issue
Block a user