浏览代码

material components: code review + .editorconfig update: add one more rule for class modifier: internal

/main
xingwei.zhu 6 年前
当前提交
a22dadce
共有 31 个文件被更改,包括 992 次插入869 次删除
  1. 1
      .editorconfig
  2. 2
      Runtime/animation/animation.cs
  3. 11
      Runtime/animation/tween.cs
  4. 15
      Runtime/material/button.cs
  5. 102
      Runtime/material/button_theme.cs
  6. 51
      Runtime/material/color_scheme.cs
  7. 216
      Runtime/material/colors.cs
  8. 28
      Runtime/material/constants.cs
  9. 36
      Runtime/material/debug.cs
  10. 30
      Runtime/material/ink_decoration.cs
  11. 17
      Runtime/material/ink_highlight.cs
  12. 27
      Runtime/material/ink_splash.cs
  13. 97
      Runtime/material/ink_well.cs
  14. 101
      Runtime/material/material.cs
  15. 54
      Runtime/material/material_button.cs
  16. 78
      Runtime/material/text_theme.cs
  17. 14
      Runtime/material/theme.cs
  18. 151
      Runtime/material/theme_data.cs
  19. 36
      Runtime/material/typography.cs
  20. 40
      Runtime/material/utils.cs
  21. 23
      Runtime/painting/colors.cs
  22. 20
      Runtime/painting/text_style.cs
  23. 72
      Runtime/rendering/box.cs
  24. 246
      Runtime/rendering/proxy_box.cs
  25. 105
      Runtime/service/system_chrome.cs
  26. 14
      Runtime/ui/painting/painting.cs
  27. 100
      Runtime/widgets/basic.cs
  28. 12
      Runtime/widgets/icon_theme_data.cs
  29. 116
      Runtime/widgets/implicit_animations.cs
  30. 21
      Runtime/widgets/layout_builder.cs
  31. 25
      Samples/UIWidgetSample/MaterialCanvas.cs

1
.editorconfig


# don't use 'private' whenever possible
csharp_default_private_modifier=implicit
csharp_default_internal_modifier=implicit
# not requirement for converting named arguments into positioned arguments whenever possible

2
Runtime/animation/animation.cs


return child.animate(this as Animation<double>);
}
}
}
}

11
Runtime/animation/tween.cs


}
public abstract class Tween<T> : Animatable<T>, IEquatable<Tween<T>> {
public Tween(T begin, T end) {
protected Tween(T begin, T end) {
D.assert(begin != null);
D.assert(end != null);

if (ReferenceEquals(null, other)) {
return false;
}
return EqualityComparer<T>.Default.Equals(this.begin, other.begin) &&
EqualityComparer<T>.Default.Equals(this.end, other.end);
}

return false;
}
return this.Equals((Tween<T>) obj);
}

return (this.begin + (this.end - this.begin) * t);
}
}
public class CurveTween : Animatable<double> {
public CurveTween(Curve curve = null) {
D.assert(curve != null);

return $"{this.GetType()}(curve: {this.curve})";
}
}
}
}

15
Runtime/material/button.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.widgets;
ValueChanged<bool> onHighlightChanged = null,
ValueChanged<bool> onHighlightChanged = null,
TextStyle textStyle = null,
Color fillColor = null,
Color highlightColor = null,

this.materialTapTargetSize = _materialTapTargetSize;
this.child = child;
}
public readonly VoidCallback onPressed;
public readonly ValueChanged<bool> onHighlightChanged;

double elevation = this.widget.enabled
? (this._highlight ? this.widget.highlightElevation : this.widget.elevation)
: this.widget.disabledElevation;
Widget result = new ConstrainedBox(
constraints: this.widget.constraints,
child: new Material(

widthFactor: 1.0,
heightFactor: 1.0,
child: this.widget.child)
)
);
)
);
}

102
Runtime/material/button_theme.cs


using System.Runtime.CompilerServices;
using System;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.ui;
using System;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
padded
}

return buttonTheme;
}
public override bool updateShouldNotify(InheritedWidget oldWidget) => this.data != ((ButtonTheme)oldWidget).data;
public override bool updateShouldNotify(InheritedWidget oldWidget) =>
this.data != ((ButtonTheme) oldWidget).data;
}

ColorScheme colorScheme = null,
MaterialTapTargetSize? materialTapTargetSize = null
) {
D.assert(textTheme != null);
D.assert(minWidth >= 0.0);
D.assert(height >= 0.0);
this.textTheme = textTheme;

public readonly ButtonBarLayoutBehavior layoutBehavior;
public BoxConstraints constraints {
get { return new BoxConstraints(minWidth: this.minWidth,
minHeight: this.height);}
get {
return new BoxConstraints(minWidth: this.minWidth,
minHeight: this.height);
}
}
public EdgeInsets padding {

case ButtonTextTheme.primary:
return EdgeInsets.symmetric(horizontal: 24.0);
}
D.assert(false);
return EdgeInsets.zero;
}

return new RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)));
}
return new RoundedRectangleBorder();
}
}

Color fillColor = button.enabled ? button.color : button.disabledColor;
if (fillColor != null)
return fillColor;
// todo xingwei.zhu: uncomment these when FlatButton & OutlineButton & RaisedButton are ready
// if (button is FlatButton || button is OutlineButton)
// return null;

? this._buttonColor ?? this.colorScheme.primary
: this.colorScheme.onSurface.withOpacity(0.12);
}
D.assert(false);
return null;
}

return Colors.black;
}
}
D.assert(false);
return null;
}

// }
return this.getTextColor(button).withOpacity(0.12);
}
public Color getHighlightColor(MaterialButton button) {
if (button.highlightColor != null)
return button.highlightColor;

D.assert(false);
return Colors.transparent;
}
public double getElevation(MaterialButton button) {
if (button.elevation != null)
return button.elevation ?? 0.0;

return 2.0;
}
public double getHighlightElevation(MaterialButton button) {
if (button.highlightElevation != null)
return button.highlightElevation ?? 0.0;

// return 2.0;
return 8.0;
}
public EdgeInsets getPadding(MaterialButton button) {
if (button.padding != null)
return button.padding;

case ButtonTextTheme.primary:
return EdgeInsets.symmetric(horizontal: 24.0);
}
public ButtonThemeData copyWith(
ButtonTextTheme? textTheme = null,

Color splashColor = null,
ColorScheme colorScheme = null,
MaterialTapTargetSize? materialTapTargetSize = null) {
return new ButtonThemeData(
textTheme: textTheme ?? this.textTheme,
layoutBehavior: layoutBehavior ?? this.layoutBehavior,

colorScheme: colorScheme ?? this.colorScheme,
materialTapTargetSize: materialTapTargetSize ?? this._materialTapTargetSize);
}
public bool Equals(ButtonThemeData other) {
if (ReferenceEquals(null, other)) {
return false;

}
return this.textTheme == other.textTheme
&& this.minWidth == other.minWidth
&& this.height == other.height
&& this.padding == other.padding
&& this.shape == other.shape
&& this.alignedDropdown == other.alignedDropdown
&& this._buttonColor == other._buttonColor
&& this._disabledColor == other._disabledColor
&& this._highlightColor == other._highlightColor
&& this._splashColor == other._splashColor
&& this.colorScheme == other.colorScheme
&& this._materialTapTargetSize == other._materialTapTargetSize;
&& this.minWidth == other.minWidth
&& this.height == other.height
&& this.padding == other.padding
&& this.shape == other.shape
&& this.alignedDropdown == other.alignedDropdown
&& this._buttonColor == other._buttonColor
&& this._disabledColor == other._disabledColor
&& this._highlightColor == other._highlightColor
&& this._splashColor == other._splashColor
&& this.colorScheme == other.colorScheme
&& this._materialTapTargetSize == other._materialTapTargetSize;
}
public override bool Equals(object obj) {

return hashCode;
}
}
properties.add(new EnumProperty<ButtonTextTheme>("textTheme", this.textTheme, defaultValue: defaultTheme.textTheme));
properties.add(new EnumProperty<ButtonTextTheme>("textTheme", this.textTheme,
defaultValue: defaultTheme.textTheme));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding, defaultValue: defaultTheme.padding));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding,
defaultValue: defaultTheme.padding));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: defaultTheme.shape));
properties.add(new FlagProperty("alignedDropdown",
value: this.alignedDropdown,

properties.add(new DiagnosticsProperty<Color>("disabledColor", this._disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", this._highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", this._splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme, defaultValue: defaultTheme.colorScheme));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize>("materialTapTargetSize", this._materialTapTargetSize ?? MaterialTapTargetSize.padded, defaultValue: null));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme,
defaultValue: defaultTheme.colorScheme));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
this._materialTapTargetSize, defaultValue: null));
}
}
}

51
Runtime/material/color_scheme.cs


D.assert(onSurface != null);
D.assert(onBackground != null);
D.assert(onError != null);
D.assert(brightness != null);
this.primary = primary;
this.primaryVariant = primaryVariant;

) {
primary = primary ?? new Color(0xFF6200EE);
primaryVariant = primaryVariant ?? new Color(0xFF3700B3);
secondary = secondary ?? new Color(0xFF03AC6);
secondary = secondary ?? new Color(0xFF03DAC6);
secondaryVariant = secondaryVariant ?? new Color(0xFF018786);
surface = surface ?? Colors.white;
background = background ?? Colors.white;

Color backgroundColor = null,
Color errorColor = null,
Brightness? brightness = Brightness.light) {
D.assert(brightness != null);
primarySwatch = primarySwatch ?? Colors.blue;
bool isDark = brightness == Brightness.dark;

Color onBackground = null,
Color onError = null,
Brightness? brightness = null) {
return new ColorScheme(
primary: primary ?? this.primary,
primaryVariant: primaryVariant ?? this.primaryVariant,

brightness: brightness ?? this.brightness
);
}
public static ColorScheme lerp(ColorScheme a, ColorScheme b, double t) {
return new ColorScheme(
primary: Color.lerp(a.primary, b.primary, t),

brightness: t < 0.5 ? a.brightness : b.brightness
);
}
public bool Equals(ColorScheme other) {
if (ReferenceEquals(null, other)) {
return false;

return hashCode;
}
}
ColorScheme defaultScheme = ColorScheme.light();
properties.add(new DiagnosticsProperty<Color>("primary", this.primary, defaultValue: defaultScheme.primary));
properties.add(new DiagnosticsProperty<Color>("primaryVariant", this.primaryVariant, defaultValue: defaultScheme.primaryVariant));
properties.add(new DiagnosticsProperty<Color>("secondary", this.secondary, defaultValue: defaultScheme.secondary));
properties.add(new DiagnosticsProperty<Color>("secondaryVariant", this.secondaryVariant, defaultValue: defaultScheme.secondaryVariant));
properties.add(new DiagnosticsProperty<Color>("surface", this.surface, defaultValue: defaultScheme.surface));
properties.add(new DiagnosticsProperty<Color>("background", this.background, defaultValue: defaultScheme.background));
ColorScheme defaultScheme = light();
properties.add(new DiagnosticsProperty<Color>("primary", this.primary,
defaultValue: defaultScheme.primary));
properties.add(new DiagnosticsProperty<Color>("primaryVariant", this.primaryVariant,
defaultValue: defaultScheme.primaryVariant));
properties.add(new DiagnosticsProperty<Color>("secondary", this.secondary,
defaultValue: defaultScheme.secondary));
properties.add(new DiagnosticsProperty<Color>("secondaryVariant", this.secondaryVariant,
defaultValue: defaultScheme.secondaryVariant));
properties.add(new DiagnosticsProperty<Color>("surface", this.surface,
defaultValue: defaultScheme.surface));
properties.add(new DiagnosticsProperty<Color>("background", this.background,
defaultValue: defaultScheme.background));
properties.add(new DiagnosticsProperty<Color>("onPrimary", this.onPrimary, defaultValue: defaultScheme.onPrimary));
properties.add(new DiagnosticsProperty<Color>("onSecondary", this.onSecondary, defaultValue: defaultScheme.onSecondary));
properties.add(new DiagnosticsProperty<Color>("onSurface", this.onSurface, defaultValue: defaultScheme.onSurface));
properties.add(new DiagnosticsProperty<Color>("onBackground", this.onBackground, defaultValue: defaultScheme.onBackground));
properties.add(new DiagnosticsProperty<Color>("onError", this.onError, defaultValue: defaultScheme.onError));
properties.add(new DiagnosticsProperty<Brightness>("brightness", this.brightness, defaultValue: defaultScheme.brightness));
properties.add(new DiagnosticsProperty<Color>("onPrimary", this.onPrimary,
defaultValue: defaultScheme.onPrimary));
properties.add(new DiagnosticsProperty<Color>("onSecondary", this.onSecondary,
defaultValue: defaultScheme.onSecondary));
properties.add(new DiagnosticsProperty<Color>("onSurface", this.onSurface,
defaultValue: defaultScheme.onSurface));
properties.add(new DiagnosticsProperty<Color>("onBackground", this.onBackground,
defaultValue: defaultScheme.onBackground));
properties.add(new DiagnosticsProperty<Color>("onError", this.onError,
defaultValue: defaultScheme.onError));
properties.add(new DiagnosticsProperty<Brightness>("brightness", this.brightness,
defaultValue: defaultScheme.brightness));
}
}
}

216
Runtime/material/colors.cs


using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;

long primary,
Dictionary<int, Color> swatch) : base(primary: primary, swatch: swatch) {
}
Dictionary<int, Color> swatch) : base(primary: primary, swatch: swatch) {}
public Color shade50 => this[50];

