浏览代码

fix f-i

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
234f0bac
共有 9 个文件被更改,包括 162 次插入106 次删除
  1. 2
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  2. 10
      com.unity.uiwidgets/Runtime/widgets/form.cs
  3. 33
      com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs
  4. 30
      com.unity.uiwidgets/Runtime/widgets/heroes.cs
  5. 34
      com.unity.uiwidgets/Runtime/widgets/icon.cs
  6. 38
      com.unity.uiwidgets/Runtime/widgets/icon_data.cs
  7. 25
      com.unity.uiwidgets/Runtime/widgets/icon_theme.cs
  8. 4
      com.unity.uiwidgets/Runtime/widgets/icon_theme_data.cs
  9. 92
      com.unity.uiwidgets/Runtime/widgets/image.cs

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


Future<bool> didPopRoute();
Future<bool> didPushRoute(string route);
void didChangeAccessibilityFeatures();
}
public static partial class ui_ {

10
com.unity.uiwidgets/Runtime/widgets/form.cs


Widget child = null,
FormState formState = null,
int? generation = null
) :
base(key: key, child: child) {
) : base(key: key, child: child) {
_formState = formState;
_generation = generation;
}

get { return _errorText != null; }
}
//[!!!] call?
/*public bool isValid {
public bool isValid {
return widget.validator?.call(_value) == null;
return widget.validator?.Invoke(_value) == null;
}*/
}
public void save() {
if (widget.onSaved != null) {

33
com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs


public delegate void GestureRecognizerFactoryInitializer<T>(T instance) where T : GestureRecognizer;
public class GestureRecognizerFactoryWithHandlers<T> : GestureRecognizerFactory<T> where T : GestureRecognizer {
public GestureRecognizerFactoryWithHandlers(GestureRecognizerFactoryConstructor<T> constructor,
public GestureRecognizerFactoryWithHandlers(
GestureRecognizerFactoryConstructor<T> constructor,
GestureRecognizerFactoryInitializer<T> initializer) {
D.assert(constructor != null);
D.assert(initializer != null);

GestureDragUpdateCallback onHorizontalDragUpdate = null,
GestureDragEndCallback onHorizontalDragEnd = null,
GestureDragCancelCallback onHorizontalDragCancel = null,
GestureForcePressStartCallback onForcePressStart = null,
GestureForcePressPeakCallback onForcePressPeak = null,
GestureForcePressUpdateCallback onForcePressUpdate = null,
GestureForcePressEndCallback onForcePressEnd = null,
GestureDragDownCallback onPanDown = null,
GestureDragStartCallback onPanStart = null,
GestureDragUpdateCallback onPanUpdate = null,

this.onHorizontalDragUpdate = onHorizontalDragUpdate;
this.onHorizontalDragEnd = onHorizontalDragEnd;
this.onHorizontalDragCancel = onHorizontalDragCancel;
this.onForcePressEnd = onForcePressEnd;
this.onForcePressPeak = onForcePressPeak;
this.onForcePressStart = onForcePressStart;
this.onForcePressUpdate = onForcePressUpdate;
this.onPanDown = onPanDown;
this.onPanStart = onPanStart;
this.onPanUpdate = onPanUpdate;

public readonly GestureScaleEndCallback onScaleEnd;
public readonly HitTestBehavior behavior;
public readonly DragStartBehavior dragStartBehavior;
public readonly GestureForcePressStartCallback onForcePressStart;
public readonly GestureForcePressPeakCallback onForcePressPeak;
public readonly GestureForcePressUpdateCallback onForcePressUpdate;
public readonly GestureForcePressEndCallback onForcePressEnd;
public override Widget build(BuildContext context) {
var gestures = new Dictionary<Type, GestureRecognizerFactory>();

}
);
}
if (onForcePressStart != null ||
onForcePressPeak != null ||
onForcePressUpdate != null ||
onForcePressEnd != null) {
gestures[typeof(ForcePressGestureRecognizer)] =
new GestureRecognizerFactoryWithHandlers<ForcePressGestureRecognizer>(
() => new ForcePressGestureRecognizer(debugOwner: this),
(ForcePressGestureRecognizer instance) => {
instance.onStart = onForcePressStart;
instance.onPeak = onForcePressPeak;
instance.onUpdate = onForcePressUpdate;
instance.onEnd = onForcePressEnd;
}
);
}
return new RawGestureDetector(
gestures: gestures,

public override Widget build(BuildContext context) {
Widget result = new Listener(
onPointerDown: _handlePointerDown,
onPointerScroll: _handlePointerScroll,
return result;
}

30
com.unity.uiwidgets/Runtime/widgets/heroes.cs


}
class HeroUtils {
/*public static Rect _globalBoundingBoxFor(BuildContext context) {
RenderBox box = (RenderBox) context.findRenderObject();
D.assert(box != null && box.hasSize);
return MatrixUtils.transformRect( box.getTransformTo(null), Offset.zero & box.size);
}*/
public static Rect _boundingBoxFor(BuildContext context, BuildContext ancestorContext = null) {
RenderBox box = context.findRenderObject() as RenderBox;
D.assert(box != null && box.hasSize);

public readonly object tag;
public readonly HeroFlightShuttleBuilder flightShuttleBuilder;
public readonly HeroPlaceholderBuilder placeholderBuilder;

BuildContext context,
bool isUserGestureTransition,
NavigatorState navigator) {
Dictionary<object, _HeroState> result = new Dictionary<object, _HeroState> { };
void inviteHero(StatefulElement hero, object tag) {

}
class _HeroState : State<Hero> {
GlobalKey _key = GlobalKey.key();
Size _placeholderSize;
bool _shouldIncludeChild = true;

_HeroState toHero = null,
CreateRectTween createRectTween = null,
HeroFlightShuttleBuilder shuttleBuilder = null,
bool isUserGestureTransition = false,
bool isDiverted = false
bool? isUserGestureTransition = null,
bool? isDiverted = null
) {
D.assert(fromHero.widget.tag.Equals(toHero.widget.tag));
this.type = type;

this.toHero = toHero;
this.createRectTween = createRectTween;
this.shuttleBuilder = shuttleBuilder;
this.isUserGestureTransition = isUserGestureTransition;
this.isDiverted = isDiverted;
this.isUserGestureTransition = isUserGestureTransition ?? false;
this.isDiverted = isDiverted ?? false;
}
public readonly HeroFlightDirection type;

get {
return new CurvedAnimation(
parent: (type == HeroFlightDirection.push) ? toRoute.animation : fromRoute.animation,
curve: Curves.fastOutSlowIn
, reverseCurve: isDiverted ? null : Curves.fastOutSlowIn.flipped
curve: Curves.fastOutSlowIn,
reverseCurve: isDiverted ? null : Curves.fastOutSlowIn.flipped
);
}
}

public void _handleAnimationUpdate(AnimationStatus status) {
if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) {
_proxyAnimation.parent = null;
D.assert(overlayEntry != null);
overlayEntry.remove();
overlayEntry = null;

HeroFlightDirection type = initialManifest.type;
switch (type) {
case HeroFlightDirection.pop:
return initial.value == 1.0f && initialManifest.isUserGestureTransition
return initial.value == 1.0f &&
initialManifest.isUserGestureTransition
? initial.status == AnimationStatus.completed
: initial.status == AnimationStatus.reverse;
case HeroFlightDirection.push:

RouteSettings from = manifest.fromRoute.settings;
RouteSettings to = manifest.toRoute.settings;
object tag = manifest.tag;
return $"HeroFlight(for: {tag}, from: {from}, to: {to} ${_proxyAnimation.parent})";
return $"HeroFlight(for: {tag}, from: {from}, to: {to} {_proxyAnimation.parent})";
}
}

if (toHeroes.ContainsKey(tag)) {
HeroFlightShuttleBuilder fromShuttleBuilder = fromHeroes[tag].widget.flightShuttleBuilder;
HeroFlightShuttleBuilder toShuttleBuilder = toHeroes[tag].widget.flightShuttleBuilder;
//bool isDiverted = _flights[tag] != null;
bool isDiverted = _flights.ContainsKey(tag);
_HeroFlightManifest manifest = new _HeroFlightManifest(
type: flightType,

34
com.unity.uiwidgets/Runtime/widgets/icon.cs


namespace Unity.UIWidgets.widgets {
public class Icon : StatelessWidget {
public Icon(IconData icon,
public Icon(
IconData icon,
Color color = null
Color color = null,
TextDirection? textDirection = null
this.textDirection = textDirection;
}
public readonly IconData icon;

public readonly Color color;
public readonly TextDirection? textDirection;
D.assert(this.textDirection != null || WidgetsD.debugCheckHasDirectionality(context));
TextDirection textDirection = this.textDirection ?? Directionality.of(context);
IconThemeData iconTheme = IconTheme.of(context);
float iconSize = size ?? iconTheme.size.Value;

if (iconOpacity != 1.0) {
iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity);
}
overflow: TextOverflow.visible,
overflow: TextOverflow.visible, // Never clip.
textDirection: textDirection, // Since we already fetched it for the assert...
text: new TextSpan(
text: new string(new[] {(char) icon.codePoint}),
style: new TextStyle(

fontFamily: icon.fontFamily
//package: icon.fontPackage
var matrix = Matrix4.identity();
matrix.scale(-1.0f, 1.0f, 1.0f);
if (icon.matchTextDirectiom) {
switch (textDirection) {
case TextDirection.rtl:
iconWidget = new Transform(
transform: matrix,
alignment: Alignment.center,
transformHitTests: false,
child: iconWidget
);
break;
case TextDirection.ltr:
break;
}
}
return new SizedBox(
width: iconSize,

38
com.unity.uiwidgets/Runtime/widgets/icon_data.cs


public class IconData : IEquatable<IconData> {
public IconData(
int codePoint,
string fontFamily = null
string fontFamily = null,
string fontPackage = null,
bool matchTextDirectiom = false
this.fontPackage = fontPackage;
this.matchTextDirectiom = matchTextDirectiom;
public readonly string fontPackage;
public readonly bool matchTextDirectiom;
public bool Equals(IconData other) {
if (ReferenceEquals(null, other)) {

}
return codePoint == other.codePoint &&
string.Equals(fontFamily, other.fontFamily);
string.Equals(fontFamily, other.fontFamily) &&
string.Equals(fontPackage, other.fontPackage) &&
matchTextDirectiom == other.matchTextDirectiom;
}
public override bool Equals(object obj) {

public override int GetHashCode() {
unchecked {
return (codePoint * 397) ^ (fontFamily != null ? fontFamily.GetHashCode() : 0);
var hashCode =
(codePoint * 397) ^ (fontFamily != null ? fontFamily.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (fontPackage != null ? fontPackage.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ matchTextDirectiom.GetHashCode();
return hashCode;
}
}

public class IconDataProperty : DiagnosticsProperty<IconData> {
public IconDataProperty(
String name,
string name,
String ifNull = null,
string ifNull = null,
) : base(name, value,
) : base(name,
value,
D.assert(showName != null);
D.assert(style != null);
D.assert(level != null);
public override Dictionary<String, Object> toJsonMap(DiagnosticsSerializationDelegate _delegate) {
Dictionary<String, Object> json = base.toJsonMap(_delegate);
public override Dictionary<string, object> toJsonMap(DiagnosticsSerializationDelegate _delegate) {
Dictionary<string, object> json = base.toJsonMap(_delegate);
json["valueProperties"] = new Dictionary<String, Object>(){
json["valueProperties"] = new Dictionary<string, object>(){
{"codePoint", value.codePoint},
};
}

25
com.unity.uiwidgets/Runtime/widgets/icon_theme.cs


) : base(key: key, child: child) {
D.assert(data != null);
D.assert(child != null);
this.data = data;
}

Widget child = null
) {
return new Builder(
builder: context => new IconTheme(
builder: (BuildContext context)=> {
return new IconTheme(
)
);
}
);
}

IconThemeData iconThemeData = _getInheritedIconThemeData(context);
return iconThemeData.isConcrete ? iconThemeData :
iconThemeData.copyWith(
IconThemeData iconThemeData = _getInheritedIconThemeData(context).resolve(context);
return iconThemeData.isConcrete
? iconThemeData
: iconThemeData.copyWith(
color: iconThemeData.color ?? IconThemeData.fallback().color,
opacity: iconThemeData.opacity ?? IconThemeData.fallback().opacity
color: iconThemeData.color ?? IconThemeData.fallback().color,
opacity: iconThemeData.opacity ?? IconThemeData.fallback().opacity
if (iconTheme != null) {
return iconTheme.data;
}
return IconThemeData.fallback();
return iconTheme?.data ?? IconThemeData.fallback();
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {

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


size: other.size
);
}
IconThemeData resolve(BuildContext context) => this;
public IconThemeData resolve(BuildContext context) => this;
public bool isConcrete {
get { return color != null && opacity != null && size != null; }

92
com.unity.uiwidgets/Runtime/widgets/image.cs


);
}
public Future precacheImage(
public static Future precacheImage(
ImageProvider provider,
BuildContext context,
Size size = null,

var completer = Completer.create();
Completer completer = Completer.create();
void listener(ImageInfo image, bool sync) {
// TODO: update
// if (!completer.isCompleted) {
// stream.removeListener(listener);
// }
//
// SchedulerBinding.instance.addPostFrameCallback(timeStamp => { stream.removeListener(listener); });
}
void errorListener(Exception exception) {
ImageStreamListener listener = null;
listener = new ImageStreamListener(
(ImageInfo image, bool sync)=> {
// TODO: update
// stream.removeListener(listener);
if (onError != null) {
onError(exception);
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeStamp)=> {
stream.removeListener(listener);
});
},
onError: (Exception error) =>{
if (!completer.isCompleted) {
completer.complete();
else {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
exception: exception,
silent: true
));
stream.removeListener(listener);
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
silent: true));
}
// TODO: update
// stream.addListener(listener, onError: errorListener);
);
stream.addListener(listener);
}
}

int? cacheWidth = default,
int? cacheHeight = null
) {
var _scale = scale ?? 1.0f;
? (AssetBundleImageProvider) new ExactAssetImage(name, bundle: bundle, scale: scale.Value)
? (AssetBundleImageProvider) new ExactAssetImage(name, bundle: bundle, scale: _scale)
var _Image = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, _image);
image: _image,
image: _Image,
frameBuilder: frameBuilder,
loadingBuilder: null,
errorBuilder: errorBuilder,

}
/*public override void didChangeAccessibilityFeatures() {
base.didChangeAccessibilityFeatures();
public void didChangeAccessibilityFeatures() {
//base.didChangeAccessibilityFeatures();
}*/
}
public override void reassemble() {
_resolveImage(); // in case the image cache was flushed
base.reassemble();
}
void _updateInvertColors() {
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors

void _resolveImage() {
/*ScrollAwareImageProvider provider = new ScrollAwareImageProvider<dynamic>(
context: _scrollAwareContext,
imageProvider: widget.image
);
ImageStream newStream =
provider.resolve(ImageUtils.createLocalImageConfiguration(
context,
size: widget.width != null && widget.height != null
? new Size(widget.width.Value, widget.height.Value)
: null
));*/
ImageStream newStream =
widget.image.resolve(ImageUtils.createLocalImageConfiguration(
context,

setState(() => { _imageInfo = null; });
}
setState(()=> {
_loadingProgress = null;
_frameNumber = 0;
_wasSynchronouslyLoaded = false;
});
if (_isListeningToStream) {
if (_isListeningToStream)
}
}
void _listenToStream() {

alignment: widget.alignment,
repeat: widget.repeat,
centerSlice: widget.centerSlice,
matchTextDirection: widget.matchTextDirection,
invertColors: _invertColors,
filterQuality: widget.filterQuality
);

正在加载...
取消
保存