Fix shrinkwrap on animated list (#115104)
This commit is contained in:
parent
4e7dbefd92
commit
d41308179a
@ -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,
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user