public class Colors {
public static Color transparent = new Color(0x00000000);
public static readonly Color transparent = new Color(0x00000000);
public static Color black = new Color(0xFF000000);
public static readonly Color black = new Color(0xFF000000);
public static Color black87 = new Color(0xDD000000);
public static readonly Color black87 = new Color(0xDD000000);
public static Color black54 = new Color(0x8A000000);
public static readonly Color black54 = new Color(0x8A000000);
public static Color black45 = new Color(0x73000000);
public static readonly Color black45 = new Color(0x73000000);
public static Color black38 = new Color(0x61000000);
public static readonly Color black38 = new Color(0x61000000);
public static Color black26 = new Color(0x42000000);
public static readonly Color black26 = new Color(0x42000000);
public static Color black12 = new Color(0x1F000000);
public static readonly Color black12 = new Color(0x1F000000);
public static Color white = new Color(0xFFFFFFFF);
public static readonly Color white = new Color(0xFFFFFFFF);
public static Color white70 = new Color(0xB3FFFFFF);
public static readonly Color white70 = new Color(0xB3FFFFFF);
public static Color white54 = new Color(0x8AFFFFFF);
public static readonly Color white54 = new Color(0x8AFFFFFF);
public static Color white30 = new Color(0x4DFFFFFF);
public static readonly Color white30 = new Color(0x4DFFFFFF);
public static Color white24 = new Color(0x3DFFFFFF);
public static readonly Color white24 = new Color(0x3DFFFFFF);
public static Color white12 = new Color(0x1FFFFFFF);
public static readonly Color white12 = new Color(0x1FFFFFFF);
public static Color white10 = new Color(0x1AFFFFFF);
public static readonly Color white10 = new Color(0x1AFFFFFF);
public static MaterialColor red = new MaterialColor(
public static readonly MaterialColor red = new MaterialColor(
_redPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFFEBEE)},

}
);
static long _redPrimaryValue = 0xFFF44336;
const long _redPrimaryValue = 0xFFF44336;
public static MaterialAccentColor redAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor redAccent = new MaterialAccentColor(
_redAccentValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFF8A80)},

}
);
static long _redAccentValue = 0xFFFF5252;
const long _redAccentValue = 0xFFFF5252;
public static MaterialColor pink = new MaterialColor(
public static readonly MaterialColor pink = new MaterialColor(
_pinkPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFCE4EC)},

}
);
static long _pinkPrimaryValue = 0xFFE91E63;
const long _pinkPrimaryValue = 0xFFE91E63;
public static MaterialAccentColor pinkAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor pinkAccent = new MaterialAccentColor(
_pinkAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFF80AB)},

}
);
static long _pinkAccentPrimaryValue = 0xFFFF4081;
const long _pinkAccentPrimaryValue = 0xFFFF4081;
public static MaterialColor purple = new MaterialColor(
public static readonly MaterialColor purple = new MaterialColor(
_purplePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFF3E5F5)},

}
);
static long _purplePrimaryValue = 0xFF9C27B0;
const long _purplePrimaryValue = 0xFF9C27B0;
public static MaterialAccentColor purpleAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor purpleAccent = new MaterialAccentColor(
_purpleAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFEA80FC)},

}
);
static long _purpleAccentPrimaryValue = 0xFFE040FB;
const long _purpleAccentPrimaryValue = 0xFFE040FB;
public static MaterialColor deepPurple = new MaterialColor(
public static readonly MaterialColor deepPurple = new MaterialColor(
_deepPurplePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFEDE7F6)},

}
);
static long _deepPurplePrimaryValue = 0xFF673AB7;
const long _deepPurplePrimaryValue = 0xFF673AB7;
public static MaterialAccentColor deepPurpleAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor deepPurpleAccent = new MaterialAccentColor(
_deepPurpleAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFB388FF)},

}
);
static long _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
const long _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
public static MaterialColor indigo = new MaterialColor(
public static readonly MaterialColor indigo = new MaterialColor(
{
50, new Color(0xFFE8EAF6)
}, {
100, new Color(0xFFC5CAE9)
},
{50, new Color(0xFFE8EAF6)},
{100, new Color(0xFFC5CAE9)},
{200, new Color(0xFF9FA8DA)},
{300, new Color(0xFF7986CB)},
{400, new Color(0xFF5C6BC0)},

}
);
static long _indigoPrimaryValue = 0xFF3F51B5;
const long _indigoPrimaryValue = 0xFF3F51B5;
public static MaterialAccentColor indigoAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor indigoAccent = new MaterialAccentColor(
_indigoAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFF8C9EFF)},

}
);
static long _indigoAccentPrimaryValue = 0xFF536DFE;
const long _indigoAccentPrimaryValue = 0xFF536DFE;
public static MaterialColor blue = new MaterialColor(
public static readonly MaterialColor blue = new MaterialColor(
_bluePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFE3F2FD)},

}
);
static long _bluePrimaryValue = 0xFF2196F3;
const long _bluePrimaryValue = 0xFF2196F3;
public static MaterialAccentColor blueAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor blueAccent = new MaterialAccentColor(
{700, new Color(0xFF2962FF)},
{700, new Color(0xFF2962FF)}
static long _blueAccentPrimaryValue = 0xFF448AFF;
const long _blueAccentPrimaryValue = 0xFF448AFF;
public static MaterialColor lightBlue = new MaterialColor(
public static readonly MaterialColor lightBlue = new MaterialColor(
_lightBluePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFE1F5FE)},

}
);
static long _lightBluePrimaryValue = 0xFF03A9F4;
const long _lightBluePrimaryValue = 0xFF03A9F4;
public static MaterialAccentColor lightBlueAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor lightBlueAccent = new MaterialAccentColor(
{700, new Color(0xFF0091EA)},
{700, new Color(0xFF0091EA)}
static long _lightBlueAccentPrimaryValue = 0xFF40C4FF;
const long _lightBlueAccentPrimaryValue = 0xFF40C4FF;
public static MaterialColor cyan = new MaterialColor(
public static readonly MaterialColor cyan = new MaterialColor(
_cyanPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFE0F7FA)},

{600, new Color(0xFF00ACC1)},
{700, new Color(0xFF0097A7)},
{800, new Color(0xFF00838F)},
{900, new Color(0xFF006064)},
{900, new Color(0xFF006064)}
static long _cyanPrimaryValue = 0xFF00BCD4;
const long _cyanPrimaryValue = 0xFF00BCD4;
public static MaterialAccentColor cyanAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor cyanAccent = new MaterialAccentColor(
{700, new Color(0xFF00B8D4)},
{700, new Color(0xFF00B8D4)}
static long _cyanAccentPrimaryValue = 0xFF18FFFF;
const long _cyanAccentPrimaryValue = 0xFF18FFFF;
public static MaterialColor teal = new MaterialColor(
public static readonly MaterialColor teal = new MaterialColor(
_tealPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFE0F2F1)},

{600, new Color(0xFF00897B)},
{700, new Color(0xFF00796B)},
{800, new Color(0xFF00695C)},
{900, new Color(0xFF004D40)},
{900, new Color(0xFF004D40)}
static long _tealPrimaryValue = 0xFF009688;
const long _tealPrimaryValue = 0xFF009688;
public static MaterialAccentColor tealAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor tealAccent = new MaterialAccentColor(
{700, new Color(0xFF00BFA5)},
{700, new Color(0xFF00BFA5)}
static long _tealAccentPrimaryValue = 0xFF64FFDA;
const long _tealAccentPrimaryValue = 0xFF64FFDA;
public static MaterialColor green = new MaterialColor(
public static readonly MaterialColor green = new MaterialColor(
_greenPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFE8F5E9)},

{600, new Color(0xFF43A047)},
{700, new Color(0xFF388E3C)},
{800, new Color(0xFF2E7D32)},
{900, new Color(0xFF1B5E20)},
{900, new Color(0xFF1B5E20)}
static long _greenPrimaryValue = 0xFF4CAF50;
const long _greenPrimaryValue = 0xFF4CAF50;
public static MaterialAccentColor greenAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor greenAccent = new MaterialAccentColor(
{700, new Color(0xFF00C853)},
{700, new Color(0xFF00C853)}
static long _greenAccentPrimaryValue = 0xFF69F0AE;
const long _greenAccentPrimaryValue = 0xFF69F0AE;
public static MaterialColor lightGreen = new MaterialColor(
public static readonly MaterialColor lightGreen = new MaterialColor(
_lightGreenPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFF1F8E9)},

{600, new Color(0xFF7CB342)},
{700, new Color(0xFF689F38)},
{800, new Color(0xFF558B2F)},
{900, new Color(0xFF33691E)},
{900, new Color(0xFF33691E)}
static long _lightGreenPrimaryValue = 0xFF8BC34A;
const long _lightGreenPrimaryValue = 0xFF8BC34A;
public static MaterialAccentColor lightGreenAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor lightGreenAccent = new MaterialAccentColor(
{700, new Color(0xFF64DD17)},
{700, new Color(0xFF64DD17)}
static long _lightGreenAccentPrimaryValue = 0xFFB2FF59;
const long _lightGreenAccentPrimaryValue = 0xFFB2FF59;
public static MaterialColor lime = new MaterialColor(
public static readonly MaterialColor lime = new MaterialColor(
_limePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFF9FBE7)},

{600, new Color(0xFFC0CA33)},
{700, new Color(0xFFAFB42B)},
{800, new Color(0xFF9E9D24)},
{900, new Color(0xFF827717)},
{900, new Color(0xFF827717)}
static long _limePrimaryValue = 0xFFCDDC39;
const long _limePrimaryValue = 0xFFCDDC39;
public static MaterialAccentColor limeAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor limeAccent = new MaterialAccentColor(
{700, new Color(0xFFAEEA00)},
{700, new Color(0xFFAEEA00)}
static long _limeAccentPrimaryValue = 0xFFEEFF41;
const long _limeAccentPrimaryValue = 0xFFEEFF41;
public static MaterialColor yellow = new MaterialColor(
public static readonly MaterialColor yellow = new MaterialColor(
_yellowPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFFFDE7)},

}
);
static long _yellowPrimaryValue = 0xFFFFEB3B;
const long _yellowPrimaryValue = 0xFFFFEB3B;
public static MaterialAccentColor yellowAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor yellowAccent = new MaterialAccentColor(
_yellowAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFFFF8D)},

}
);
static long _yellowAccentPrimaryValue = 0xFFFFFF00;
const long _yellowAccentPrimaryValue = 0xFFFFFF00;
public static MaterialColor amber = new MaterialColor(
public static readonly MaterialColor amber = new MaterialColor(
_amberPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFFF8E1)},

}
);
static long _amberPrimaryValue = 0xFFFFC107;
const long _amberPrimaryValue = 0xFFFFC107;
public static MaterialAccentColor amberAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor amberAccent = new MaterialAccentColor(
_amberAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFFE57F)},

}
);
static long _amberAccentPrimaryValue = 0xFFFFD740;
const long _amberAccentPrimaryValue = 0xFFFFD740;
public static MaterialColor orange = new MaterialColor(
public static readonly MaterialColor orange = new MaterialColor(
_orangePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFFF3E0)},

}
);
static long _orangePrimaryValue = 0xFFFF9800;
const long _orangePrimaryValue = 0xFFFF9800;
public static MaterialAccentColor orangeAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor orangeAccent = new MaterialAccentColor(
_orangeAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFFD180)},

}
);
static long _orangeAccentPrimaryValue = 0xFFFFAB40;
const long _orangeAccentPrimaryValue = 0xFFFFAB40;
public static MaterialColor deepOrange = new MaterialColor(
public static readonly MaterialColor deepOrange = new MaterialColor(
_deepOrangePrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFBE9E7)},

}
);
static long _deepOrangePrimaryValue = 0xFFFF5722;
const long _deepOrangePrimaryValue = 0xFFFF5722;
public static MaterialAccentColor deepOrangeAccent = new MaterialAccentColor(
public static readonly MaterialAccentColor deepOrangeAccent = new MaterialAccentColor(
_deepOrangeAccentPrimaryValue,
new Dictionary<int, Color> {
{100, new Color(0xFFFF9E80)},

}
);
static long _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
const long _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
public static MaterialColor brown = new MaterialColor(
public static readonly MaterialColor brown = new MaterialColor(
_brownPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFEFEBE9)},

}
);
static long _brownPrimaryValue = 0xFF795548;
const long _brownPrimaryValue = 0xFF795548;
public static MaterialColor grey = new MaterialColor(
public static readonly MaterialColor grey = new MaterialColor(
_greyPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFFAFAFA)},

