forked from firka/flutter
Updated GridView API Doc (#71611)
This commit is contained in:
@@ -1513,28 +1513,6 @@ class ListView extends BoxScrollView {
|
||||
/// [CustomScrollView.slivers] property instead of the grid itself, and having
|
||||
/// the [SliverGrid] instead be a child of the [SliverPadding].
|
||||
///
|
||||
/// By default, [ListView] will automatically pad the list's scrollable
|
||||
/// extremities to avoid partial obstructions indicated by [MediaQuery]'s
|
||||
/// padding. To avoid this behavior, override with a zero [padding] property.
|
||||
///
|
||||
/// {@tool snippet}
|
||||
/// The following example demonstrates how to override the default top padding
|
||||
/// using [MediaQuery.removePadding].
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget myWidget(BuildContext context) {
|
||||
/// return MediaQuery.removePadding(
|
||||
/// context: context,
|
||||
/// removeTop: true,
|
||||
/// child: ListView.builder(
|
||||
/// itemCount: 25,
|
||||
/// itemBuilder: (BuildContext context, int index) => ListTile(title: Text('item $index')),
|
||||
/// )
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// Once code has been ported to use [CustomScrollView], other slivers, such as
|
||||
/// [SliverList] or [SliverAppBar], can be put in the [CustomScrollView.slivers]
|
||||
/// list.
|
||||
@@ -1644,6 +1622,37 @@ class ListView extends BoxScrollView {
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// By default, [GridView] will automatically pad the limits of the
|
||||
/// grids's scrollable to avoid partial obstructions indicated by
|
||||
/// [MediaQuery]'s padding. To avoid this behavior, override with a
|
||||
/// zero [padding] property.
|
||||
///
|
||||
/// {@tool snippet}
|
||||
/// The following example demonstrates how to override the default top padding
|
||||
/// using [MediaQuery.removePadding].
|
||||
///
|
||||
/// ```dart
|
||||
/// Widget myWidget(BuildContext context) {
|
||||
/// return MediaQuery.removePadding(
|
||||
/// context: context,
|
||||
/// removeTop: true,
|
||||
/// child: GridView.builder(
|
||||
/// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
/// crossAxisCount: 3,
|
||||
/// ),
|
||||
/// itemCount: 300,
|
||||
/// itemBuilder: (BuildContext context, int index) {
|
||||
/// return Card(
|
||||
/// color: Colors.amber,
|
||||
/// child: Center(child: Text('$index')),
|
||||
/// );
|
||||
/// }
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [SingleChildScrollView], which is a scrollable widget that has a single
|
||||
|
||||
Reference in New Issue
Block a user