浏览代码

constants => material_

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
c6eba7af
共有 26 个文件被更改,包括 111 次插入102 次删除
  1. 16
      com.unity.uiwidgets/Runtime/material/app_bar.cs
  2. 2
      com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs
  3. 6
      com.unity.uiwidgets/Runtime/material/button.cs
  4. 2
      com.unity.uiwidgets/Runtime/material/button_theme.cs
  5. 6
      com.unity.uiwidgets/Runtime/material/checkbox.cs
  6. 2
      com.unity.uiwidgets/Runtime/material/chip.cs
  7. 15
      com.unity.uiwidgets/Runtime/material/circle_avatar.cs
  8. 2
      com.unity.uiwidgets/Runtime/material/constants.cs
  9. 50
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  10. 4
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs
  11. 2
      com.unity.uiwidgets/Runtime/material/flexible_space_bar.cs
  12. 38
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  13. 4
      com.unity.uiwidgets/Runtime/material/list_tile.cs
  14. 2
      com.unity.uiwidgets/Runtime/material/material.cs
  15. 2
      com.unity.uiwidgets/Runtime/material/mergeable_material.cs
  16. 6
      com.unity.uiwidgets/Runtime/material/outline_button.cs
  17. 4
      com.unity.uiwidgets/Runtime/material/popup_menu.cs
  18. 6
      com.unity.uiwidgets/Runtime/material/radio.cs
  19. 2
      com.unity.uiwidgets/Runtime/material/shadows.cs
  20. 2
      com.unity.uiwidgets/Runtime/material/slider.cs
  21. 14
      com.unity.uiwidgets/Runtime/material/switch.cs
  22. 2
      com.unity.uiwidgets/Runtime/material/tab_controller.cs
  23. 8
      com.unity.uiwidgets/Runtime/material/tabs.cs
  24. 4
      com.unity.uiwidgets/Runtime/material/toggle_buttons.cs
  25. 12
      com.unity.uiwidgets/Runtime/material/toggleable.cs
  26. 0
      /com.unity.uiwidgets/Runtime/material/material_.cs.meta

16
com.unity.uiwidgets/Runtime/material/app_bar.cs


namespace Unity.UIWidgets.material {
static class AppBarUtils {
internal const float _kLeadingWidth = Constants.kToolbarHeight;
internal const float _kLeadingWidth = material_.kToolbarHeight;
}
class _ToolbarContainerLayout : SingleChildLayoutDelegate {

public override BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return constraints.tighten(height: Constants.kToolbarHeight);
return constraints.tighten(height: material_.kToolbarHeight);
return new Size(constraints.maxWidth, Constants.kToolbarHeight);
return new Size(constraints.maxWidth, material_.kToolbarHeight);
}
public override Offset getPositionForChild(Size size, Size childSize) {

this.titleSpacing = titleSpacing;
this.toolbarOpacity = toolbarOpacity;
this.bottomOpacity = bottomOpacity;
preferredSize = Size.fromHeight(Constants.kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0f));
preferredSize = Size.fromHeight(material_.kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0f));
}
public readonly Widget leading;

children: new List<Widget> {
new Flexible(
child: new ConstrainedBox(
constraints: new BoxConstraints(maxHeight: Constants.kToolbarHeight),
constraints: new BoxConstraints(maxHeight: material_.kToolbarHeight),
child: appBar
)
),

readonly float _bottomHeight;
public override float? minExtent {
get { return collapsedHeight ?? (topPadding + Constants.kToolbarHeight + _bottomHeight); }
get { return collapsedHeight ?? (topPadding + material_.kToolbarHeight + _bottomHeight); }
(topPadding ?? 0.0f) + (expandedHeight ?? Constants.kToolbarHeight + _bottomHeight),
(topPadding ?? 0.0f) + (expandedHeight ?? material_.kToolbarHeight + _bottomHeight),
minExtent ?? 0.0f);
}
}

