Пример #1
0
 public _RenderSwitch(
     bool?value                                   = null,
     Color activeColor                            = null,
     Color inactiveColor                          = null,
     Color hoverColor                             = null,
     Color focusColor                             = null,
     ImageProvider activeThumbImage               = null,
     ImageErrorListener onActiveThumbImageError   = null,
     ImageProvider inactiveThumbImage             = null,
     ImageErrorListener onInactiveThumbImageError = null,
     Color activeTrackColor                       = null,
     Color inactiveTrackColor                     = null,
     ImageConfiguration configuration             = null,
     BoxConstraints additionalConstraints         = null,
     TextDirection?textDirection                  = null,
     ValueChanged <bool?> onChanged               = null,
     DragStartBehavior?dragStartBehavior          = null,
     bool hasFocus                                = false,
     bool hovering                                = false,
     _SwitchState state                           = null
     ) : base(
         value: value,
         tristate: false,
         activeColor: activeColor,
         inactiveColor: inactiveColor,
         hoverColor: hoverColor,
         focusColor: focusColor,
         onChanged: onChanged,
         additionalConstraints: additionalConstraints,
         hasFocus: hasFocus,
         hovering: hovering,
         vsync: state
         )
 {
     D.assert(textDirection != null);
     _activeThumbImage          = activeThumbImage;
     _onActiveThumbImageError   = onActiveThumbImageError;
     _inactiveThumbImage        = inactiveThumbImage;
     _onInactiveThumbImageError = onInactiveThumbImageError;
     _activeTrackColor          = activeTrackColor;
     _inactiveTrackColor        = inactiveTrackColor;
     _configuration             = configuration;
     _drag = new HorizontalDragGestureRecognizer {
         onStart           = _handleDragStart,
         onUpdate          = _handleDragUpdate,
         onEnd             = _handleDragEnd,
         dragStartBehavior = dragStartBehavior ?? DragStartBehavior.down
     };
 }
Пример #2
0
 public _SwitchRenderObjectWidget(
     Key key                                      = null,
     bool?value                                   = null,
     Color activeColor                            = null,
     Color inactiveColor                          = null,
     Color hoverColor                             = null,
     Color focusColor                             = null,
     ImageProvider activeThumbImage               = null,
     ImageErrorListener onActiveThumbImageError   = null,
     ImageProvider inactiveThumbImage             = null,
     ImageErrorListener onInactiveThumbImageError = null,
     Color activeTrackColor                       = null,
     Color inactiveTrackColor                     = null,
     ImageConfiguration configuration             = null,
     ValueChanged <bool?> onChanged               = null,
     BoxConstraints additionalConstraints         = null,
     DragStartBehavior?dragStartBehavior          = null,
     bool hasFocus                                = false,
     bool hovering                                = false,
     _SwitchState state                           = null
     ) : base(key: key)
 {
     D.assert(value != null);
     this.value                     = value.Value;
     this.activeColor               = activeColor;
     this.inactiveColor             = inactiveColor;
     this.hoverColor                = hoverColor;
     this.focusColor                = focusColor;
     this.activeThumbImage          = activeThumbImage;
     this.onActiveThumbImageError   = onActiveThumbImageError;
     this.inactiveThumbImage        = inactiveThumbImage;
     this.onInactiveThumbImageError = onInactiveThumbImageError;
     this.activeTrackColor          = activeTrackColor;
     this.inactiveTrackColor        = inactiveTrackColor;
     this.configuration             = configuration;
     this.onChanged                 = onChanged;
     this.additionalConstraints     = additionalConstraints;
     this.dragStartBehavior         = dragStartBehavior;
     this.hasFocus                  = hasFocus;
     this.hovering                  = hovering;
     this.state                     = state;
 }