{350, new Color(0xFFD6D6D6)}, // only for raised button while pressed in light theme
{350, new Color(0xFFD6D6D6)},
{850, new Color(0xFF303030)}, // only for background color in dark theme
{850, new Color(0xFF303030)},
static long _greyPrimaryValue = 0xFF9E9E9E;
const long _greyPrimaryValue = 0xFF9E9E9E;
public static MaterialColor blueGrey = new MaterialColor(
public static readonly MaterialColor blueGrey = new MaterialColor(
_blueGreyPrimaryValue,
new Dictionary<int, Color> {
{50, new Color(0xFFECEFF1)},

}
);
static long _blueGreyPrimaryValue = 0xFF607D8B;
const long _blueGreyPrimaryValue = 0xFF607D8B;
public static List<MaterialColor> primaries = new List<MaterialColor> {
public static readonly List<MaterialColor> primaries = new List<MaterialColor> {
red,
pink,
purple,

orange,
deepOrange,
brown,
// The grey swatch is intentionally omitted because when picking a color
// randomly from this list to colorize an application, picking grey suddenly
// makes the app look disabled.
public static List<MaterialAccentColor> accents = new List<MaterialAccentColor> {
public static readonly List<MaterialAccentColor> accents = new List<MaterialAccentColor> {
redAccent,
pinkAccent,
purpleAccent,

28
Runtime/material/constants.cs


using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.material {
public class Constants {
public static class Constants {
public static readonly double kToolbarHeight = 56.0;
public static double kToolbarHeight = 56.0;
public static readonly double kBottomNavigationBarHeight = 56.0;
public static double kBottomNavigationBarHeight = 56.0;
public static readonly double kTextTabBarHeight = 48.0;
public static double kTextTabBarHeight = 48.0;
public static TimeSpan kThemeChangeDuration = new TimeSpan(0, 0, 0, 0, 200);
public static readonly TimeSpan kThemeChangeDuration = new TimeSpan(0, 0, 0, 0, 200);
public static double kRadialReactionRadius = 20.0;
public static readonly double kRadialReactionRadius = 20.0;
public static TimeSpan kRadialReactionDuration = new TimeSpan(0, 0, 0, 0, 100);
public static readonly TimeSpan kRadialReactionDuration = new TimeSpan(0, 0, 0, 0, 100);
public static int kRadialReactionAlpha = 0x1F;
public static TimeSpan kTabScrollDuration = new TimeSpan(0, 0, 0, 0, 300);
public static EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0);
public static readonly int kRadialReactionAlpha = 0x1F;
public static EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0);
public static readonly TimeSpan kTabScrollDuration = new TimeSpan(0, 0, 0, 0, 300);
public static readonly EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0);
public static readonly EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0);
}
}

36
Runtime/material/debug.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.foundation;
using System.Collections.Generic;
public class MaterialDebug {
public static class MaterialDebug {
"a sheet of material. In Flutter\'s material library, that " +
"material is represented by the Material widget. It is the " +
"Material widget that renders ink splashes, for instance. " +
"Because of this, many material library widgets require that " +
"there be a Material widget in the tree above them.";
"a sheet of material. In Flutter\'s material library, that " +
"material is represented by the Material widget. It is the " +
"Material widget that renders ink splashes, for instance. " +
"Because of this, many material library widgets require that " +
"there be a Material widget in the tree above them.";
"include one, or use a widget that contains Material itself, " +
"such as a Card, Dialog, Drawer, or Scaffold.";
"include one, or use a widget that contains Material itself, " +
"such as a Card, Dialog, Drawer, or Scaffold.";
context.visitAncestorElements((Element element) => {
ancestors.Add(element.widget);
return true;

foreach (Widget ancestor in ancestors)
message += "\n $ancestor";
} else {
message +="This widget is the root of the tree, so it has no " +
"ancestors, let alone a \"Material\" ancestor.";
}
else {
message += "This widget is the root of the tree, so it has no " +
"ancestors, let alone a \"Material\" ancestor.";
return true;
});
return true;

30
Runtime/material/ink_decoration.cs


using System.Runtime.InteropServices.WindowsRuntime;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.widgets;
using ImageUtils = Unity.UIWidgets.widgets.ImageUtils;
namespace Unity.UIWidgets.material {

) {
D.assert(padding == null || padding.isNonNegative);
D.assert(image != null);
D.assert(repeat != null);
image: new DecorationImage(image,
image: new DecorationImage(
image: image,
colorFilter: colorFilter,
fit: fit,
alignment: alignment,

if (this.decoration == null || this.decoration.padding == null)
return this.padding;
EdgeInsets decorationPadding = this.decoration.padding;
if (this.padding == null) {
if (this.padding == null)
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", this.padding, defaultValue: null));

base.deactivate();
}
public Widget _build(BuildContext context, BoxConstraints contraints) {
public Widget _build(BuildContext context, BoxConstraints constraints) {
decoration: this.widget.decoration,
decoration: this.widget.decoration,
referenceBox: (RenderBox)context.findRenderObject(),
onRemoved: this._handleRemoved);
referenceBox: (RenderBox) context.findRenderObject(),
onRemoved: this._handleRemoved
);
}
else {
this._ink.decoration = this.widget.decoration;

public override Widget build(BuildContext context) {
D.assert(MaterialDebug.debugCheckHasMaterial(context));
Widget result = new LayoutBuilder(
builder: this._build);
builder: this._build
);
if (this.widget.width != null || this.widget.height != null) {
result = new SizedBox(
width: this.widget.width,

D.assert(decoration != null);
D.assert(controller != null);
D.assert(referenceBox != null);
this._configuration = configuration;
this.decoration = decoration;
this.controller.addInkFeature(this);
}

this.controller.markNeedsPaint();
}
}
Decoration _decoration;
public ImageConfiguration configuration {

this.controller.markNeedsPaint();
}
}
public override void dispose() {
this._painter?.Dispose();
base.dispose();

17
Runtime/material/ink_highlight.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Color = Unity.UIWidgets.ui.Color;
public class InkHighlight : InteractiveInkFeature {
public InkHighlight(
MaterialInkController controller = null,

this._borderRadius = borderRadius ?? BorderRadius.zero;
this._customBorder = customBorder;
this._rectCallback = rectCallback;
this._alphaController = new AnimationController(
duration: InkHighlightUtils._kHighlightFadeDuration,
vsync: controller.vsync);

this._alpha = this._alphaController.drive(new IntTween(
begin: 0, end: color.alpha));
this.controller.addInkFeature(this);
}

Animation<int> _alpha;
AnimationController _alphaController;
public bool active {
get { return this._active; }
}
public bool active => this._active;
bool _active = true;
public void activate() {

}
protected override void paintFeature(Canvas canvas, Matrix3 transform) {
Paint paint = new Paint();
paint.color = this.color.withAlpha(this._alpha.value);
Paint paint = new Paint {color = this.color.withAlpha(this._alpha.value)};
Offset originOffset = transform.getAsTranslation();
Rect rect = this._rectCallback != null ? this._rectCallback() : Offset.zero & this.referenceBox.size;
if (originOffset == null) {

27
Runtime/material/ink_splash.cs


using System;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

double? radius = null,
VoidCallback onRemoved = null
) {
D.assert(controller != null);
D.assert(referenceBox != null);
D.assert(position != null);
D.assert(color != null);
return new InkSplash(
controller: controller,
referenceBox: referenceBox,

BorderRadius borderRadius = null,
ShapeBorder customBorder = null,
double? radius = null,
VoidCallback onRemoved = null) : base(
VoidCallback onRemoved = null
) : base(
controller: controller,
referenceBox: referenceBox,
color: color,

radius ?? InkSplashUtils._getTargetRadius(referenceBox, containedInkWell, rectCallback, position);
this._clipCallback = InkSplashUtils._getClipCallback(referenceBox, containedInkWell, rectCallback);
this._repositionToReferenceBox = !containedInkWell;
this._radiusController = new AnimationController(duration:
InkSplashUtils._kUnconfirmedSplashDuration,
this._radiusController = new AnimationController(
duration: InkSplashUtils._kUnconfirmedSplashDuration,
vsync: controller.vsync);
this._radiusController.addListener(controller.markNeedsPaint);
this._radiusController.forward();

this._alphaController = new AnimationController(duration:
InkSplashUtils._kSplashFadeDuration,
this._alphaController = new AnimationController(
duration: InkSplashUtils._kSplashFadeDuration,
vsync: controller.vsync);
this._alphaController.addListener(controller.markNeedsPaint);
this._alphaController.addStatusListener(this._handleAlphaStatusChanged);

controller.addInkFeature(this);
}

Animation<int> _alpha;
AnimationController _alphaController;
public static InteractiveInkFeatureFactory splashFactory = new _InkSplashFactory();
public override void confirm() {

}
protected override void paintFeature(Canvas canvas, Matrix3 transform) {
Paint paint = new Paint();
paint.color = this.color.withAlpha(this._alpha.value);
Paint paint = new Paint {color = this.color.withAlpha(this._alpha.value)};
Offset center = this._position;
if (this._repositionToReferenceBox)
center = Offset.lerp(center, this.referenceBox.size.center(Offset.zero), this._radiusController.value);

canvas.clipRect(rect);
}
}
canvas.restore();
}
}

97
Runtime/material/ink_well.cs


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

using Color = Unity.UIWidgets.ui.Color;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public abstract class InteractiveInkFeature : InkFeature {
public InteractiveInkFeature(
MaterialInkController controller = null,

this._color = color;
}
public virtual void confirm() {}
public virtual void cancel() {}
public virtual void confirm() {
}
public virtual void cancel() {
}
if (value == this._color) {
if (value == this._color)
}
this._color = value;
this.controller.markNeedsPaint();
}

}
public abstract class InteractiveInkFeatureFactory {
public InteractiveInkFeatureFactory() {}
public InteractiveInkFeatureFactory() {
}
MaterialInkController controller = null,
RenderBox referenceBox = null,
Offset position = null,
Color color = null,
bool containedInkWell = false,
RectCallback rectCallback = null,
BorderRadius borderRadius = null,
ShapeBorder customBorder = null,
double? radius = null,
VoidCallback onRemoved = null);
MaterialInkController controller = null,
RenderBox referenceBox = null,
Offset position = null,
Color color = null,
bool containedInkWell = false,
RectCallback rectCallback = null,
BorderRadius borderRadius = null,
ShapeBorder customBorder = null,
double? radius = null,
VoidCallback onRemoved = null);
}

Widget child = null,
GestureTapCallback onTap = null,
GestureTapDownCallback onTapDown = null,
GestureTapCancelCallback onTapCancel = null,
GestureTapCallback onTapCancel = null,
GestureTapCallback onDoubleTap = null,
GestureLongPressCallback onLongPress = null,
ValueChanged<bool> onHighlightChanged = null,

}
public readonly Widget child;
public readonly GestureTapCancelCallback onTapCancel;
public readonly GestureTapCallback onTapCancel;
public readonly GestureTapCallback onDoubleTap;

}
public override State createState() => new _InkResponseState<InkResponse>();
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
List<string> gestures = new List<string>();

if (this.onTapCancel != null)
gestures.Add("tap cancel");
properties.add(new EnumerableProperty<string>("gestures", gestures, ifEmpty: "<none>"));
properties.add(new DiagnosticsProperty<bool>("containedInkWell", this.containedInkWell, level: DiagnosticLevel.fine));
properties.add(new DiagnosticsProperty<bool>("containedInkWell", this.containedInkWell,
level: DiagnosticLevel.fine));
properties.add(new DiagnosticsProperty<BoxShape>(
"highlightShape",
this.highlightShape,

InteractiveInkFeature _currentSplash;
InkHighlight _lastHighlight;
protected override bool wantKeepAlive {
get { return this._lastHighlight != null || (this._splashes != null && this._splashes.isNotEmpty()); }
}
protected override bool wantKeepAlive =>
this._lastHighlight != null || (this._splashes != null && this._splashes.isNotEmpty());
public void updateHighlight(bool value) {
if (value == (this._lastHighlight != null && this._lastHighlight.active))

RenderBox referenceBox = (RenderBox)this.context.findRenderObject();
RenderBox referenceBox = (RenderBox) this.context.findRenderObject();
this._lastHighlight = new InkHighlight(
controller: Material.of(this.context),
referenceBox: referenceBox,

else {
this._lastHighlight.deactivate();
}
D.assert(value == (this._lastHighlight != null && this._lastHighlight.active));
if (this.widget.onHighlightChanged != null)
this.widget.onHighlightChanged(value);

ShapeBorder customBorder = this.widget.customBorder;
InteractiveInkFeature splash = null;
VoidCallback onRemoved = () => {
void OnRemoved() {
if (this._currentSplash == splash)
this._currentSplash = null;
if (this._currentSplash == splash) this._currentSplash = null;
};
}
splash = (this.widget.splashFactory ?? Theme.of(this.context).splashFactory).create(
controller: inkController,
referenceBox: referenceBox,

radius: this.widget.radius,
borderRadius: borderRadius,
customBorder: customBorder,
onRemoved: onRemoved);
onRemoved: OnRemoved);
return splash;
}

if (this.widget.onTapDown != null) {
this.widget.onTapDown(details);
}
this.updateKeepAlive();
this.updateHighlight(true);
}

if (this.widget.onTapCancel != null) {
this.widget.onTapCancel();
}
this.updateHighlight(false);
}

splash.dispose();
this._currentSplash = null;
}
D.assert(this._currentSplash == null);
this._lastHighlight?.dispose();
this._lastHighlight = null;

this.widget.onLongPress != null;
return new GestureDetector(
onTapDown: enabled? (GestureTapDownCallback)this._handleTapDown : null,
onTap: enabled? (GestureTapCallback)(() => this._handleTap(context)) : null,
onTapCancel: enabled? (GestureTapCancelCallback)this._handleTapCancel : null,
onDoubleTap: this.widget.onDoubleTap != null ? (GestureDoubleTapCallback)this._handleDoubleTap : null,
onLongPress: this.widget.onLongPress != null ? (GestureLongPressCallback)(() => this._handleLongPress(context)) : null,
onTapDown: enabled ? (GestureTapDownCallback) this._handleTapDown : null,
onTap: enabled ? (GestureTapCallback) (() => this._handleTap(context)) : null,
onTapCancel: enabled ? (GestureTapCancelCallback) this._handleTapCancel : null,
onDoubleTap: this.widget.onDoubleTap != null ? (GestureDoubleTapCallback) this._handleDoubleTap : null,
onLongPress: this.widget.onLongPress != null
? (GestureLongPressCallback) (() => this._handleLongPress(context))
: null,
behavior: HitTestBehavior.opaque,
child: this.widget.child
);

double? radius = null,
BorderRadius borderRadius = null,
ShapeBorder customBorder = null
) : base(key: key,
) : base(
key: key,
onTapCancel: onTapCancel,
onTapCancel: () => onTapCancel(),
onHighlightChanged: onHighlightChanged,
containedInkWell: true,
highlightColor: highlightColor,

borderRadius: borderRadius,
customBorder: customBorder){}
customBorder: customBorder) {
}
}
}

101
Runtime/material/material.cs