public override Widget build(BuildContext context, float shrinkOffset, bool overlapsContent) {
float? visibleMainHeight = maxExtent - shrinkOffset - topPadding;
float toolbarOpacity = !pinned || (!floating && bottom != null)
? ((visibleMainHeight - _bottomHeight) / Constants.kToolbarHeight)?.clamp(0.0f, 1.0f) ?? 1.0f
? ((visibleMainHeight - _bottomHeight) / material_.kToolbarHeight)?.clamp(0.0f, 1.0f) ?? 1.0f
: 1.0f;
Widget appBar = FlexibleSpaceBar.createSettings(
minExtent: minExtent,

2
com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs


color: backgroundColor,
child: new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: Constants.kBottomNavigationBarHeight + additionalBottomPadding),
minHeight: material_.kBottomNavigationBarHeight + additionalBottomPadding),
child: new CustomPaint(
painter: new _RadialPainter(
circles: _circles.ToList()

6
com.unity.uiwidgets/Runtime/material/button.cs


visualDensity = visualDensity ?? new VisualDensity();
padding = padding ?? EdgeInsets.zero;
constraints = constraints ?? new BoxConstraints(minWidth: 88.0f, minHeight: 36.0f);
TimeSpan _animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
TimeSpan _animationDuration = animationDuration ?? material_.kThemeChangeDuration;
this.onPressed = onPressed;
this.onLongPress = onLongPress;

switch (widget.materialTapTargetSize) {
case MaterialTapTargetSize.padded:
minSize = new Size(
Constants.kMinInteractiveDimension + densityAdjustment.dx,
Constants.kMinInteractiveDimension + densityAdjustment.dy
material_.kMinInteractiveDimension + densityAdjustment.dx,
material_.kMinInteractiveDimension + densityAdjustment.dy
);
D.assert(minSize.width >= 0.0f);
D.assert(minSize.height >= 0.0f);

2
com.unity.uiwidgets/Runtime/material/button_theme.cs


public TimeSpan getAnimationDuration(MaterialButton button) {
return button.animationDuration ?? Constants.kThemeChangeDuration;
return button.animationDuration ?? material_.kThemeChangeDuration;
}
public BoxConstraints getConstraints(MaterialButton button) {

6
com.unity.uiwidgets/Runtime/material/checkbox.cs


Size size;
switch (widget.materialTapTargetSize ?? themeData.materialTapTargetSize) {
case MaterialTapTargetSize.padded:
size = new Size(2 * Constants.kRadialReactionRadius + 8.0f,
2 * Constants.kRadialReactionRadius + 8.0f);
size = new Size(2 * material_.kRadialReactionRadius + 8.0f,
2 * material_.kRadialReactionRadius + 8.0f);
size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius);
size = new Size(2 * material_.kRadialReactionRadius, 2 * material_.kRadialReactionRadius);
break;
default:
throw new Exception("Unknown target size: " + widget.materialTapTargetSize);

2
com.unity.uiwidgets/Runtime/material/chip.cs


switch (widget.materialTapTargetSize ?? theme.materialTapTargetSize) {
case MaterialTapTargetSize.padded:
constraints =
new BoxConstraints(minHeight: Constants.kMinInteractiveDimension + densityAdjustment.dy);
new BoxConstraints(minHeight: material_.kMinInteractiveDimension + densityAdjustment.dy);
break;
case MaterialTapTargetSize.shrinkWrap:
constraints = new BoxConstraints();

15
com.unity.uiwidgets/Runtime/material/circle_avatar.cs


Widget child = null,
Color backgroundColor = null,
ImageProvider backgroundImage = null,
ImageErrorListener onBackgroundImageError = null,
Color foregroundColor = null,
float? radius = null,
float? minRadius = null,

D.assert(backgroundImage != null || onBackgroundImageError == null);
this.onBackgroundImageError = onBackgroundImageError;
this.foregroundColor = foregroundColor;
this.radius = radius;
this.minRadius = minRadius;

public readonly ImageProvider backgroundImage;
public readonly ImageErrorListener onBackgroundImageError;
public readonly float? radius;
public readonly float? minRadius;

public override Widget build(BuildContext context) {
D.assert(WidgetsD.debugCheckHasMediaQuery(context));
ThemeData theme = Theme.of(context);
TextStyle textStyle = theme.primaryTextTheme.subhead.copyWith(color: foregroundColor);
TextStyle textStyle = theme.primaryTextTheme.subtitle1.copyWith(color: foregroundColor);
Color effectiveBackgroundColor = backgroundColor;
if (effectiveBackgroundColor == null) {
switch (ThemeData.estimateBrightnessForColor(textStyle.color)) {

maxWidth: maxDiameter,
maxHeight: maxDiameter
),
duration: Constants.kThemeChangeDuration,
duration: material_.kThemeChangeDuration,
? new DecorationImage(image: backgroundImage, fit: BoxFit.cover)
? new DecorationImage(
image: backgroundImage,
onError: onBackgroundImageError,
fit: BoxFit.cover
)
: null,
shape: BoxShape.circle
),

2
com.unity.uiwidgets/Runtime/material/constants.cs


using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.material {
public static class Constants {
public partial class material_ {
public const float kMinInteractiveDimension = 48.0f;
public const float kToolbarHeight = 56.0f;

50
com.unity.uiwidgets/Runtime/material/dropdown.cs


using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
class DropdownConstants {
public partial class material_ {
public static readonly TimeSpan _kDropdownMenuDuration = new TimeSpan(0, 0, 0, 0, 300);
public const float _kMenuItemHeight = 48.0f;
public const float _kDenseButtonHeight = 24.0f;

_painter = new BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(2.0f),
boxShadow: ShadowConstants.kElevationToShadow[elevation ?? 0]
boxShadow: material_.kElevationToShadow[elevation ?? 0]
).createBoxPainter();
this.color = color;
this.elevation = elevation;

public readonly BoxPainter _painter;
public override void paint(Canvas canvas, Size size) {
float selectedItemOffset = selectedIndex ?? 0 * DropdownConstants._kMenuItemHeight +
Constants.kMaterialListPadding.top;
float selectedItemOffset = selectedIndex ?? 0 * material_._kMenuItemHeight +
material_.kMaterialListPadding.top;
begin: selectedItemOffset.clamp(0.0f, size.height - DropdownConstants._kMenuItemHeight),
begin: selectedItemOffset.clamp(0.0f, size.height - material_._kMenuItemHeight),
begin: (top.begin + DropdownConstants._kMenuItemHeight).clamp(DropdownConstants._kMenuItemHeight,
begin: (top.begin + material_._kMenuItemHeight).clamp(material_._kMenuItemHeight,
size.height),
end: size.height
);

child: new Scrollbar(
child: new ListView(
controller: widget.route.scrollController,
padding: Constants.kMaterialListPadding,
itemExtent: DropdownConstants._kMenuItemHeight,
padding: material_.kMaterialListPadding,
itemExtent: material_._kMenuItemHeight,
shrinkWrap: true,
children: children
)

public readonly float menuHeight;
public override BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
float maxHeight = Mathf.Max(0.0f, constraints.maxHeight - 2 * DropdownConstants._kMenuItemHeight);
float maxHeight = Mathf.Max(0.0f, constraints.maxHeight - 2 * material_._kMenuItemHeight);
float width = Mathf.Min(constraints.maxWidth, buttonRect.width);
return new BoxConstraints(
minWidth: width,

public ScrollController scrollController;
public override TimeSpan transitionDuration {
get { return DropdownConstants._kDropdownMenuDuration; }
get { return material_._kDropdownMenuDuration; }
}
public override bool barrierDismissible {

public override Widget build(BuildContext context) {
D.assert(WidgetsD.debugCheckHasDirectionality(context));
float availableHeight = constraints.maxHeight;
float maxMenuHeight = availableHeight - 2.0f * DropdownConstants._kMenuItemHeight;
float maxMenuHeight = availableHeight - 2.0f * material_._kMenuItemHeight;
float topLimit = Mathf.Min(DropdownConstants._kMenuItemHeight, buttonTop);
float bottomLimit = Mathf.Max(availableHeight - DropdownConstants._kMenuItemHeight, buttonBottom);
float topLimit = Mathf.Min(material_._kMenuItemHeight, buttonTop);
float bottomLimit = Mathf.Max(availableHeight - material_._kMenuItemHeight, buttonBottom);
float? selectedItemOffset = selectedIndex * DropdownConstants._kMenuItemHeight +
Constants.kMaterialListPadding.top;
float? selectedItemOffset = selectedIndex * material_._kMenuItemHeight +
material_.kMaterialListPadding.top;
(DropdownConstants._kMenuItemHeight - buttonRect.height) / 2.0f;
float preferredMenuHeight = (items.Count * DropdownConstants._kMenuItemHeight) +
Constants.kMaterialListPadding.vertical;
(material_._kMenuItemHeight - buttonRect.height) / 2.0f;
float preferredMenuHeight = (items.Count * material_._kMenuItemHeight) +
material_.kMaterialListPadding.vertical;
float menuHeight = Mathf.Min(maxMenuHeight, preferredMenuHeight);

public override Widget build(BuildContext context) {
return new Container(
height: DropdownConstants._kMenuItemHeight,
height: material_._kMenuItemHeight,
alignment: Alignment.centerLeft,
child: child
);

RenderBox itemBox = (RenderBox) context.findRenderObject();
Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size;
EdgeInsets menuMargin = ButtonTheme.of(context).alignedDropdown
? DropdownConstants._kAlignedMenuMargin
: DropdownConstants._kUnalignedMenuMargin;
? material_._kAlignedMenuMargin
: material_._kUnalignedMenuMargin;
padding: DropdownConstants._kMenuItemPadding,
padding: material_._kMenuItemPadding,
selectedIndex: _selectedIndex ?? 0,
elevation: widget.elevation,
theme: Theme.of(context, shadowThemeOnly: true),

float? _denseButtonHeight {
get {
return Mathf.Max(_textStyle.fontSize ?? 0.0f,
Mathf.Max(widget.iconSize, DropdownConstants._kDenseButtonHeight));
Mathf.Max(widget.iconSize, material_._kDenseButtonHeight));
}
}

}
EdgeInsets padding = ButtonTheme.of(context).alignedDropdown
? DropdownConstants._kAlignedButtonPadding
: DropdownConstants._kUnalignedButtonPadding;
? material_._kAlignedButtonPadding
: material_._kUnalignedButtonPadding;
IndexedStack innerItemsWidget = new IndexedStack(
index: _enabled ? (_selectedIndex ?? hintIndex) : hintIndex,

4
com.unity.uiwidgets/Runtime/material/expansion_panel.cs


TimeSpan? animationDuration = null) : base(key: key) {
this.children = children ?? new List<ExpansionPanel>();
this.expansionCallback = expansionCallback;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.animationDuration = animationDuration ?? material_.kThemeChangeDuration;
_allowOnlyOnePanelOpen = false;
initialOpenPanelValue = null;
}

object initialOpenPanelValue = null) : base(key: key) {
this.children = children ?? new List<ExpansionPanel>();
this.expansionCallback = expansionCallback;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.animationDuration = animationDuration ?? material_.kThemeChangeDuration;
_allowOnlyOnePanelOpen = true;
this.initialOpenPanelValue = initialOpenPanelValue;
}

2
com.unity.uiwidgets/Runtime/material/flexible_space_bar.cs


.clamp(0.0f, 1.0f);
if (widget.background != null) {
float fadeStart = Mathf.Max(0.0f, 1.0f - Constants.kToolbarHeight / deltaExtent);
float fadeStart = Mathf.Max(0.0f, 1.0f - material_.kToolbarHeight / deltaExtent);
float fadeEnd = 1.0f;
D.assert(fadeStart <= fadeEnd);

38
com.unity.uiwidgets/Runtime/material/input_decorator.cs


using Transform = Unity.UIWidgets.widgets.Transform;
namespace Unity.UIWidgets.material {
class InputDecoratorConstants {
public partial class material_ {
public static readonly TimeSpan _kTransitionDuration = new TimeSpan(0, 0, 0, 0, 200);
public static readonly Curve _kTransitionCurve = Curves.fastOutSlowIn;
}

vsync: this
);
_controller = new AnimationController(
duration: InputDecoratorConstants._kTransitionDuration,
duration: material_._kTransitionDuration,
curve: InputDecoratorConstants._kTransitionCurve
curve: material_._kTransitionCurve
);
_border = new _InputBorderTween(
begin: widget.border,

public override void initState() {
base.initState();
_controller = new AnimationController(
duration: InputDecoratorConstants._kTransitionDuration,
duration: material_._kTransitionDuration,
vsync: this
);
if (widget.errorText != null) {

);
float minContainerHeight = decoration.isDense.Value || expands
? 0.0f
: Constants.kMinInteractiveDimension + densityOffset.dy;
: material_.kMinInteractiveDimension + densityOffset.dy;
float maxContainerHeight = boxConstraints.maxHeight - bottomHeight + densityOffset.dy;
float containerHeight = expands
? maxContainerHeight

return DefaultTextStyle.merge(
style: style,
child: new AnimatedOpacity(
duration: InputDecoratorConstants._kTransitionDuration,
curve: InputDecoratorConstants._kTransitionCurve,
duration: material_._kTransitionDuration,
curve: material_._kTransitionCurve,
opacity: labelIsFloating ? 1.0f : 0.0f,
child: child ?? new Text(text, style: style)
)

(widget.decoration.hasFloatingPlaceholder == true &&
widget._labelShouldWithdraw);
_floatingLabelController = new AnimationController(
duration: InputDecoratorConstants._kTransitionDuration,
duration: material_._kTransitionDuration,
vsync: this,
value: labelIsInitiallyFloating ? 1.0f : 0.0f
);

duration: InputDecoratorConstants._kTransitionDuration,
duration: material_._kTransitionDuration,
vsync: this
);
}

? null
: new AnimatedOpacity(
opacity: (isEmpty && !_hasInlineLabel) ? 1.0f : 0.0f,
duration: InputDecoratorConstants._kTransitionDuration,
curve: InputDecoratorConstants._kTransitionCurve,
duration: material_._kTransitionDuration,
curve: material_._kTransitionCurve,
child: new Text(decoration.hintText,
style: hintStyle,
overflow: TextOverflow.ellipsis,

: new _Shaker(
animation: _shakingLabelController.view,
child: new AnimatedOpacity(
duration: InputDecoratorConstants._kTransitionDuration,
curve: InputDecoratorConstants._kTransitionCurve,
duration: material_._kTransitionDuration,
curve: material_._kTransitionCurve,
duration: InputDecoratorConstants._kTransitionDuration,
curve: InputDecoratorConstants._kTransitionCurve,
duration: material_._kTransitionDuration,
curve: material_._kTransitionCurve,
style: widget._labelShouldWithdraw
? _getFloatingLabelStyle(themeData)
: inlineLabelStyle,

child: new ConstrainedBox(
constraints: decoration.prefixIconConstraints ?? themeData.visualDensity.effectiveConstraints(
new BoxConstraints(
minWidth: Constants.kMinInteractiveDimension,
minHeight: Constants.kMinInteractiveDimension
minWidth: material_.kMinInteractiveDimension,
minHeight: material_.kMinInteractiveDimension
)),
child: IconTheme.merge(
data: new IconThemeData(

child: new ConstrainedBox(
constraints: decoration.suffixIconConstraints ?? themeData.visualDensity.effectiveConstraints(
new BoxConstraints(
minWidth: Constants.kMinInteractiveDimension,
minHeight: Constants.kMinInteractiveDimension
minWidth: material_.kMinInteractiveDimension,
minHeight: material_.kMinInteractiveDimension
)),
child: IconTheme.merge(
data: new IconThemeData(

4
com.unity.uiwidgets/Runtime/material/list_tile.cs


TextStyle titleStyle = _titleTextStyle(theme, tileTheme);
Widget titleText = new AnimatedDefaultTextStyle(
style: titleStyle,
duration: Constants.kThemeChangeDuration,
duration: material_.kThemeChangeDuration,
child: title ?? new SizedBox()
);

subtitleStyle = _subtitleTextStyle(theme, tileTheme);
subtitleText = new AnimatedDefaultTextStyle(
style: subtitleStyle,
duration: Constants.kThemeChangeDuration,
duration: material_.kThemeChangeDuration,
child: subtitle);
}

2
com.unity.uiwidgets/Runtime/material/material.cs


this.shape = shape;
this.borderOnForeground = borderOnForeground;
this.clipBehavior = clipBehavior;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.animationDuration = animationDuration ?? material_.kThemeChangeDuration;
this.child = child;
}

2
com.unity.uiwidgets/Runtime/material/mergeable_material.cs


return new _MergeableMaterialListBody(
mainAxis: widget.mainAxis,
boxShadows: ShadowConstants.kElevationToShadow[widget.elevation],
boxShadows: material_.kElevationToShadow[widget.elevation],
items: _children,
children: widgets
);

6
com.unity.uiwidgets/Runtime/material/outline_button.cs


using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
class OutlineButtonConstants {
public partial class material_ {
public static readonly TimeSpan _kPressDuration = new TimeSpan(0, 0, 0, 0, 150);
public static readonly TimeSpan _kElevationDuration = new TimeSpan(0, 0, 0, 0, 75);

_controller = new AnimationController(
duration: OutlineButtonConstants._kPressDuration,
duration: material_._kPressDuration,
vsync: this
);
_fillAnimation = new CurvedAnimation(

),
clipBehavior:
widget.clipBehavior,
animationDuration: OutlineButtonConstants._kElevationDuration,
animationDuration: material_._kElevationDuration,
child:
widget.child
);

4
com.unity.uiwidgets/Runtime/material/popup_menu.cs


Widget item = new AnimatedDefaultTextStyle(
style: style,
duration: Constants.kThemeChangeDuration,
duration: material_.kThemeChangeDuration,
child: new Baseline(
baseline: widget.height - PopupMenuUtils._kBaselineOffsetFromBottom,
baselineType: style.textBaseline,

Widget item = new AnimatedDefaultTextStyle(
style: style,
duration: Constants.kThemeChangeDuration,
duration: material_.kThemeChangeDuration,
child: new Baseline(
baseline: widget.height - PopupMenuUtils._kBaselineOffsetFromBottom,
baselineType: style.textBaseline,

6
com.unity.uiwidgets/Runtime/material/radio.cs


Size size;
switch (widget.materialTapTargetSize ?? themeData.materialTapTargetSize) {
case MaterialTapTargetSize.padded:
size = new Size(2 * Constants.kRadialReactionRadius + 8.0f,
2 * Constants.kRadialReactionRadius + 8.0f);
size = new Size(2 * material_.kRadialReactionRadius + 8.0f,
2 * material_.kRadialReactionRadius + 8.0f);
size = new Size(2 * Constants.kRadialReactionRadius, 2 * Constants.kRadialReactionRadius);
size = new Size(2 * material_.kRadialReactionRadius, 2 * material_.kRadialReactionRadius);
break;
default:
throw new Exception("Unknown material tap target size");

2
com.unity.uiwidgets/Runtime/material/shadows.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.material {
public class ShadowConstants {
public partial class material_ {
static readonly Color _kKeyUmbraOpacity = new Color(0x33000000); // alpha = 0.2
static readonly Color _kKeyPenumbraOpacity = new Color(0x24000000); // alpha = 0.14
static readonly Color _kAmbientShadowOpacity = new Color(0x1F000000); // alpha = 0.12

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


public override void initState() {
base.initState();
overlayController = new AnimationController(
duration: Constants.kRadialReactionDuration,
duration: material_.kRadialReactionDuration,
vsync: this
);
valueIndicatorController = new AnimationController(

14
com.unity.uiwidgets/Runtime/material/switch.cs


internal const float _kTrackWidth = 33.0f;
internal const float _kTrackRadius = _kTrackHeight / 2.0f;
internal const float _kThumbRadius = 10.0f;
internal const float _kSwitchWidth = _kTrackWidth - 2 * _kTrackRadius + 2 * Constants.kRadialReactionRadius;
internal const float _kSwitchHeight = 2 * Constants.kRadialReactionRadius + 8.0f;
internal const float _kSwitchHeightCollapsed = 2 * Constants.kRadialReactionRadius;
internal const float _kSwitchWidth = _kTrackWidth - 2 * _kTrackRadius + 2 * material_.kRadialReactionRadius;
internal const float _kSwitchHeight = 2 * material_.kRadialReactionRadius + 8.0f;
internal const float _kSwitchHeightCollapsed = 2 * material_.kRadialReactionRadius;
public Switch(
Key key = null,

}
float _trackInnerLength {
get { return size.width - 2.0f * Constants.kRadialReactionRadius; }
get { return size.width - 2.0f * material_.kRadialReactionRadius; }
}
HorizontalDragGestureRecognizer _drag;

color: color,
image: image == null ? null : new DecorationImage(image: image),
shape: BoxShape.circle,
boxShadow: ShadowConstants.kElevationToShadow[1]
boxShadow: material_.kElevationToShadow[1]
);
}

// Paint the track
Paint paint = new Paint {color = trackColor};
float trackHorizontalPadding = Constants.kRadialReactionRadius - Switch._kTrackRadius;
float trackHorizontalPadding = material_.kRadialReactionRadius - Switch._kTrackRadius;
Rect trackRect = Rect.fromLTWH(
offset.dx + trackHorizontalPadding,
offset.dy + (size.height - Switch._kTrackHeight) / 2.0f,

canvas.drawRRect(trackRRect, paint);
Offset thumbPosition = new Offset(
Constants.kRadialReactionRadius + visualPosition * _trackInnerLength,
material_.kRadialReactionRadius + visualPosition * _trackInnerLength,
size.height / 2.0f
);

2
com.unity.uiwidgets/Runtime/material/tab_controller.cs


int _indexIsChangingCount = 0;
public void animateTo(int value, TimeSpan? duration = null, Curve curve = null) {
duration = duration ?? Constants.kTabScrollDuration;
duration = duration ?? material_.kTabScrollDuration;
curve = curve ?? Curves.ease;
_changeIndex(value, duration: duration, curve: curve);
}

8
com.unity.uiwidgets/Runtime/material/tabs.cs


void _scrollToCurrentIndex() {
float offset = _tabCenteredScrollOffset(_currentIndex);
_scrollController.animateTo(offset, duration: Constants.kTabScrollDuration, curve: Curves.ease);
_scrollController.animateTo(offset, duration: material_.kTabScrollDuration, curve: Curves.ease);
}
void _scrollToControllerValue() {

wrappedTabs.Add(new Center(
heightFactor: 1.0f,
child: new Padding(
padding: widget.labelPadding ?? tabBarTheme.labelPadding ?? Constants.kTabLabelPadding,
padding: widget.labelPadding ?? tabBarTheme.labelPadding ?? material_.kTabLabelPadding,
child: new KeyedSubtree(
key: _tabKeys[i],
child: widget.tabs[i]

int previousIndex = _controller.previousIndex;
if ((_currentIndex.Value - previousIndex).abs() == 1) {
_pageController.animateToPage(_currentIndex.Value, duration: Constants.kTabScrollDuration,
_pageController.animateToPage(_currentIndex.Value, duration: material_.kTabScrollDuration,
curve: Curves.ease);
return;
}

});
_pageController.jumpToPage(initialPage);
_pageController.animateToPage(_currentIndex.Value, duration: Constants.kTabScrollDuration,
_pageController.animateToPage(_currentIndex.Value, duration: material_.kTabScrollDuration,
curve: Curves.ease).then((value) => {
if (!mounted) {
return Future.value();

4
com.unity.uiwidgets/Runtime/material/toggle_buttons.cs


TextStyle currentTextStyle = textStyle ?? toggleButtonsTheme.textStyle ?? theme.textTheme.bodyText2;
BoxConstraints currentConstraints = constraints ?? toggleButtonsTheme.constraints ??
new BoxConstraints(minWidth: Constants.kMinInteractiveDimension,
minHeight: Constants.kMinInteractiveDimension);
new BoxConstraints(minWidth: material_.kMinInteractiveDimension,
minHeight: material_.kMinInteractiveDimension);
Widget result = new ClipRRect(
borderRadius: clipRadius,

12
com.unity.uiwidgets/Runtime/material/toggleable.cs


public static readonly TimeSpan _kToggleDuration = new TimeSpan(0, 0, 0, 0, 200);
public static readonly Animatable<float> _kRadialReactionRadiusTween =
new FloatTween(begin: 0.0f, end: Constants.kRadialReactionRadius);
new FloatTween(begin: 0.0f, end: material_.kRadialReactionRadius);
public static readonly TimeSpan _kReactionFadeDuration = new TimeSpan(0, 0, 0, 0, 50);
}

_tristate = tristate;
_activeColor = activeColor;
_inactiveColor = inactiveColor;
_hoverColor = hoverColor ?? activeColor.withAlpha(Constants.kRadialReactionAlpha);
_focusColor = focusColor ?? activeColor.withAlpha(Constants.kRadialReactionAlpha);
_hoverColor = hoverColor ?? activeColor.withAlpha(material_.kRadialReactionAlpha);
_focusColor = focusColor ?? activeColor.withAlpha(material_.kRadialReactionAlpha);
_onChanged = onChanged;
_hasFocus = hasFocus;
_hovering = hovering;

_position.addListener(markNeedsPaint);
_reactionController = new AnimationController(
duration: Constants.kRadialReactionDuration,
duration: material_.kRadialReactionDuration,
vsync: vsync);
_reaction = new CurvedAnimation(
parent: _reactionController,

if (!_reaction.isDismissed || !_reactionFocusFade.isDismissed || !_reactionHoverFade.isDismissed) {
Paint reactionPaint = new Paint();
reactionPaint.color = Color.lerp(
Color.lerp(activeColor.withAlpha(Constants.kRadialReactionAlpha), hoverColor,
Color.lerp(activeColor.withAlpha(material_.kRadialReactionAlpha), hoverColor,
? Constants.kRadialReactionRadius
? material_.kRadialReactionRadius
: ToggleableUtils._kRadialReactionRadiusTween.evaluate(_reaction);
if (reactionRadius > 0.0f) {

/com.unity.uiwidgets/Runtime/material/constants.cs.meta → /com.unity.uiwidgets/Runtime/material/material_.cs.meta

正在加载...
取消
保存