From 268656a8a0fff5214f99cd3e03134a692e8cf0b5 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Fri, 4 Dec 2020 09:54:12 -0800 Subject: [PATCH] Updated GridView API Doc (#71611) --- .../flutter/lib/src/widgets/scroll_view.dart | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart index 0f9592e610..88bc59c181 100644 --- a/packages/flutter/lib/src/widgets/scroll_view.dart +++ b/packages/flutter/lib/src/widgets/scroll_view.dart @@ -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