Refresh indicator overscroll (#5836)
* Added OverscrollIndicatorEdge et al * RefreshIndicator only clamps its scrollable edge * added a test * Updated the test * fixed lint-os * fixed a typo * Scrollable should restore its viewport dimensions when it reappears * removed an accidental commit * updated per review feedback
This commit is contained in:
@@ -45,46 +45,34 @@ class OverscrollDemoState extends State<OverscrollDemo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget body = new MaterialList(
|
||||
type: MaterialListType.threeLine,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
scrollableKey: _scrollableKey,
|
||||
children: _items.map((String item) {
|
||||
return new ListItem(
|
||||
isThreeLine: true,
|
||||
leading: new CircleAvatar(child: new Text(item)),
|
||||
title: new Text('This item represents $item.'),
|
||||
subtitle: new Text('Even more additional list item information appears on line three.')
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
String indicatorTypeText;
|
||||
switch(_type) {
|
||||
switch (_type) {
|
||||
case IndicatorType.overscroll:
|
||||
indicatorTypeText = 'Over-scroll indicator';
|
||||
break;
|
||||
case IndicatorType.refresh:
|
||||
indicatorTypeText = 'Refresh indicator';
|
||||
break;
|
||||
}
|
||||
|
||||
// The default ScrollConfiguration doesn't include the
|
||||
// OverscrollIndicator. That's what we want, since this demo
|
||||
// adds the OverscrollIndicator itself.
|
||||
Widget body = new ScrollConfiguration(
|
||||
child: new MaterialList(
|
||||
type: MaterialListType.threeLine,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
scrollableKey: _scrollableKey,
|
||||
children: _items.map((String item) {
|
||||
return new ListItem(
|
||||
isThreeLine: true,
|
||||
leading: new CircleAvatar(child: new Text(item)),
|
||||
title: new Text('This item represents $item.'),
|
||||
subtitle: new Text('Even more additional list item information appears on line three.')
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
switch(_type) {
|
||||
case IndicatorType.overscroll:
|
||||
body = new OverscrollIndicator(child: body);
|
||||
break;
|
||||
case IndicatorType.refresh:
|
||||
body = new RefreshIndicator(
|
||||
key: _refreshIndicatorKey,
|
||||
child: body,
|
||||
refresh: refresh,
|
||||
scrollableKey: _scrollableKey,
|
||||
location: RefreshIndicatorLocation.top
|
||||
location: RefreshIndicatorLocation.top,
|
||||
child: body,
|
||||
);
|
||||
indicatorTypeText = 'Refresh indicator';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ class _RecipePageState extends State<RecipePage> {
|
||||
)
|
||||
),
|
||||
new ClampOverscrolls(
|
||||
value: true,
|
||||
edge: ScrollableEdge.both,
|
||||
child: new ScrollableViewport(
|
||||
scrollableKey: _scrollableKey,
|
||||
child: new RepaintBoundary(
|
||||
|
||||
Reference in New Issue
Block a user