浏览代码

update

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
9c7151ee
共有 5 个文件被更改,包括 130 次插入23 次删除
  1. 8
      com.unity.uiwidgets/Runtime/material/dialog.cs
  2. 4
      com.unity.uiwidgets/Runtime/material/dialog_theme.cs
  3. 105
      com.unity.uiwidgets/Runtime/material/divider.cs
  4. 2
      com.unity.uiwidgets/Runtime/rendering/table.cs
  5. 34
      com.unity.uiwidgets/Runtime/widgets/debug.cs

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


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

ThemeData theme = Theme.of(context);
DialogTheme dialogTheme = DialogTheme.of(context);
Widget titleWidget = null;
Widget contentWidget = null;
Widget actionsWidget = null;

public static Future<T> showDialog<T>(
BuildContext context = null,
bool barrierDismissible = true,
Widget child = null,
D.assert(child == null || builder == null);
D.assert(debugCheckHasMaterialLocalizations(context));
ThemeData theme = Theme.of(context, shadowThemeOnly: true);

Widget pageChild = new Builder(builder: builder);
Widget pageChild = child ?? new Builder(builder: builder);
return new SafeArea(
child: new Builder(
builder: (_) => theme != null

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


public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Color>("backgroundColor", backgroundColor));
properties.add(new ColorProperty("backgroundColor", backgroundColor));
properties.add(new DiagnosticsProperty<float?>("elevation", elevation));
properties.add(new FloatProperty("elevation", elevation));
properties.add(new DiagnosticsProperty<TextStyle>("titleTextStyle", titleTextStyle));
properties.add(new DiagnosticsProperty<TextStyle>("contentTextStyle", contentTextStyle));
}

105
com.unity.uiwidgets/Runtime/material/divider.cs


public class Divider : StatelessWidget {
public Divider(
Key key = null,
float height = 16.0f,
float indent = 0.0f,
float? height = null,
float? thickness = null,
float? indent = null,
float? endIndent = null,
this.thickness = thickness;
this.endIndent = endIndent;
public readonly float height;
public readonly float? height;
public readonly float? thickness;
public readonly float? indent;
public readonly float indent;
public readonly float? endIndent;
public static BorderSide createBorderSide(BuildContext context, Color color = null, float width = 0.0f) {
public static BorderSide createBorderSide(BuildContext context, Color color = null, float? width = null) {
Color effectiveColor = color
?? (context != null
? (DividerTheme.of(context).color ?? Theme.of(context).dividerColor)
: null);
float effectiveWidth = width
?? (context != null ? DividerTheme.of(context).thickness : null)
?? 0.0f;
// Prevent assertion since it is possible that context is null and no color
// is specified.
if (effectiveColor == null) {
return new BorderSide(
width: effectiveWidth
);
}
color: color ?? Theme.of(context).dividerColor,
width: width);
color: effectiveColor,
width: effectiveWidth
);
DividerThemeData dividerTheme = DividerTheme.of(context);
float height = this.height ?? dividerTheme.space ?? 16.0f;
float thickness = this.thickness ?? dividerTheme.thickness ?? 0.0f;
float indent = this.indent ?? dividerTheme.indent ?? 0.0f;
float endIndent = this.endIndent ?? dividerTheme.endIndent ?? 0.0f;
height: 0.0f,
margin: EdgeInsets.only(indent),
height: thickness,
//TODO: update to EdgeInsetsGeometry
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(start: indent,
end: endIndent),
decoration: new BoxDecoration(
border: new Border(
bottom: createBorderSide(context, color: color, width: thickness))
)
)
)
);
}
}
public class VerticalDivider : StatelessWidget {
public VerticalDivider(
Key key = null,
float? width = null,
float? thickness = null,
float? indent = null,
float? endIndent = null,
Color color = null
) : base(key) {
D.assert(width == null || width >= 0.0);
D.assert(thickness == null || thickness >= 0.0);
D.assert(indent == null || indent >= 0.0);
D.assert(endIndent == null || endIndent >= 0.0);
this.width = width;
this.thickness = thickness;
this.indent = indent;
this.endIndent = endIndent;
this.color = color;
}
public readonly float? width;
public readonly float? thickness;
public readonly float? indent;
public readonly float? endIndent;
public readonly Color color;
public override Widget build(BuildContext context) {
DividerThemeData dividerTheme = DividerTheme.of(context);
float width = this.width ?? dividerTheme.space ?? 16.0f;
float thickness = this.thickness ?? dividerTheme.thickness ?? 0.0f;
float indent = this.indent ?? dividerTheme.indent ?? 0.0f;
float endIndent = this.endIndent ?? dividerTheme.endIndent ?? 0.0f;
return new SizedBox(
width: width,
child: new Center(
child: new Container(
width: thickness,
//TODO: update to EdgeInsetsGeometry
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(top: indent,
bottom: endIndent),
bottom: createBorderSide(context, color: color))
left: Divider.createBorderSide(context, color: color, width: thickness)
)
)
)
)

2
com.unity.uiwidgets/Runtime/rendering/table.cs


readonly List<float> _rowTops = new List<float>();
List<float> _columnLefts;
Rect getRowBox(int row) {
public Rect getRowBox(int row) {
D.assert(row >= 0);
D.assert(row < rows);

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


public static bool debugPrintGlobalKeyedWidgetLifecycle = false;
public static bool debugPrintScheduleBuildForStacks = false;
public static bool debugHighlightDeprecatedWidgets = false;
static Key _firstNonUniqueKey(IEnumerable<Widget> widgets) {

return false;
}
public static bool debugCheckHasTable(BuildContext context) {
D.assert(() => {
if (!(context.widget is Table) && context.findAncestorWidgetOfExactType<Table>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorSummary("No Table widget found."),
new ErrorDescription($"{context.widget.GetType()} widgets require a Table widget ancestor."),
context.describeWidget("The specific widget that could not find a Table ancestor was"),
context.describeOwnershipChain("The ownership chain for the affected widget is")
});
}
return true;
});
return true;
}
public static void debugWidgetBuilderValue(Widget widget, Widget built) {
D.assert(() => {
if (built == null) {

if (!(context.widget is MediaQuery) && context.findAncestorWidgetOfExactType<MediaQuery>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorSummary("No MediaQuery widget found."),
new ErrorDescription($"{context.widget.GetType()} widgets require a MediaQuery widget ancestor."),
new ErrorDescription(
$"{context.widget.GetType()} widgets require a MediaQuery widget ancestor."),
context.describeWidget("The specific widget that could not find a MediaQuery ancestor was"),
context.describeOwnershipChain("The ownership chain for the affected widget is"),
new ErrorHint(

D.assert(() => {
if (!(context.widget is Directionality) &&
context.findAncestorWidgetOfExactType<Directionality>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorDescription($"{context.widget.GetType()} widgets require a Directionality widget ancestor.\n"),
new ErrorDescription(
$"{context.widget.GetType()} widgets require a Directionality widget ancestor.\n"),
context.describeWidget("The specific widget that could not find a Directionality ancestor was"),
context.describeOwnershipChain("The ownership chain for the affected widget is"),
new ErrorHint(

UIWidgetsError.reportError(details);
return details;
}
D.assert(()=> {
D.assert(() => {
if (debugPrintRebuildDirtyWidgets ||
debugPrintBuildScope ||
debugPrintScheduleBuildForStacks ||

throw new UIWidgetsError(reason);
}
}
}
正在加载...
取消
保存