浏览代码

Merge branch 'siyaoH/1.17/material' of https://github.com/Unity-Technologies/com.unity.uiwidgets into siyaoH/1.17/material

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
7fd61299
共有 44 个文件被更改,包括 162 次插入159 次删除
  1. 1
      com.unity.uiwidgets/Runtime/material/app_bar.cs
  2. 1
      com.unity.uiwidgets/Runtime/material/app_bar_theme.cs
  3. 1
      com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs
  4. 11
      com.unity.uiwidgets/Runtime/material/bottom_sheet.cs
  5. 1
      com.unity.uiwidgets/Runtime/material/button_theme.cs
  6. 9
      com.unity.uiwidgets/Runtime/material/chip.cs
  7. 1
      com.unity.uiwidgets/Runtime/material/color_scheme.cs
  8. 8
      com.unity.uiwidgets/Runtime/material/date_picker.cs
  9. 14
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  10. 2
      com.unity.uiwidgets/Runtime/material/expansion_tile.cs
  11. 14
      com.unity.uiwidgets/Runtime/material/feedback.cs
  12. 2
      com.unity.uiwidgets/Runtime/material/flexible_space_bar.cs
  13. 4
      com.unity.uiwidgets/Runtime/material/floating_action_button.cs
  14. 2
      com.unity.uiwidgets/Runtime/material/ink_decoration.cs
  15. 2
      com.unity.uiwidgets/Runtime/material/ink_highlight.cs
  16. 2
      com.unity.uiwidgets/Runtime/material/ink_ripple.cs
  17. 2
      com.unity.uiwidgets/Runtime/material/ink_splash.cs
  18. 28
      com.unity.uiwidgets/Runtime/material/input_border.cs
  19. 13
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  20. 9
      com.unity.uiwidgets/Runtime/material/list_tile.cs
  21. 5
      com.unity.uiwidgets/Runtime/material/material.cs
  22. 1
      com.unity.uiwidgets/Runtime/material/material_button.cs
  23. 10
      com.unity.uiwidgets/Runtime/material/material_localizations.cs
  24. 8
      com.unity.uiwidgets/Runtime/material/outline_button.cs
  25. 8
      com.unity.uiwidgets/Runtime/material/popup_menu.cs
  26. 1
      com.unity.uiwidgets/Runtime/material/radio.cs
  27. 28
      com.unity.uiwidgets/Runtime/material/refresh_indicator.cs
  28. 2
      com.unity.uiwidgets/Runtime/material/reorderable_list.cs
  29. 30
      com.unity.uiwidgets/Runtime/material/scaffold.cs
  30. 3
      com.unity.uiwidgets/Runtime/material/scrollbar.cs
  31. 31
      com.unity.uiwidgets/Runtime/material/search.cs
  32. 12
      com.unity.uiwidgets/Runtime/material/slider.cs
  33. 1
      com.unity.uiwidgets/Runtime/material/snack_bar.cs
  34. 1
      com.unity.uiwidgets/Runtime/material/switch.cs
  35. 1
      com.unity.uiwidgets/Runtime/material/tab_controller.cs
  36. 12
      com.unity.uiwidgets/Runtime/material/tabs.cs
  37. 1
      com.unity.uiwidgets/Runtime/material/text_field.cs
  38. 1
      com.unity.uiwidgets/Runtime/material/text_form_field.cs
  39. 24
      com.unity.uiwidgets/Runtime/material/text_selection.cs
  40. 1
      com.unity.uiwidgets/Runtime/material/theme_data.cs
  41. 1
      com.unity.uiwidgets/Runtime/material/toggleable.cs
  42. 3
      com.unity.uiwidgets/Runtime/material/tooltip.cs
  43. 5
      com.unity.uiwidgets/Runtime/services/system_chrome.cs
  44. 4
      com.unity.uiwidgets/Runtime/widgets/navigator.cs

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


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Brightness = Unity.UIWidgets.service.Brightness;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

