Unverified Commit 268656a8 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Updated GridView API Doc (#71611)

parent 4300226a
...@@ -1513,28 +1513,6 @@ class ListView extends BoxScrollView { ...@@ -1513,28 +1513,6 @@ class ListView extends BoxScrollView {
/// [CustomScrollView.slivers] property instead of the grid itself, and having /// [CustomScrollView.slivers] property instead of the grid itself, and having
/// the [SliverGrid] instead be a child of the [SliverPadding]. /// 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 /// Once code has been ported to use [CustomScrollView], other slivers, such as
/// [SliverList] or [SliverAppBar], can be put in the [CustomScrollView.slivers] /// [SliverList] or [SliverAppBar], can be put in the [CustomScrollView.slivers]
/// list. /// list.
...@@ -1644,6 +1622,37 @@ class ListView extends BoxScrollView { ...@@ -1644,6 +1622,37 @@ class ListView extends BoxScrollView {
/// ``` /// ```
/// {@end-tool} /// {@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: /// See also:
/// ///
/// * [SingleChildScrollView], which is a scrollable widget that has a single /// * [SingleChildScrollView], which is a scrollable widget that has a single
......
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