浏览代码

temporary stashes

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
41f140ff
共有 2 个文件被更改,包括 83 次插入4 次删除
  1. 55
      com.unity.uiwidgets/Runtime/material/slider.cs
  2. 32
      com.unity.uiwidgets/Runtime/material/slider_theme.cs

55
com.unity.uiwidgets/Runtime/material/slider.cs


using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.material {
public enum _SliderType {
material,
adaptive
}
public class Slider : StatefulWidget {
public Slider(
Key key = null,

int? divisions = null,
string label = null,
Color activeColor = null,
Color inactiveColor = null
Color inactiveColor = null,
_SliderType _sliderType = _SliderType.material
) : base(key: key) {
D.assert(value != null);
D.assert(min <= max);

this.label = label;
this.activeColor = activeColor;
this.inactiveColor = inactiveColor;
this._sliderType = _sliderType;
}
public static Slider adaptive(
Key key = null,
float? value = null,
ValueChanged<float> onChanged = null,
ValueChanged<float> onChangeStart = null,
ValueChanged<float> onChangeEnd = null,
float min = 0.0f,
float max = 1.0f,
int? divisions = null,
string label = null,
Color activeColor = null,
Color inactiveColor = null
) {
return new Slider(
key: key,
value: value,
onChanged: onChanged,
onChangeStart: onChangeStart,
onChangeEnd: onChangeEnd,
min: min,
max: max,
divisions: divisions,
label: label,
activeColor: activeColor,
inactiveColor: inactiveColor,
_sliderType: _SliderType.adaptive
);
}
public readonly float value;

public readonly Color inactiveColor;
public readonly _SliderType _sliderType;
public override State createState() {
return new _SliderState();
}

base.debugFillProperties(properties);
properties.add(new FloatProperty("value", value));
properties.add(new ObjectFlagProperty<ValueChanged<float>>("onChanged", onChanged, ifNull: "disabled"));
properties.add(ObjectFlagProperty<ValueChanged<float>>.has("onChangeStart", onChangeStart));
properties.add(ObjectFlagProperty<ValueChanged<float>>.has("onChangeEnd", onChangeEnd));
properties.add(new IntProperty("divisions", divisions));
properties.add(new StringProperty("label", label));
properties.add(new ColorProperty("activeColor", activeColor));
properties.add(new ColorProperty("inactiveColor", inactiveColor));
}
}

? (value - widget.min) / (widget.max - widget.min)
: 0.0f;
}
const double _defaultTrackHeight = 2;
static readonly SliderTrackShape _defaultTrackShape = new RoundedRectSliderTrackShape();
static readonly SliderTickMarkShape _defaultTickMarkShape = new RoundSliderTickMarkShape();
static readonly SliderComponentShape _defaultOverlayShape = new RoundSliderOverlayShape();
static readonly SliderComponentShape _defaultThumbShape = new RoundSliderThumbShape();
static readonly SliderComponentShape _defaultValueIndicatorShape = new PaddleSliderValueIndicatorShape();
static readonly ShowValueIndicator _defaultShowValueIndicator = ShowValueIndicator.onlyForDiscrete;
public override Widget build(BuildContext context) {
D.assert(material_.debugCheckHasMaterial(context));

32
com.unity.uiwidgets/Runtime/material/slider_theme.cs


using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class SliderTheme : InheritedWidget {
public class SliderTheme : InheritedTheme {
public SliderTheme(
Key key = null,
SliderThemeData data = null,

public readonly SliderThemeData data;
public static SliderThemeData of(BuildContext context) {
SliderTheme inheritedTheme = (SliderTheme) context.inheritFromWidgetOfExactType(typeof(SliderTheme));
SliderTheme inheritedTheme = context.dependOnInheritedWidgetOfExactType<SliderTheme>();
public override Widget wrap(BuildContext context, Widget child) {
SliderTheme ancestorTheme = context.findAncestorWidgetOfExactType<SliderTheme>();
return ReferenceEquals(this, ancestorTheme) ? child : new SliderTheme(data: data, child: child);
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {
SliderTheme _oldWidget = (SliderTheme) oldWidget;
return data != _oldWidget.data;

onlyForContinuous,
always,
never
}
public enum Thumb {
start,
end
}
public class SliderThemeData : Diagnosticable {

public readonly Color thumbColor;
public readonly Color overlappingShapeStrokeColor;
public readonly Color disabledThumbColor;
public readonly Color overlayColor;

public readonly SliderTrackShape trackShape;
public readonly SliderComponentShape overlayShap;
public readonly SliderTickMarkShape tickMarkShape;

public readonly SliderTrackShape trackShape;
public readonly RangeSliderTickMarkShape rangeTickMarkShape;
public readonly RangeSliderThumbShape rangeThumbShape;
public readonly RangeSliderTrackShape rangeTrackShape;
public readonly RangeSliderValueIndicatorShape rangeValueIndicatorShape;
public readonly float minThumbSeparation;
public readonly RangeThumbSelector thumbSelector;
public SliderThemeData copyWith(
float? trackHeight = null,

正在加载...
取消
保存