public BoxScrollView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsetsGeometry padding          = null,
     float?cacheExtent                   = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior,
         keyboardDismissBehavior: keyboardDismissBehavior
         )
 {
     this.padding = padding;
 }
 ListView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsetsGeometry padding          = null,
     float?itemExtent                    = null,
     IndexedWidgetBuilder itemBuilder    = null,
     int?itemCount                       = null,
     bool addAutomaticKeepAlives         = true,
     bool addRepaintBoundaries           = true,
     float?cacheExtent                   = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
     ) : base(key: key,
              scrollDirection: scrollDirection,
              reverse: reverse,
              controller: controller,
              primary: primary,
              physics: physics,
              shrinkWrap: shrinkWrap,
              padding: padding,
              cacheExtent: cacheExtent,
              dragStartBehavior: dragStartBehavior,
              keyboardDismissBehavior: keyboardDismissBehavior
              )
 {
     D.assert(itemCount == null || itemCount >= 0);
     this.itemExtent  = itemExtent;
     childrenDelegate = new SliverChildBuilderDelegate(
         itemBuilder,
         childCount: itemCount,
         addAutomaticKeepAlives: addAutomaticKeepAlives,
         addRepaintBoundaries: addRepaintBoundaries
         );
 }
 public static ListView builder(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsetsGeometry padding          = null,
     float?itemExtent                    = null,
     IndexedWidgetBuilder itemBuilder    = null,
     int?itemCount                       = null,
     bool addAutomaticKeepAlives         = true,
     bool addRepaintBoundaries           = true,
     float?cacheExtent                   = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
     )
 {
     return(new ListView(
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller,
                primary: primary,
                physics: physics,
                shrinkWrap: shrinkWrap,
                padding: padding,
                cacheExtent: cacheExtent,
                itemExtent: itemExtent,
                itemBuilder: itemBuilder,
                itemCount: itemCount,
                addAutomaticKeepAlives: addAutomaticKeepAlives,
                addRepaintBoundaries: addRepaintBoundaries,
                dragStartBehavior: dragStartBehavior,
                keyboardDismissBehavior: keyboardDismissBehavior
                ));
 }
 public static ListView seperated(
     Key key = null,
     Axis scrollDirection                  = Axis.vertical,
     bool reverse                          = false,
     ScrollController controller           = null,
     bool?primary                          = null,
     ScrollPhysics physics                 = null,
     bool shrinkWrap                       = false,
     EdgeInsetsGeometry padding            = null,
     IndexedWidgetBuilder itemBuilder      = null,
     IndexedWidgetBuilder separatorBuilder = null,
     int itemCount                         = 0,
     bool addAutomaticKeepAlives           = true,
     bool addRepaintBoundaries             = true,
     float?cacheExtent                     = null,
     ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
     )
 {
     return(new ListView(
                key,
                scrollDirection,
                reverse,
                controller,
                primary,
                physics,
                shrinkWrap,
                padding,
                itemBuilder,
                separatorBuilder,
                itemCount,
                addAutomaticKeepAlives,
                addRepaintBoundaries,
                cacheExtent,
                keyboardDismissBehavior: keyboardDismissBehavior
                ));
 }
        protected ScrollView(
            Key key = null,
            Axis scrollDirection        = Axis.vertical,
            bool reverse                = false,
            ScrollController controller = null,
            bool?primary                = null,
            ScrollPhysics physics       = null,
            bool shrinkWrap             = false,
            Key center        = null,
            float anchor      = 0.0f,
            float?cacheExtent = null,
            DragStartBehavior dragStartBehavior = DragStartBehavior.start,
            ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
            ) : base(key: key)
        {
            D.assert(!(controller != null && primary == true),
                     () => "Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. " +
                     "You cannot both set primary to true and pass an explicit controller.");
            D.assert(!shrinkWrap || center == null);
            D.assert(anchor >= 0.0f && anchor <= 1.0f);

            primary = primary ?? controller == null && scrollDirection == Axis.vertical;
            physics = physics ?? (primary.Value ? new AlwaysScrollableScrollPhysics() : null);

            this.scrollDirection         = scrollDirection;
            this.reverse                 = reverse;
            this.controller              = controller;
            this.primary                 = primary.Value;
            this.physics                 = physics;
            this.shrinkWrap              = shrinkWrap;
            this.center                  = center;
            this.anchor                  = anchor;
            this.cacheExtent             = cacheExtent;
            this.dragStartBehavior       = dragStartBehavior;
            this.keyboardDismissBehavior = keyboardDismissBehavior;
        }
        ListView(
            Key key = null,
            Axis scrollDirection                  = Axis.vertical,
            bool reverse                          = false,
            ScrollController controller           = null,
            bool?primary                          = null,
            ScrollPhysics physics                 = null,
            bool shrinkWrap                       = false,
            EdgeInsetsGeometry padding            = null,
            IndexedWidgetBuilder itemBuilder      = null,
            IndexedWidgetBuilder separatorBuilder = null,
            int itemCount                         = 0,
            bool addAutomaticKeepAlives           = true,
            bool addRepaintBoundaries             = true,
            float?cacheExtent                     = null,
            DragStartBehavior dragStartBehavior   = DragStartBehavior.start,
            ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual
            ) : base(
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller,
                primary: primary,
                physics: physics,
                shrinkWrap: shrinkWrap,
                padding: padding,
                cacheExtent: cacheExtent,
                dragStartBehavior: dragStartBehavior,
                keyboardDismissBehavior: keyboardDismissBehavior
                )
        {
            D.assert(itemBuilder != null);
            D.assert(separatorBuilder != null);
            D.assert(itemCount >= 0);
            itemExtent       = null;
            childrenDelegate = new SliverChildBuilderDelegate(
                (context, index) => {
                int itemIndex = index / 2;
                Widget widget = null;
                if (index % 2 == 0)
                {
                    widget = itemBuilder(context, itemIndex);
                }
                else
                {
                    widget = separatorBuilder(context, itemIndex);
                    D.assert(() => {
                        if (widget == null)
                        {
                            throw new UIWidgetsError("separatorBuilder cannot return null.");
                        }

                        return(true);
                    });
                }
                return(widget);
            },
                childCount: _computeActualChildCount(itemCount),
                addAutomaticKeepAlives: addAutomaticKeepAlives,
                addRepaintBoundaries: addRepaintBoundaries
                );
        }