1
com.unity.uiwidgets/Runtime/material/app_bar_theme.cs


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Brightness = Unity.UIWidgets.service.Brightness;
namespace Unity.UIWidgets.material {
public class AppBarTheme : Diagnosticable {

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


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Brightness = Unity.UIWidgets.service.Brightness;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;

11
com.unity.uiwidgets/Runtime/material/bottom_sheet.cs


using System;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

public const float _kMinFlingVelocity = 700.0f;
public const float _kCloseProgressThreshold = 0.5f;
public static IPromise<object> showModalBottomSheet<T>(
public static Future<T> showModalBottomSheet<T>(
BuildContext context,
WidgetBuilder builder
) {

return Navigator.push(context, new _ModalBottomSheetRoute<T>(
return Navigator.of(context, rootNavigator: false).push<T>(new _ModalBottomSheetRoute<T>(
builder: builder,
theme: Theme.of(context, shadowThemeOnly: true),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel

MaterialLocalizations localizations = MaterialLocalizations.of(context);
return new GestureDetector(
onTap: () => Navigator.pop(context),
onTap: () => Navigator.pop<T>(context),
child: new AnimatedBuilder(
animation: widget.route.animation,
builder: (BuildContext _context, Widget child) => {

layoutDelegate: new _ModalBottomSheetLayout(animationValue),
child: new BottomSheet(
animationController: widget.route._animationController,
onClosing: () => Navigator.pop(_context),
onClosing: () => Navigator.pop<T>(_context),
builder: widget.route.builder
)
)

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


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Brightness = Unity.UIWidgets.service.Brightness;
namespace Unity.UIWidgets.material {
public enum ButtonTextTheme {

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


using System;
using System.Collections.Generic;
using RSG.Promises;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;

slotToChild.Values.Each((value) => { visitor(value); });
}
protected override void forgetChild(Element child) {
internal override void forgetChild(Element child) {
D.assert(slotToChild.ContainsValue(child));
D.assert(childToSlot.ContainsKey(child));
_ChipSlot slot = childToSlot[child];

return (BoxParentData) box.parentData;
}
protected override float computeMinIntrinsicWidth(float height) {
protected internal override float computeMinIntrinsicWidth(float height) {
float overallPadding = theme.padding.horizontal + theme.labelPadding.horizontal;
return overallPadding +
_minWidth(avatar, height) +

protected override float computeMaxIntrinsicWidth(float height) {
protected internal override float computeMaxIntrinsicWidth(float height) {
float overallPadding = theme.padding.vertical + theme.labelPadding.horizontal;
return overallPadding +
_maxWidth(avatar, height) +

protected override float computeMinIntrinsicHeight(float width) {
protected internal override float computeMinIntrinsicHeight(float width) {
return Mathf.Max(
ChipUtils._kChipHeight,
theme.padding.vertical + theme.labelPadding.vertical + _minHeight(label, width)

1
com.unity.uiwidgets/Runtime/material/color_scheme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Brightness = Unity.UIWidgets.service.Brightness;
namespace Unity.UIWidgets.material {
public class ColorScheme : Diagnosticable, IEquatable<ColorScheme> {

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


using System;
using System.Collections.Generic;
using com.unity.uiwidgets.Runtime.rendering;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

internal static readonly _DayPickerGridDelegate _kDayPickerGridDelegate = new _DayPickerGridDelegate();
public static IPromise<object> showDatePicker(
public static Future<object> showDatePicker(
BuildContext context,
DateTime initialDate,
DateTime firstDate,

DateTime tomorrow = _todayDate.AddDays(1);
TimeSpan timeUntilTomorrow = tomorrow.TimeOfDay - _todayDate.TimeOfDay;
_timer?.cancel();
_timer = Window.instance.run(timeUntilTomorrow,
_timer = Timer.create(timeUntilTomorrow,
() => { setState(() => { _updateCurrentDate(); }); });
}

}
void _handleCancel() {
Navigator.pop(context);
Navigator.pop<object>(context);
}
void _handleOk() {

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


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

}
}
class _DropdownRoute<T> : PopupRoute where T : class {
class _DropdownRoute<T> : PopupRoute<_DropdownRouteResult<T>> where T : class {
public _DropdownRoute(
List<DropdownMenuItem<T>> items = null,
EdgeInsets padding = null,

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future.value(false).to<bool>();
}
public void didChangePlatformBrightness() {

barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel
);
Navigator.push(context, _dropdownRoute).Then(newValue => {
Navigator.push<T>(context, _dropdownRoute).then(newValue => {
_DropdownRouteResult<T> value = newValue as _DropdownRouteResult<T>;
_dropdownRoute = null;
if (!mounted || newValue == null) {

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


_controller.forward();
}
else {
_controller.reverse().Then(() => {
_controller.reverse().then((value) => {
if (!mounted) {
return;
}

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


using Unity.UIWidgets.async2;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.widgets;
using UnityEngine;

Feedback() {
}
public static IPromise forTap(BuildContext context) {
public static Future forTap(BuildContext context) {
Promise.Resolved(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
return Promise.Resolved();
return Future.value();
}
}

};
}
public static IPromise forLongPress(BuildContext context) {
public static Future forLongPress(BuildContext context) {
return Promise.Resolved(); // HapticFeedback.vibrate(); TODO
return Future.value(); // HapticFeedback.vibrate(); TODO
return Promise.Resolved();
return Future.value();
}
}

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


bottom: 16.0f
);
float scaleValue = new FloatTween(begin: 1.5f, end: 1.0f).lerp(t);
Matrix4 scaleTransform = new Matrix4().diagonal3Values(scaleValue, scaleValue, 1);
Matrix4 scaleTransform = Matrix4.diagonal3Values(scaleValue, scaleValue, 1);
Alignment titleAlignment = _getTitleAlignment(effectiveCenterTitle);
children.Add(new Container(

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


RenderBox child = null) : base(child: child, alignment: Alignment.center) {
}
protected override float computeMinIntrinsicWidth(float height) {
protected internal override float computeMinIntrinsicWidth(float height) {
protected override float computeMinIntrinsicHeight(float width) {
protected internal override float computeMinIntrinsicHeight(float width) {
return 0.0f;
}

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


if (originOffset == null) {
canvas.save();
canvas.concat(transform.toMatrix3());
canvas.transform(transform.storage);
_painter.paint(canvas, Offset.zero, sizedConfiguration);
canvas.restore();
}

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


Rect rect = _rectCallback != null ? _rectCallback() : Offset.zero & referenceBox.size;
if (originOffset == null) {
canvas.save();
canvas.concat(transform.toMatrix3());
canvas.transform(transform.storage);
_paintHighlight(canvas, rect, paint);
canvas.restore();
}

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


Offset originOffset = transform.getAsTranslation();
canvas.save();
if (originOffset == null) {
canvas.concat(transform.toMatrix3());
canvas.transform(transform.storage);
}
else {
canvas.translate(originOffset.dx, originOffset.dy);

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


Offset originOffset = transform.getAsTranslation();
canvas.save();
if (originOffset == null) {
canvas.concat(transform.toMatrix3());
canvas.transform(transform.storage);
}
else {
canvas.translate(originOffset.dx, originOffset.dy);

28
com.unity.uiwidgets/Runtime/material/input_border.cs


float gapPercentage = 0.0f
);
public override void paint(Canvas canvas, Rect rect) {
public override void paint(Canvas canvas, Rect rect, TextDirection? textDirection) {
paint(canvas, rect, 0.0f);
}
}

get { return false; }
}
public override EdgeInsets dimensions {
public override EdgeInsetsGeometry dimensions {
get { return EdgeInsets.zero; }
}

public override Path getInnerPath(Rect rect) {
public override Path getInnerPath(Rect rect, TextDirection? textDirection) {
public override Path getOuterPath(Rect rect) {
public override void paint(Canvas canvas, Rect rect, TextDirection? textDirection) {
throw new System.NotImplementedException();
}
public override Path getOuterPath(Rect rect, TextDirection? textDirection) {
Path path = new Path();
path.addRect(rect);
return path;

);
}
public override EdgeInsets dimensions {
public override EdgeInsetsGeometry dimensions {
get { return EdgeInsets.only(bottom: borderSide.width); }
}

public override Path getInnerPath(Rect rect) {
public override Path getInnerPath(Rect rect, TextDirection? textDirection) {
Path path = new Path();
path.addRect(Rect.fromLTWH(rect.left, rect.top, rect.width,
Mathf.Max(0.0f, rect.height - borderSide.width)));

public override Path getOuterPath(Rect rect) {
public override Path getOuterPath(Rect rect, TextDirection? textDirection) {
Path path = new Path();
path.addRRect(borderRadius.toRRect(rect));
return path;

float gapPercentage = 0.0f
) {
if (borderRadius.bottomLeft != Radius.zero || borderRadius.bottomRight != Radius.zero) {
canvas.clipPath(getOuterPath(rect));
canvas.clipPath(getOuterPath(rect, null));
}
canvas.drawLine(rect.bottomLeft, rect.bottomRight, borderSide.toPaint());

);
}
public override EdgeInsets dimensions {
public override EdgeInsetsGeometry dimensions {
get { return EdgeInsets.all(borderSide.width); }
}

borderRadius: borderRadius * t,
borderRadius: (BorderRadius)(borderRadius * t),
gapPadding: gapPadding * t
);
}

return base.lerpTo(b, t);
}
public override Path getInnerPath(Rect rect) {
public override Path getInnerPath(Rect rect, TextDirection? textDirection) {
public override Path getOuterPath(Rect rect) {
public override Path getOuterPath(Rect rect, TextDirection? textDirection) {
Path path = new Path();
path.addRRect(borderRadius.toRRect(rect));
return path;

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


using System;
using System.Collections.Generic;
using RSG.Promises;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;

protected internal override Widget build(BuildContext context) {
return new Transform(
transform: new Matrix4().translationValues(translateX, 0, 0),
transform: Matrix4.translationValues(translateX, 0, 0),
child: child
);
}

);
}
protected override float computeMinIntrinsicWidth(float height) {
protected internal override float computeMinIntrinsicWidth(float height) {
return _minWidth(icon, height)
+ contentPadding.left
+ _minWidth(prefixIcon, height)

+ contentPadding.right;
}
protected override float computeMaxIntrinsicWidth(float height) {
protected internal override float computeMaxIntrinsicWidth(float height) {
return _maxWidth(icon, height)
+ contentPadding.left
+ _maxWidth(prefixIcon, height)

return height;
}
protected override float computeMinIntrinsicHeight(float width) {
protected internal override float computeMinIntrinsicHeight(float width) {
float subtextHeight = _lineHeight(width, new List<RenderBox> {helperError, counter});
if (subtextHeight > 0.0f) {
subtextHeight += subtextGap;

float scale = MathUtils.lerpFloat(1.0f, 0.75f, t);
float dx = labelOffset.dx;
float dy = MathUtils.lerpFloat(0.0f, floatingY - labelOffset.dy, t);
_labelTransform = new Matrix4().identity();
_labelTransform = Matrix4.identity();
_labelTransform.translate(dx, labelOffset.dy + dy);
_labelTransform.scale(scale, scale, 1);
context.pushTransform(needsCompositing, offset, _labelTransform, _paintLabel);

slotToChild.Values.Each((child) => { visitor(child); });
}
protected override void forgetChild(Element child) {
internal override void forgetChild(Element child) {
D.assert(slotToChild.ContainsValue(child));
D.assert(childToSlot.ContainsKey(child));
_DecorationSlot slot = childToSlot[child];

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


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Brightness = Unity.UIWidgets.service.Brightness;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

}
}
protected override void forgetChild(Element child) {
internal override void forgetChild(Element child) {
D.assert(slotToChild.Values.Contains(child));
D.assert(childToSlot.Keys.Contains(child));
_ListTileSlot slot = childToSlot[child];

return box == null ? 0.0f : box.getMaxIntrinsicWidth(height);
}
protected override float computeMinIntrinsicWidth(float height) {
protected internal override float computeMinIntrinsicWidth(float height) {
float leadingWidth = leading != null
? Mathf.Max(leading.getMinIntrinsicWidth(height), _minLeadingWidth) + _horizontalTitleGap
: 0.0f;

protected override float computeMaxIntrinsicWidth(float height) {
protected internal override float computeMaxIntrinsicWidth(float height) {
float leadingWidth = leading != null
? Mathf.Max(leading.getMaxIntrinsicWidth(height), _minLeadingWidth) + _horizontalTitleGap
: 0.0f;

}
}
protected override float computeMinIntrinsicHeight(float width) {
protected internal override float computeMinIntrinsicHeight(float width) {
return Mathf.Max(
_defaultTileHeight,
title.getMinIntrinsicHeight(width) + subtitle?.getMinIntrinsicHeight(width) ?? 0.0f);

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


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

descendants.Add(node);
}
Matrix4 transform = new Matrix4().identity();
Matrix4 transform = Matrix4.identity();
D.assert(descendants.Count >= 2);
for (int index = descendants.Count - 1; index > 0; index -= 1) {
descendants[index].applyPaintTransform(descendants[index - 1], transform);

public override void paint(Canvas canvas, Size size) {
border.paint(canvas, Offset.zero & size);
border.paint(canvas, Offset.zero & size, null);
}
public override bool shouldRepaint(CustomPainter oldDelegate) {

1
com.unity.uiwidgets/Runtime/material/material_button.cs


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Brightness = Unity.UIWidgets.service.Brightness;
namespace Unity.UIWidgets.material {
public class MaterialButton : StatelessWidget {

10
com.unity.uiwidgets/Runtime/material/material_localizations.cs


using System;
using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

return locale.languageCode == "en";
}
public override IPromise<object> load(Locale locale) {
return DefaultMaterialLocalizations.load(locale);
public override Future<WidgetsLocalizations> load(Locale locale) {
return DefaultMaterialLocalizations.load(locale).to<WidgetsLocalizations>();
}
public override bool shouldReload(LocalizationsDelegate old) {

: TimeOfDayFormat.h_colon_mm_space_a;
}
public static IPromise<object> load(Locale locale) {
return Promise<object>.Resolved(new DefaultMaterialLocalizations());
public static Future<MaterialLocalizations> load(Locale locale) {
return new SynchronousFuture<MaterialLocalizations>(new DefaultMaterialLocalizations());
}
public static readonly LocalizationsDelegate<MaterialLocalizations> del = new _MaterialLocalizationsDelegate();

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


public readonly ShapeBorder shape;
public readonly BorderSide side;
public override EdgeInsets dimensions {
public override EdgeInsetsGeometry dimensions {
get { return EdgeInsets.all(side.width); }
}

return base.lerpTo(b, t);
}
public override Path getInnerPath(Rect rect) {
public override Path getInnerPath(Rect rect, TextDirection? textDirection) {
public override Path getOuterPath(Rect rect) {
public override Path getOuterPath(Rect rect, TextDirection? textDirection) {
public override void paint(Canvas canvas, Rect rect) {
public override void paint(Canvas canvas, Rect rect, TextDirection? textDirection) {
switch (side.style) {
case BorderStyle.none:
break;

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


using System;
using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

}
public static partial class PopupMenuUtils {
public static IPromise<object> showMenu<T>(
public static Future<T> showMenu<T>(
BuildContext context,
RelativeRect position,
List<PopupMenuEntry<T>> items,

D.assert(items != null && items.isNotEmpty());
D.assert(material_.debugCheckHasMaterialLocalizations(context));
return Navigator.push(context, new _PopupMenuRoute<T>(
return Navigator.push<T>(context, new _PopupMenuRoute<T>(
position: position,
items: items,
initialValue: initialValue,

initialValue: widget.initialValue,
position: position
)
.Then(newValue => {
.then(newValue => {
if (!mounted) {
return;
}

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


using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

28
com.unity.uiwidgets/Runtime/material/refresh_indicator.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;

public static readonly TimeSpan _kIndicatorScaleDuration = new TimeSpan(0, 0, 0, 0, 200);
}
public delegate Promise RefreshCallback();
public delegate Future RefreshCallback();
enum _RefreshIndicatorMode {
drag, // Pointer is down.

Animation<Color> _valueColor;
_RefreshIndicatorMode? _mode;
Promise _pendingRefreshFuture;
Future _pendingRefreshFuture;
bool? _isIndicatorAtTop;
float? _dragOffset;

}
}
IPromise _dismiss(_RefreshIndicatorMode newMode) {
Future _dismiss(_RefreshIndicatorMode newMode) {
.animateTo(1.0f, duration: RefreshIndicatorUtils._kIndicatorScaleDuration).Then(() => {
.animateTo(1.0f, duration: RefreshIndicatorUtils._kIndicatorScaleDuration).then((value) => {
if (mounted && _mode == newMode) {
_dragOffset = null;
_isIndicatorAtTop = null;

case _RefreshIndicatorMode.canceled:
return _positionController
.animateTo(0.0f, duration: RefreshIndicatorUtils._kIndicatorScaleDuration).Then(() => {
.animateTo(0.0f, duration: RefreshIndicatorUtils._kIndicatorScaleDuration).then((value) => {
if (mounted && _mode == newMode) {
_dragOffset = null;
_isIndicatorAtTop = null;

void _show() {
D.assert(_mode != _RefreshIndicatorMode.refresh);
D.assert(_mode != _RefreshIndicatorMode.snap);
Promise completer = new Promise();
_pendingRefreshFuture = completer;
Completer completer = Completer.create();
_pendingRefreshFuture = completer.future;
.Then(() => {
.then((value) => {
Promise refreshResult = widget.onRefresh();
Future refreshResult = widget.onRefresh();
D.assert(() => {
if (refreshResult == null) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(

),
context: "when calling onRefresh",
context: new ErrorDescription("when calling onRefresh"),
library: "material library"
));
}

return;
}
refreshResult.Finally(() => {
refreshResult.whenComplete(() => {
completer.Resolve();
completer.complete();
_dismiss(_RefreshIndicatorMode.done);
}
});

Promise show(bool atTop = true) {
Future show(bool atTop = true) {
if (_mode != _RefreshIndicatorMode.refresh && _mode != _RefreshIndicatorMode.snap) {
if (_mode == null) {
_start(atTop ? AxisDirection.down : AxisDirection.up);

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


scrollOffset < bottomOffset ? bottomOffset : topOffset,
duration: _scrollAnimationDuration,
curve: Curves.easeInOut
).Then(() => { setState(() => { _scrolling = false; }); });
).then((value) => { setState(() => { _scrolling = false; }); });
}
}

30
com.unity.uiwidgets/Runtime/material/scaffold.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> controller = null;
controller = new ScaffoldFeatureController<SnackBar, SnackBarClosedReason>(
snackbar.withAnimation(_snackBarController, fallbackKey: new UniqueKey()),
new Promise<SnackBarClosedReason>(),
Completer.create(),
() => {
D.assert(_snackBars.First() == controller);
hideCurrentSnackBar(reason: SnackBarClosedReason.hide);

return;
}
Promise<SnackBarClosedReason> completer = _snackBars.First()._completer;
Completer completer = _snackBars.First()._completer;
completer.Resolve(reason);
completer.complete(FutureOr.value(reason));
}
_snackBarTimer?.cancel();

}
MediaQueryData mediaQuery = MediaQuery.of(context);
Promise<SnackBarClosedReason> completer = _snackBars.First()._completer;
Completer completer = _snackBars.First()._completer;
completer.Resolve(reason);
completer.complete(FutureOr.value(reason));
_snackBarController.reverse().Then(() => {
_snackBarController.reverse().then((value) => {
completer.Resolve(reason);
completer.complete(FutureOr.value(reason));
}
});
}

PersistentBottomSheetController<T> _buildBottomSheet<T>(WidgetBuilder builder, AnimationController controller,
bool isLocalHistoryEntry, T resolveValue) {
Promise<T> completer = new Promise<T>();
Completer completer = Completer.create();
GlobalKey<_PersistentBottomSheetState> bottomSheetKey = GlobalKey<_PersistentBottomSheetState>.key();
_PersistentBottomSheet bottomSheet = null;

}
setState(() => { _currentBottomSheet = null; });
completer.Resolve(resolveValue);
completer.complete(FutureOr.value(resolveValue));
}
LocalHistoryEntry entry = isLocalHistoryEntry

if (route == null || route.isCurrent) {
if (_snackBarController.isCompleted && _snackBarTimer == null) {
SnackBar snackBar = _snackBars.First()._widget;
_snackBarTimer = Window.instance.run(snackBar.duration, () => {
_snackBarTimer = Timer.create(snackBar.duration, () => {
D.assert(_snackBarController.status == AnimationStatus.forward ||
_snackBarController.status == AnimationStatus.completed);
MediaQueryData subMediaQuery = MediaQuery.of(context);

public class ScaffoldFeatureController<T, U> where T : Widget {
public ScaffoldFeatureController(
T _widget,
Promise<U> _completer,
Completer _completer,
VoidCallback close,
StateSetter setState) {
this._widget = _widget;

public readonly T _widget;
public readonly Promise<U> _completer;
public readonly Completer _completer;
public IPromise<U> closed {
public Completer closed {
get { return _completer; }
}

public class PersistentBottomSheetController<T> : ScaffoldFeatureController<_PersistentBottomSheet, T> {
public PersistentBottomSheetController(
_PersistentBottomSheet widget,
Promise<T> completer,
Completer completer,
VoidCallback close,
StateSetter setState,
bool _isLocalHistoryEntry

3
com.unity.uiwidgets/Runtime/material/scrollbar.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

_materialPainter.update(notification.metrics, notification.metrics.axisDirection);
_fadeoutTimer?.cancel();
_fadeoutTimer = Window.instance.run(ScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutTimer = Timer.create(ScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutAnimationController.reverse();
_fadeoutTimer = null;
});

31
com.unity.uiwidgets/Runtime/material/search.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

public static IPromise<object> showSearch(
public static Future<T> showSearch<T>(
SearchDelegate del,
SearchDelegate<T> del,
string query = ""
) {
D.assert(del != null);

del._currentBody = _SearchBody.suggestions;
return Navigator.of(context).push(new _SearchPageRoute(
return Navigator.of(context).push<T>(new _SearchPageRoute<T>(
public abstract class SearchDelegate {
public abstract class SearchDelegate<T> {
public abstract Widget buildSuggestions(BuildContext context);
public abstract Widget buildResults(BuildContext context);
public abstract Widget buildLeading(BuildContext context);

set { _currentBodyNotifier.value = value; }
}
internal _SearchPageRoute _route;
internal _SearchPageRoute<T> _route;
}
enum _SearchBody {

class _SearchPageRoute : PageRoute {
public _SearchPageRoute(SearchDelegate del) {
class _SearchPageRoute<T> : PageRoute {
public _SearchPageRoute(SearchDelegate<T> del) {
D.assert(del != null);
D.assert(del._route == null,
() => $"The {this.del.GetType()} instance is currently used by another active " +

this.del._route = this;
}
public readonly SearchDelegate del;
public readonly SearchDelegate<T> del;
public override Color barrierColor {
get { return null; }

Animation<float> animation,
Animation<float> secondaryAnimation
) {
return new _SearchPage(
return new _SearchPage<T>(
del: del,
animation: animation
);

}
}
class _SearchPage : StatefulWidget {
class _SearchPage<T> : StatefulWidget {
SearchDelegate del,
SearchDelegate<T> del,
Animation<float> animation
) {
this.del = del;

public readonly SearchDelegate del;
public readonly SearchDelegate<T> del;
return new _SearchPageState();
return new _SearchPageState<T>();
class _SearchPageState : State<_SearchPage> {
class _SearchPageState<T> : State<_SearchPage<T>> {
public override void initState() {
base.initState();
queryTextController.addListener(_onQueryChanged);

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


using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

if (showValueIndicator) {
_state.valueIndicatorController.forward();
_state.interactionTimer?.cancel();
_state.interactionTimer = Window.instance.run(
_state.interactionTimer = Timer.create(
(int) (_minimumInteractionTimeMilliSeconds * SchedulerBinding.instance.timeDilation)),
(int) (_minimumInteractionTimeMilliSeconds * scheduler_.timeDilation)),
() => {
_state.interactionTimer = null;
if (!_active &&

}
protected override float computeMinIntrinsicWidth(float height) {
protected internal override float computeMinIntrinsicWidth(float height) {
protected override float computeMaxIntrinsicWidth(float height) {
protected internal override float computeMaxIntrinsicWidth(float height) {
protected override float computeMinIntrinsicHeight(float width) {
protected internal override float computeMinIntrinsicHeight(float width) {
return Mathf.Max(_minPreferredTrackHeight, _maxSliderPartHeight);
}

1
com.unity.uiwidgets/Runtime/material/snack_bar.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

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


using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

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


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.widgets;

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


using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("text", text, defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new StringProperty("text", text, defaultValue: foundation_.kNullDefaultValue));
defaultValue: Diagnostics.kNullDefaultValue));
defaultValue: foundation_.kNullDefaultValue));
}
}

_pageController.jumpToPage(initialPage);
_pageController.animateToPage(_currentIndex.Value, duration: Constants.kTabScrollDuration,
curve: Curves.ease).Then(() => {
curve: Curves.ease).then((value) => {
return new Promise();
return Future.value();
}
setState(() => {

return new Promise();
return Future.value();
});
}

1
com.unity.uiwidgets/Runtime/material/text_field.cs


using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {

1
com.unity.uiwidgets/Runtime/material/text_form_field.cs


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgets.Runtime.material {

24
com.unity.uiwidgets/Runtime/material/text_selection.cs


}
class _MaterialTextSelectionControls : TextSelectionControls {
public override Size getHandleSize(float textLineHeight) {
return new Size(MaterialUtils._kHandleSize,
MaterialUtils._kHandleSize);
}
public override Size handleSize {
get {
return new Size(MaterialUtils._kHandleSize,

public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,
TextSelectionDelegate selectionDelegate) {
public override Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight) {
switch (type) {
case TextSelectionHandleType.left:
return new Offset(MaterialUtils._kHandleSize, 0);
case TextSelectionHandleType.right:
return Offset.zero;
default:
return new Offset(MaterialUtils._kHandleSize / 2, -4);
}
}
public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, float textLineHeight,
Offset position, List<TextSelectionPoint> endpoints, TextSelectionDelegate selectionDelegate) {
return new ConstrainedBox(
constraints: BoxConstraints.tight(globalEditableRegion.size),
child: new CustomSingleChildLayout(

switch (type) {
case TextSelectionHandleType.left: // points up-right
return new Transform(
transform: new Matrix4().rotationZ(Mathf.PI / 2),
transform: Matrix4.rotationZ(Mathf.PI / 2),
child: handle
);
case TextSelectionHandleType.right: // points up-left

transform: new Matrix4().rotationZ(Mathf.PI / 4),
transform: Matrix4.rotationZ(Mathf.PI / 4),
child: handle
);
}

1
com.unity.uiwidgets/Runtime/material/theme_data.cs


using uiwidgets;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

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


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;

3
com.unity.uiwidgets/Runtime/material/tooltip.cs


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Brightness = Unity.UIWidgets.service.Brightness;
namespace Unity.UIWidgets.material {
static class TooltipUtils {

void _handlePointerEvent(PointerEvent pEvent) {
D.assert(_entry != null);
if (pEvent is PointerUpEvent || pEvent is PointerCancelEvent) {
_timer = _timer ?? Window.instance.run(TooltipUtils._kShowDuration,
_timer = _timer ?? Timer.create(TooltipUtils._kShowDuration,
() => _controller.reverse());
}
else if (pEvent is PointerDownEvent) {

5
com.unity.uiwidgets/Runtime/services/system_chrome.cs


bottom
}
public enum Brightness {
dark,
light
}
public class SystemUiOverlayStyle {
public SystemUiOverlayStyle(
Color systemNavigationBarColor = null,

4
com.unity.uiwidgets/Runtime/widgets/navigator.cs


return of(context).pushNamedAndRemoveUntil<T>(newRouteName, predicate, arguments: arguments);
}
public static Future<T> push<T>(BuildContext context, Route<T> route) {
public static Future<T> push<T>(BuildContext context, Route route) {
return of(context).push<T>(route);
}

return route.popped;
}
public Future<T> push<T>(Route<T> route) {
public Future<T> push<T>(Route route) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

正在加载...
取消
保存