@@ -454,6 +454,45 @@ abstract class BoxScrollView extends ScrollView {
454
454
/// [SliverGrid] or [SliverAppBar] , can be put in the [CustomScrollView.slivers]
455
455
/// list.
456
456
///
457
+ /// ### Sample code
458
+ ///
459
+ /// Here are two brief snippets showing a [ListView] and its equivalent using
460
+ /// [CustomScrollView] :
461
+ ///
462
+ /// ```dart
463
+ /// new ListView(
464
+ /// shrinkWrap: true,
465
+ /// padding: const EdgeInsets.all(20.0),
466
+ /// children: <Widget>[
467
+ /// const Text('I\'m dedicating every day to you'),
468
+ /// const Text('Domestic life was never quite my style'),
469
+ /// const Text('When you smile, you knock me out, I fall apart'),
470
+ /// const Text('And I thought I was so smart'),
471
+ /// ],
472
+ /// )
473
+ /// ```
474
+ ///
475
+ /// ```dart
476
+ /// new CustomScrollView(
477
+ /// shrinkWrap: true,
478
+ /// slivers: <Widget>[
479
+ /// new SliverPadding(
480
+ /// padding: const EdgeInsets.all(20.0),
481
+ /// sliver: new SliverList(
482
+ /// delegate: new SliverChildListDelegate(
483
+ /// <Widget>[
484
+ /// const Text('I\'m dedicating every day to you'),
485
+ /// const Text('Domestic life was never quite my style'),
486
+ /// const Text('When you smile, you knock me out, I fall apart'),
487
+ /// const Text('And I thought I was so smart'),
488
+ /// ],
489
+ /// ),
490
+ /// ),
491
+ /// ),
492
+ /// ],
493
+ /// )
494
+ /// ```
495
+ ///
457
496
/// See also:
458
497
///
459
498
/// * [SingleChildScrollView] , which is a scrollable widget that has a single
@@ -603,10 +642,13 @@ class ListView extends BoxScrollView {
603
642
604
643
/// A scrollable, 2D array of widgets.
605
644
///
645
+ /// The main axis direction of a grid is the direction in which it scrolls (the
646
+ /// [scrollDirection] ).
647
+ ///
606
648
/// The most commonly used grid layouts are [GridView.count] , which creates a
607
649
/// layout with a fixed number of tiles in the cross axis, and
608
650
/// [GridView.extent] , which creates a layout with tiles that have a maximum
609
- /// cross-axis extent. A custom [SliverGridDelegate] can produce an aribtrary 2D
651
+ /// cross-axis extent. A custom [SliverGridDelegate] can produce an arbitrary 2D
610
652
/// arrangement of children, including arrangements that are unaligned or
611
653
/// overlapping.
612
654
///
@@ -657,9 +699,54 @@ class ListView extends BoxScrollView {
657
699
/// the [SliverGrid] instead be a child of the [SliverPadding] .
658
700
///
659
701
/// Once code has been ported to use [CustomScrollView] , other slivers, such as
660
- /// [SliverGrid ] or [SliverAppBar] , can be put in the [CustomScrollView.slivers]
702
+ /// [SliverList ] or [SliverAppBar] , can be put in the [CustomScrollView.slivers]
661
703
/// list.
662
704
///
705
+ /// ### Sample code
706
+ ///
707
+ /// Here are two brief snippets showing a [GridView] and its equivalent using
708
+ /// [CustomScrollView] :
709
+ ///
710
+ /// ```dart
711
+ /// new GridView.count(
712
+ /// primary: false,
713
+ /// padding: const EdgeInsets.all(20.0),
714
+ /// crossAxisSpacing: 10.0,
715
+ /// crossAxisCount: 2,
716
+ /// children: <Widget>[
717
+ /// const Text('He\'d have you all unravel at the'),
718
+ /// const Text('Heed not the rabble'),
719
+ /// const Text('Sound of screams but the'),
720
+ /// const Text('Who scream'),
721
+ /// const Text('Revolution is coming...'),
722
+ /// const Text('Revolution, they...'),
723
+ /// ],
724
+ /// )
725
+ /// ```
726
+ ///
727
+ /// ```dart
728
+ /// new CustomScrollView(
729
+ /// primary: false,
730
+ /// slivers: <Widget>[
731
+ /// new SliverPadding(
732
+ /// padding: const EdgeInsets.all(20.0),
733
+ /// sliver: new SliverGrid.count(
734
+ /// crossAxisSpacing: 10.0,
735
+ /// crossAxisCount: 2,
736
+ /// children: <Widget>[
737
+ /// const Text('He\'d have you all unravel at the'),
738
+ /// const Text('Heed not the rabble'),
739
+ /// const Text('Sound of screams but the'),
740
+ /// const Text('Who scream'),
741
+ /// const Text('Revolution is coming...'),
742
+ /// const Text('Revolution, they...'),
743
+ /// ],
744
+ /// ),
745
+ /// ),
746
+ /// ],
747
+ /// )
748
+ /// ```
749
+ ///
663
750
/// See also:
664
751
///
665
752
/// * [SingleChildScrollView] , which is a scrollable widget that has a single
@@ -810,8 +897,8 @@ class GridView extends BoxScrollView {
810
897
padding: padding,
811
898
);
812
899
813
- /// Creates a scrollable, 2D array of widgets with tiles that have a maximum
814
- /// cross-axis extent.
900
+ /// Creates a scrollable, 2D array of widgets with tiles that each have a
901
+ /// maximum cross-axis extent.
815
902
///
816
903
/// Uses a [SliverGridDelegateWithMaxCrossAxisExtent] as the [gridDelegate] .
817
904
///
0 commit comments