public _RenderSlider( float?value = null, int?divisions = null, string label = null, SliderThemeData sliderTheme = null, MediaQueryData mediaQueryData = null, RuntimePlatform?platform = null, ValueChanged <float> onChanged = null, ValueChanged <float> onChangeStart = null, ValueChanged <float> onChangeEnd = null, _SliderState state = null, TextDirection?textDirection = null ) { D.assert(value != null && value >= 0.0 && value <= 1.0); D.assert(state != null); D.assert(textDirection != null); this.onChangeStart = onChangeStart; this.onChangeEnd = onChangeEnd; _platform = platform; _label = label; _value = value.Value; _divisions = divisions; _sliderTheme = sliderTheme; _mediaQueryData = mediaQueryData; _onChanged = onChanged; _state = state; _textDirection = textDirection.Value; _updateLabelPainter(); GestureArenaTeam team = new GestureArenaTeam(); _drag = new HorizontalDragGestureRecognizer { team = team, onStart = _handleDragStart, onUpdate = _handleDragUpdate, onEnd = _handleDragEnd, onCancel = _endInteraction }; _tap = new TapGestureRecognizer { team = team, onTapDown = _handleTapDown, onTapUp = _handleTapUp, onTapCancel = _endInteraction }; _overlayAnimation = new CurvedAnimation( parent: _state.overlayController, curve: Curves.fastOutSlowIn); _valueIndicatorAnimation = new CurvedAnimation( parent: _state.valueIndicatorController, curve: Curves.fastOutSlowIn); _enableAnimation = new CurvedAnimation( parent: _state.enableController, curve: Curves.easeInOut); }
public override void initState() { base.initState(); _tap = new TapGestureRecognizer(); _tap.onTapDown = _handleTapDown; _tap.onTapUp = _handleTapUp; _tap.onTap = _handleTap; _tap.onTapCancel = _handleTapCancel; _drag = new HorizontalDragGestureRecognizer(); _drag.onStart = _handleDragStart; _drag.onUpdate = _handleDragUpdate; _drag.onEnd = _handleDragEnd; _drag.dragStartBehavior = widget.dragStartBehavior; _positionController = new AnimationController( duration: CupertinoSwitchUtils._kToggleDuration, value: widget.value ? 1.0f : 0.0f, vsync: this ); position = new CurvedAnimation( parent: _positionController, curve: Curves.linear ); _reactionController = new AnimationController( duration: CupertinoSwitchUtils._kReactionDuration, vsync: this ); _reaction = new CurvedAnimation( parent: _reactionController, curve: Curves.ease ); }
public _RenderCupertinoSlider( float value, int?divisions = null, Color activeColor = null, Color thumbColor = null, Color trackColor = null, ValueChanged <float> onChanged = null, ValueChanged <float> onChangeStart = null, ValueChanged <float> onChangeEnd = null, TickerProvider vsync = null, TextDirection?textDirection = null ) : base(additionalConstraints: BoxConstraints.tightFor(width: SliderUtils._kSliderWidth, height: SliderUtils._kSliderHeight)) { D.assert(value >= 0.0f && value <= 1.0f && value != null); _value = value; _divisions = divisions; _activeColor = activeColor; _thumbColor = thumbColor; _trackColor = trackColor; _onChanged = onChanged; this.onChangeStart = onChangeStart; this.onChangeEnd = onChangeEnd; _textDirection = textDirection; _drag = new HorizontalDragGestureRecognizer(); _drag.onStart = _handleDragStart; _drag.onUpdate = _handleDragUpdate; _drag.onEnd = _handleDragEnd; _position = new AnimationController( value: value, duration: SliderUtils._kDiscreteTransitionDuration, vsync: vsync ); _position.addListener(markNeedsPaint); }
public override void initState() { base.initState(); _recognizer = new HorizontalDragGestureRecognizer(debugOwner: this); _recognizer.onStart = _handleDragStart; _recognizer.onUpdate = _handleDragUpdate; _recognizer.onEnd = _handleDragEnd; _recognizer.onCancel = _handleDragCancel; }
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 }; }
public _RenderRangeSlider( RangeValues values, int?divisions, RangeLabels labels, SliderThemeData sliderTheme, ThemeData theme, float textScaleFactor, RuntimePlatform platform, ValueChanged <RangeValues> onChanged, ValueChanged <RangeValues> onChangeStart, ValueChanged <RangeValues> onChangeEnd, _RangeSliderState state, TextDirection?textDirection) { D.assert(values != null); D.assert(values.start >= 0.0 && values.start <= 1.0); D.assert(values.end >= 0.0 && values.end <= 1.0); D.assert(state != null); D.assert(textDirection != null); this.onChangeStart = onChangeStart; this.onChangeEnd = onChangeEnd; _platform = platform; _labels = labels; _values = values; _divisions = divisions; _sliderTheme = sliderTheme; _theme = theme; _textScaleFactor = textScaleFactor; _onChanged = onChanged; _state = state; _textDirection = textDirection; _updateLabelPainters(); GestureArenaTeam team = new GestureArenaTeam(); _drag = new HorizontalDragGestureRecognizer(); _drag.team = team; _drag.onStart = _handleDragStart; _drag.onUpdate = _handleDragUpdate; _drag.onEnd = _handleDragEnd; _drag.onCancel = _handleDragCancel; _tap = new TapGestureRecognizer(); _tap.team = team; _tap.onTapDown = _handleTapDown; _tap.onTapUp = _handleTapUp; _tap.onTapCancel = _handleTapCancel; _overlayAnimation = new CurvedAnimation( parent: _state.overlayController, curve: Curves.fastOutSlowIn ); _valueIndicatorAnimation = new CurvedAnimation( parent: _state.valueIndicatorController, curve: Curves.fastOutSlowIn ); _enableAnimation = new CurvedAnimation( parent: _state.enableController, curve: Curves.easeInOut ); }