-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to Reproduce
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'List playground',
home: TestPage(),
);
}
}
class TestPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
List<String> items = ['1', '2', '3', '4', '5'];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SizedBox(
width: 44.4,
height: 30.0,
child: Directionality(
textDirection: TextDirection.ltr,
child: CustomScrollView(
slivers: <Widget>[
SliverFixedExtentList(
itemExtent: 22.2,
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return TextWidget(
items[index],
);
},
childCount : items.length,
),
),
],
),
),
),
),
);
}
}
class TextWidget extends StatefulWidget {
const TextWidget(this.data);
final String data;
@override
TextWidgetState createState() => TextWidgetState();
}
class TextWidgetState extends State<TextWidget>{
@override
void dispose() {
print('disposed ${widget.data}');
super.dispose();
}
@override
Widget build(BuildContext context) {
return Text(widget.data);
}
}When scrolling the sliver in the middle, It should disposes the elements that are not in view. Actual, it doesn't dispose them.
It turns out in RenderSliverFixedExtentBoxAdaptor.constraints.scrollOffset is always zero no matter how far you drag the scroll view, so it does not do the garbage collection to remove the widget that are not in view.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team