using System;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using System;
using Unity.UIWidgets.animation;
public delegate Rect RectCallback();
public enum MaterialType {

button,
transparency
}
Color color { get; set; }
TickerProvider vsync { get; }

Clip clipBehavior = Clip.none,
TimeSpan? animationDuration = null,
Widget child = null
) : base(key: key) {
D.assert(type != null);
D.assert(elevation != null);
) : base(key: key) {
D.assert(type != MaterialType.circle && (borderRadius != null || shape != null));
D.assert(clipBehavior != null);
D.assert(!(type == MaterialType.circle && (borderRadius != null || shape != null)));
this.type = type;
this.elevation = elevation;
this.color = color;

this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.child = child;
}
public readonly Widget child;

public readonly BorderRadius borderRadius;
_RenderInkFeatures result = (_RenderInkFeatures) context.ancestorRenderObjectOfType(new TypeMatcher<_RenderInkFeatures>());
_RenderInkFeatures result =
(_RenderInkFeatures) context.ancestorRenderObjectOfType(new TypeMatcher<_RenderInkFeatures>());
properties.add(new DiagnosticsProperty<Color>("shadowColor", this.shadowColor, defaultValue: new Color(0xFF000000)));
properties.add(new DiagnosticsProperty<Color>("shadowColor", this.shadowColor,
defaultValue: new Color(0xFF000000)));
public static double defaultSplashRadius = 35.0;
public const double defaultSplashRadius = 35.0;
readonly GlobalKey _inkFeatureRenderer = GlobalKey.key(debugLabel:"ink renderer");
readonly GlobalKey _inkFeatureRenderer = GlobalKey.key(debugLabel: "ink renderer");
Color _getBackgroundColor(BuildContext context) {
if (this.widget.color != null)

contents = new NotificationListener<LayoutChangedNotification>(
onNotification: (LayoutChangedNotification notification) => {
_RenderInkFeatures renderer = (_RenderInkFeatures) this._inkFeatureRenderer.currentContext.findRenderObject();
_RenderInkFeatures renderer =
(_RenderInkFeatures) this._inkFeatureRenderer.currentContext.findRenderObject();
renderer._didChangeLayout();
return true;
},

child: contents,
vsync: this
)
)
);
if (this.widget.type == MaterialType.canvas && this.widget.shape == null &&

ShapeBorder shape = this._getShape();
//todo xingwei.zhu: add support for transparentInterior Material
if (this.widget.type == MaterialType.transparency) {
D.assert(false, "material widget is not completely implemented yet.");
return null;

case MaterialType.circle:
return new CircleBorder();
}
return new RoundedRectangleBorder();
}
}

inkFeature._paint(canvas);
canvas.restore();
}
base.paint(context, offset);
}
}

VoidCallback onRemoved = null) {
D.assert(controller != null);
D.assert(referenceBox != null);
this._controller = (_RenderInkFeatures)controller;
this._controller = (_RenderInkFeatures) controller;
public MaterialInkController controller {
get { return this._controller; }
}
public MaterialInkController controller => this._controller;
public _RenderInkFeatures _controller;
public readonly RenderBox referenceBox;

D.assert(this.referenceBox.attached);
D.assert(!this._debugDisposed);
List<RenderObject> descendants = new List<RenderObject> { this.referenceBox };
List<RenderObject> descendants = new List<RenderObject> {this.referenceBox};
node = (RenderObject)node.parent;
node = (RenderObject) node.parent;
for(int index = descendants.Count - 1; index > 0; index -= 1)
for (int index = descendants.Count - 1; index > 0; index -= 1)
descendants[index].applyPaintTransform(descendants[index - 1], transform);
this.paintFeature(canvas, transform);
}

