Commit 9df8b721 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Deprecate old list-based scrolling widgets (#8120)

- MaterialList
 - ScrollableList
 - ScrollableLazyList
 - LazyBlock

All of these widgets can be replaced by ListView now.
parent c6757570
......@@ -45,7 +45,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
@override
Widget build(BuildContext context) {
Widget body = new MaterialList(
Widget body = new MaterialList( // ignore: DEPRECATED_MEMBER_USE
type: MaterialListType.threeLine,
padding: const EdgeInsets.all(8.0),
scrollableKey: _scrollableKey,
......
......@@ -8,7 +8,6 @@ import 'package:flutter/widgets.dart';
///
/// See also:
///
/// * [MaterialList]
/// * [ListItem]
/// * [kListItemExtent]
/// * <https://material.google.com/components/lists.html#lists-specs>
......@@ -57,6 +56,7 @@ Map<MaterialListType, double> kListItemExtent = const <MaterialListType, double>
/// expand.
/// * [GridView]
/// * <https://material.google.com/components/lists.html>
@Deprecated('use ListView instead')
class MaterialList extends StatelessWidget {
/// Creates a material list.
///
......
......@@ -71,11 +71,6 @@ enum _DismissTransition {
/// it returns. The refresh indicator disappears after the callback's
/// Future has completed.
///
/// The required [scrollableKey] parameter identifies the scrollable widget
/// whose scrollOffset is monitored by this RefreshIndicator. The same
/// scrollableKey must also be set on the scrollable. See [Block.scrollableKey],
/// [ScrollableList.scrollableKey], etc.
///
/// See also:
///
/// * <https://material.google.com/patterns/swipe-to-refresh.html>
......
......@@ -256,7 +256,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
///
/// * [TwoLevelSublist]
/// * [TwoLevelListItem]
/// * [MaterialList], for lists that only have one level.
/// * [ListView], for lists that only have one level.
class TwoLevelList extends StatelessWidget {
/// Creates a scrollable list of items that can expand and collapse.
///
......
......@@ -22,6 +22,7 @@ import 'scroll_behavior.dart';
///
/// See also [LazyBlockBuilder] for an implementation of LazyBlockDelegate based
/// on an [IndexedWidgetBuilder] closure.
@Deprecated('use SliverChildDelegate instead')
abstract class LazyBlockDelegate {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
......@@ -86,9 +87,10 @@ abstract class LazyBlockDelegate {
double estimateTotalExtent(int firstIndex, int lastIndex, double minOffset, double firstStartOffset, double lastEndOffset);
}
/// Signature for callbacks that estimate the total height of a [LazyBlock]'s contents.
/// Signature for callbacks that estimate the total height of a `LazyBlock`'s contents.
///
/// See [LazyBlockDelegate.estimateTotalExtent] for details.
/// See `LazyBlockDelegate.estimateTotalExtent` for details.
@deprecated
typedef double TotalExtentEstimator(int firstIndex, int lastIndex, double minOffset, double firstStartOffset, double lastEndOffset);
/// Uses an [IndexedWidgetBuilder] to provide children for [LazyBlock].
......@@ -100,6 +102,7 @@ typedef double TotalExtentEstimator(int firstIndex, int lastIndex, double minOff
/// [estimateTotalExtent] callback.
///
/// See also [LazyBlockViewport].
@Deprecated('use SliverChildBuilderDelegate instead')
class LazyBlockBuilder extends LazyBlockDelegate {
/// Creates a LazyBlockBuilder based on the given builder.
LazyBlockBuilder({ this.builder, this.totalExtentEstimator }) {
......@@ -143,6 +146,7 @@ class LazyBlockBuilder extends LazyBlockDelegate {
/// Uses a [List<Widget>] to provide children for [LazyBlock].
///
/// See also [LazyBlockViewport].
@Deprecated('use SliverChildListDelegate instead')
class LazyBlockChildren extends LazyBlockDelegate {
/// Creates a LazyBlockChildren that displays the given children.
///
......@@ -202,6 +206,7 @@ class LazyBlockChildren extends LazyBlockDelegate {
/// Consider [Block] if you have a small number of children that will only
/// scroll in unusual circumstances (e.g. when the user's device is smaller than
/// expected).
@Deprecated('use ListView instead')
class LazyBlock extends StatelessWidget {
/// Creates an infinite scrolling list of variable height children.
///
......@@ -301,7 +306,7 @@ class LazyBlock extends StatelessWidget {
}
}
/// Signature used by [LazyBlockViewport] to report its interior and exterior dimensions.
/// Signature used by `LazyBlockViewport` to report its interior and exterior dimensions.
///
/// * The `firstIndex` is the index of the child that is visible at the
/// starting edge of the viewport.
......@@ -323,6 +328,7 @@ class LazyBlock extends StatelessWidget {
/// * The `containerExtent` is the exterior dimension of the viewport (i.e.,
/// the amount of the thing inside the viewport that is visible from outside
/// the viewport).
@deprecated
typedef void LazyBlockExtentsChangedCallback(int firstIndex, int lastIndex, double firstStartOffset, double lastEndOffset, double minScrollOffset, double containerExtent);
/// A viewport on an infinite list of variable height children.
......@@ -346,6 +352,7 @@ typedef void LazyBlockExtentsChangedCallback(int firstIndex, int lastIndex, doub
/// is only one child.
///
/// For a scrollable version of this widget, see [LazyBlock].
@deprecated
class LazyBlockViewport extends RenderObjectWidget {
/// Creates a viewport on an infinite list of variable height children.
///
......@@ -395,8 +402,10 @@ class LazyBlockViewport extends RenderObjectWidget {
_RenderLazyBlock createRenderObject(BuildContext context) => new _RenderLazyBlock();
}
@deprecated
class _LazyBlockParentData extends ContainerBoxParentDataMixin<RenderBox> { }
@deprecated
class _RenderLazyBlock extends RenderVirtualViewport<_LazyBlockParentData> {
_RenderLazyBlock({
Offset paintOffset: Offset.zero,
......@@ -471,6 +480,7 @@ class _RenderLazyBlock extends RenderVirtualViewport<_LazyBlockParentData> {
}
}
@deprecated
class _LazyBlockElement extends RenderObjectElement {
_LazyBlockElement(LazyBlockViewport widget) : super(widget);
......
......@@ -35,6 +35,7 @@ import 'virtual_viewport.dart';
/// * [ScrollableLazyList], a more efficient version of [ScrollableList].
/// * [LazyBlock], a more efficient version of [Block].
/// * [ScrollableViewport], which only has one child.
@Deprecated('use ListView instead')
class ScrollableList extends StatelessWidget {
/// Creats a scrollable list of children that have equal size.
///
......@@ -381,6 +382,7 @@ class _VirtualListViewportElement extends VirtualViewportElement {
/// * [LazyListViewport].
/// * [LazyBlockViewport].
/// * [GridViewport].
@deprecated
class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable {
/// Creates a virtual viewport onto a list of equally sized children.
///
......@@ -423,6 +425,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable
///
/// * [ScrollableList].
/// * [LazyBlock].
@Deprecated('use ListView.builder instead')
class ScrollableLazyList extends StatelessWidget {
/// Creates an infinite scrollable list of children that have equal size.
///
......@@ -578,6 +581,7 @@ class ScrollableLazyList extends StatelessWidget {
///
/// * [ListViewport].
/// * [LazyBlockViewport].
@deprecated
class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuilder {
/// Creates a virtual viewport onto an extremely large or infinite list of equally sized children.
///
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('MaterialList default control', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new MaterialList()));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment