Пример #1
0
        public TextSelectionOverlay(TextEditingValue value                  = null,
                                    BuildContext context                    = null, Widget debugRequiredFor = null,
                                    LayerLink layerLink                     = null,
                                    RenderEditable renderObject             = null,
                                    TextSelectionControls selectionControls = null,
                                    TextSelectionDelegate selectionDelegate = null,
                                    DragStartBehavior dragStartBehavior     = DragStartBehavior.start)
        {
            D.assert(value != null);
            D.assert(context != null);
            this.context           = context;
            this.debugRequiredFor  = debugRequiredFor;
            this.layerLink         = layerLink;
            this.renderObject      = renderObject;
            this.selectionControls = selectionControls;
            this.selectionDelegate = selectionDelegate;
            this._value            = value;
            OverlayState overlay = Overlay.of(context);

            D.assert(overlay != null, () => $"No Overlay widget exists above {context}.\n" +
                     "Usually the Navigator created by WidgetsApp provides the overlay. Perhaps your " +
                     "app content was created above the Navigator with the WidgetsApp builder parameter.");
            this._toolbarController = new AnimationController(duration: fadeDuration, vsync: overlay);
            this.dragStartBehavior  = dragStartBehavior;
        }
Пример #2
0
        public static PageView custom(
            Key key = null,
            Axis scrollDirection                 = Axis.horizontal,
            bool reverse                         = false,
            PageController controller            = null,
            ScrollPhysics physics                = null,
            bool pageSnapping                    = true,
            ValueChanged <int> onPageChanged     = null,
            SliverChildDelegate childrenDelegate = null,
            DragStartBehavior dragStartBehavior  = DragStartBehavior.start,
            bool allowImplicitScrolling          = false
            )
        {
            D.assert(childrenDelegate != null);
            var page = new PageView(
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller ?? PageViewUtils._defaultPageController,
                physics: physics,
                pageSnapping: pageSnapping,
                onPageChanged: onPageChanged,
                allowImplicitScrolling: allowImplicitScrolling,
                dragStartBehavior: dragStartBehavior
                );

            page.childrenDelegate = childrenDelegate;
            return(page);
        }
Пример #3
0
 public ListView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsets padding                  = null,
     float?itemExtent                    = null,
     bool addAutomaticKeepAlives         = true,
     bool addRepaintBoundaries           = true,
     float?cacheExtent                   = null,
     List <Widget> children              = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         padding: padding,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior
         )
 {
     this.itemExtent       = itemExtent;
     this.childrenDelegate = new SliverChildListDelegate(
         children,
         addAutomaticKeepAlives: addAutomaticKeepAlives,
         addRepaintBoundaries: addRepaintBoundaries
         );
 }
Пример #4
0
        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
            ) : 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;
        }
Пример #5
0
 public CustomScrollView(
     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,
     List <Widget> slivers = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         center: center,
         anchor: anchor,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior
         )
 {
     this.slivers = slivers ?? new List <Widget>();
 }
Пример #6
0
 public BoxScrollView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsets padding                  = null,
     float?cacheExtent                   = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior
         )
 {
     this.padding = padding;
 }
Пример #7
0
        public static PageView builder(
            Key key = null,
            Axis scrollDirection                = Axis.horizontal,
            bool reverse                        = false,
            PageController controller           = null,
            ScrollPhysics physics               = null,
            bool pageSnapping                   = true,
            ValueChanged <int> onPageChanged    = null,
            IndexedWidgetBuilder itemBuilder    = null,
            int itemCount                       = 0,
            DragStartBehavior dragStartBehavior = DragStartBehavior.start,
            bool allowImplicitScrolling         = false
            )
        {
            var page = new PageView(
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller ?? PageViewUtils._defaultPageController,
                physics: physics,
                pageSnapping: pageSnapping,
                onPageChanged: onPageChanged,
                allowImplicitScrolling: allowImplicitScrolling,
                dragStartBehavior: dragStartBehavior
                );

            page.childrenDelegate = new SliverChildBuilderDelegate(itemBuilder, childCount: itemCount);
            return(page);
        }
Пример #8
0
 public static GridView custom(
     Key key = null,
     Axis scrollDirection                 = Axis.vertical,
     bool reverse                         = false,
     ScrollController controller          = null,
     bool?primary                         = null,
     ScrollPhysics physics                = null,
     bool shrinkWrap                      = false,
     EdgeInsets padding                   = null,
     SliverGridDelegate gridDelegate      = null,
     SliverChildDelegate childrenDelegate = null,
     float?cacheExtent                    = null,
     DragStartBehavior dragStartBehavior  = DragStartBehavior.start
     )
 {
     return(new GridView(
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller,
                primary: primary,
                physics: physics,
                shrinkWrap: shrinkWrap,
                padding: padding,
                gridDelegate: gridDelegate,
                childrenDelegate: childrenDelegate,
                cacheExtent: cacheExtent,
                dragStartBehavior: dragStartBehavior
                ));
 }
Пример #9
0
 public PageView(
     Key key = null,
     Axis scrollDirection                = Axis.horizontal,
     bool reverse                        = false,
     PageController controller           = null,
     ScrollPhysics physics               = null,
     bool pageSnapping                   = true,
     ValueChanged <int> onPageChanged    = null,
     List <Widget> children              = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     IndexedWidgetBuilder itemBuilder    = null,
     SliverChildDelegate childDelegate   = null,
     int itemCount                       = 0
     ) : base(key: key)
 {
     this.scrollDirection   = scrollDirection;
     this.reverse           = reverse;
     this.physics           = physics;
     this.pageSnapping      = pageSnapping;
     this.onPageChanged     = onPageChanged;
     this.dragStartBehavior = dragStartBehavior;
     this.controller        = controller ?? PageViewUtils._defaultPageController;
     if (itemBuilder != null)
     {
         this.childrenDelegate = new SliverChildBuilderDelegate(itemBuilder, childCount: itemCount);
     }
     else if (childDelegate != null)
     {
         this.childrenDelegate = childDelegate;
     }
     else
     {
         this.childrenDelegate = new SliverChildListDelegate(children ?? new List <Widget>());
     }
 }
Пример #10
0
 public Dismissible(
     Key key                               = null,
     Widget child                          = null,
     Widget background                     = null,
     Widget secondaryBackground            = null,
     ConfirmDismissCallback confirmDismiss = null,
     VoidCallback onResize                 = null,
     DismissDirectionCallback onDismissed  = null,
     DismissDirection direction            = DismissDirection.horizontal,
     TimeSpan?resizeDuration               = null,
     Dictionary <DismissDirection?, float?> dismissThresholds = null,
     TimeSpan?movementDuration           = null,
     float crossAxisEndOffset            = 0.0f,
     DragStartBehavior dragStartBehavior = DragStartBehavior.down
     ) : base(key: key)
 {
     D.assert(key != null);
     D.assert(secondaryBackground != null ? background != null : true);
     this.resizeDuration      = resizeDuration ?? new TimeSpan(0, 0, 0, 0, 300);
     this.dismissThresholds   = dismissThresholds ?? new Dictionary <DismissDirection?, float?>();
     this.movementDuration    = movementDuration ?? new TimeSpan(0, 0, 0, 0, 200);
     this.child               = child;
     this.background          = background;
     this.secondaryBackground = secondaryBackground;
     this.confirmDismiss      = confirmDismiss;
     this.onResize            = onResize;
     this.onDismissed         = onDismissed;
     this.direction           = direction;
     this.crossAxisEndOffset  = crossAxisEndOffset;
     this.dragStartBehavior   = dragStartBehavior;
 }
 public static PageView builder(
     IndexedWidgetBuilder itemBuilder,
     Key key = null,
     Axis scrollDirection                = Axis.horizontal,
     bool reverse                        = false,
     PageController controller           = null,
     ScrollPhysics physics               = null,
     bool pageSnapping                   = true,
     ValueChanged <int> onPageChanged    = null,
     int itemCount                       = 0,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     )
 {
     return(new PageView(
                itemBuilder: itemBuilder,
                key: key,
                scrollDirection: scrollDirection,
                reverse: reverse,
                controller: controller,
                physics: physics,
                pageSnapping: pageSnapping,
                onPageChanged: onPageChanged,
                itemCount: itemCount,
                dragStartBehavior: dragStartBehavior
                ));
 }
Пример #12
0
 public SingleChildScrollView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     EdgeInsets padding                  = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     ScrollController controller         = null,
     Widget child                        = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : 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.");
     this.scrollDirection   = scrollDirection;
     this.reverse           = reverse;
     this.padding           = padding;
     this.primary           = primary ?? controller == null && scrollDirection == Axis.vertical;
     this.physics           = physics;
     this.controller        = controller;
     this.child             = child;
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #13
0
 public GridView(
     Key key = null,
     Axis scrollDirection                 = Axis.vertical,
     bool reverse                         = false,
     ScrollController controller          = null,
     bool?primary                         = null,
     ScrollPhysics physics                = null,
     bool shrinkWrap                      = false,
     EdgeInsets padding                   = null,
     SliverGridDelegate gridDelegate      = null,
     SliverChildDelegate childrenDelegate = null,
     float?cacheExtent                    = null,
     DragStartBehavior dragStartBehavior  = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         padding: padding,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior
         )
 {
     D.assert(gridDelegate != null);
     D.assert(childrenDelegate != null);
     this.gridDelegate     = gridDelegate;
     this.childrenDelegate = childrenDelegate;
 }
Пример #14
0
 public Switch(
     Key key    = null,
     bool?value = null,
     ValueChanged <bool?> onChanged = null,
     Color activeColor                           = null,
     Color activeTrackColor                      = null,
     Color inactiveThumbColor                    = null,
     Color inactiveTrackColor                    = null,
     ImageProvider activeThumbImage              = null,
     ImageProvider inactiveThumbImage            = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     DragStartBehavior dragStartBehavior         = DragStartBehavior.start
     ) : this(
         key : key,
         value : value,
         onChanged : onChanged,
         activeColor : activeColor,
         activeTrackColor : activeTrackColor,
         inactiveThumbColor : inactiveThumbColor,
         inactiveTrackColor : inactiveTrackColor,
         activeThumbImage : activeThumbImage,
         inactiveThumbImage : inactiveThumbImage,
         materialTapTargetSize : materialTapTargetSize,
         switchType : _SwitchType.material,
         dragStartBehavior : dragStartBehavior
         )
 {
 }
Пример #15
0
 Switch(
     Key key    = null,
     bool?value = null,
     ValueChanged <bool?> onChanged = null,
     Color activeColor                           = null,
     Color activeTrackColor                      = null,
     Color inactiveThumbColor                    = null,
     Color inactiveTrackColor                    = null,
     ImageProvider activeThumbImage              = null,
     ImageProvider inactiveThumbImage            = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     _SwitchType switchType                      = _SwitchType.material,
     DragStartBehavior dragStartBehavior         = DragStartBehavior.start
     ) : base(key : key)
 {
     D.assert(value != null);
     this.value = value.Value;
     D.assert(onChanged != null);
     this.onChanged             = onChanged;
     this.activeColor           = activeColor;
     this.activeTrackColor      = activeTrackColor;
     this.inactiveThumbColor    = inactiveThumbColor;
     this.inactiveTrackColor    = inactiveTrackColor;
     this.activeThumbImage      = activeThumbImage;
     this.inactiveThumbImage    = inactiveThumbImage;
     this.materialTapTargetSize = materialTapTargetSize;
     this._switchType           = switchType;
     this.dragStartBehavior     = dragStartBehavior;
 }