public string toString() => this.GetType() + "";
}
ShapeBorder end = null) : base(begin: begin, end: end) {}
ShapeBorder end = null) : base(begin: begin, end: end) {
}
public override ShapeBorder lerp(double t) {
return ShapeBorder.lerp(this.begin, this.end, t);

public class _MaterialInterior : ImplicitlyAnimatedWidget {
public _MaterialInterior(
Key key = null,
Widget child = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
double? elevation = null,
Color color = null,
Color shadowColor = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key : key, curve : curve ?? Curves.linear, duration : duration){
Key key = null,
Widget child = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
double? elevation = null,
Color color = null,
Color shadowColor = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(child != null);
D.assert(shape != null);
D.assert(elevation != null);

public readonly Color shadowColor;
public override State createState() => new _MaterialInteriorState();
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape));

public override Widget build(BuildContext context) {
ShapeBorder shape = this._border.evaluate(this.animation);
return new PhysicalShape(
child : new _ShapeBorderPaint(
child : this.widget.child,
child: new _ShapeBorderPaint(
child: this.widget.child,
shape: shape),
clipper: new ShapeBorderClipper(
shape: shape),

public override Widget build(BuildContext context) {
return new CustomPaint(
child :this.child,
child: this.child,
public _ShapeBorderPainter (
ShapeBorder border = null,
Listenable repaint = null) : base(repaint) {
public _ShapeBorderPainter(ShapeBorder border = null) : base(null) {
this.border = border;
}

54
Runtime/material/material_button.cs


using System;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.service;

namespace Unity.UIWidgets.material {
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
Brightness? colorBrightness = null,
double? elevation = null,
double? highlightElevation = null,
double? disabledElevation = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
TimeSpan? animationDuration = null,
double? minWidth = null,
double? height = null,
Widget child = null
) : base(key : key) {
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
Brightness? colorBrightness = null,
double? elevation = null,
double? highlightElevation = null,
double? disabledElevation = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
TimeSpan? animationDuration = null,
double? minWidth = null,
double? height = null,
Widget child = null
) : base(key: key) {
D.assert(onPressed != null);
this.onPressed = onPressed;
this.onHighlightChanged = onHighlightChanged;

public readonly Brightness? colorBrightness;
public readonly Widget child;
public bool enabled => this.onPressed != null;
public readonly EdgeInsets padding;

child: this.child,
materialTapTargetSize: this.materialTapTargetSize ?? theme.materialTapTargetSize);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FlagProperty("enabled", value: this.enabled, ifFalse: "disabled"));

78
Runtime/material/text_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

public TextTheme copyWith(
TextStyle display4,
TextStyle display3,
TextStyle display2,
TextStyle display1,
TextStyle headline,
TextStyle title,
TextStyle subhead,
TextStyle body2,
TextStyle body1,
TextStyle caption,
TextStyle button,
TextStyle subtitle,
TextStyle overline
TextStyle display4 = null,
TextStyle display3 = null,
TextStyle display2 = null,
TextStyle display1 = null,
TextStyle headline = null,
TextStyle title = null,
TextStyle subhead = null,
TextStyle body2 = null,
TextStyle body1 = null,
TextStyle caption = null,
TextStyle button = null,
TextStyle subtitle = null,
TextStyle overline = null
) {
return new TextTheme(
display4: display4 ?? this.display4,

)
);
}
public static TextTheme lerp(TextTheme a, TextTheme b, double t) {
D.assert(a != null);
D.assert(b != null);

overline: TextStyle.lerp(a.overline, b.overline, t)
);
}
return this.display4 == other.display4
&& this.display3 == other.display3
&& this.display2 == other.display2

if (ReferenceEquals(null, obj)) {
return false;
}
public static bool operator ==(TextTheme a, TextTheme b) {
return ReferenceEquals(a, null) ? ReferenceEquals(b, null) : a.Equals(b);
public static bool operator ==(TextTheme left, TextTheme right) {
return Equals(left, right);
public static bool operator !=(TextTheme a, TextTheme b) {
return !(a == b);
public static bool operator !=(TextTheme left, TextTheme right) {
return !Equals(left, right);
public override int GetHashCode() {
unchecked {
var hashCode = this.display4.GetHashCode();

return hashCode;
}
}
properties.add(new DiagnosticsProperty<TextStyle>("display4", this.display4, defaultValue: defaultTheme.display4));
properties.add(new DiagnosticsProperty<TextStyle>("display3", this.display3, defaultValue: defaultTheme.display3));
properties.add(new DiagnosticsProperty<TextStyle>("display2", this.display2, defaultValue: defaultTheme.display2));
properties.add(new DiagnosticsProperty<TextStyle>("display1", this.display1, defaultValue: defaultTheme.display1));
properties.add(new DiagnosticsProperty<TextStyle>("headline", this.headline, defaultValue: defaultTheme.headline));
properties.add(new DiagnosticsProperty<TextStyle>("display4", this.display4,
defaultValue: defaultTheme.display4));
properties.add(new DiagnosticsProperty<TextStyle>("display3", this.display3,
defaultValue: defaultTheme.display3));
properties.add(new DiagnosticsProperty<TextStyle>("display2", this.display2,
defaultValue: defaultTheme.display2));
properties.add(new DiagnosticsProperty<TextStyle>("display1", this.display1,
defaultValue: defaultTheme.display1));
properties.add(new DiagnosticsProperty<TextStyle>("headline", this.headline,
defaultValue: defaultTheme.headline));
properties.add(new DiagnosticsProperty<TextStyle>("subhead", this.subhead, defaultValue: defaultTheme.subhead));
properties.add(
new DiagnosticsProperty<TextStyle>("subhead", this.subhead, defaultValue: defaultTheme.subhead));
properties.add(new DiagnosticsProperty<TextStyle>("caption", this.caption, defaultValue: defaultTheme.caption));
properties.add(new DiagnosticsProperty<TextStyle>("button", this.button, defaultValue: defaultTheme.button));
properties.add(new DiagnosticsProperty<TextStyle>("subtitle)", this.subtitle, defaultValue: defaultTheme.subtitle));
properties.add(new DiagnosticsProperty<TextStyle>("overline", this.overline, defaultValue: defaultTheme.overline));
properties.add(
new DiagnosticsProperty<TextStyle>("caption", this.caption, defaultValue: defaultTheme.caption));
properties.add(
new DiagnosticsProperty<TextStyle>("button", this.button, defaultValue: defaultTheme.button));
properties.add(new DiagnosticsProperty<TextStyle>("subtitle)", this.subtitle,
defaultValue: defaultTheme.subtitle));
properties.add(new DiagnosticsProperty<TextStyle>("overline", this.overline,
defaultValue: defaultTheme.overline));
}
}
}

14
Runtime/material/theme.cs


using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class Theme : StatelessWidget {
public Theme(
Key key = null,

return inheritedTheme.theme.data;
}
//todo:xingwei.zhu: materialLocalizations
//todo:xingwei.zhu: material Localizations
return inheritedTheme?.theme?.data ?? _kFallbackTheme;
}

class _AnimatedThemeState : AnimatedWidgetBaseState<AnimatedTheme> {
ThemeDataTween _data;
protected override void forEachTween(ITweenVisitor visitor) {
this._data = (ThemeDataTween) visitor.visit<ThemeData, AnimatedTheme>(this, this._data, this.widget.data, (ThemeData value) => new ThemeDataTween(begin: value));
protected override void forEachTween(ITweenVisitor visitor) {
this._data = (ThemeDataTween) visitor.visit(this, this._data, this.widget.data,
(ThemeData value) => new ThemeDataTween(begin: value));
}
public override Widget build(BuildContext context) {

data: this._data.evaluate(this.animation)
);
}
description.add(new DiagnosticsProperty<ThemeDataTween>("data", this._data, showName: false, defaultValue: null));
description.add(
new DiagnosticsProperty<ThemeDataTween>("data", this._data, showName: false, defaultValue: null));
}

151
Runtime/material/theme_data.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
public enum MaterialTapTargetSize {

primaryColorLight = primaryColorLight ?? (isDark ? Colors.grey[500] : primarySwatch[100]);
primaryColorDark = primaryColorDark ?? (isDark ? Colors.black : primarySwatch[700]);
bool primaryIsDark = primaryColorBrightness == Brightness.dark;
toggleableActiveColor = toggleableActiveColor ??
(isDark ? Colors.tealAccent[200] : (accentColor ?? primarySwatch[600]));
colorScheme = colorScheme ?? ColorScheme.fromSwatch(
primarySwatch: primarySwatch,
primaryColorDark: primaryColorDark,

errorColor: errorColor,
brightness: brightness);
highlightColor = highlightColor ??
(isDark
? ThemeDataUtils._kDarkThemeHighlightColor
: ThemeDataUtils._kLightThemeHighlightColor);
splashColor = splashColor ??
(isDark
? ThemeDataUtils._kDarkThemeSplashColor
: ThemeDataUtils._kLightThemeSplashColor);
splashFactory = splashFactory ?? InkSplash.splashFactory;
selectedRowColor = selectedRowColor ?? Colors.grey[100];

cursorColor = cursorColor ?? Color.fromRGBO(66, 133, 244, 1.0);
textSelectionHandleColor =
textSelectionHandleColor ?? (isDark ? Colors.tealAccent[400] : primarySwatch[300]);
iconTheme = iconTheme ??
(isDark ? new IconThemeData(color: Colors.white) : new IconThemeData(color: Colors.black87));
(isDark
(primaryIsDark
accentIconTheme = accentIconTheme ?? (isDark
accentIconTheme = accentIconTheme ??
(accentIsDark
iconTheme = iconTheme ??
(isDark ? new IconThemeData(color: Colors.white) : new IconThemeData(color: Colors.black87));
typography = typography ?? new Typography();
TextTheme defaultTextTheme = isDark ? typography.white : typography.black;
textTheme = defaultTextTheme.merge(textTheme);

primaryTextTheme = primaryTextTheme.apply(fontFamily: fontFamily);
accentTextTheme = accentTextTheme.apply(fontFamily: fontFamily);
}
buttonColor = buttonColor ?? (isDark ? primarySwatch[600] : Colors.grey[300]);
buttonTheme = buttonTheme ?? new ButtonThemeData(
colorScheme: colorScheme,

splashColor: splashColor,
materialTapTargetSize: materialTapTargetSize);
disabledColor = disabledColor ?? (isDark ? Colors.white30 : Colors.black38);
toggleableActiveColor = toggleableActiveColor ??
(isDark ? Colors.tealAccent[200] : (accentColor ?? primarySwatch[600]));
highlightColor = highlightColor ??
(isDark
? ThemeDataUtils._kDarkThemeHighlightColor
: ThemeDataUtils._kLightThemeHighlightColor);
splashColor = splashColor ??
(isDark
? ThemeDataUtils._kDarkThemeSplashColor
: ThemeDataUtils._kLightThemeSplashColor);
D.assert(brightness != null);
D.assert(primaryColor != null);

D.assert(selectedRowColor != null);
D.assert(unselectedWidgetColor != null);
D.assert(disabledColor != null);
D.assert(buttonColor != null);
D.assert(toggleableActiveColor != null);
D.assert(buttonTheme != null);
D.assert(secondaryHeaderColor != null);
D.assert(textSelectionColor != null);
D.assert(cursorColor != null);

D.assert(indicatorColor != null);
D.assert(hintColor != null);
D.assert(errorColor != null);
D.assert(toggleableActiveColor != null);
D.assert(buttonTheme != null);
D.assert(textTheme != null);
D.assert(primaryTextTheme != null);
D.assert(accentTextTheme != null);
D.assert(textTheme != null);
D.assert(primaryTextTheme != null);
D.assert(accentTextTheme != null);
D.assert(materialTapTargetSize != null);
D.assert(materialTapTargetSize != null);
D.assert(buttonColor != null);
this.canvasColor = canvasColor;
this.canvasColor = canvasColor;
this.scaffoldBackgroundColor = scaffoldBackgroundColor;
this.bottomAppBarColor = bottomAppBarColor;
this.cardColor = cardColor;

this.hintColor = hintColor;
this.errorColor = errorColor;
this.toggleableActiveColor = toggleableActiveColor;
this.iconTheme = iconTheme;
this.primaryIconTheme = primaryIconTheme;
this.accentIconTheme = accentIconTheme;
this.iconTheme = iconTheme;
this.primaryIconTheme = primaryIconTheme;
this.accentIconTheme = accentIconTheme;
public static ThemeData raw(
Brightness? brightness,
Color primaryColor,

Color canvasColor,
Color canvasColor,
Color scaffoldBackgroundColor,
Color bottomAppBarColor,
Color cardColor,

Color indicatorColor,
Color hintColor,
Color errorColor,
Color toggleableActiveColor,
Color toggleableActiveColor,
IconThemeData iconTheme,
IconThemeData primaryIconTheme,
IconThemeData accentIconTheme,

) {
D.assert(brightness != null);
D.assert(primaryColor != null);
D.assert(primaryColorBrightness != null);
D.assert(primaryColorLight != null);
D.assert(primaryColorDark != null);
D.assert(accentColor != null);
D.assert(accentColorBrightness != null);
D.assert(canvasColor != null);
D.assert(scaffoldBackgroundColor != null);
D.assert(bottomAppBarColor != null);
D.assert(cardColor != null);
D.assert(dividerColor != null);
D.assert(highlightColor != null);
D.assert(splashColor != null);
D.assert(splashFactory != null);
D.assert(selectedRowColor != null);
D.assert(unselectedWidgetColor != null);
D.assert(disabledColor != null);
D.assert(toggleableActiveColor != null);
D.assert(buttonTheme != null);
D.assert(secondaryHeaderColor != null);
D.assert(textSelectionColor != null);
D.assert(cursorColor != null);
D.assert(textSelectionHandleColor != null);
D.assert(backgroundColor != null);
D.assert(dialogBackgroundColor != null);
D.assert(indicatorColor != null);
D.assert(hintColor != null);
D.assert(errorColor != null);
D.assert(textTheme != null);
D.assert(primaryTextTheme != null);
D.assert(accentTextTheme != null);
D.assert(iconTheme != null);
D.assert(primaryIconTheme != null);
D.assert(accentIconTheme != null);
D.assert(materialTapTargetSize != null);
D.assert(colorScheme != null);
D.assert(typography != null);
D.assert(buttonColor != null);
return new ThemeData(
brightness: brightness,
primaryColor: primaryColor,

public static ThemeData dark() => new ThemeData(brightness: Brightness.dark);
public static ThemeData fallback() => ThemeData.light();
public static ThemeData fallback() => light();
public readonly Brightness brightness;

public readonly Color primaryColorDark;
public readonly Color canvasColor;
public readonly Color canvasColor;
public readonly Color scaffoldBackgroundColor;

Color indicatorColor,
Color hintColor,
Color errorColor,
Color toggleableActiveColor,
Color toggleableActiveColor,
IconThemeData iconTheme,
IconThemeData primaryIconTheme,
IconThemeData accentIconTheme,

) {
return ThemeData.raw(
return raw(
brightness: brightness ?? this.brightness,
primaryColor: primaryColor ?? this.primaryColor,
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,

selectedRowColor: selectedRowColor ?? this.selectedRowColor,
unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
disabledColor: disabledColor ?? this.disabledColor,
buttonTheme : buttonTheme ?? this.buttonTheme,
buttonTheme: buttonTheme ?? this.buttonTheme,
buttonColor: buttonColor ?? this.buttonColor,
secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
textSelectionColor: textSelectionColor ?? this.textSelectionColor,

indicatorColor: indicatorColor ?? this.indicatorColor,
hintColor: hintColor ?? this.hintColor,
errorColor: errorColor ?? this.errorColor,
toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
colorScheme : colorScheme ?? this.colorScheme,
colorScheme: colorScheme ?? this.colorScheme,
typography: typography ?? this.typography
);
}

}
public static ThemeData lerp(ThemeData a, ThemeData b, double t) {
return ThemeData.raw(
D.assert(a != null);
D.assert(b != null);
return raw(
canvasColor: Color.lerp(a.canvasColor, b.canvasColor, t),
canvasColor: Color.lerp(a.canvasColor, b.canvasColor, t),
scaffoldBackgroundColor: Color.lerp(a.scaffoldBackgroundColor, b.scaffoldBackgroundColor, t),
bottomAppBarColor: Color.lerp(a.bottomAppBarColor, b.bottomAppBarColor, t),
cardColor: Color.lerp(a.cardColor, b.cardColor, t),

indicatorColor: Color.lerp(a.indicatorColor, b.indicatorColor, t),
hintColor: Color.lerp(a.hintColor, b.hintColor, t),
errorColor: Color.lerp(a.errorColor, b.errorColor, t),
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
materialTapTargetSize: t < 0.5? a.materialTapTargetSize : b.materialTapTargetSize,
materialTapTargetSize: t < 0.5 ? a.materialTapTargetSize : b.materialTapTargetSize,
colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t),
typography: Typography.lerp(a.typography, b.typography, t)
);

other.dividerColor == this.dividerColor &&
other.highlightColor == this.highlightColor &&
other.splashColor == this.splashColor &&
other.splashFactory == this.splashFactory &&
other.splashFactory == this.splashFactory &&
other.selectedRowColor == this.selectedRowColor &&
other.unselectedWidgetColor == this.unselectedWidgetColor &&
other.disabledColor == this.disabledColor &&

hashCode = (hashCode * 397) ^ this.primaryColorBrightness.GetHashCode();
hashCode = (hashCode * 397) ^ this.primaryColorLight.GetHashCode();
hashCode = (hashCode * 397) ^ this.primaryColorDark.GetHashCode();
hashCode = (hashCode * 397) ^ this.canvasColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.canvasColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.scaffoldBackgroundColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.bottomAppBarColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.cardColor.GetHashCode();

hashCode = (hashCode * 397) ^ this.indicatorColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.hintColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.errorColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.toggleableActiveColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.toggleableActiveColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.iconTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.primaryIconTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.accentIconTheme.GetHashCode();

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
ThemeData defaultData = ThemeData.fallback();
ThemeData defaultData = fallback();
properties.add(new EnumProperty<Brightness>("brightness", this.brightness,
defaultValue: defaultData.brightness));
properties.add(new DiagnosticsProperty<Color>("primaryColor", this.primaryColor,

properties.add(new DiagnosticsProperty<IconThemeData>("iconTheme", this.iconTheme));
properties.add(new DiagnosticsProperty<IconThemeData>("primaryIconTheme", this.primaryIconTheme));
properties.add(new DiagnosticsProperty<IconThemeData>("accentIconTheme", this.accentIconTheme));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize>("materialTapTargetSize", this.materialTapTargetSize));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme, defaultValue: defaultData.colorScheme));
properties.add(new DiagnosticsProperty<Typography>("typography", this.typography, defaultValue: defaultData.typography));
properties.add(
new DiagnosticsProperty<MaterialTapTargetSize>("materialTapTargetSize", this.materialTapTargetSize));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme,
defaultValue: defaultData.colorScheme));
properties.add(new DiagnosticsProperty<Typography>("typography", this.typography,
defaultValue: defaultData.typography));
}
}
}

36
Runtime/material/typography.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using UnityEngine;
namespace Unity.UIWidgets.material {
public enum ScriptCategory {

public readonly TextTheme tall;
public TextTheme geometryThemeFor(ScriptCategory? category) {
D.assert(category != null);
public TextTheme geometryThemeFor(ScriptCategory category) {
switch (category) {
case ScriptCategory.englishLike:
return this.englishLike;

return this.Equals((Typography) obj);
}
public static bool operator ==(Typography a, Typography b) {
return ReferenceEquals(a, null) ? ReferenceEquals(b, null) : a.Equals(b);
public static bool operator ==(Typography left, Typography right) {
return Equals(left, right);
public static bool operator !=(Typography a, Typography b) {
return !(a == b);
public static bool operator !=(Typography left, Typography right) {
return !Equals(left, right);
}
public override int GetHashCode() {

properties.add(new DiagnosticsProperty<TextTheme>("tall", this.tall, defaultValue: defaultTypography.tall));
}
public static TextTheme blackMountainView = new TextTheme(
public static readonly TextTheme blackMountainView = new TextTheme(
display4: new TextStyle(debugLabel: "blackMountainView display4", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "blackMountainView display3", fontFamily: "Roboto", inherit: true,

color: Colors.black, decoration: TextDecoration.none)
);
public static TextTheme whiteMountainView = new TextTheme(
public static readonly TextTheme whiteMountainView = new TextTheme(
display4: new TextStyle(debugLabel: "whiteMountainView display4", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "whiteMountainView display3", fontFamily: "Roboto", inherit: true,

color: Colors.white, decoration: TextDecoration.none)
);
public static TextTheme blackCupertino = new TextTheme(
public static readonly TextTheme blackCupertino = new TextTheme(
display4: new TextStyle(debugLabel: "blackCupertino display4", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "blackCupertino display3", fontFamily: ".SF UI Display", inherit: true,

color: Colors.black, decoration: TextDecoration.none)
);
public static TextTheme whiteCupertino = new TextTheme(
public static readonly TextTheme whiteCupertino = new TextTheme(
display4: new TextStyle(debugLabel: "whiteCupertino display4", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "whiteCupertino display3", fontFamily: ".SF UI Display", inherit: true,

);
public static TextTheme englishLike2014 = new TextTheme(
public static readonly TextTheme englishLike2014 = new TextTheme(
display4: new TextStyle(debugLabel: "englishLike display4 2014", inherit: false, fontSize: 112.0,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "englishLike display3 2014", inherit: false, fontSize: 56.0,

fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 1.5)
);
public static TextTheme englishLike2018 = new TextTheme(
public static readonly TextTheme englishLike2018 = new TextTheme(
display4: new TextStyle(debugLabel: "englishLike display4 2018", fontSize: 96.0,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: -1.5),
display3: new TextStyle(debugLabel: "englishLike display3 2018", fontSize: 60.0,

fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 1.5)
);
public static TextTheme dense2014 = new TextTheme(
public static readonly TextTheme dense2014 = new TextTheme(
display4: new TextStyle(debugLabel: "dense display4 2014", inherit: false, fontSize: 112.0,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
display3: new TextStyle(debugLabel: "dense display3 2014", inherit: false, fontSize: 56.0,

fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic)
);
public static TextTheme dense2018 = new TextTheme(
public static readonly TextTheme dense2018 = new TextTheme(
display4: new TextStyle(debugLabel: "dense display4 2018", fontSize: 96.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
display3: new TextStyle(debugLabel: "dense display3 2018", fontSize: 60.0, fontWeight: FontWeight.w400,

);
public static TextTheme tall2014 = new TextTheme(
public static readonly TextTheme tall2014 = new TextTheme(
display4: new TextStyle(debugLabel: "tall display4 2014", inherit: false, fontSize: 112.0,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "tall display3 2014", inherit: false, fontSize: 56.0,

fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic)
);
public static TextTheme tall2018 = new TextTheme(
public static readonly TextTheme tall2018 = new TextTheme(
display4: new TextStyle(debugLabel: "tall display4 2018", fontSize: 96.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "tall display3 2018", fontSize: 60.0, fontWeight: FontWeight.w400,

textBaseline: TextBaseline.alphabetic),
body1: new TextStyle(debugLabel: "tall body1 2018", fontSize: 15.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
caption: new TextStyle(debugLabel: "tall caption 2018", fontSize: 13.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
textBaseline: TextBaseline.alphabetic),
caption: new TextStyle(debugLabel: "tall caption 2018", fontSize: 13.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
subtitle: new TextStyle(debugLabel: "tall subtitle 2018", fontSize: 15.0, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),

40
Runtime/material/utils.cs


using System;
using Unity.UIWidgets.ui;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.ui;
public class ThemeDataUtils {
public static class ThemeDataUtils {
public class ThemeUtils {
public static class ThemeUtils {
public class MaterialUtils {
public static Dictionary<MaterialType, BorderRadius> kMaterialEdges =
new Dictionary<MaterialType, BorderRadius>() {
public static class MaterialUtils {
public static readonly Dictionary<MaterialType, BorderRadius> kMaterialEdges =
new Dictionary<MaterialType, BorderRadius> {
{MaterialType.card, BorderRadius.all(2.0)},
{MaterialType.card, BorderRadius.circular(2.0)},
{MaterialType.button, BorderRadius.all(2.0)},
{MaterialType.button, BorderRadius.circular(2.0)},
public class InkHighlightUtils {
public static class InkHighlightUtils {
public class InkSplashUtils {
public static class InkSplashUtils {
public static double _kSplashInitialSize = 0.0;
public const double _kSplashInitialSize = 0.0;
public static double _kSplashConfirmedVelocity = 1.0;
public const double _kSplashConfirmedVelocity = 1.0;
public static RectCallback _getClipCallback(RenderBox referenceBox, bool containedInkWell,
RectCallback rectCallback) {

return Material.defaultSplashRadius;
}
public static double _getSplashRadiusForPositionInSize(Size bounds, Offset position) {
static double _getSplashRadiusForPositionInSize(Size bounds, Offset position) {
double d1 = (position - bounds.topLeft(Offset.zero)).distance;
double d2 = (position - bounds.topRight(Offset.zero)).distance;
double d3 = (position - bounds.bottomLeft(Offset.zero)).distance;

23
Runtime/painting/colors.cs


using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine.WSA;
Dictionary<T, Color> swatch = null) : base(value: primary) {
Dictionary<T, Color> swatch) : base(primary) {
public Color this[T index] {
get { return this._swatch[index]; }
set { this._swatch[index] = value; }
}
public Color this[T index] => this._swatch[index];
if (ReferenceEquals(this, other)) {
return true;
}

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((ColorSwatch<T>) obj);
}

public static bool operator !=(ColorSwatch<T> left, ColorSwatch<T> right) {
return !Equals(left, right);
}
var hashCode = (int)this.value;
var hashCode = (int) this.value;
hashCode = (hashCode * 397) ^ this._swatch.GetHashCode();
return hashCode;
}

}
}

20
Runtime/painting/text_style.cs


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

TextDecoration decoration = null,
Color decorationColor = null,
TextDecorationStyle? decorationStyle = null,
String fontFamily = null,
string fontFamily = null,
double fontSizeFactor = 1.0,
double fontSizeDelta = 0.0,
int fontWeightDelta = 0,

double heightFactor = 1.0,
double heightDelta = 0.0
) {
D.assert(fontSizeFactor != null);
D.assert(fontSizeDelta != null);
D.assert(fontWeightDelta != null);
D.assert(letterSpacingFactor != null);
D.assert(letterSpacingDelta != null);
D.assert(wordSpacingFactor != null);
D.assert(wordSpacingDelta != null);
D.assert(heightFactor != null);
D.assert(heightDelta != null);
String modifiedDebugLabel = "";
string modifiedDebugLabel = "";
D.assert(() => {
if (this.debugLabel != null)
modifiedDebugLabel = this.debugLabel + ".apply";

wordSpacing: t < 0.5 ? null : b.wordSpacing,
textBaseline: t < 0.5 ? null : b.textBaseline,
height: t < 0.5 ? null : b.height,
background: t < 0.5 ? null : b.background,
background: t < 0.5 ? null : b.background,
debugLabel: lerpDebugLabel
);
}

wordSpacing: t < 0.5 ? a.wordSpacing : null,
textBaseline: t < 0.5 ? a.textBaseline : null,
height: t < 0.5 ? a.height : null,
background: t < 0.5 ? a.background : null,
background: t < 0.5 ? a.background : null,
debugLabel: lerpDebugLabel
);
}

b.wordSpacing ?? a.wordSpacing, t),
textBaseline: t < 0.5 ? a.textBaseline : b.textBaseline,
height: MathUtils.lerpNullableDouble(a.height ?? b.height, b.height ?? a.height, t),
background: t < 0.5 ? a.background : b.background,
background: t < 0.5 ? a.background : b.background,
debugLabel: lerpDebugLabel
);
}

72
Runtime/rendering/box.cs


maxHeight: it.maxHeight % value
);
}
D.assert(t != null);
if (a == null && b == null)
return null;
if (a == null)

D.assert(a.debugAssertIsValid());
D.assert(b.debugAssertIsValid());
D.assert((a.minWidth == double.PositiveInfinity && b.minWidth == double.PositiveInfinity), "Cannot interpolate between finite constraints and unbounded constraints.");
D.assert((a.maxWidth == double.PositiveInfinity && b.maxWidth == double.PositiveInfinity), "Cannot interpolate between finite constraints and unbounded constraints.");
D.assert((a.minHeight == double.PositiveInfinity && b.minHeight == double.PositiveInfinity), "Cannot interpolate between finite constraints and unbounded constraints.");
D.assert((a.maxHeight == double.PositiveInfinity && b.maxHeight == double.PositiveInfinity), "Cannot interpolate between finite constraints and unbounded constraints.");
D.assert(
(a.minWidth.isFinite() && b.minWidth.isFinite()) ||
(a.minWidth == double.PositiveInfinity && b.minWidth == double.PositiveInfinity),
"Cannot interpolate between finite constraints and unbounded constraints.");
D.assert(
(a.maxWidth.isFinite() && b.maxWidth.isFinite()) ||
(a.maxWidth == double.PositiveInfinity && b.maxWidth == double.PositiveInfinity),
"Cannot interpolate between finite constraints and unbounded constraints.");
D.assert(
(a.minHeight.isFinite() && b.minHeight.isFinite()) ||
(a.minHeight == double.PositiveInfinity && b.minHeight == double.PositiveInfinity),
"Cannot interpolate between finite constraints and unbounded constraints.");
D.assert(
(a.maxHeight.isFinite() && b.maxHeight.isFinite()) ||
(a.maxHeight == double.PositiveInfinity && b.maxHeight == double.PositiveInfinity),
"Cannot interpolate between finite constraints and unbounded constraints.");
minWidth: a.minWidth == double.PositiveInfinity ? MathUtils.lerpDouble(a.minWidth, b.minWidth, t) : double.PositiveInfinity,
maxWidth: a.maxWidth == double.PositiveInfinity ? MathUtils.lerpDouble(a.maxWidth, b.maxWidth, t) : double.PositiveInfinity,
minHeight: a.minHeight == double.PositiveInfinity ? MathUtils.lerpDouble(a.minHeight, b.minHeight, t) : double.PositiveInfinity,
maxHeight: a.maxHeight == double.PositiveInfinity ? MathUtils.lerpDouble(a.maxHeight, b.maxHeight, t) : double.PositiveInfinity
minWidth: a.minWidth.isFinite()
? MathUtils.lerpDouble(a.minWidth, b.minWidth, t)
: double.PositiveInfinity,
maxWidth: a.maxWidth.isFinite()
? MathUtils.lerpDouble(a.maxWidth, b.maxWidth, t)
: double.PositiveInfinity,
minHeight: a.minHeight.isFinite()
? MathUtils.lerpDouble(a.minHeight, b.minHeight, t)
: double.PositiveInfinity,
maxHeight: a.maxHeight.isFinite()
? MathUtils.lerpDouble(a.maxHeight, b.maxHeight, t)
: double.PositiveInfinity
);
}

string whichFields;
if (affectedFieldsList.Count > 2) {
whichFields = string.Join(", ", affectedFieldsList.ToArray());
} else if (affectedFieldsList.Count == 2) {
}
else if (affectedFieldsList.Count == 2) {
} else {
}
else {
whichFields = affectedFieldsList.Single();
}

if (ReferenceEquals(null, other)) {
return false;
}
return this.minWidth.Equals(other.minWidth)
&& this.maxWidth.Equals(other.maxWidth)
&& this.minHeight.Equals(other.minHeight)

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((BoxConstraints) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return this.dimension == other.dimension && this.argument.Equals(other.argument);
}

}
return this.Equals((_IntrinsicDimensionsCacheEntry) obj);
}

D.assert(this.sizedByParent);
violation = "It appears that the size setter was called from performLayout().";
hint = "";
} else {
}
else {
violation =
"The size setter was called from outside layout (neither performResize() nor performLayout() were being run for this object).";
if (this.owner != null && this.owner.debugDoingLayout) {

if (this.sizedByParent) {
contract =
"Because this RenderBox has sizedByParent set to true, it must set its size in performResize().";
} else {
}
else {
contract =
"Because this RenderBox has sizedByParent set to false, it must set its size in performLayout().";
}

if (this.sizedByParent) {
contract =
"Because this RenderBox has sizedByParent set to true, it must set its size in performResize().\n";
} else {
}
else {
contract =
"Because this RenderBox has sizedByParent set to false, it must set its size in performLayout().\n";
}

if (D.debugPaintPointersEnabled) {
if (evt is PointerDownEvent) {
this._debugActivePointers += 1;
} else if (evt is PointerUpEvent || evt is PointerCancelEvent) {
}
else if (evt is PointerUpEvent || evt is PointerCancelEvent) {
this._debugActivePointers -= 1;
}

candidate += childParentData.offset.dy;
if (result != null) {
result = Math.Min(result.Value, candidate.Value);
} else {
}
else {
result = candidate;
}
}

return result;
}
}
}
}

246
Runtime/rendering/proxy_box.cs


using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEditor.Rendering;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Gradient = Unity.UIWidgets.ui.Gradient;
using Rect = Unity.UIWidgets.ui.Rect;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.rendering {
public class RenderProxyBox : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBox<RenderBox> {

if (this.child != null) {
this.child.layout(this._additionalConstraints.enforce(this.constraints), parentUsesSize: true);
this.size = this.child.size;
} else {
}
else {
this.size = this._additionalConstraints.enforce(this.constraints).constrain(Size.zero);
}
}

if (this.child != null) {
this.child.layout(this._limitConstraints(this.constraints), parentUsesSize: true);
this.size = this.constraints.constrain(this.child.size);
} else {
}
else {
this.size = this._limitConstraints(this.constraints).constrain(Size.zero);
}
}

if (!double.IsInfinity(height)) {
return height * this._aspectRatio;
}
return 0.0;
}

}
if (this.child != null) {
return this.child.getMaxIntrinsicWidth(height);
}

if (!double.IsInfinity(width)) {
return width / this._aspectRatio;
}
if (this.child != null) {
return this.child.getMinIntrinsicHeight(width);
}

if (!double.IsInfinity(width)) {
return width / this._aspectRatio;
}
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}

}
double _opacity;
public double opacity {
get { return this._opacity; }
set {

}
public class RenderAnimatedOpacity : RenderProxyBox {
RenderBox child = null
RenderBox child = null
) : base(child) {
D.assert(opacity != null);
this.opacity = opacity;

int _alpha;
public Animation<double> opacity {
public Animation<double> opacity {
get => this._opacity;
set {
D.assert(value != null);

this._updateOpacity();
}
}
public override void attach(object owner) {
base.attach(owner);
this._opacity.addListener(this._updateOpacity);

this._alpha = RenderOpacity._getAlphaFromOpacity(this._opacity.value.clamp(0.0, 1.0));
if (oldAlpha != this._alpha) {
bool didNeedCompositing = this._currentlyNeedsCompositing;
this._currentlyNeedsCompositing = this._alpha > 0 &&this. _alpha < 255;
this._currentlyNeedsCompositing = this._alpha > 0 && this._alpha < 255;
public override void paint(PaintingContext context, Offset offset) {
if (this.child != null) {
if (this._alpha == 0)

return;
}
}
}
}

public override bool shouldReclip(CustomClipper<Path> oldClipper) {
if (oldClipper.GetType() != this.GetType())
return true;
ShapeBorderClipper typedOldClipper = (ShapeBorderClipper)oldClipper;
ShapeBorderClipper typedOldClipper = (ShapeBorderClipper) oldClipper;
public abstract class _RenderCustomClip<T> : RenderProxyBox where T : class{
public abstract class _RenderCustomClip<T> : RenderProxyBox where T : class {
D.assert(clipBehavior != null);
this.clipBehavior = clipBehavior;
this._clipper = clipper;
}

protected abstract T _defaultClip { get; }
protected T _clip;
protected Clip clipBehavior;
public readonly Clip clipBehavior;
protected override void performLayout() {
Size oldSize = this.hasSize ? this.size : null;

TextPainter _debugText;
protected override void debugPaintSize(PaintingContext context, Offset offset) {
base.debugPaintSize(context, offset);
// this._debugPaint = this._debugPaint ?? new Paint();
// if (this._debugPaint == null) {
// this._debugPaint = new Paint();
// this._debugPaint.shader = Gradient.linear(
// new Offset(0.0, 0.0),
// new Offset(10.0, 10.0),

// this._debugPaint.strokeWidth = 2.0;
// this._debugPaint.style = PaintingStyle.stroke;
// this._debugText = this._debugText ?? new TextPainter(
// }
// if (this._debugText == null) {
// this._debugText = new TextPainter(
// ),
// textDirection: TextDirection.ltr);
// ));
// }
public abstract class _RenderPhysicalModelBase<T> : _RenderCustomClip<T> where T : class{
public abstract class _RenderPhysicalModelBase<T> : _RenderCustomClip<T> where T : class {
public _RenderPhysicalModelBase(
RenderBox child = null,
double? elevation = null,

D.assert(elevation != null);
D.assert(color != null);
D.assert(shadowColor != null);
D.assert(clipBehavior != null);
this._elevation = elevation ?? 0.0;
this._color = color;
this._shadowColor = shadowColor;

get { return this._elevation; }
get { return this._elevation; }
D.assert(value != null);
if (this.elevation == value)
return;
bool didNeedCompositing = this.alwaysNeedsCompositing;

double _elevation;
public Color shadowColor {
get { return this._shadowColor; }
get { return this._shadowColor; }
set {
D.assert(value != null);
if (this.shadowColor == value)

Color _color;
public static Paint _transparentPaint {
get {
Paint paint = new Paint();
paint.color = new Color(0x00000000);
return paint;
}
}
static Paint _transparentPaint => new Paint {color = new Color(0x00000000)};
protected override bool alwaysNeedsCompositing => this._elevation != 0.0;
protected override bool alwaysNeedsCompositing {
get { return this._elevation != 0.0; }
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DoubleProperty("elevation", this.elevation));
description.add(new DiagnosticsProperty<Color>("color", this.color));

Color shadowColor = null
) : base(clipBehavior: clipBehavior, child: child, elevation: elevation, color: color,
shadowColor: shadowColor ?? new Color(0xFF000000)) {
D.assert(shape != null);
D.assert(clipBehavior != null);
D.assert(color != null);
this._shape = shape;
this._borderRadius = borderRadius;

get { return this._shape; }
set {
D.assert(value != null);
if (this.shape == value)
return;
this._shape = value;

this._markNeedsClip();
}
}
D.assert(this._shape != null);
switch (this._shape) {
case BoxShape.rectangle:
return (this.borderRadius ?? BorderRadius.zero).toRRect(Offset.zero & this.size);

if (!this._clip.contains(position))
return false;
}
return base.hitTest(result, position: position);
}

);*/
}
Paint paint = new Paint();
paint.color = this.color;
Paint paint = new Paint {color = this.color};
context.clipRRectAndPaint(offsetRRect, this.clipBehavior, offsetBounds, () => base.paint(context, offset));
context.clipRRectAndPaint(offsetRRect, this.clipBehavior, offsetBounds,
() => base.paint(context, offset));
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<BoxShape>("shape", this.shape));

double elevation = 0.0,
Color color = null,
Color shadowColor = null
): base(child: child,
) : base(child: child,
elevation = elevation,
color: color,
shadowColor: shadowColor ?? new Color(0xFF000000),

D.assert(color != null);
}
protected override Path _defaultClip {
get {
Path path = new Path();

}
public override bool hitTest(HitTestResult result, Offset position = null) {
if (this._clipper != null) {
this._updateClip();

Rect offsetBounds = offset & this.size;
//Path offsetPath = this._clip.shift(offset);
Path offsetPath = this._clip;
bool paintShadows = true;
Canvas canvas = context.canvas;
// if (this.elevation != 0.0 && paintShadows) {
// canvas.drawRect(

// this.color.alpha != 0xFF,
// );
// }
Paint paint = new Paint();
paint.color = this.color;
paint.style = PaintingStyle.fill;
Paint paint = new Paint {color = this.color, style = PaintingStyle.fill};
canvas.drawPath(offsetPath, paint);
context.clipPathAndPaint(offsetPath, this.clipBehavior,
offsetBounds, () => base.paint(context, offset));

public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", this.clipper));

}
public void rotateZ(double degrees) {
this._transform.preRotate((float)degrees);
this._transform.preRotate((float) degrees);
this.markNeedsPaint();
}

Offset translation = null;
if (resolvedAlignment != null) {
translation = resolvedAlignment.alongSize(this.size);
translation = resolvedAlignment.alongSize(this.size);
result.preTranslate((float) translation.dx, (float) translation.dy);
}

if (childOffset == null) {
context.pushTransform(this.needsCompositing, offset, transform, base.paint);
} else {
}
else {
base.paint(context, offset + childOffset);
}
}

}
public class RenderFractionalTranslation : RenderProxyBox {
public RenderFractionalTranslation(
Offset translation = null,
bool transformHitTests = true,

this.markNeedsPaint();
}
}
protected override bool hitTestChildren(HitTestResult result, Offset position) {
D.assert(!this.debugNeedsLayout);
if (this.transformHitTests) {

);
}
public override void paint(PaintingContext context, Offset offset) {
D.assert(!this.debugNeedsLayout);
if (this.child != null) {

));
}
}
public override void applyPaintTransform(RenderObject child, Matrix3 transform) {
transform.preTranslate((float)(this.translation.dx * this.size.width),
(float)(this.translation.dy * this.size.height));
public override void applyPaintTransform(RenderObject child, Matrix3 transform) {
transform.preTranslate((float) (this.translation.dx * this.size.width),
(float) (this.translation.dy * this.size.height));
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Offset>("translation", this.translation));
properties.add(new DiagnosticsProperty<bool>("transformHitTests", this.transformHitTests));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Offset>("translation", this.translation));
properties.add(new DiagnosticsProperty<bool>("transformHitTests", this.transformHitTests));
}
}
public delegate void PointerDownEventListener(PointerDownEvent evt);

if (this.onPointerDown != null) {
listeners.Add("down");
}
if (listeners.isEmpty()) {
listeners.Add("<none>");
}

D.assert(() => {
if (includedParent && includedChild) {
this._debugSymmetricPaintCount += 1;
} else {
}
else {
this._debugAsymmetricPaintCount += 1;
}

inReleaseMode = false;
if (this.debugSymmetricPaintCount + this.debugAsymmetricPaintCount == 0) {
properties.add(new MessageProperty("usefulness ratio", "no metrics collected yet (never painted)"));
} else {
}
else {
double fraction = (double) this.debugAsymmetricPaintCount /
(this.debugSymmetricPaintCount + this.debugAsymmetricPaintCount);

} else if (fraction > 0.9) {
}
else if (fraction > 0.9) {
} else if (fraction > 0.5) {
}
else if (fraction > 0.5) {
} else if (fraction > 0.30) {
}
else if (fraction > 0.30) {
} else if (fraction > 0.1) {
}
else if (fraction > 0.1) {
} else if (this.debugAsymmetricPaintCount == 0) {
}
else if (this.debugAsymmetricPaintCount == 0) {
} else {
}
else {
diagnosis = "this repaint boundary is not very effective and should probably be removed";
}

public class RenderOffstage : RenderProxyBox {
public RenderOffstage(bool offstage = true,
RenderBox child = null): base(child) {
RenderBox child = null) : base(child) {
this._offstage = offstage;
}

this.markNeedsLayoutForSizedByParentChange();
}
}
protected override double computeMaxIntrinsicWidth(double height) {
if (this.offstage)
return 0.0;

protected override void performLayout() {
if (this.offstage) {
this.child?.layout(this.constraints);
} else {
}
else {
base.performLayout();
}
}

}
public override List<DiagnosticsNode> debugDescribeChildren() {
if (this.child == null)
return new List<DiagnosticsNode>();

};
}
}
) : base(child)
{
this._absorbing = absorbing;
}
) : base(child) {
this._absorbing = absorbing;
}
public bool absorbing
{
public bool absorbing {
set
{
this._absorbing = value;
}
set { this._absorbing = value; }
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("absorbing", this.absorbing));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("absorbing", this.absorbing));
}
public class RenderMetaData : RenderProxyBoxWithHitTestBehavior {
public RenderMetaData(
object metaData,

this.metaData = metaData;
}
public object metaData;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

}
}
}

105
Runtime/service/system_chrome.cs


using System.Collections.Generic;
using JetBrains.Annotations;
public enum DeviceOrientation {
public enum DeviceOrientation {
landscapeLeft,
portraitDown,
landscapeLeft,
portraitDown,
landscapeRight
}

public enum SystemUiOverlay {
top,
bottom,
bottom
light,
light
}
public class SystemUiOverlayStyle {

public readonly Brightness? statusBarBrightness;
public readonly Brightness? statusBarIconBrightness;
public static SystemUiOverlayStyle light = new SystemUiOverlayStyle(
public static readonly SystemUiOverlayStyle light = new SystemUiOverlayStyle(
systemNavigationBarColor: new Color(0xFF000000),
systemNavigationBarDividerColor: null,
statusBarColor: null,

);
public static SystemUiOverlayStyle dark = new SystemUiOverlayStyle(
);
public static readonly SystemUiOverlayStyle dark = new SystemUiOverlayStyle(
systemNavigationBarColor: new Color(0xFF000000),
systemNavigationBarDividerColor: null,
statusBarColor: null,

);
);
return new Dictionary<string, object>() {
return new Dictionary<string, object> {
{"systemNavigationBarColor", this.systemNavigationBarColor?.value},
{"systemNavigationBarDividerColor", this.systemNavigationBarDividerColor?.value},
{"statusBarColor", this.statusBarColor?.value},

public string toString() => this._toMap().ToString();
public SystemUiOverlayStyle copyWith(
[CanBeNull] Color systemNavigationBarColor,
[CanBeNull] Color systemNavigationBarDividerColor,
[CanBeNull] Color statusBarColor,
Brightness? statusBarBrightness,
Brightness? statusBarIconBrightness,
Brightness? systemNavigationBarIconBrightness
Color systemNavigationBarColor = null,
Color systemNavigationBarDividerColor = null,
Color statusBarColor = null,
Brightness? statusBarBrightness = null,
Brightness? statusBarIconBrightness = null,
Brightness? systemNavigationBarIconBrightness = null
systemNavigationBarDividerColor: systemNavigationBarDividerColor ?? this.systemNavigationBarDividerColor,
systemNavigationBarDividerColor:
systemNavigationBarDividerColor ?? this.systemNavigationBarDividerColor,
systemNavigationBarIconBrightness: systemNavigationBarIconBrightness ?? this.systemNavigationBarIconBrightness
);
systemNavigationBarIconBrightness: systemNavigationBarIconBrightness ??
this.systemNavigationBarIconBrightness
);
var hashCode = this.systemNavigationBarColor == null ? 0 : this.systemNavigationBarColor.GetHashCode();
hashCode = (hashCode * 397) ^ (this.systemNavigationBarDividerColor == null ? 0 : this.systemNavigationBarDividerColor.GetHashCode());
hashCode = (hashCode * 397) ^ (this.statusBarColor == null ? 0 : this.statusBarColor.GetHashCode());
hashCode = (hashCode * 397) ^ (this.statusBarBrightness == null ? 0 : this.statusBarBrightness.GetHashCode());
hashCode = (hashCode * 397) ^ (this.statusBarIconBrightness == null ? 0 : this.statusBarIconBrightness.GetHashCode());
hashCode = (hashCode * 397) ^ (this.systemNavigationBarIconBrightness == null ? 0 : this.systemNavigationBarIconBrightness.GetHashCode());
var hashCode = this.systemNavigationBarColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.systemNavigationBarDividerColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.statusBarColor.GetHashCode();
hashCode = (hashCode * 397) ^ this.statusBarBrightness.GetHashCode();
hashCode = (hashCode * 397) ^ this.statusBarIconBrightness.GetHashCode();
hashCode = (hashCode * 397) ^ this.systemNavigationBarIconBrightness.GetHashCode();
public static bool operator ==(SystemUiOverlayStyle a, SystemUiOverlayStyle b) {
return a.systemNavigationBarColor == b.systemNavigationBarColor &&
a.systemNavigationBarDividerColor == b.systemNavigationBarDividerColor &&
a.statusBarColor == b.statusBarColor &&
a.statusBarIconBrightness == b.statusBarIconBrightness &&
a.statusBarBrightness == b.statusBarIconBrightness &&
a.systemNavigationBarIconBrightness == b.systemNavigationBarIconBrightness;
public bool Equals(SystemUiOverlayStyle other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return other.systemNavigationBarColor == this.systemNavigationBarColor &&
other.systemNavigationBarDividerColor == this.systemNavigationBarDividerColor &&
other.statusBarColor == this.statusBarColor &&
other.statusBarIconBrightness == this.statusBarIconBrightness &&
other.statusBarBrightness == this.statusBarIconBrightness &&
other.systemNavigationBarIconBrightness == this.systemNavigationBarIconBrightness;
public static bool operator !=(SystemUiOverlayStyle a, SystemUiOverlayStyle b) {
return !(a == b);
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((SystemUiOverlayStyle) obj);
}
public static bool operator ==(SystemUiOverlayStyle left, SystemUiOverlayStyle right) {
return Equals(left, right);
}
public static bool operator !=(SystemUiOverlayStyle left, SystemUiOverlayStyle right) {
return !Equals(left, right);
}
}
}

14
Runtime/ui/painting/painting.cs


using System;
using Unity.UIWidgets.painting;
using UnityEditor.OSXStandalone;
using UnityEngine;
namespace Unity.UIWidgets.ui {

}
public static readonly Color clear = new Color(0x00000000);
public static readonly Color black = new Color(0xFF000000);

if (ReferenceEquals(null, other)) {
return false;
}
return this.value == other.value;
}

}
return this.Equals((Color) obj);
}

if (d > 0.0001f) {
dx /= d;
dy /= d;
} else {
}
else {
dx = 0;
dy = 1;
}

color,
luminosity,
}
}
}

100
Runtime/widgets/basic.cs


}
public class CustomPaint : SingleChildRenderObjectWidget {
public CustomPaint(
Key key = null,
CustomPainter painter = null,

public readonly Size size;
public readonly bool isComplex;
public readonly bool willChange;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderCustomPaint(
painter: this.painter,

willChange: this.willChange
);
}
((RenderCustomPaint)renderObject).willChange = this.willChange;
((RenderCustomPaint) renderObject).willChange = this.willChange;
((RenderCustomPaint)renderObject).painter = null;
((RenderCustomPaint)renderObject).foregroundPainter = null;
((RenderCustomPaint) renderObject).painter = null;
((RenderCustomPaint) renderObject).foregroundPainter = null;
}
}

string type;
if (this.width == double.PositiveInfinity && this.height == double.PositiveInfinity) {
type = this.GetType() + "expand";
} else if (this.width == 0.0 && this.height == 0.0) {
}
else if (this.width == 0.0 && this.height == 0.0) {
} else {
}
else {
type = this.GetType() + "";
}

if ((this.width == double.PositiveInfinity && this.height == double.PositiveInfinity) ||
(this.width == 0.0 && this.height == 0.0)) {
level = DiagnosticLevel.hidden;
} else {
}
else {
level = DiagnosticLevel.info;
}

}
public class Offstage : SingleChildRenderObjectWidget {
public Offstage(Key key = null, bool offstage = true, Widget child = null):base(key: key, child: child) {
public Offstage(Key key = null, bool offstage = true, Widget child = null) : base(key: key, child: child) {
((RenderOffstage)renderObject).offstage = this.offstage;
((RenderOffstage) renderObject).offstage = this.offstage;
class _OffstageElement: SingleChildRenderObjectElement {
internal _OffstageElement(Offstage widget) : base(widget) {}
class _OffstageElement : SingleChildRenderObjectElement {
internal _OffstageElement(Offstage widget) : base(widget) {
}
new Offstage widget => (Offstage) base.widget;

}
}
public class AspectRatio : SingleChildRenderObjectWidget {
public AspectRatio(
Key key = null,

right = end;
break;
}
return new Positioned(child, key: key, left: left, top: top, right: right, bottom: bottom, width: width,
height: height);
}

Color color = null,
Color shadowColor = null,
Widget child = null) : base(key: key, child: child) {
D.assert(shape != null);
this.shape = shape;
this.clipBehavior = clipBehavior;
this.borderRadius = borderRadius;

_renderObject.color = this.color;
_renderObject.shadowColor = this.shadowColor;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<BoxShape>("shape", this.shape));

public class PhysicalShape : SingleChildRenderObjectWidget {
public PhysicalShape(
Key key = null,
CustomClipper<Path> clipper = null,
Clip clipBehavior = Clip.none,
double elevation = 0.0,
Color color = null,
Color shadowColor = null,
Widget child = null) : base(key : key, child: child){
Key key = null,
CustomClipper<Path> clipper = null,
Clip clipBehavior = Clip.none,
double elevation = 0.0,
Color color = null,
Color shadowColor = null,
Widget child = null) : base(key: key, child: child) {
D.assert(clipper != null);
D.assert(color != null);
this.clipper = clipper;

_renderObject.color = this.color;
_renderObject.shadowColor = this.shadowColor;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", this.clipper));

}
}
public class Padding : SingleChildRenderObjectWidget {
public Padding(

bool transformHitTests = true, Widget child = null) : base(key: key, child: child) {
this.translation = translation;
this.transformHitTests = transformHitTests;
}
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderFractionalTranslation(
translation: this.translation,

((RenderFractionalTranslation)renderObject).translation = this.translation;
((RenderFractionalTranslation)renderObject).transformHitTests = this.transformHitTests;
((RenderFractionalTranslation) renderObject).translation = this.translation;
((RenderFractionalTranslation) renderObject).transformHitTests = this.transformHitTests;
public class Align : SingleChildRenderObjectWidget {
public Align(
Key key = null,

if (this.onPointerLeave != null) {
listeners.Add("leave");
}
properties.add(new EnumerableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
properties.add(new EnumProperty<HitTestBehavior>("behavior", this.behavior));
}

}
public class AbsorbPointer : SingleChildRenderObjectWidget {
public override void updateRenderObject(BuildContext context, RenderObject renderObject)
{
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
public class MetaData : SingleChildRenderObjectWidget {
public MetaData(
object metaData,

return this.builder(context);
}
}
}
}

12
Runtime/widgets/icon_theme_data.cs


public readonly double? size;
public static IconThemeData lerp(IconThemeData a, IconThemeData b, double t) {
D.assert(t != null);
opacity: MathUtils.lerpDouble(a.opacity ?? 1.0, b.opacity ?? 1.0, t),
size: MathUtils.lerpDouble(a.size ?? 24.0, b.size ?? 24.0, t));
opacity: MathUtils.lerpNullableDouble(a.opacity, b.opacity, t),
size: MathUtils.lerpNullableDouble(a.size, b.size, t));
}

}
return Equals(this.color, other.color) &&
this._opacity.Equals(other._opacity) &&
this.size.Equals(other.size);

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((IconThemeData) obj);
}

defaultValue: Diagnostics.kNullDefaultValue));
}
}
}
}

116
Runtime/widgets/implicit_animations.cs


using System;
using System.Linq.Expressions;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.rendering;
using UnityEngine.Experimental.PlayerLoop;
using Random = UnityEngine.Random;
public class BoxConstraintsTween : Tween<BoxConstraints> {
public BoxConstraintsTween(
BoxConstraints begin = null,

public class TextStyleTween : Tween<TextStyle> {
public TextStyleTween(
TextStyle begin = null,
TextStyle end = null) : base(begin: begin, end: end) {}
public override TextStyle lerp(double t) => TextStyle.lerp(this.begin, this.end, t);
}
BorderRadius begin = null,
BorderRadius end = null) : base(begin: begin, end: end) {}
BorderRadius begin = null,
BorderRadius end = null) : base(begin: begin, end: end) {
}
public class TextStyleTween : Tween<TextStyle> {
public TextStyleTween(
TextStyle begin = null,
TextStyle end = null) : base(begin: begin, end: end) {
}
public abstract class ImplicitlyAnimatedWidget : StatefulWidget {
public override TextStyle lerp(double t) => TextStyle.lerp(this.begin, this.end, t);
}
public abstract class ImplicitlyAnimatedWidget : StatefulWidget {
if (curve == null) {
curve = Curves.linear;
}
D.assert(curve != null);
this.curve = curve;
this.curve = curve ?? Curves.linear;
this.duration = duration ?? TimeSpan.Zero;
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new IntProperty("duration", (int)this.duration.TotalMilliseconds, unit: "ms"));
properties.add(new IntProperty("duration", (int) this.duration.TotalMilliseconds, unit: "ms"));
}
}

public interface ITweenVisitor {
Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue,
TweenConstructor<T> constructor) where T2 : ImplicitlyAnimatedWidget;

public Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue, TweenConstructor<T> constructor)
where T2 : ImplicitlyAnimatedWidget{
public Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue,
TweenConstructor<T> constructor)
where T2 : ImplicitlyAnimatedWidget {
state._updateTween(tween, targetValue);
return tween;
}

public TweenVisitorCheckStartAnimation() {
this.shouldStartAnimation = false;
}
public Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue, TweenConstructor<T> constructor)
where T2 : ImplicitlyAnimatedWidget{
public Tween<T> visit<T, T2>(ImplicitlyAnimatedWidgetState<T2> state, Tween<T> tween, T targetValue,
TweenConstructor<T> constructor)
where T2 : ImplicitlyAnimatedWidget {
tween = tween == null ? constructor(targetValue) : tween;
tween = tween ?? constructor(targetValue);
if (state._shouldAnimateTween(tween, targetValue))
this.shouldStartAnimation = true;
}

public abstract class ImplicitlyAnimatedWidgetState<T> : SingleTickerProviderStateMixin<T>
where T : ImplicitlyAnimatedWidget {
protected AnimationController controller => this._controller;
protected AnimationController controller {
get { return this._controller; }
}
public Animation<double> animation {
get { return this._animation; }
}
public Animation<double> animation => this._animation;
Animation<double> _animation;
public override void initState() {

debugLabel: "{" + this.widget.toStringShort() + "}",
vsync: this
);
);
this._updateCurve();
this._constructTweens();
this.didUpdateTweens();

base.didUpdateWidget(oldWidget);
if (this.widget.curve != ((ImplicitlyAnimatedWidget)oldWidget).curve) {
if (this.widget.curve != ((ImplicitlyAnimatedWidget) oldWidget).curve)
}
this._controller.duration = this.widget.duration;
if (this._constructTweens()) {
var visitor = new TweenVisitorUpdateTween();

}
public bool _shouldAnimateTween<T2>(Tween<T2> tween, T2 targetValue) {
return !targetValue.Equals(tween.end); //(tween.end ?? tween.begin);
return !targetValue.Equals(tween.end == null ? tween.begin : tween.end);
}
public void _updateTween<T2>(Tween<T2> tween, T2 targetValue) {

bool _constructTweens() {
var visitor = new TweenVisitorCheckStartAnimation();
this.forEachTween(visitor);
return visitor.shouldStartAnimation;
}

protected virtual void didUpdateTweens() {}
protected virtual void didUpdateTweens() {
}
public override void initState() {
base.initState();
this.controller.addListener(this._handleAnimationChanged);

int? maxLines = null,
Curve curve = null,
TimeSpan? duration = null
) : base(key : key, curve: curve ?? Curves.linear, duration: duration) {
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(duration != null);
D.assert(softWrap != null);
D.assert(maxLines == null || maxLines > 0);
this.child = child;
this.style = style;

public readonly int? maxLines;
public override State createState() => new _AnimatedDefaultTextStyleState();
properties.add(new EnumProperty<TextAlign>("textAlign", this.textAlign ?? TextAlign.center, defaultValue: null));
properties.add(new FlagProperty("softWrap", value: this.softWrap, ifTrue: "wrapping at box width", ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextAlign>("textAlign", this.textAlign ?? TextAlign.center,
defaultValue: null));
properties.add(new FlagProperty("softWrap", value: this.softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", this.overflow, defaultValue: null));
properties.add(new IntProperty("maxLines", this.maxLines, defaultValue: null));
}

public override Widget build(BuildContext context) {
return new DefaultTextStyle(
style: this._style.evaluate(this.animation),
textAlign: this.widget.textAlign,
style: this._style.evaluate(this.animation),
textAlign: this.widget.textAlign,
softWrap: this.widget.softWrap,
overflow: this.widget.overflow,
maxLines: this.widget.maxLines,

Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
borderRadius = borderRadius ?? BorderRadius.zero;
D.assert(clipBehavior != null);
D.assert(animateColor != null);
D.assert(animateShadowColor != null);
this.borderRadius = borderRadius;
this.borderRadius = borderRadius ?? BorderRadius.zero;
this.elevation = elevation ?? 0.0;
this.color = color;
this.animateColor = animateColor;

public readonly bool animateShadowColor;
public override State createState() => new _AnimatedPhysicalModelState();
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<BoxShape>("shape", this.shape));

ColorTween _shadowColor;
protected override void forEachTween(ITweenVisitor visitor) {
this._borderRadius = (BorderRadiusTween)visitor.visit(this, this._borderRadius, this.widget.borderRadius,
this._borderRadius = (BorderRadiusTween) visitor.visit(this, this._borderRadius, this.widget.borderRadius,
(BorderRadius value) => new BorderRadiusTween(begin: value));
this._elevation = (DoubleTween) visitor.visit(this, this._elevation, this.widget.elevation,
(double value) => new DoubleTween(begin: value, end: value));

public override Widget build(BuildContext context) {
return new PhysicalModel(
child: this.widget.child,
child: this.widget.child,
borderRadius: this.widget.borderRadius,
elevation: this.widget.elevation,
borderRadius: this._borderRadius.evaluate(this.animation),
elevation: this._elevation.evaluate(this.animation),
shadowColor: this.widget.animateShadowColor ? this._shadowColor.evaluate(this.animation) : this.widget.shadowColor);
shadowColor: this.widget.animateShadowColor
? this._shadowColor.evaluate(this.animation)
: this.widget.shadowColor);
}
}
}

21
Runtime/widgets/layout_builder.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public LayoutBuilder(
Key key = null,
LayoutWidgetBuilder builder = null) : base(key: key) {

class _LayoutBuilderElement : RenderObjectElement {
public _LayoutBuilderElement(
LayoutBuilder widget) : base(widget){}
LayoutBuilder widget) : base(widget) {
}
new LayoutBuilder widget => (LayoutBuilder) base.widget;

}
protected override void insertChildRenderObject(RenderObject child, object slot) {
_RenderLayoutBuilder renderObject = (_RenderLayoutBuilder) this.renderObject;
_RenderLayoutBuilder renderObject = this.renderObject;
D.assert(slot == null);
D.assert(renderObject.debugValidateChild(child));
renderObject.child = (RenderBox) child;

}
protected override void removeChildRenderObject(RenderObject child) {
_RenderLayoutBuilder renderObject = (_RenderLayoutBuilder) this.renderObject;
_RenderLayoutBuilder renderObject = this.renderObject;
D.assert(renderObject.child == child);
renderObject.child = null;
D.assert(renderObject == this.renderObject);

}
public LayoutCallback<BoxConstraints> callback {
get { return this._callback; }
get { return this._callback; }
set {
if (value == this._callback)
return;

}
if (!RenderObject.debugCheckingIntrinsics) {
if (!debugCheckingIntrinsics) {
"Calculating the intrinsic dimensions would require running the layout " +
"callback speculatively, which might mutate the live render object tree."
"Calculating the intrinsic dimensions would require running the layout " +
"callback speculatively, which might mutate the live render object tree."
return true;
});
return true;

D.assert(this._debugThrowIfNotCheckingIntrinsics());
return 0.0;
}
protected override double computeMaxIntrinsicWidth(double height) {
D.assert(this._debugThrowIfNotCheckingIntrinsics());
return 0.0;

25
Samples/UIWidgetSample/MaterialCanvas.cs


using System.Collections.Generic;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.material;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Material = Unity.UIWidgets.material.Material;
namespace UIWidgetsSample {
public class MaterialCanvas : WidgetCanvas {

return new MaterialWidgetState();
}
}
child : new Center(
child : new Container(
width: 30,
height : 30,
child: new Center(
splashColor: new Color(0xFFFF0011),
highlightColor: new Color(0x88000011),
onPressed : () => { }))));
//splashColor: new Color(0xFFFF0011),
//highlightColor: new Color(0x88FF0011),
onPressed: () => { Debug.Log("pressed here");}
)
)
);
}
}

正在加载...
取消
保存