Merge branch 'feat/update-spl' into feat/message-list-view-shrink-wrap
This commit is contained in:
+8
-6
@@ -391,12 +391,14 @@ void main() {
|
||||
),
|
||||
));
|
||||
|
||||
// Insert a new opaque OverlayEntry that would prevent the first OverlayEntry
|
||||
// from doing re-layout. Since there's no relayout boundaries in the first
|
||||
// OverlayEntry, no dirty RenderObjects in its render subtree can update
|
||||
// layout.
|
||||
final newOverlay =
|
||||
OverlayEntry(builder: (context) => const SizedBox.expand(), opaque: true);
|
||||
// Insert a new opaque OverlayEntry that would prevent the first
|
||||
// OverlayEntry from doing re-layout. Since there's no relayout boundaries
|
||||
// in the first OverlayEntry, no dirty RenderObjects in its render subtree
|
||||
// can update layout.
|
||||
final newOverlay = OverlayEntry(
|
||||
builder: (context) => const SizedBox.expand(),
|
||||
opaque: true,
|
||||
);
|
||||
tester.state<OverlayState>(find.byType(Overlay)).insert(newOverlay);
|
||||
await tester.pump();
|
||||
|
||||
|
||||
+20
-6
@@ -48,7 +48,10 @@ void main() {
|
||||
itemCount: itemCount,
|
||||
itemScrollController: itemScrollController,
|
||||
itemBuilder: (context, index) {
|
||||
assert(index >= 0 && index <= itemCount - 1);
|
||||
assert(
|
||||
index >= 0 && index <= itemCount - 1,
|
||||
'index must be in the range of 0 to itemCount - 1',
|
||||
);
|
||||
return SizedBox(
|
||||
height:
|
||||
variableHeight ? (itemHeight + (index % 13) * 5) : itemHeight,
|
||||
@@ -1160,7 +1163,8 @@ void main() {
|
||||
final itemFinder = find.text('Item 399');
|
||||
expect(itemFinder, findsOneWidget);
|
||||
expect(tester.getBottomLeft(itemFinder).dy, screenHeight);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('physics', (WidgetTester tester) async {
|
||||
final itemScrollController = ItemScrollController();
|
||||
@@ -1715,7 +1719,8 @@ void main() {
|
||||
.firstWhere((position) => position.index == 9)
|
||||
.itemTrailingEdge,
|
||||
(itemHeight / screenHeight) / 2);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('List with no items', (WidgetTester tester) async {
|
||||
final itemScrollController = ItemScrollController();
|
||||
@@ -1746,7 +1751,10 @@ void main() {
|
||||
itemScrollController: itemScrollController,
|
||||
itemPositionsListener: itemPositionsListener,
|
||||
itemBuilder: (context, index) {
|
||||
assert(index >= 0 && index <= itemCount - 1);
|
||||
assert(
|
||||
index >= 0 && index <= itemCount - 1,
|
||||
'index must be in the range of 0 to itemCount - 1',
|
||||
);
|
||||
return SizedBox(
|
||||
height: itemHeight,
|
||||
child: Text('Item $index'),
|
||||
@@ -1788,7 +1796,10 @@ void main() {
|
||||
initialScrollIndex: min(100, itemCount - 1),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
assert(index >= 0 && index <= itemCount - 1);
|
||||
assert(
|
||||
index >= 0 && index <= itemCount - 1,
|
||||
'index must be in the range of 0 to itemCount - 1',
|
||||
);
|
||||
return SizedBox(
|
||||
height: itemHeight,
|
||||
child: Text('Item $index'),
|
||||
@@ -1827,7 +1838,10 @@ void main() {
|
||||
initialScrollIndex: itemCount - 1,
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
assert(index >= 0 && index <= itemCount - 1);
|
||||
assert(
|
||||
index >= 0 && index <= itemCount - 1,
|
||||
'index must be in the range of 0 to itemCount - 1',
|
||||
);
|
||||
return SizedBox(
|
||||
height: itemHeight,
|
||||
child: Text('Item $index'),
|
||||
|
||||
+12
-8
@@ -31,12 +31,13 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
// Use flex layout to ensure that the minimum height is not limited to screenHeight
|
||||
// Use flex layout to ensure that the minimum height is not limited to
|
||||
// screenHeight.
|
||||
home: Column(children: [
|
||||
// Use Constrained to make max height not more than screenHeight
|
||||
ConstrainedBox(
|
||||
constraints:
|
||||
const BoxConstraints(maxHeight: screenHeight, maxWidth: screenWidth),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: screenHeight, maxWidth: screenWidth),
|
||||
child: PositionedList(
|
||||
key: key,
|
||||
itemCount: itemCount,
|
||||
@@ -292,7 +293,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'List positioned with 5 at top then scroll up 2 programatically and shrink wrap',
|
||||
'''List positioned with 5 at top then scroll up 2 programatically and shrink wrap''',
|
||||
(WidgetTester tester) async {
|
||||
final scrollController = ScrollController();
|
||||
await setUpWidgetTest(tester,
|
||||
@@ -321,10 +322,11 @@ void main() {
|
||||
.firstWhere((position) => position.index == 12)
|
||||
.itemTrailingEdge,
|
||||
1);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'List positioned with 5 at top then scroll down 20 programatically and shrink wrap',
|
||||
'''List positioned with 5 at top then scroll down 20 programatically and shrink wrap''',
|
||||
(WidgetTester tester) async {
|
||||
final scrollController = ScrollController();
|
||||
await setUpWidgetTest(tester,
|
||||
@@ -358,7 +360,8 @@ void main() {
|
||||
.firstWhere((position) => position.index == 5)
|
||||
.itemLeadingEdge,
|
||||
-20 / 10);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'List positioned with 5 at top and initial scroll offset and shrink wrap',
|
||||
@@ -424,7 +427,8 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
// Use flex layout to ensure that the minimum height is not limited to screenHeight
|
||||
// Use flex layout to ensure that the minimum height is not limited to
|
||||
// screenHeight.
|
||||
home: PositionedList(
|
||||
itemCount: 5,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
+4
-3
@@ -27,12 +27,13 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
// Use flex layout to ensure that the minimum height is not limited to screenHeight
|
||||
// Use flex layout to ensure that the minimum height is not limited to
|
||||
// screenHeight.
|
||||
home: Column(children: [
|
||||
// Use Constrained to make max height not more than screenHeight
|
||||
ConstrainedBox(
|
||||
constraints:
|
||||
const BoxConstraints(maxHeight: screenHeight, maxWidth: screenWidth),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: screenHeight, maxWidth: screenWidth),
|
||||
child: ScrollablePositionedList.builder(
|
||||
itemCount: itemCount,
|
||||
initialScrollIndex: initialIndex,
|
||||
|
||||
Reference in New Issue
Block a user