Пример #16
0
 public static Switch adaptive(
     Key key    = null,
     bool?value = null,
     ValueChanged <bool?> onChanged = null,
     Color activeColor                           = null,
     Color activeTrackColor                      = null,
     Color inactiveThumbColor                    = null,
     Color inactiveTrackColor                    = null,
     ImageProvider activeThumbImage              = null,
     ImageProvider inactiveThumbImage            = null,
     MaterialTapTargetSize?materialTapTargetSize = null,
     DragStartBehavior dragStartBehavior         = DragStartBehavior.down
     )
 {
     return(new Switch(key: key,
                       value: value,
                       onChanged: onChanged,
                       activeColor: activeColor,
                       activeTrackColor: activeTrackColor,
                       inactiveThumbColor: inactiveThumbColor,
                       inactiveTrackColor: inactiveTrackColor,
                       activeThumbImage: activeThumbImage,
                       inactiveThumbImage: inactiveThumbImage,
                       materialTapTargetSize: materialTapTargetSize,
                       switchType: _SwitchType.adaptive
                       ));
 }
Пример #17
0
        SelectableText(
            string data,
            TextSpan textSpan,
            Key key                             = null,
            FocusNode focusNode                 = null,
            TextStyle style                     = null,
            StrutStyle strutStyle               = null,
            TextAlign?textAlign                 = null,
            TextDirection?textDirection         = null,
            float?textScaleFactor               = null,
            bool showCursor                     = false,
            bool autofocus                      = false,
            ToolbarOptions toolbarOptions       = null,
            int?minLines                        = null,
            int?maxLines                        = null,
            float cursorWidth                   = 2.0f,
            Radius cursorRadius                 = null,
            Color cursorColor                   = null,
            DragStartBehavior dragStartBehavior = DragStartBehavior.start,
            bool enableInteractiveSelection     = true,
            GestureTapCallback onTap            = null,
            ScrollPhysics scrollPhysics         = null,
            TextWidthBasis?textWidthBasis       = null
            ) : base(key: key)
        {
            D.assert(maxLines == null || maxLines > 0);
            D.assert(minLines == null || minLines > 0);
            D.assert(
                (maxLines == null) || (minLines == null) || (maxLines >= minLines),
                () => "minLines can\'t be greater than maxLines"
                );
            toolbarOptions = toolbarOptions ??
                             new ToolbarOptions(
                selectAll: true,
                copy: true
                );

            this.data                       = data;
            this.textSpan                   = textSpan;
            this.focusNode                  = focusNode;
            this.style                      = style;
            this.strutStyle                 = strutStyle;
            this.textAlign                  = textAlign;
            this.textDirection              = textDirection;
            this.textScaleFactor            = textScaleFactor;
            this.showCursor                 = showCursor;
            this.autofocus                  = autofocus;
            this.toolbarOptions             = toolbarOptions;
            this.minLines                   = minLines;
            this.maxLines                   = maxLines;
            this.cursorWidth                = cursorWidth;
            this.cursorRadius               = cursorRadius;
            this.cursorColor                = cursorColor;
            this.dragStartBehavior          = dragStartBehavior;
            this.enableInteractiveSelection = enableInteractiveSelection;
            this.onTap                      = onTap;
            this.scrollPhysics              = scrollPhysics;
            this.textWidthBasis             = textWidthBasis;
        }
