浏览代码

Merge pull request #101 from Unity-Technologies/zgn/future.value

Zgn/future.value
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
434fdb99
共有 15 个文件被更改,包括 64 次插入22 次删除
  1. 4
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs
  2. 2
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/text_form_field_demo.cs
  3. 3
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs
  4. 4
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs
  5. 2
      com.unity.uiwidgets/Runtime/material/about.cs
  6. 3
      com.unity.uiwidgets/Runtime/material/feedback.cs
  7. 7
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  8. 4
      com.unity.uiwidgets/Runtime/painting/image_resolution.cs
  9. 3
      com.unity.uiwidgets/Runtime/painting/shader_warmup.cs
  10. 2
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  11. 4
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  12. 2
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  13. 2
      com.unity.uiwidgets/Runtime/widgets/scroll_position.cs
  14. 4
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  15. 40
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/NetWorkImageSample.cs

4
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs


if (picked != null && picked != this.selectedDate) this.selectDate(picked);
});
return Future.value();
return null;
}
private Future _selectTime(BuildContext context)

if (picked != null && picked != this.selectedTime) this.selectTime(picked);
});
return Future.value();
return null;
}
public override Widget build(BuildContext context)

2
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/text_form_field_demo.cs


}
);
}
);
)?? Future.value(false).to<bool>();
}

3
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs


// Closes the cart if the cart is open, otherwise exits the app (this should
// only be relevant for Android).
Future<bool> _onWillPop() {
if (!_isOpen) {
if (!_isOpen)
{
//SystemNavigator.pop();
return Future.value(true).to<bool>();
}

4
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs


}
);
}
);
);
return Future.value();
return null;
}
public override Widget build(BuildContext context)

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


// }
//TODO: implement
setState(() => { _loaded = true; });
return Future.value();
return null;
// D.assert(() {
// Timeline.timeSync("Build scheduled", () { }, flow: Flow.end(debugFlowId));
// return true;

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


public static Future forTap(BuildContext context) {
switch (_platform(context)) {
case RuntimePlatform.Android:
return
Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
return Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:

7
com.unity.uiwidgets/Runtime/painting/image_provider.cs


public readonly float scale;
public override Future<MemoryImage> obtainKey(ImageConfiguration configuration) {
return Future.value(FutureOr.value(this)).to<MemoryImage>();
return new SynchronousFuture<MemoryImage>(this);
//Future.value(FutureOr.value(this)).to<MemoryImage>();
}
public override ImageStreamCompleter load(MemoryImage key, DecoderCallback decode) {

public readonly AssetBundle bundle;
public override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Future.value(FutureOr.value(new AssetBundleImageKey(
return new SynchronousFuture<AssetBundleImageKey>(new AssetBundleImageKey(
))).to<AssetBundleImageKey>();
));
}
public bool Equals(ExactAssetImage other) {

4
com.unity.uiwidgets/Runtime/painting/image_resolution.cs


AssetBundleImageKey key;
var cache = AssetBundleCache.instance.get(configuration.bundle);
if (cache.TryGetValue(assetConfig, out key)) {
return Future.value(FutureOr.value(key)).to<AssetBundleImageKey>();
return new SynchronousFuture<AssetBundleImageKey>(key);
}
AssetBundle chosenBundle = bundle ? bundle : configuration.bundle;

return Future.value(FutureOr.value(key)).to<AssetBundleImageKey>();
return new SynchronousFuture<AssetBundleImageKey>(key);
}
internal string _chooseVariant(string main, ImageConfiguration config, List<string> candidates) {

3
com.unity.uiwidgets/Runtime/painting/shader_warmup.cs


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

}
canvas.translate(0.0f, drawCallSpacing);
return Future.value();
return null;
}
}
}

2
com.unity.uiwidgets/Runtime/widgets/localizations.cs


}
if (pendingList == null) {
return Future.value(output).to<Dictionary<Type, object>>();
return new SynchronousFuture<Dictionary<Type, object>>(output);
}
return Future.wait<object>(pendingList.Select(p => p.futureValue))

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


public virtual Future<RoutePopDisposition> willPop() {
return Future.value(isFirst
? RoutePopDisposition.bubble
: RoutePopDisposition.pop).to<RoutePopDisposition>();
? RoutePopDisposition.bubble
: RoutePopDisposition.pop).to<RoutePopDisposition>();
}
public virtual bool willHandlePopInternally {

2
com.unity.uiwidgets/Runtime/widgets/routes.cs


foreach (WillPopCallback callback in _willPopCallbacks) {
callback.Invoke().then(v => result = !(bool)v);
if (result) {
return Future.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
return Future.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
}
}
return base.willPop();

2
com.unity.uiwidgets/Runtime/widgets/scroll_position.cs


}
break;
}
if (target == pixels) {
if (foundation_.FloatEqual(target,pixels)) {
return Future.value();
}

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


name: name,
callback:
((IDictionary<string, string> parameters) => {
var result = Future.value(FutureOr.value(new Dictionary<string, object>(){{"result", callback}})).to<IDictionary<string, object>>();
var result = Future.value(FutureOr.value(new Dictionary<string, object>(){{"result", callback}})).to<IDictionary<string, object>>();
return result;
})
);

) {
registerServiceExtension(
name: name,
callback: (IDictionary<string, string> parameters) =>{
callback: (IDictionary<string, string> parameters) => {
var result = Future.value(FutureOr.value((new Dictionary<string, object>{{"result", callback(parameters["objectGroup"])}}))).to<IDictionary<string, object>>();
return result;
}

40
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/NetWorkImageSample.cs


using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsSample
{
public class NetWorkImageSample : UIWidgetsPanel
{
protected override void main()
{
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new NetWorkeImageWidget()));
}
class NetWorkeImageWidget : StatelessWidget {
public override Widget build(BuildContext context) {
var title = "NetWork Image";
return new MaterialApp(
title: title,
home: new Scaffold(
appBar: new AppBar(
title: new Text(title)
),
body: Image.network("https://picsum.photos/250?image=2")
)
);
}
}
}
}
正在加载...
取消
保存