Skip to content

Commit

Permalink
Fix shrinkwrap on animated list (flutter#115104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piinks authored and gspencergoog committed Jan 19, 2023
1 parent 86faa06 commit 1afee5f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/flutter/lib/src/widgets/animated_scroll_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ abstract class _AnimatedScrollViewState<T extends _AnimatedScrollView> extends S
primary: widget.primary,
physics: widget.physics,
clipBehavior: widget.clipBehavior,
shrinkWrap: widget.shrinkWrap,
slivers: <Widget>[
SliverPadding(
padding: widget.padding ?? EdgeInsets.zero,
Expand Down
25 changes: 25 additions & 0 deletions packages/flutter/test/widgets/animated_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,31 @@ void main() {

expect(tester.widget<CustomScrollView>(find.byType(CustomScrollView)).clipBehavior, clipBehavior);
});

testWidgets('AnimatedList.shrinkwrap is forwarded to its inner CustomScrollView', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/115040
final ScrollController controller = ScrollController();
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: AnimatedList(
controller: controller,
initialItemCount: 2,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index, Animation<double> _) {
return SizedBox(
height: 100.0,
child: Center(
child: Text('Item $index'),
),
);
},
),
),
);

expect(tester.widget<CustomScrollView>(find.byType(CustomScrollView)).shrinkWrap, true);
});
}


Expand Down

0 comments on commit 1afee5f

Please sign in to comment.