Пример #18
0
 public DragGestureRecognizer(
     object debugOwner      = null,
     PointerDeviceKind?kind = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.down)
     : base(debugOwner: debugOwner, kind: kind)
 {
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #19
0
        public _RenderCupertinoSwitch(
            bool value,
            Color activeColor,
            TextDirection textDirection,
            TickerProvider vsync,
            ValueChanged <bool> onChanged       = null,
            DragStartBehavior dragStartBehavior = DragStartBehavior.start
            ) : base(additionalConstraints: BoxConstraints.tightFor(
                         width: CupertinoSwitchUtils._kSwitchWidth,
                         height: CupertinoSwitchUtils._kSwitchHeight)
                     )
        {
            D.assert(activeColor != null);
            D.assert(vsync != null);
            this._value         = value;
            this._activeColor   = activeColor;
            this._onChanged     = onChanged;
            this._textDirection = textDirection;
            this._vsync         = vsync;

            this._tap = new TapGestureRecognizer()
            {
                onTapDown   = this._handleTapDown,
                onTap       = this._handleTap,
                onTapUp     = this._handleTapUp,
                onTapCancel = this._handleTapCancel,
            };

            this._drag = new HorizontalDragGestureRecognizer()
            {
                onStart           = this._handleDragStart,
                onUpdate          = this._handleDragUpdate,
                onEnd             = this._handleDragEnd,
                dragStartBehavior = dragStartBehavior
            };

            this._positionController = new AnimationController(
                duration: CupertinoSwitchUtils._kToggleDuration,
                value: value ? 1.0f : 0.0f,
                vsync: vsync
                );
            this._position = new CurvedAnimation(
                parent: this._positionController,
                curve: Curves.linear
                );
            this._position.addListener(this.markNeedsPaint);
            this._position.addStatusListener(this._handlePositionStateChanged);

            this._reactionController = new AnimationController(
                duration: CupertinoSwitchUtils._kReactionDuration,
                vsync: vsync
                );
            this._reaction = new CurvedAnimation(
                parent: this._reactionController,
                curve: Curves.ease
                );
            this._reaction.addListener(this.markNeedsPaint);
        }
Пример #20
0
        public static SelectableText rich(
            TextSpan textSpan,
            Key key                             = null,
            FocusNode focusNode                 = null,
            TextStyle style                     = null,
            StrutStyle strutStyle               = null,
            TextAlign?textAlign                 = null,
            TextDirection?textDirection         = null,
            float?textScaleFactor               = null,
            bool showCursor                     = false,
            bool autofocus                      = false,
            ToolbarOptions toolbarOptions       = null,
            int?minLines                        = null,
            int?maxLines                        = null,
            float cursorWidth                   = 2.0f,
            Radius cursorRadius                 = null,
            Color cursorColor                   = null,
            DragStartBehavior dragStartBehavior = DragStartBehavior.start,
            bool enableInteractiveSelection     = true,
            GestureTapCallback onTap            = null,
            ScrollPhysics scrollPhysics         = null,
            TextWidthBasis?textWidthBasis       = null
            )
        {
            D.assert(
                textSpan != null,
                () => "A non-null TextSpan must be provided to a SelectableText.rich widget."
                );

            return(new SelectableText(
                       data: null,
                       textSpan: textSpan,
                       key: key,
                       focusNode: focusNode,
                       style: style,
                       strutStyle: strutStyle,
                       textAlign: textAlign,
                       textDirection: textDirection,
                       textScaleFactor: textScaleFactor,
                       showCursor: showCursor,
                       autofocus: autofocus,
                       toolbarOptions: toolbarOptions,
                       minLines: minLines,
                       maxLines: maxLines,
                       cursorWidth: cursorWidth,
                       cursorRadius: cursorRadius,
                       cursorColor: cursorColor,
                       dragStartBehavior: dragStartBehavior,
                       enableInteractiveSelection: enableInteractiveSelection,
                       onTap: onTap,
                       scrollPhysics: scrollPhysics,
                       textWidthBasis: textWidthBasis
                       ));
        }
Пример #21
0
 public PaginatedDataTable(
     Key key                                 = null,
     Widget header                           = null,
     List <Widget> actions                   = null,
     List <DataColumn> columns               = null,
     int?sortColumnIndex                     = null,
     bool sortAscending                      = false,
     ValueSetter <bool> onSelectAll          = null,
     float dataRowHeight                     = material_.kMinInteractiveDimension,
     float headingRowHeight                  = 56.0f,
     float horizontalMargin                  = 24.0f,
     float columnSpacing                     = 56.0f,
     bool showCheckboxColumn                 = true,
     int?initialFirstRowIndex                = 0,
     ValueChanged <int> onPageChanged        = null,
     int rowsPerPage                         = defaultRowsPerPage,
     List <int> availableRowsPerPage         = null,
     ValueChanged <int> onRowsPerPageChanged = null,
     DragStartBehavior dragStartBehavior     = DragStartBehavior.start,
     DataTableSource source                  = null
     ) : base(key: key)
 {
     availableRowsPerPage = availableRowsPerPage ?? new List <int> {
         defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10
     };
     D.assert(columns.isNotEmpty);
     D.assert(() => {
         if (onRowsPerPageChanged != null)
         {
             D.assert(availableRowsPerPage != null && availableRowsPerPage.Contains(rowsPerPage));
         }
         return(true);
     });
     D.assert(source != null);
     this.header               = header;
     this.actions              = actions;
     this.columns              = columns;
     this.sortColumnIndex      = sortColumnIndex;
     this.sortAscending        = sortAscending;
     this.onSelectAll          = onSelectAll;
     this.dataRowHeight        = dataRowHeight;
     this.headingRowHeight     = headingRowHeight;
     this.horizontalMargin     = horizontalMargin;
     this.columnSpacing        = columnSpacing;
     this.showCheckboxColumn   = showCheckboxColumn;
     this.initialFirstRowIndex = initialFirstRowIndex;
     this.onPageChanged        = onPageChanged;
     this.rowsPerPage          = rowsPerPage;
     this.availableRowsPerPage = availableRowsPerPage;
     this.onRowsPerPageChanged = onRowsPerPageChanged;
     this.dragStartBehavior    = dragStartBehavior;
     this.source               = source;
 }
Пример #22
0
 public CupertinoSwitch(
     bool value,
     ValueChanged <bool> onChanged,
     Key key           = null,
     Color activeColor = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(key: key)
 {
     this.value             = value;
     this.onChanged         = onChanged;
     this.activeColor       = activeColor;
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #23
0
        public TextField(Key key = null, TextEditingController controller                = null, FocusNode focusNode         = null,
                         InputDecoration decoration            = null, bool noDecoration = false, TextInputType keyboardType = null,
                         TextInputAction?textInputAction       = null,
                         TextCapitalization textCapitalization = TextCapitalization.none, TextStyle style = null,
                         TextAlign textAlign               = TextAlign.left, TextDirection textDirection = TextDirection.ltr,
                         bool autofocus                    = false, bool obscureText      = false, bool autocorrect = false, int?maxLines = 1,
                         int?maxLength                     = null, bool maxLengthEnforced = true, ValueChanged <string> onChanged = null,
                         VoidCallback onEditingComplete    = null,
                         ValueChanged <string> onSubmitted = null, List <TextInputFormatter> inputFormatters = null,
                         bool?enabled = null, float?cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null,
                         Brightness?keyboardAppearance          = null, EdgeInsets scrollPadding = null,
                         DragStartBehavior dragStartBehavior    = DragStartBehavior.down,
                         bool?enableInteractiveSelection        = null,
                         GestureTapCallback onTap               = null,
                         InputCounterWidgetBuilder buildCounter = null
                         ) : base(key: key)
        {
            D.assert(maxLines == null || maxLines > 0);
            D.assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0);

            this.controller         = controller;
            this.focusNode          = focusNode;
            this.decoration         = noDecoration ? null : (decoration ?? new InputDecoration());
            this.textInputAction    = textInputAction;
            this.textCapitalization = textCapitalization;
            this.style                      = style;
            this.textAlign                  = textAlign;
            this.textDirection              = textDirection;
            this.autofocus                  = autofocus;
            this.obscureText                = obscureText;
            this.autocorrect                = autocorrect;
            this.maxLines                   = maxLines;
            this.maxLength                  = maxLength;
            this.maxLengthEnforced          = maxLengthEnforced;
            this.onChanged                  = onChanged;
            this.onEditingComplete          = onEditingComplete;
            this.onSubmitted                = onSubmitted;
            this.inputFormatters            = inputFormatters;
            this.enabled                    = enabled;
            this.cursorWidth                = cursorWidth;
            this.cursorColor                = cursorColor;
            this.cursorRadius               = cursorRadius;
            this.onSubmitted                = onSubmitted;
            this.keyboardAppearance         = keyboardAppearance;
            this.enableInteractiveSelection = enableInteractiveSelection;
            this.onTap                      = onTap;
            this.keyboardType               = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
            this.scrollPadding              = scrollPadding ?? EdgeInsets.all(20.0f);
            this.dragStartBehavior          = dragStartBehavior;
            this.buildCounter               = buildCounter;
        }
Пример #24
0
 public _CupertinoSwitchRenderObjectWidget(
     Key key                             = null,
     bool value                          = false,
     Color activeColor                   = null,
     ValueChanged <bool> onChanged       = null,
     TickerProvider vsync                = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(key: key)
 {
     this.value             = value;
     this.activeColor       = activeColor;
     this.onChanged         = onChanged;
     this.vsync             = vsync;
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #25
0
 public DrawerController(
     GlobalKey key                       = null,
     Widget child                        = null,
     DrawerAlignment?alignment           = null,
     DrawerCallback drawerCallback       = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(key: key)
 {
     D.assert(child != null);
     D.assert(alignment != null);
     this.child             = child;
     this.alignment         = alignment ?? DrawerAlignment.start;
     this.drawerCallback    = drawerCallback;
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #26
0
        public Scrollable(
            Key key = null,
            AxisDirection axisDirection         = AxisDirection.down,
            ScrollController controller         = null,
            ScrollPhysics physics               = null,
            ViewportBuilder viewportBuilder     = null,
            DragStartBehavior dragStartBehavior = DragStartBehavior.down
            ) : base(key: key)
        {
            D.assert(viewportBuilder != null);

            this.axisDirection     = axisDirection;
            this.controller        = controller;
            this.physics           = physics;
            this.viewportBuilder   = viewportBuilder;
            this.dragStartBehavior = dragStartBehavior;
        }
Пример #27
0
 ListView(
     Key key = null,
     Axis scrollDirection                  = Axis.vertical,
     bool reverse                          = false,
     ScrollController controller           = null,
     bool?primary                          = null,
     ScrollPhysics physics                 = null,
     bool shrinkWrap                       = false,
     EdgeInsets padding                    = null,
     IndexedWidgetBuilder itemBuilder      = null,
     IndexedWidgetBuilder separatorBuilder = null,
     int itemCount                         = 0,
     bool addAutomaticKeepAlives           = true,
     bool addRepaintBoundaries             = true,
     float?cacheExtent                     = null,
     DragStartBehavior dragStartBehavior   = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         padding: padding,
         cacheExtent: cacheExtent,
         dragStartBehavior: dragStartBehavior
         )
 {
     D.assert(itemBuilder != null);
     D.assert(separatorBuilder != null);
     D.assert(itemCount >= 0);
     this.itemExtent       = null;
     this.childrenDelegate = new SliverChildBuilderDelegate(
         (context, index) => {
         int itemIndex = index / 2;
         return(index % 2 == 0
                 ? itemBuilder(context, itemIndex)
                 : separatorBuilder(context, itemIndex));
     },
         childCount: Mathf.Max(0, itemCount * 2 - 1),
         addAutomaticKeepAlives: addAutomaticKeepAlives,
         addRepaintBoundaries: addRepaintBoundaries
         );
 }
Пример #28
0
 public YearPicker(
     DateTime selectedDate,
     ValueChanged <DateTime> onChanged,
     DateTime firstDate,
     DateTime lastDate,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start,
     Key key = null
     ) : base(key: key)
 {
     D.assert(selectedDate != null);
     D.assert(onChanged != null);
     D.assert(firstDate <= lastDate);
     this.selectedDate      = selectedDate;
     this.onChanged         = onChanged;
     this.firstDate         = firstDate;
     this.lastDate          = lastDate;
     this.dragStartBehavior = dragStartBehavior;
 }
Пример #29
0
 public GridView(
     Key key = null,
     Axis scrollDirection                = Axis.vertical,
     bool reverse                        = false,
     ScrollController controller         = null,
     bool?primary                        = null,
     ScrollPhysics physics               = null,
     bool shrinkWrap                     = false,
     EdgeInsets padding                  = null,
     float?maxCrossAxisExtent            = null,
     float mainAxisSpacing               = 0.0f,
     float crossAxisSpacing              = 0.0f,
     float childAspectRatio              = 1.0f,
     bool addAutomaticKeepAlives         = true,
     bool addRepaintBoundaries           = true,
     bool addSemanticIndexes             = true,
     List <Widget> children              = null,
     DragStartBehavior dragStartBehavior = DragStartBehavior.start
     ) : base(
         key: key,
         scrollDirection: scrollDirection,
         reverse: reverse,
         controller: controller,
         primary: primary,
         physics: physics,
         shrinkWrap: shrinkWrap,
         padding: padding,
         dragStartBehavior: dragStartBehavior
         )
 {
     this.gridDelegate = new SliverGridDelegateWithMaxCrossAxisExtent(
         maxCrossAxisExtent: maxCrossAxisExtent ?? 0,
         mainAxisSpacing: mainAxisSpacing,
         crossAxisSpacing: crossAxisSpacing,
         childAspectRatio: childAspectRatio
         );
     this.childrenDelegate = new SliverChildListDelegate(
         children ?? new List <Widget> {
     },
         addAutomaticKeepAlives: addAutomaticKeepAlives,
         addRepaintBoundaries: addRepaintBoundaries
         );
 }
Пример #30
0
 Switch(
     Key key    = null,
     bool?value = null,
     ValueChanged <bool?> onChanged = null,
     Color activeColor                            = null,
     Color activeTrackColor                       = null,
     Color inactiveThumbColor                     = null,
     Color inactiveTrackColor                     = null,
     ImageProvider activeThumbImage               = null,
     ImageErrorListener onActiveThumbImageError   = null,
     ImageProvider inactiveThumbImage             = null,
     ImageErrorListener onInactiveThumbImageError = null,
     MaterialTapTargetSize?materialTapTargetSize  = null,
     _SwitchType switchType                       = _SwitchType.material,
     DragStartBehavior dragStartBehavior          = DragStartBehavior.start,
     Color focusColor    = null,
     Color hoverColor    = null,
     FocusNode focusNode = null,
     bool autofocus      = false
     ) : base(key : key)
 {
     D.assert(value != null);
     this.value = value.Value;
     D.assert(activeThumbImage != null || onActiveThumbImageError == null);
     D.assert(inactiveThumbImage != null || onInactiveThumbImageError == null);
     this.onChanged                 = onChanged;
     this.activeColor               = activeColor;
     this.activeTrackColor          = activeTrackColor;
     this.inactiveThumbColor        = inactiveThumbColor;
     this.inactiveTrackColor        = inactiveTrackColor;
     this.activeThumbImage          = activeThumbImage;
     this.onActiveThumbImageError   = onActiveThumbImageError;
     this.inactiveThumbImage        = inactiveThumbImage;
     this.onInactiveThumbImageError = onInactiveThumbImageError;
     this.materialTapTargetSize     = materialTapTargetSize;
     _switchType            = switchType;
     this.dragStartBehavior = dragStartBehavior;
     this.focusColor        = focusColor;
     this.hoverColor        = hoverColor;
     this.focusNode         = focusNode;
     this.autofocus         = autofocus;
 }