浏览代码

Merge pull request #152 from UnityTech/yczhang

Yczhang
/main
GitHub 6 年前
当前提交
302c2b32
共有 102 个文件被更改,包括 3913 次插入949 次删除
  1. 20
      Runtime/foundation/change_notifier.cs
  2. 24
      Runtime/gestures/binding.cs
  3. 2
      Runtime/gestures/hit_test.cs
  4. 140
      Runtime/gestures/long_press.cs
  5. 24
      Runtime/gestures/recognizer.cs
  6. 70
      Runtime/material/app.cs
  7. 38
      Runtime/material/app_bar.cs
  8. 40
      Runtime/material/bottom_app_bar.cs
  9. 204
      Runtime/material/bottom_navigation_bar.cs
  10. 1
      Runtime/material/bottom_sheet.cs
  11. 37
      Runtime/material/button.cs
  12. 2
      Runtime/material/button_theme.cs
  13. 27
      Runtime/material/card.cs
  14. 10
      Runtime/material/chip.cs
  15. 1
      Runtime/material/chip_theme.cs
  16. 74
      Runtime/material/dialog.cs
  17. 64
      Runtime/material/dialog_theme.cs
  18. 11
      Runtime/material/drawer.cs
  19. 3
      Runtime/material/dropdown.cs
  20. 11
      Runtime/material/expansion_tile.cs
  21. 17
      Runtime/material/flexible_space_bar.cs
  22. 72
      Runtime/material/float_action_button.cs
  23. 114
      Runtime/material/float_action_button_location.cs
  24. 206
      Runtime/material/input_decorator.cs
  25. 19
      Runtime/material/list_tile.cs
  26. 31
      Runtime/material/material.cs
  27. 1
      Runtime/material/material_button.cs
  28. 72
      Runtime/material/outline_button.cs
  29. 118
      Runtime/material/page_transitions_theme.cs
  30. 50
      Runtime/material/reorderable_list.cs
  31. 88
      Runtime/material/scaffold.cs
  32. 75
      Runtime/material/switch.cs
  33. 26
      Runtime/material/tab_bar_theme.cs
  34. 44
      Runtime/material/tabs.cs
  35. 147
      Runtime/material/text_field.cs
  36. 54
      Runtime/material/text_theme.cs
  37. 50
      Runtime/material/theme_data.cs
  38. 103
      Runtime/painting/image_cache.cs
  39. 16
      Runtime/painting/image_stream.cs
  40. 2
      Runtime/painting/notched_shapes.cs
  41. 82
      Runtime/painting/text_painter.cs
  42. 3
      Runtime/rendering/binding.cs
  43. 353
      Runtime/rendering/editable.cs
  44. 8
      Runtime/rendering/layer.cs
  45. 2
      Runtime/rendering/object.cs
  46. 10
      Runtime/rendering/proxy_box.cs
  47. 6
      Runtime/rendering/sliver.cs
  48. 2
      Runtime/rendering/sliver_multi_box_adaptor.cs
  49. 10
      Runtime/rendering/sliver_persistent_header.cs
  50. 3
      Runtime/rendering/table.cs
  51. 51
      Runtime/rendering/viewport.cs
  52. 4
      Runtime/service/text_formatter.cs
  53. 79
      Runtime/service/text_input.cs
  54. 5
      Runtime/widgets/app.cs
  55. 45
      Runtime/widgets/basic.cs
  56. 8
      Runtime/widgets/binding.cs
  57. 11
      Runtime/widgets/debug.cs
  58. 117
      Runtime/widgets/dismissible.cs
  59. 321
      Runtime/widgets/editable_text.cs
  60. 30
      Runtime/widgets/focus_manager.cs
  61. 22
      Runtime/widgets/focus_scope.cs
  62. 10
      Runtime/widgets/framework.cs
  63. 50
      Runtime/widgets/gesture_detector.cs
  64. 6
      Runtime/widgets/icon_theme_data.cs
  65. 3
      Runtime/widgets/image.cs
  66. 2
      Runtime/widgets/implicit_animations.cs
  67. 17
      Runtime/widgets/media_query.cs
  68. 105
      Runtime/widgets/navigator.cs
  69. 3
      Runtime/widgets/notification_listener.cs
  70. 3
      Runtime/widgets/overlay.cs
  71. 8
      Runtime/widgets/page_view.cs
  72. 1
      Runtime/widgets/routes.cs
  73. 120
      Runtime/widgets/scroll_view.cs
  74. 28
      Runtime/widgets/scrollable.cs
  75. 3
      Runtime/widgets/selectable_text.cs
  76. 6
      Runtime/widgets/single_child_scroll_view.cs
  77. 24
      Runtime/widgets/text_selection.cs
  78. 4
      Runtime/widgets/transitions.cs
  79. 3
      Runtime/widgets/widget_inspector.cs
  80. 1
      Samples/ReduxSample/ObjectFinder/ObjectFinderApp.cs
  81. 3
      Samples/UIWidgetSample/AsScreenSample.cs
  82. 163
      Samples/UIWidgetSample/MaterialSample.cs
  83. 63
      Samples/UIWidgetSample/TextInputSample.cs
  84. 10
      Samples/UIWidgetSample/txt/TextFieldSample.cs
  85. 2
      Samples/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs
  86. 19
      Tests/Editor/RenderEditable.cs
  87. 7
      Runtime/foundation/constants.cs
  88. 3
      Runtime/foundation/constants.cs.meta
  89. 112
      Runtime/material/app_bar_theme.cs
  90. 3
      Runtime/material/app_bar_theme.cs.meta
  91. 92
      Runtime/material/bottom_app_bar_theme.cs
  92. 3
      Runtime/material/bottom_app_bar_theme.cs.meta
  93. 89
      Runtime/material/card_theme.cs
  94. 3
      Runtime/material/card_theme.cs.meta
  95. 45
      Samples/UIWidgetSample/LongPressSample.cs
  96. 3
      Samples/UIWidgetSample/LongPressSample.cs.meta
  97. 468
      Samples/UIWidgetSample/LongPressSample.unity
  98. 7
      Samples/UIWidgetSample/LongPressSample.unity.meta
  99. 87
      Samples/UIWidgetSample/MaterialThemeSample.cs
  100. 3
      Samples/UIWidgetSample/MaterialThemeSample.cs.meta

20
Runtime/foundation/change_notifier.cs


}
}
class _MergingListenable : ChangeNotifier {
class _MergingListenable : Listenable {
foreach (Listenable child in _children) {
if (child != null) {
child.addListener(this.notifyListeners);
}
}
public override void dispose() {
public void addListener(VoidCallback listener) {
if (child != null) {
child.removeListener(this.notifyListeners);
}
child?.addListener(listener);
}
base.dispose();
public void removeListener(VoidCallback listener) {
foreach (Listenable child in this._children) {
child?.removeListener(listener);
}
}
public override string ToString() {

24
Runtime/gestures/binding.cs


this._handlePointerHoverEvent(evt);
}
HitTestResult result = null;
HitTestResult hitTestResult = null;
result = new HitTestResult();
this.hitTest(result, evt.position);
hitTestResult = new HitTestResult();
this.hitTest(hitTestResult, evt.position);
this._hitTests[evt.pointer] = result;
this._hitTests[evt.pointer] = hitTestResult;
Debug.LogFormat("{0}: {1}", evt, result);
Debug.LogFormat("{0}: {1}", evt, hitTestResult);
}
return true;

result = this._hitTests.getOrDefault(evt.pointer);
hitTestResult = this._hitTests.getOrDefault(evt.pointer);
result = this._hitTests.getOrDefault(evt.pointer);
hitTestResult = this._hitTests.getOrDefault(evt.pointer);
}
D.assert(() => {

return true;
});
if (result != null ||
if (hitTestResult != null ||
this.dispatchEvent(evt, result);
this.dispatchEvent(evt, hitTestResult);
}
}

result.add(new HitTestEntry(this));
}
public void dispatchEvent(PointerEvent evt, HitTestResult result) {
if (result == null) {
public void dispatchEvent(PointerEvent evt, HitTestResult hitTestResult) {
if (hitTestResult == null) {
D.assert(evt is PointerHoverEvent || evt is PointerAddedEvent || evt is PointerRemovedEvent);
try {
this.pointerRouter.route(evt);

return;
}
foreach (HitTestEntry entry in result.path) {
foreach (HitTestEntry entry in hitTestResult.path) {
try {
entry.target.handleEvent(evt, entry);
}

2
Runtime/gestures/hit_test.cs


}
public interface HitTestDispatcher {
void dispatchEvent(PointerEvent evt, HitTestResult result);
void dispatchEvent(PointerEvent evt, HitTestResult hitTestResult);
}
public interface HitTestTarget {

140
Runtime/gestures/long_press.cs


using System;
public delegate void GestureLongPressUpCallback();
public delegate void GestureLongPressDragStartCallback(GestureLongPressDragStartDetails details);
public delegate void GestureLongPressDragUpdateCallback(GestureLongPressDragUpdateDetails details);
public delegate void GestureLongPressDragUpCallback(GestureLongPressDragUpDetails details);
public class GestureLongPressDragStartDetails {
public GestureLongPressDragStartDetails(
TimeSpan? sourceTimeStamp = null,
Offset globalPosition = null
) {
this.sourceTimeStamp = sourceTimeStamp;
this.globalPosition = globalPosition ?? Offset.zero;
}
public readonly TimeSpan? sourceTimeStamp;
public readonly Offset globalPosition;
}
public class GestureLongPressDragUpdateDetails {
public GestureLongPressDragUpdateDetails(
TimeSpan? sourceTimeStamp = null,
Offset globalPosition = null,
Offset offsetFromOrigin = null
) {
this.sourceTimeStamp = sourceTimeStamp;
this.globalPosition = globalPosition ?? Offset.zero;
this.offsetFromOrigin = offsetFromOrigin ?? Offset.zero;
}
public readonly TimeSpan? sourceTimeStamp;
public readonly Offset globalPosition;
public readonly Offset offsetFromOrigin;
}
public class GestureLongPressDragUpDetails {
public GestureLongPressDragUpDetails(
TimeSpan? sourceTimeStamp = null,
Offset globalPosition = null
) {
this.sourceTimeStamp = sourceTimeStamp;
this.globalPosition = globalPosition ?? Offset.zero;
}
public readonly TimeSpan? sourceTimeStamp;
public readonly Offset globalPosition;
}
public class LongPressGestureRecognizer : PrimaryPointerGestureRecognizer {
public LongPressGestureRecognizer(object debugOwner = null, PointerDeviceKind? kind = null) :
base(deadline: Constants.kLongPressTimeout, debugOwner: debugOwner, kind: kind) {

public override string debugDescription {
get { return "long press"; }
}
}
public class LongPressDragGestureRecognizer : PrimaryPointerGestureRecognizer {
public LongPressDragGestureRecognizer(object debugOwner = null) : base(
deadline: Constants.kLongPressTimeout,
postAcceptSlopTolerance: null,
debugOwner: debugOwner
) {
}
bool _longPressAccepted = false;
Offset _longPressOrigin;
TimeSpan? _longPressStartTimestamp;
public GestureLongPressDragStartCallback onLongPressStart;
public GestureLongPressDragUpdateCallback onLongPressDragUpdate;
public GestureLongPressDragUpCallback onLongPressUp;
protected override void didExceedDeadline() {
this.resolve(GestureDisposition.accepted);
this._longPressAccepted = true;
base.acceptGesture(this.primaryPointer);
if (this.onLongPressStart != null) {
this.invokeCallback<object>("onLongPressStart", () => {
this.onLongPressStart(new GestureLongPressDragStartDetails(
sourceTimeStamp: this._longPressStartTimestamp,
globalPosition: this._longPressOrigin
));
return null;
});
}
}
protected override void handlePrimaryPointer(PointerEvent e) {
if (e is PointerUpEvent) {
if (this._longPressAccepted == true && this.onLongPressUp != null) {
this._longPressAccepted = false;
this.invokeCallback<object>("onLongPressUp", () => {
this.onLongPressUp(new GestureLongPressDragUpDetails(
sourceTimeStamp: e.timeStamp,
globalPosition: e.position
));
return null;
});
}
else {
this.resolve(GestureDisposition.rejected);
}
}
else if (e is PointerDownEvent) {
this._longPressAccepted = false;
this._longPressStartTimestamp = e.timeStamp;
this._longPressOrigin = e.position;
}
else if (e is PointerMoveEvent && this._longPressAccepted && this.onLongPressDragUpdate != null) {
this.invokeCallback<object>("onLongPressDrag", () => {
this.onLongPressDragUpdate(new GestureLongPressDragUpdateDetails(
sourceTimeStamp: e.timeStamp,
globalPosition: e.position,
offsetFromOrigin: e.position - this._longPressOrigin
));
return null;
});
}
}
public override void acceptGesture(int pointer) {
}
protected override void didStopTrackingLastPointer(int pointer) {
this._longPressAccepted = false;
this._longPressOrigin = null;
this._longPressStartTimestamp = null;
base.didStopTrackingLastPointer(pointer);
}
public override string debugDescription {
get { return "long press drag"; }
}
}
}

24
Runtime/gestures/recognizer.cs


TimeSpan? deadline = null,
object debugOwner = null,
PointerDeviceKind? kind = null,
float? preAcceptSlotTolerance = Constants.kTouchSlop,
float? postAcceptSlotTolerance = Constants.kTouchSlop
float? preAcceptSlopTolerance = Constants.kTouchSlop,
float? postAcceptSlopTolerance = Constants.kTouchSlop
D.assert(preAcceptSlotTolerance == null || preAcceptSlotTolerance >= 0,
D.assert(preAcceptSlopTolerance == null || preAcceptSlopTolerance >= 0,
D.assert(postAcceptSlotTolerance == null || postAcceptSlotTolerance >= 0,
D.assert(postAcceptSlopTolerance == null || postAcceptSlopTolerance >= 0,
this.preAcceptSlotTolerance = preAcceptSlotTolerance;
this.postAcceptSlotTolerance = postAcceptSlotTolerance;
this.preAcceptSlopTolerance = preAcceptSlopTolerance;
this.postAcceptSlopTolerance = postAcceptSlopTolerance;
public readonly float? preAcceptSlotTolerance;
public readonly float? preAcceptSlopTolerance;
public readonly float? postAcceptSlotTolerance;
public readonly float? postAcceptSlopTolerance;
public GestureRecognizerState state = GestureRecognizerState.ready;

if (evt.pointer == this.primaryPointer) {
bool isPreAcceptSlopPastTolerance = this.state == GestureRecognizerState.possible &&
this.preAcceptSlotTolerance != null &&
this._getDistance(evt) > this.preAcceptSlotTolerance;
this.preAcceptSlopTolerance != null &&
this._getDistance(evt) > this.preAcceptSlopTolerance;
this.postAcceptSlotTolerance != null &&
this._getDistance(evt) > this.postAcceptSlotTolerance;
this.postAcceptSlopTolerance != null &&
this._getDistance(evt) > this.postAcceptSlopTolerance;
if (evt is PointerMoveEvent && (isPreAcceptSlopPastTolerance || isPostAcceptSlopPastTolerance)) {
this.resolve(GestureDisposition.rejected);

70
Runtime/material/app.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

string title = "",
Color color = null,
ThemeData theme = null,
ThemeData darkTheme = null,
Locale locale = null,
List<LocalizationsDelegate<MaterialLocalizations>> localizationsDelegates = null,
LocaleListResolutionCallback localeListResolutionCallback = null,

this.title = title;
this.color = color;
this.theme = theme;
this.darkTheme = darkTheme;
this.locale = locale;
this.localizationsDelegates = localizationsDelegates;
this.localeListResolutionCallback = localeListResolutionCallback;

public readonly string title;
public readonly ThemeData theme;
public readonly ThemeData darkTheme;
public readonly Color color;

}
public override Widget build(BuildContext context) {
ThemeData theme = this.widget.theme ?? ThemeData.fallback();
Widget result = new AnimatedTheme(
data: theme,
isMaterialAppTheme: true,
child: new WidgetsApp(
key: new GlobalObjectKey<State>(this),
navigatorKey: this.widget.navigatorKey,
navigatorObservers: this._navigatorObservers,
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
new MaterialPageRoute(settings: settings, builder: builder),
home: this.widget.home,
routes: this.widget.routes,
initialRoute: this.widget.initialRoute,
onGenerateRoute: this.widget.onGenerateRoute,
onUnknownRoute: this.widget.onUnknownRoute,
builder: this.widget.builder,
textStyle: AppUtils._errorTextStyle,
locale: this.widget.locale,
localizationsDelegates: this._localizationsDelegates,
localeResolutionCallback: this.widget.localeResolutionCallback,
localeListResolutionCallback: this.widget.localeListResolutionCallback,
supportedLocales: this.widget.supportedLocales,
showPerformanceOverlay: this.widget.showPerformanceOverlay
)
Widget result = new WidgetsApp(
key: new GlobalObjectKey<State>(this),
navigatorKey: this.widget.navigatorKey,
navigatorObservers: this._navigatorObservers,
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
new MaterialPageRoute(settings: settings, builder: builder),
home: this.widget.home,
routes: this.widget.routes,
initialRoute: this.widget.initialRoute,
onGenerateRoute: this.widget.onGenerateRoute,
onUnknownRoute: this.widget.onUnknownRoute,
builder: (BuildContext _context, Widget child) => {
ThemeData theme;
Brightness platformBrightness = MediaQuery.platformBrightnessOf(_context);
if (platformBrightness == Brightness.dark && this.widget.darkTheme != null) {
theme = this.widget.darkTheme;
}
else if (this.widget.theme != null) {
theme = this.widget.theme;
}
else {
theme = ThemeData.fallback();
}
return new AnimatedTheme(
data: theme,
isMaterialAppTheme: true,
child: this.widget.builder != null
? new Builder(
builder: (__context) => { return this.widget.builder(__context, child); }
)
: child
);
},
textStyle: AppUtils._errorTextStyle,
locale: this.widget.locale,
localizationsDelegates: this._localizationsDelegates,
localeResolutionCallback: this.widget.localeResolutionCallback,
localeListResolutionCallback: this.widget.localeListResolutionCallback,
supportedLocales: this.widget.supportedLocales,
showPerformanceOverlay: this.widget.showPerformanceOverlay
);
return result;

38
Runtime/material/app_bar.cs


List<Widget> actions = null,
Widget flexibleSpace = null,
PreferredSizeWidget bottom = null,
float elevation = 4.0f,
float? elevation = null,
Color backgroundColor = null,
Brightness? brightness = null,
IconThemeData iconTheme = null,

float toolbarOpacity = 1.0f,
float bottomOpacity = 1.0f
) : base(key: key) {
D.assert(elevation == null || elevation >= 0.0);
this.leading = leading;
this.automaticallyImplyLeading = automaticallyImplyLeading;
this.title = title;

public readonly PreferredSizeWidget bottom;
public readonly float elevation;
public readonly float? elevation;
public readonly Color backgroundColor;

class _AppBarState : State<AppBar> {
const float _defaultElevation = 4.0f;
void _handleDrawerButton() {
Scaffold.of(this.context).openDrawer();
}

public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));
ThemeData themeData = Theme.of(context);
AppBarTheme appBarTheme = AppBarTheme.of(context);
ScaffoldState scaffold = Scaffold.of(context, nullOk: true);
ModalRoute parentRoute = ModalRoute.of(context);

bool useCloseButton = parentRoute is PageRoute && ((PageRoute) parentRoute).fullscreenDialog;
IconThemeData appBarIconTheme = this.widget.iconTheme ?? themeData.primaryIconTheme;
TextStyle centerStyle = this.widget.textTheme?.title ?? themeData.primaryTextTheme.title;
TextStyle sideStyle = this.widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1;
IconThemeData appBarIconTheme = this.widget.iconTheme
?? appBarTheme.iconTheme
?? themeData.primaryIconTheme;
TextStyle centerStyle = this.widget.textTheme?.title
?? appBarTheme.textTheme?.title
?? themeData.primaryTextTheme.title;
TextStyle sideStyle = this.widget.textTheme?.body1
?? appBarTheme.textTheme?.body1
?? themeData.primaryTextTheme.body1;
if (this.widget.toolbarOpacity != 1.0f) {
float opacity =

);
}
Brightness brightness = this.widget.brightness ?? themeData.primaryColorBrightness;
Brightness brightness = this.widget.brightness
?? appBarTheme.brightness
?? themeData.primaryColorBrightness;
SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark;

child: new Material(
color: this.widget.backgroundColor ?? themeData.primaryColor,
elevation: this.widget.elevation,
color: this.widget.backgroundColor
?? appBarTheme.color
?? themeData.primaryColor,
elevation: this.widget.elevation
?? appBarTheme.elevation
?? _defaultElevation,
child: appBar
));
}

public override Widget build(BuildContext context, float shrinkOffset, bool overlapsContent) {
float? visibleMainHeight = this.maxExtent - shrinkOffset - this.topPadding;
float toolbarOpacity = this.pinned && !this.floating
? 1.0f
: ((visibleMainHeight - this._bottomHeight) / Constants.kToolbarHeight)?.clamp(0.0f, 1.0f) ?? 0.0f;
float toolbarOpacity = !this.pinned || (!this.floating && this.bottom != null)
? ((visibleMainHeight - this._bottomHeight) / Constants.kToolbarHeight)?.clamp(0.0f, 1.0f) ?? 1.0f
: 1.0f;
Widget appBar = FlexibleSpaceBar.createSettings(
minExtent: this.minExtent,
maxExtent: this.maxExtent,

40
Runtime/material/bottom_app_bar.cs


public BottomAppBar(
Key key = null,
Color color = null,
float elevation = 8.0f,
float? elevation = null,
D.assert(elevation >= 0.0f);
D.assert(elevation == null || elevation >= 0.0f);
this.child = child;
this.color = color;
this.elevation = elevation;

public readonly Color color;
public readonly float elevation;
public readonly float? elevation;
public readonly NotchedShape shape;

class _BottomAppBarState : State<BottomAppBar> {
ValueListenable<ScaffoldGeometry> geometryListenable;
const float _defaultElevation = 8.0f;
public override void didChangeDependencies() {
base.didChangeDependencies();

public override Widget build(BuildContext context) {
CustomClipper<Path> clipper = this.widget.shape != null
BottomAppBarTheme babTheme = BottomAppBarTheme.of(context);
NotchedShape notchedShape = this.widget.shape ?? babTheme.shape;
CustomClipper<Path> clipper = notchedShape != null
shape: this.widget.shape,
shape: notchedShape,
elevation: this.widget.elevation,
color: this.widget.color ?? Theme.of(context).bottomAppBarColor,
elevation: this.widget.elevation ?? babTheme.elevation ?? _defaultElevation,
color: this.widget.color ?? babTheme.color ?? Theme.of(context).bottomAppBarColor,
clipBehavior: this.widget.clipBehavior,
child: new Material(
type: MaterialType.transparency,

public readonly float notchMargin;
public override Path getClip(Size size) {
Rect appBar = Offset.zero & size;
if (this.geometry.value.floatingActionButtonArea == null) {
Path path = new Path();
path.addRect(appBar);
return path;
}
Rect button = this.geometry.value.floatingActionButtonArea
.translate(0.0f, (this.geometry.value.bottomNavigationBarTop * -1.0f) ?? 0.0f);
return this.shape.getOuterPath(appBar, button.inflate(this.notchMargin));
Rect button = this.geometry.value.floatingActionButtonArea?.translate(
0.0f,
(this.geometry.value.bottomNavigationBarTop ?? 0.0f) * -1.0f
);
return this.shape.getOuterPath(Offset.zero & size, button?.inflate(this.notchMargin));
public override bool shouldReclip(CustomClipper<Path> oldClipper) {
return (oldClipper as _BottomAppBarClipper).geometry != this.geometry;
public override bool shouldReclip(CustomClipper<Path> _oldClipper) {
_BottomAppBarClipper oldClipper = _oldClipper as _BottomAppBarClipper;
return oldClipper.geometry != this.geometry
|| oldClipper.shape != this.shape
|| oldClipper.notchMargin != this.notchMargin;
}
}
}

204
Runtime/material/bottom_navigation_bar.cs


public readonly bool selected;
public readonly string indexLabel;
Widget _buildIcon() {
public override Widget build(BuildContext context) {
int size;
Widget label;
switch (this.type) {
case BottomNavigationBarType.fix:
size = 1;
label = new _FixedLabel(colorTween: this.colorTween, animation: this.animation, item: this.item);
break;
case BottomNavigationBarType.shifting:
size = ((this.flex * 1000.0f) ?? 0.0f).round();
label = new _ShiftingLabel(animation: this.animation, item: this.item);
break;
default:
throw new Exception("Unknown BottomNavigationBarType: " + this.type);
}
return new Expanded(
flex: size,
child: new Stack(
children: new List<Widget> {
new InkResponse(
onTap: this.onTap == null ? (GestureTapCallback) null : () => { this.onTap(); },
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
new _TileIcon(
type: this.type,
colorTween: this.colorTween,
animation: this.animation,
iconSize: this.iconSize,
selected: this.selected,
item: this.item
),
label
}
)
)
}
)
);
}
}
class _TileIcon : StatelessWidget {
public _TileIcon(
Key key = null,
BottomNavigationBarType? type = null,
ColorTween colorTween = null,
Animation<float> animation = null,
float? iconSize = null,
bool? selected = null,
BottomNavigationBarItem item = null
) : base(key: key) {
this.type = type;
this.colorTween = colorTween;
this.animation = animation;
this.iconSize = iconSize;
this.selected = selected;
this.item = item;
}
BottomNavigationBarType? type;
ColorTween colorTween;
Animation<float> animation;
float? iconSize;
bool? selected;
BottomNavigationBarItem item;
public override Widget build(BuildContext context) {
float tweenStart;
Color iconColor;
switch (this.type) {

color: iconColor,
size: this.iconSize
),
child: this.selected ? this.item.activeIcon : this.item.icon
child: this.selected == true ? this.item.activeIcon : this.item.icon
}
Widget _buildFixedLabel() {
class _FixedLabel : StatelessWidget {
public _FixedLabel(
Key key = null,
ColorTween colorTween = null,
Animation<float> animation = null,
BottomNavigationBarItem item = null
) : base(key: key) {
this.colorTween = colorTween;
this.animation = animation;
this.item = item;
}
ColorTween colorTween;
Animation<float> animation;
BottomNavigationBarItem item;
public override Widget build(BuildContext context) {
float t = new FloatTween(
begin: BottomNavigationBarUtils._kInactiveFontSize / BottomNavigationBarUtils._kActiveFontSize,
end: 1.0f

)
);
}
}
Widget _buildShiftingLabel() {
class _ShiftingLabel : StatelessWidget {
public _ShiftingLabel(
Key key = null,
Animation<float> animation = null,
BottomNavigationBarItem item = null
) : base(key: key) {
this.animation = animation;
this.item = item;
}
Animation<float> animation;
BottomNavigationBarItem item;
public override Widget build(BuildContext context) {
return new Align(
alignment: Alignment.bottomCenter,
heightFactor: 1.0f,

)
);
}
}
public override Widget build(BuildContext context) {
int size;
Widget label;
switch (this.type) {
case BottomNavigationBarType.fix:
size = 1;
label = this._buildFixedLabel();
break;
case BottomNavigationBarType.shifting:
size = ((this.flex * 1000.0f) ?? 0.0f).round();
label = this._buildShiftingLabel();
break;
default:
throw new Exception("Unknown BottomNavigationBarType: " + this.type);
}
return new Expanded(
flex: size,
child: new Stack(
children: new List<Widget> {
new InkResponse(
onTap: this.onTap == null ? (GestureTapCallback) null : () => { this.onTap(); },
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {this._buildIcon(), label}
)
)
}
)
);
}
}
class _BottomNavigationBarState : TickerProviderStateMixin<BottomNavigationBar> {
public List<AnimationController> _controllers = new List<AnimationController> { };

},
colorTween: colorTween,
selected: i == this.widget.currentIndex,
indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
indexLabel: localizations.tabLabel(tabIndex: i + 1,
tabCount: this.widget.items.Count)
)
);
}

flex:
this._evaluateFlex(this._animations[i]),
selected: i == this.widget.currentIndex,
indexLabel: localizations.tabLabel(tabIndex: i + 1, tabCount: this.widget.items.Count)
indexLabel: localizations.tabLabel(tabIndex: i + 1,
tabCount: this.widget.items.Count)
)
);
}

break;
}
return new Stack(
children: new List<Widget> {
Positioned.fill(
child: new Material( // Casts shadow.
elevation: 8.0f,
color: backgroundColor
)
),
new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: Constants.kBottomNavigationBarHeight + additionalBottomPadding),
child: new Stack(
children: new List<Widget> {
Positioned.fill(
child: new CustomPaint(
painter: new _RadialPainter(
circles: this._circles.ToList()
)
)
),
new Material( // Splashes.
type: MaterialType.transparency,
child: new Padding(
padding: EdgeInsets.only(bottom: additionalBottomPadding),
child: MediaQuery.removePadding(
context: context,
removeBottom: true,
child: this._createContainer(this._createTiles())
)
)
return new Material(
elevation: 8.0f,
color: backgroundColor,
child: new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: Constants.kBottomNavigationBarHeight + additionalBottomPadding),
child: new CustomPaint(
painter: new _RadialPainter(
circles: this._circles.ToList()
),
child: new Material( // Splashes.
type: MaterialType.transparency,
child: new Padding(
padding: EdgeInsets.only(bottom: additionalBottomPadding),
child: MediaQuery.removePadding(
context: context,
removeBottom: true,
child: this._createContainer(this._createTiles())
}
)
}
)
);
}
}

1
Runtime/material/bottom_sheet.cs


) : base(key: key) {
D.assert(onClosing != null);
D.assert(builder != null);
D.assert(elevation >= 0.0f);
this.animationController = animationController;
this.enableDrag = enableDrag;
this.elevation = elevation;

37
Runtime/material/button.cs


Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget child = null) : base(key: key) {
D.assert(elevation >= 0.0);
D.assert(highlightElevation >= 0.0);
D.assert(disabledElevation >= 0.0);
MaterialTapTargetSize _materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;
shape = shape ?? new RoundedRectangleBorder();
padding = padding ?? EdgeInsets.zero;

bool _highlight = false;
void _handleHighlightChanged(bool value) {
this.setState(() => {
this._highlight = value;
if (this._highlight != value) {
this.setState(() => {
this._highlight = value;
if (this.widget.onHighlightChanged != null) {
this.widget.onHighlightChanged(value);
}
});
}
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {
RawMaterialButton oldWidget = _oldWidget as RawMaterialButton;
base.didUpdateWidget(oldWidget);
if (this._highlight && !this.widget.enabled) {
this._highlight = false;
this.widget.onHighlightChanged(value);
this.widget.onHighlightChanged(false);
});
}
}
public override Widget build(BuildContext context) {

onHighlightChanged: this._handleHighlightChanged,
splashColor: this.widget.splashColor,
highlightColor: this.widget.highlightColor,
onTap: this.widget.onPressed == null ? (GestureTapCallback) null : () => {
if (this.widget.onPressed != null) {
this.widget.onPressed();
}
},
onTap: this.widget.onPressed == null
? (GestureTapCallback) null
: () => {
if (this.widget.onPressed != null) {
this.widget.onPressed();
}
},
customBorder: this.widget.shape,
child: IconTheme.merge(
data: new IconThemeData(color: this.widget.textStyle?.color),

2
Runtime/material/button_theme.cs


}
if (button is OutlineButton) {
return 2.0f;
return 0.0f;
}
return 8.0f;
}

27
Runtime/material/card.cs


Color color = null,
float? elevation = null,
ShapeBorder shape = null,
bool borderOnForeground = true,
Clip clipBehavior = Clip.none,
Clip? clipBehavior = null,
D.assert(elevation == null || elevation >= 0.0f);
this.margin = margin ?? EdgeInsets.all(4.0f);
this.borderOnForeground = borderOnForeground;
this.margin = margin;
this.clipBehavior = clipBehavior;
this.child = child;
}

public readonly ShapeBorder shape;
public readonly Clip clipBehavior;
public readonly bool borderOnForeground;
public readonly Clip? clipBehavior;
const float _defaultElevation = 1.0f;
const Clip _defaultClipBehavior = Clip.none;
CardTheme cardTheme = CardTheme.of(context);
margin: this.margin ?? EdgeInsets.all(4.0f),
margin: this.margin ?? cardTheme.margin ?? EdgeInsets.all(4.0f),
color: this.color ?? Theme.of(context).cardColor,
elevation: this.elevation ?? 1.0f,
shape: this.shape ?? new RoundedRectangleBorder(
color: this.color ?? cardTheme.color ?? Theme.of(context).cardColor,
elevation: this.elevation ?? cardTheme.elevation ?? _defaultElevation,
shape: this.shape ?? cardTheme.shape ?? new RoundedRectangleBorder(
clipBehavior: this.clipBehavior,
borderOnForeground: this.borderOnForeground,
clipBehavior: this.clipBehavior ?? cardTheme.clipBehavior ?? _defaultClipBehavior,
child: this.child)
);
}

10
Runtime/material/chip.cs


Color selectedShadowColor = null,
ShapeBorder avatarBorder = null
) : base(key: key) {
D.assert(selected != null);
D.assert(isEnabled != null);
D.assert(clipBehavior != null);
D.assert(pressElevation == null || pressElevation >= 0.0f);
D.assert(elevation == null || elevation >= 0.0f);
this._avatarBorder = avatarBorder ?? new CircleBorder();

float? _elevation;
public Color selectedShadowColor {
get { return this._selectedShadowColor; }
}
Color _selectedShadowColor;
public ShapeBorder avatarBorder {
get { return this._avatarBorder; }
}

) : base(key: key) {
D.assert(selected != null);
D.assert(label != null);
D.assert(clipBehavior != null);
D.assert(pressElevation == null || pressElevation >= 0.0f);
D.assert(elevation == null || elevation >= 0.0f);
this._avatarBorder = avatarBorder ?? new CircleBorder();

1
Runtime/material/chip_theme.cs


}
public static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, float t) {
D.assert(t != null);
if (a == null && b == null) {
return null;
}

74
Runtime/material/dialog.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
Widget child = null,
Color backgroundColor = null,
float? elevation = null,
ShapeBorder shape = null
ShapeBorder shape = null,
Widget child = null
this.backgroundColor = backgroundColor;
this.elevation = elevation;
this.insetAnimationCurve = Curves.decelerate;
this.insetAnimationCurve = insetAnimationCurve ?? Curves.decelerate;
public readonly Widget child;
public readonly Color backgroundColor;
public readonly float? elevation;
public readonly TimeSpan insetAnimationDuration;

Color _getColor(BuildContext context) {
return Theme.of(context).dialogBackgroundColor;
}
public readonly Widget child;
const float _defaultElevation = 24.0f;
public override Widget build(BuildContext context) {
DialogTheme dialogTheme = DialogTheme.of(context);

child: new ConstrainedBox(
constraints: new BoxConstraints(minWidth: 280.0f),
child: new Material(
elevation: 24.0f,
color: this._getColor(context),
color: this.backgroundColor ?? dialogTheme.backgroundColor ??
Theme.of(context).dialogBackgroundColor,
elevation: this.elevation ?? dialogTheme.elevation ?? _defaultElevation,
shape: this.shape ?? dialogTheme.shape ?? _defaultDialogShape,
child: this.child,
shape: this.shape ?? dialogTheme.shape ?? _defaultDialogShape
child: this.child
)
)
)

Key key = null,
Widget title = null,
EdgeInsets titlePadding = null,
TextStyle titleTextStyle = null,
TextStyle contentTextStyle = null,
Color backgroundColor = null,
float? elevation = null,
this.titleTextStyle = titleTextStyle;
this.contentTextStyle = contentTextStyle;
this.backgroundColor = backgroundColor;
this.elevation = elevation;
public readonly TextStyle titleTextStyle;
public readonly TextStyle contentTextStyle;
public readonly Color backgroundColor;
public readonly float? elevation;
ThemeData theme = Theme.of(context);
DialogTheme dialogTheme = DialogTheme.of(context);
List<Widget> children = new List<Widget>();
if (this.title != null) {

child: new DefaultTextStyle(
style: Theme.of(context).textTheme.title,
style: this.titleTextStyle ?? dialogTheme.titleTextStyle ?? theme.textTheme.title,
child: this.title
)
));

child: new Padding(
padding: this.contentPadding,
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.subhead,
style: this.contentTextStyle ?? dialogTheme.contentTextStyle ?? theme.textTheme.subhead,
child: this.content
)
)

)
);
return new Dialog(child: dialogChild, shape: this.shape);
return new Dialog(
backgroundColor: this.backgroundColor,
elevation: this.elevation,
shape: this.shape,
child: dialogChild
);
}
}

EdgeInsets titlePadding = null,
List<Widget> children = null,
EdgeInsets contentPadding = null,
Color backgroundColor = null,
float? elevation = null,
ShapeBorder shape = null
) : base(key: key) {
this.title = title;

this.backgroundColor = backgroundColor;
this.elevation = elevation;
this.shape = shape;
}

public readonly List<Widget> children;
public readonly EdgeInsets contentPadding;
public readonly Color backgroundColor;
public readonly float? elevation;
public readonly ShapeBorder shape;

)
);
return new Dialog(child: dialogChild, shape: this.shape);
return new Dialog(
backgroundColor: this.backgroundColor,
elevation: this.elevation,
shape: this.shape,
child: dialogChild
);
static Widget _buildMaterialDialogTransitions(BuildContext context, Animation<float> animation,
Animation<float> secondaryAnimation, Widget child) {
return new FadeTransition(

);
}
}
}
}

64
Runtime/material/dialog_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
public DialogTheme(ShapeBorder shape = null) {
public DialogTheme(
Color backgroundColor = null,
float? elevation = null,
ShapeBorder shape = null,
TextStyle titleTextStyle = null,
TextStyle contentTextStyle = null
) {
this.backgroundColor = backgroundColor;
this.elevation = elevation;
this.titleTextStyle = titleTextStyle;
this.contentTextStyle = contentTextStyle;
public readonly Color backgroundColor;
public readonly float? elevation;
public DialogTheme copyWith(ShapeBorder shape = null) {
return new DialogTheme(shape: shape ?? this.shape);
public readonly TextStyle titleTextStyle;
public readonly TextStyle contentTextStyle;
DialogTheme copyWith(
Color backgroundColor = null,
float? elevation = null,
ShapeBorder shape = null,
TextStyle titleTextStyle = null,
TextStyle contentTextStyle = null
) {
return new DialogTheme(
backgroundColor: backgroundColor ?? this.backgroundColor,
elevation: elevation ?? this.elevation,
shape: shape ?? this.shape,
titleTextStyle: titleTextStyle ?? this.titleTextStyle,
contentTextStyle: contentTextStyle ?? this.contentTextStyle
);
}
public static DialogTheme of(BuildContext context) {

public static DialogTheme lerp(DialogTheme a, DialogTheme b, float t) {
return new DialogTheme(
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
titleTextStyle: TextStyle.lerp(a?.titleTextStyle, b?.titleTextStyle, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t)
);
}

}
return Equals(this.shape, other.shape);
return Equals(this.backgroundColor, other.backgroundColor)
&& Equals(this.elevation, other.elevation)
&& Equals(this.shape, other.shape)
&& Equals(this.titleTextStyle, other.titleTextStyle)
&& Equals(this.contentTextStyle, other.contentTextStyle);
}
public override bool Equals(object obj) {

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

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape,
defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new DiagnosticsProperty<Color>("backgroundColor", this.backgroundColor));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape));
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation));
properties.add(new DiagnosticsProperty<TextStyle>("titleTextStyle", this.titleTextStyle));
properties.add(new DiagnosticsProperty<TextStyle>("contentTextStyle", this.contentTextStyle));
}
}

11
Runtime/material/drawer.cs


Key key = null,
float elevation = 16.0f,
Widget child = null) : base(key: key) {
D.assert(elevation >= 0.0f);
this.elevation = elevation;
this.child = child;
}

GlobalKey key = null,
Widget child = null,
DrawerAlignment? alignment = null,
DrawerCallback drawerCallback = null) : base(key: key) {
DrawerCallback drawerCallback = null,
DragStartBehavior? dragStartBehavior = null
) : base(key: key) {
D.assert(dragStartBehavior != null);
this.dragStartBehavior = dragStartBehavior;
public readonly DragStartBehavior? dragStartBehavior;
public readonly DrawerCallback drawerCallback;

onHorizontalDragUpdate: this._move,
onHorizontalDragEnd: this._settle,
behavior: HitTestBehavior.translucent,
dragStartBehavior: this.widget.dragStartBehavior ?? DragStartBehavior.down,
child: new Container(width: dragAreaWidth)
)
);

onHorizontalDragUpdate: this._move,
onHorizontalDragEnd: this._settle,
onHorizontalDragCancel: this._handleDragCancel,
dragStartBehavior: this.widget.dragStartBehavior ?? DragStartBehavior.down,
child: new RepaintBoundary(
child: new Stack(
children: new List<Widget> {

3
Runtime/material/dropdown.cs


return Promise<bool>.Resolved(false);
}
public void didChangePlatformBrightness() {
}
public override void initState() {
base.initState();
this._updateSelectedIndex();

11
Runtime/material/expansion_tile.cs


Widget _buildChildren(BuildContext context, Widget child) {
Color borderSideColor = this._borderColor.value ?? Colors.transparent;
Color titleColor = this._headerColor.value;
return new Container(
decoration: new BoxDecoration(

child: new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
IconTheme.merge(
data: new IconThemeData(color: this._iconColor.value),
ListTileTheme.merge(
iconColor: this._iconColor.value,
textColor: this._headerColor.value,
title: new DefaultTextStyle(
style: Theme.of(this.context).textTheme.subhead.copyWith(color: titleColor),
child: this.widget.title
),
title: this.widget.title,
trailing: this.widget.trailing ?? new RotationTransition(
turns: this._iconTurns,
child: new Icon(Icons.expand_more)

17
Runtime/material/flexible_space_bar.cs


Widget title = null,
Widget background = null,
bool? centerTitle = null,
EdgeInsets titlePadding = null,
this.titlePadding = titlePadding;
this.collapseMode = collapseMode;
}

public readonly bool? centerTitle;
public readonly EdgeInsets titlePadding;
public static Widget createSettings(
float? toolbarOpacity = null,

color: titleStyle.color.withOpacity(toolbarOpacity));
bool effectiveCenterTitle = this._getEffectiveCenterTitle(theme).Value;
EdgeInsets padding = this.widget.titlePadding ??
EdgeInsets.only(
left: effectiveCenterTitle ? 0.0f : 72.0f,
bottom: 16.0f
);
padding: EdgeInsets.fromLTRB(
effectiveCenterTitle ? 0.0f : 72.0f,
0f,
0f,
16.0f),
padding: padding,
child: new Transform(
alignment: titleAlignment,
transform: scaleTransform,

72
Runtime/material/float_action_button.cs


}
}
public class FloatingActionButton : StatefulWidget {
public class FloatingActionButton : StatelessWidget {
FloatingActionButton(
Key key = null,
Widget child = null,

object heroTag = null,
float elevation = 6.0f,
float highlightElevation = 12.0f,
float? disabledElevation = null,
VoidCallback onPressed = null,
bool mini = false,
ShapeBorder shape = null,

BoxConstraints _sizeConstraints = null
) : base(key: key) {
D.assert(elevation >= 0.0f);
D.assert(highlightElevation >= 0.0f);
D.assert(disabledElevation == null || disabledElevation >= 0.0f);
heroTag = heroTag ?? new _DefaultHeroTag();
shape = shape ?? new CircleBorder();
this.child = child;

this.clipBehavior = clipBehavior;
this.materialTapTargetSize = materialTapTargetSize;
this.isExtended = isExtended;
this._sizeConstraints = _sizeConstraints ??
(mini
this.disabledElevation = disabledElevation;
this._sizeConstraints = _sizeConstraints ?? (mini
? FloatActionButtonUtils._kMiniSizeConstraints
: FloatActionButtonUtils._kSizeConstraints);
}

object heroTag = null,
float elevation = 6.0f,
float highlightElevation = 12.0f,
float? disabledElevation = null,
VoidCallback onPressed = null,
ShapeBorder shape = null,
bool isExtended = true,

Widget label = null
) {
D.assert(elevation >= 0.0f);
D.assert(highlightElevation >= 0.0f);
D.assert(disabledElevation == null || disabledElevation >= 0.0f);
D.assert(icon != null);
D.assert(label != null);
D.assert(icon != null);
D.assert(label != null);
BoxConstraints _sizeConstraints = FloatActionButtonUtils._kExtendedSizeConstraints;
bool mini = false;

heroTag: heroTag,
elevation: elevation,
highlightElevation: highlightElevation,
disabledElevation: disabledElevation ?? elevation,
onPressed: onPressed,
mini: mini,
shape: shape,

public readonly float highlightElevation;
public readonly float? disabledElevation;
public readonly bool mini;
public readonly ShapeBorder shape;

public readonly BoxConstraints _sizeConstraints;
public override State createState() {
return new _FloatingActionButtonState();
}
}
public class _FloatingActionButtonState : State<FloatingActionButton> {
bool _highlight = false;
void _handleHighlightChanged(bool value) {
this.setState(() => { this._highlight = value; });
}
Color foregroundColor = this.widget.foregroundColor ?? theme.accentIconTheme.color;
Color foregroundColor = this.foregroundColor ?? theme.accentIconTheme.color;
if (this.widget.child != null) {
if (this.child != null) {
child: this.widget.child
child: this.child
onPressed: this.widget.onPressed,
onHighlightChanged: this._handleHighlightChanged,
elevation: this._highlight ? this.widget.highlightElevation : this.widget.elevation,
constraints: this.widget._sizeConstraints,
materialTapTargetSize: this.widget.materialTapTargetSize ?? theme.materialTapTargetSize,
fillColor: this.widget.backgroundColor ?? theme.accentColor,
onPressed: this.onPressed,
elevation: this.elevation,
highlightElevation: this.highlightElevation,
disabledElevation: this.disabledElevation ?? this.elevation,
constraints: this._sizeConstraints,
materialTapTargetSize: this.materialTapTargetSize ?? theme.materialTapTargetSize,
fillColor: this.backgroundColor ?? theme.accentColor,
shape: this.widget.shape,
clipBehavior: this.widget.clipBehavior,
shape: this.shape,
clipBehavior: this.clipBehavior,
if (this.widget.tooltip != null) {
if (this.tooltip != null) {
message: this.widget.tooltip,
message: this.tooltip,
//todo: xingwei.zhu: Hero widget
// if (this.widget.heroTag != null) {
// result = new Hero(
// tag: this.widget.heroTag,
// child: result);
// }
if (this.heroTag != null) {
result = new Hero(
tag: this.heroTag,
child: result);
}
return result;
}

114
Runtime/material/float_action_button_location.cs


public static readonly TimeSpan kFloatingActionButtonSegue = new TimeSpan(0, 0, 0, 0, 200);
public const float kFloatingActionButtonTurnInterval = 0.125f;
public static float _leftOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, float offset = 0.0f) {
return kFloatingActionButtonMargin
+ scaffoldGeometry.minInsets.left
- offset;
}
public static float _rightOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, float offset = 0.0f) {
return scaffoldGeometry.scaffoldSize.width
- kFloatingActionButtonMargin
- scaffoldGeometry.minInsets.right
- scaffoldGeometry.floatingActionButtonSize.width
+ offset;
}
public static float _endOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, float offset = 0.0f) {
return _rightOffset(scaffoldGeometry, offset: offset);
}
public static float _startOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, float offset = 0.0f) {
return _leftOffset(scaffoldGeometry, offset: offset);
}
public static float _straddleAppBar(ScaffoldPrelayoutGeometry scaffoldGeometry) {
float fabHalfHeight = scaffoldGeometry.floatingActionButtonSize.height / 2.0f;
return scaffoldGeometry.contentTop - fabHalfHeight;
}
}

public static readonly FloatingActionButtonLocation endFloat = new _EndFloatFabLocation();
public static readonly FloatingActionButtonLocation endFloat = new _EndFloatFloatingActionButtonLocation();
public static readonly FloatingActionButtonLocation centerFloat = new _CenterFloatFabLocation();
public static readonly FloatingActionButtonLocation
centerFloat = new _CenterFloatFloatingActionButtonLocation();
public static readonly FloatingActionButtonLocation endDocked = new _EndDockedFloatingActionButtonLocation();

public static readonly FloatingActionButtonLocation startTop = new _StartTopFloatingActionButtonLocation();
public static readonly FloatingActionButtonLocation miniStartTop =
new _MiniStartTopFloatingActionButtonLocation();
public static readonly FloatingActionButtonLocation endTop = new _EndTopFloatingActionButtonLocation();
public abstract Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry);
public override string ToString() {

class _CenterFloatFabLocation : FloatingActionButtonLocation {
public _CenterFloatFabLocation() {
class _CenterFloatFloatingActionButtonLocation : FloatingActionButtonLocation {
public _CenterFloatFloatingActionButtonLocation() {
}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {

return new Offset(fabX, fabY);
}
public override string ToString() {
return "FloatingActionButtonLocation.centerFloat";
}
class _EndFloatFabLocation : FloatingActionButtonLocation {
public _EndFloatFabLocation() {
class _EndFloatFloatingActionButtonLocation : FloatingActionButtonLocation {
public _EndFloatFloatingActionButtonLocation() {
float endPadding = scaffoldGeometry.minInsets.right;
float fabX = scaffoldGeometry.scaffoldSize.width - scaffoldGeometry.floatingActionButtonSize.width -
FloatingActionButtonLocationUtils.kFloatingActionButtonMargin - endPadding;
float fabX = FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry);
float contentBottom = scaffoldGeometry.contentBottom;
float bottomSheetHeight = scaffoldGeometry.bottomSheetSize.height;

return new Offset(fabX, fabY);
}
public override string ToString() {
return "FloatingActionButtonLocation.endFloat";
}
}
abstract class _DockedFloatingActionButtonLocation : FloatingActionButtonLocation {

}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
float endPadding = scaffoldGeometry.minInsets.right;
float fabX = scaffoldGeometry.scaffoldSize.width - scaffoldGeometry.floatingActionButtonSize.width -
FloatingActionButtonLocationUtils.kFloatingActionButtonMargin - endPadding;
float fabX = FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry);
public override string ToString() {
return "FloatingActionButtonLocation.endDocked";
}
}
class _CenterDockedFloatingActionButtonLocation : _DockedFloatingActionButtonLocation {

public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
float fabX = (scaffoldGeometry.scaffoldSize.width - scaffoldGeometry.floatingActionButtonSize.width) / 2.0f;
return new Offset(fabX, this.getDockedY(scaffoldGeometry));
}
public override string ToString() {
return "FloatingActionButtonLocation.centerDocked";
}
}
class _StartTopFloatingActionButtonLocation : FloatingActionButtonLocation {
public _StartTopFloatingActionButtonLocation() {
}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._startOffset(scaffoldGeometry),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {
return "FloatingActionButtonLocation.startTop";
}
}
class _MiniStartTopFloatingActionButtonLocation : FloatingActionButtonLocation {
public _MiniStartTopFloatingActionButtonLocation() {
}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._startOffset(scaffoldGeometry, offset: 4.0f),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {
return "FloatingActionButtonLocation.miniStartTop";
}
}
class _EndTopFloatingActionButtonLocation : FloatingActionButtonLocation {
public _EndTopFloatingActionButtonLocation() {
}
public override Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
return new Offset(FloatingActionButtonLocationUtils._endOffset(scaffoldGeometry),
FloatingActionButtonLocationUtils._straddleAppBar(scaffoldGeometry));
}
public override string ToString() {
return "FloatingActionButtonLocation.endTop";
}
}

206
Runtime/material/input_decorator.cs


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

}
void _handleChange() {
this.setState(() => {
});
this.setState(() => { });
}
public override void didUpdateWidget(StatefulWidget _old) {

Widget suffixIcon = null,
Widget helperError = null,
Widget counter = null,
Widget container = null
Widget container = null,
bool? alignLabelWithHint = null
) {
D.assert(contentPadding != null);
this.contentPadding = contentPadding;

this.helperError = helperError;
this.counter = counter;
this.container = container;
this.alignLabelWithHint = alignLabelWithHint;
}
public readonly EdgeInsets contentPadding;

public readonly InputBorder border;
public readonly _InputBorderGap borderGap;
public readonly bool? alignLabelWithHint;
public readonly Widget icon;
public readonly Widget input;
public readonly Widget label;

Equals(this.prefix, other.prefix) && Equals(this.suffix, other.suffix) &&
Equals(this.prefixIcon, other.prefixIcon) && Equals(this.suffixIcon, other.suffixIcon) &&
Equals(this.helperError, other.helperError) && Equals(this.counter, other.counter) &&
Equals(this.container, other.container);
Equals(this.container, other.container) && Equals(this.alignLabelWithHint, other.alignLabelWithHint);
}
public override bool Equals(object obj) {

hashCode = (hashCode * 397) ^ (this.helperError != null ? this.helperError.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.counter != null ? this.counter.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.container != null ? this.container.GetHashCode() : 0);
hashCode = (hashCode * 397) ^
(this.alignLabelWithHint != null ? this.alignLabelWithHint.GetHashCode() : 0);
return hashCode;
}
}

}
float inputWidth = Mathf.Max(0.0f, this.constraints.maxWidth - (
_boxSize(this.icon).width
+ this.contentPadding.left
+ _boxSize(this.prefixIcon).width
+ _boxSize(this.prefix).width
+ _boxSize(this.suffix).width
+ _boxSize(this.suffixIcon).width
+ this.contentPadding.right));
_boxSize(this.icon).width
+ this.contentPadding.left
+ _boxSize(this.prefixIcon).width
+ _boxSize(this.prefix).width
+ _boxSize(this.suffix).width
+ _boxSize(this.suffixIcon).width
+ this.contentPadding.right));
if (this.label != null)
{
this.label.layout(boxConstraints, parentUsesSize: true);
if (this.label != null) {
if (this.decoration.alignLabelWithHint == true) {
layoutLineBox(this.label);
}
else {
this.label.layout(boxConstraints, parentUsesSize: true);
}
}
boxConstraints = boxConstraints.copyWith(minWidth: inputWidth);

boxConstraints = boxConstraints.copyWith(
maxWidth: Mathf.Max(0.0f, boxConstraints.maxWidth
- _boxSize(this.icon).width
- _boxSize(this.counter).width
- this.contentPadding.horizontal
- _boxSize(this.icon).width
- _boxSize(this.counter).width
- this.contentPadding.horizontal
)
);
layoutLineBox(this.helperError);

}
if (this.label != null) {
centerLayout(this.label, start);
if (this.decoration.alignLabelWithHint == true) {
baselineLayout(this.label, start);
}
else {
centerLayout(this.label, start);
}
}
if (this.prefix != null) {

if (this.counter != null) {
baselineLayout(this.counter, right - this.counter.size.width);
}
}
if (this.label != null) {

}
void _handleChange() {
this.setState(() => {
});
this.setState(() => { });
}
InputDecoration _effectiveDecoration;

}
Color _getFillColor(ThemeData themeData) {
if (this.decoration.filled != true)
{
if (this.decoration.filled != true) {
return Colors.transparent;
}

child: new Text(this.decoration.hintText,
style: hintStyle,
overflow: TextOverflow.ellipsis,
textAlign: this.textAlign
textAlign: this.textAlign,
maxLines: this.decoration.hintMaxLines
)
);

errorMaxLines: this.decoration.errorMaxLines
);
Widget counter = this.decoration.counterText == null
? null
: new Text(this.decoration.counterText,
Widget counter = null;
if (this.decoration.counter != null) {
counter = this.decoration.counter;
}
else if (this.decoration.counterText != null && this.decoration.counterText != "") {
counter = new Text(this.decoration.counterText,
}
EdgeInsets decorationContentPadding = this.decoration.contentPadding;
EdgeInsets contentPadding;

icon: icon,
input: this.widget.child,
label: label,
alignLabelWithHint: this.decoration.alignLabelWithHint,
hint: hint,
prefix: prefix,
suffix: suffix,

TextStyle helperStyle = null,
string hintText = null,
TextStyle hintStyle = null,
int? hintMaxLines = null,
string errorText = null,
TextStyle errorStyle = null,
int? errorMaxLines = null,

Widget suffix = null,
string suffixText = null,
TextStyle suffixStyle = null,
Widget counter = null,
string counterText = null,
TextStyle counterStyle = null,
bool? filled = null,

InputBorder disabledBorder = null,
InputBorder enabledBorder = null,
InputBorder border = null,
bool? enabled = true
bool? enabled = true,
bool? alignLabelWithHint = null
D.assert(!(prefix != null && prefixText != null), "Declaring both prefix and prefixText is not allowed");
D.assert(!(suffix != null && suffixText != null), "Declaring both suffix and suffixText is not allowed");
D.assert(!(prefix != null && prefixText != null), "Declaring both prefix and prefixText is not supported");
D.assert(!(suffix != null && suffixText != null), "Declaring both suffix and suffixText is not supported");
this.isCollapsed = false;
this.icon = icon;
this.labelText = labelText;

this.hintText = hintText;
this.hintStyle = hintStyle;
this.hintMaxLines = hintMaxLines;
this.errorText = errorText;
this.errorStyle = errorStyle;
this.errorMaxLines = errorMaxLines;

this.prefixStyle = prefixStyle;
this.suffixIcon = suffixIcon;
this.suffixStyle = suffixStyle;
this.counter = counter;
this.counterText = counterText;
this.counterStyle = counterStyle;
this.filled = filled;

this.enabledBorder = enabledBorder;
this.border = border;
this.enabled = enabled;
this.alignLabelWithHint = alignLabelWithHint;
}
public static InputDecoration collapsed(

labelStyle: null,
helperText: null,
helperStyle: null,
hintMaxLines: null,
errorText: null,
errorStyle: null,
errorMaxLines: null,

suffixIcon: null,
suffixText: null,
suffixStyle: null,
counter: null,
counterText: null,
counterStyle: null,
errorBorder: null,

filled: filled,
fillColor: fillColor,
border: border,
enabled: enabled
enabled: enabled,
alignLabelWithHint: false
);
decoration.isCollapsed = true;
return decoration;

public readonly string hintText;
public readonly TextStyle hintStyle;
public readonly int? hintMaxLines;
public readonly string errorText;

public readonly TextStyle suffixStyle;
public readonly Widget counter;
public readonly string counterText;
public readonly TextStyle counterStyle;

public readonly InputBorder border;
public readonly bool? enabled;
public readonly bool? alignLabelWithHint;
public InputDecoration copyWith(
Widget icon = null,

TextStyle helperStyle = null,
string hintText = null,
TextStyle hintStyle = null,
int? hintMaxLines = null,
string errorText = null,
TextStyle errorStyle = null,
int? errorMaxLines = null,

Widget suffix = null,
string suffixText = null,
TextStyle suffixStyle = null,
Widget counter = null,
string counterText = null,
TextStyle counterStyle = null,
bool? filled = null,

InputBorder disabledBorder = null,
InputBorder enabledBorder = null,
InputBorder border = null,
bool? enabled = null
bool? enabled = null,
bool? alignLabelWithHint = null
) {
return new InputDecoration(
icon: icon ?? this.icon,

helperStyle: helperStyle ?? this.helperStyle,
hintText: hintText ?? this.hintText,
hintStyle: hintStyle ?? this.hintStyle,
hintMaxLines: hintMaxLines ?? this.hintMaxLines,
errorText: errorText ?? this.errorText,
errorStyle: errorStyle ?? this.errorStyle,
errorMaxLines: errorMaxLines ?? this.errorMaxLines,

suffix: suffix ?? this.suffix,
suffixText: suffixText ?? this.suffixText,
suffixStyle: suffixStyle ?? this.suffixStyle,
counter: counter ?? this.counter,
counterText: counterText ?? this.counterText,
counterStyle: counterStyle ?? this.counterStyle,
filled: filled ?? this.filled,

disabledBorder: disabledBorder ?? this.disabledBorder,
enabledBorder: enabledBorder ?? this.enabledBorder,
border: border ?? this.border,
enabled: enabled ?? this.enabled
enabled: enabled ?? this.enabled,
alignLabelWithHint: alignLabelWithHint ?? this.alignLabelWithHint
);
}

focusedErrorBorder: this.focusedErrorBorder ?? theme.focusedErrorBorder,
disabledBorder: this.disabledBorder ?? theme.disabledBorder,
enabledBorder: this.enabledBorder ?? theme.enabledBorder,
border: this.border ?? theme.border
border: this.border ?? theme.border,
alignLabelWithHint: this.alignLabelWithHint ?? theme.alignLabelWithHint
);
}

}
public bool Equals(InputDecoration other) {
return other.icon == this.icon
&& other.labelText == this.labelText
&& other.labelStyle == this.labelStyle
&& other.helperText == this.helperText
&& other.helperStyle == this.helperStyle
&& other.hintText == this.hintText
&& other.hintStyle == this.hintStyle
&& other.errorText == this.errorText
&& other.errorStyle == this.errorStyle
&& other.errorMaxLines == this.errorMaxLines
&& other.hasFloatingPlaceholder == this.hasFloatingPlaceholder
&& other.isDense == this.isDense
&& other.contentPadding == this.contentPadding
&& other.isCollapsed == this.isCollapsed
&& other.prefixIcon == this.prefixIcon
&& other.prefix == this.prefix
&& other.prefixText == this.prefixText
&& other.prefixStyle == this.prefixStyle
&& other.suffixIcon == this.suffixIcon
&& other.suffix == this.suffix
&& other.suffixText == this.suffixText
&& other.suffixStyle == this.suffixStyle
&& other.counterText == this.counterText
&& other.counterStyle == this.counterStyle
&& other.filled == this.filled
&& other.fillColor == this.fillColor
&& other.errorBorder == this.errorBorder
&& other.focusedBorder == this.focusedBorder
&& other.focusedErrorBorder == this.focusedErrorBorder
&& other.disabledBorder == this.disabledBorder
&& other.enabledBorder == this.enabledBorder
&& other.border == this.border
&& other.enabled == this.enabled;
return Equals(other.icon, this.icon)
&& Equals(other.labelText, this.labelText)
&& Equals(other.labelStyle, this.labelStyle)
&& Equals(other.helperText, this.helperText)
&& Equals(other.helperStyle, this.helperStyle)
&& Equals(other.hintText, this.hintText)
&& Equals(other.hintStyle, this.hintStyle)
&& Equals(other.hintMaxLines, this.hintMaxLines)
&& Equals(other.errorText, this.errorText)
&& Equals(other.errorStyle, this.errorStyle)
&& Equals(other.errorMaxLines, this.errorMaxLines)
&& Equals(other.hasFloatingPlaceholder, this.hasFloatingPlaceholder)
&& Equals(other.isDense, this.isDense)
&& Equals(other.contentPadding, this.contentPadding)
&& Equals(other.isCollapsed, this.isCollapsed)
&& Equals(other.prefixIcon, this.prefixIcon)
&& Equals(other.prefix, this.prefix)
&& Equals(other.prefixText, this.prefixText)
&& Equals(other.prefixStyle, this.prefixStyle)
&& Equals(other.suffixIcon, this.suffixIcon)
&& Equals(other.suffix, this.suffix)
&& Equals(other.suffixText, this.suffixText)
&& Equals(other.suffixStyle, this.suffixStyle)
&& Equals(other.counter, this.counter)
&& Equals(other.counterText, this.counterText)
&& Equals(other.counterStyle, this.counterStyle)
&& Equals(other.filled, this.filled)
&& Equals(other.fillColor, this.fillColor)
&& Equals(other.errorBorder, this.errorBorder)
&& Equals(other.focusedBorder, this.focusedBorder)
&& Equals(other.focusedErrorBorder, this.focusedErrorBorder)
&& Equals(other.disabledBorder, this.disabledBorder)
&& Equals(other.enabledBorder, this.enabledBorder)
&& Equals(other.border, this.border)
&& Equals(other.enabled, this.enabled)
&& Equals(other.alignLabelWithHint, this.alignLabelWithHint);
return this.Equals((InputDecoration) obj);
}

hashCode = (hashCode * 397) ^ this.helperStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.hintText.GetHashCode();
hashCode = (hashCode * 397) ^ this.hintStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.hintMaxLines.GetHashCode();
hashCode = (hashCode * 397) ^ this.errorText.GetHashCode();
hashCode = (hashCode * 397) ^ this.errorStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.errorMaxLines.GetHashCode();

hashCode = (hashCode * 397) ^ this.suffix.GetHashCode();
hashCode = (hashCode * 397) ^ this.suffixText.GetHashCode();
hashCode = (hashCode * 397) ^ this.suffixStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.counter.GetHashCode();
hashCode = (hashCode * 397) ^ this.counterText.GetHashCode();
hashCode = (hashCode * 397) ^ this.counterStyle.GetHashCode();
hashCode = (hashCode * 397) ^ this.filled.GetHashCode();

hashCode = (hashCode * 397) ^ this.enabledBorder.GetHashCode();
hashCode = (hashCode * 397) ^ this.border.GetHashCode();
hashCode = (hashCode * 397) ^ this.enabled.GetHashCode();
hashCode = (hashCode * 397) ^ this.alignLabelWithHint.GetHashCode();
return hashCode;
}
}

if (this.helperText != null) {
description.Add($"helperText: ${this.helperText}");
}
if (this.hintMaxLines != null) {
description.Add($"hintMaxLines: ${this.hintMaxLines}");
}
if (this.hintText != null) {

description.Add($"suffixStyle: ${this.suffixStyle}");
}
if (this.counter != null) {
description.Add($"counter: ${this.counter}");
}
if (this.counterText != null) {
description.Add($"counterText: ${this.counterText}");
}

description.Add("enabled: false");
}
if (this.alignLabelWithHint != null) {
description.Add($"alignLabelWithHint: {this.alignLabelWithHint}");
}
return $"InputDecoration(${string.Join(", ", description)})";
}
}

InputBorder focusedErrorBorder = null,
InputBorder disabledBorder = null,
InputBorder enabledBorder = null,
InputBorder border = null
InputBorder border = null,
bool alignLabelWithHint = false
) {
D.assert(isDense != null);
D.assert(isCollapsed != null);

this.disabledBorder = disabledBorder;
this.enabledBorder = enabledBorder;
this.border = border;
this.alignLabelWithHint = alignLabelWithHint;
}
public readonly TextStyle labelStyle;

public readonly InputBorder border;
public readonly bool alignLabelWithHint;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
InputDecorationTheme defaultTheme = new InputDecorationTheme();

defaultValue: defaultTheme.errorBorder));
properties.add(new DiagnosticsProperty<InputBorder>("focusedBorder", this.focusedBorder,
defaultValue: defaultTheme.focusedErrorBorder));
properties.add(new DiagnosticsProperty<InputBorder>("focusedErrorborder", this.focusedErrorBorder,
properties.add(new DiagnosticsProperty<InputBorder>("focusedErrorBorder", this.focusedErrorBorder,
defaultValue: defaultTheme.focusedErrorBorder));
properties.add(new DiagnosticsProperty<InputBorder>("disabledBorder", this.disabledBorder,
defaultValue: defaultTheme.disabledBorder));

new DiagnosticsProperty<InputBorder>("border", this.border, defaultValue: defaultTheme.border));
properties.add(new DiagnosticsProperty<bool>("alignLabelWithHint", this.alignLabelWithHint,
defaultValue: defaultTheme.alignLabelWithHint));
}
}
}

19
Runtime/material/list_tile.cs


D.assert(isOneLine);
}
float defaultTileHeight = this._defaultTileHeight;
tileHeight = Mathf.Max(this._defaultTileHeight, titleSize.height + 2.0f * _minVerticalPadding);
tileHeight = Mathf.Max(defaultTileHeight, titleSize.height + 2.0f * _minVerticalPadding);
titleY = (tileHeight - titleSize.height) / 2.0f;
}
else {

_boxBaseline(this.subtitle, this.subtitleBaselineType ?? TextBaseline.alphabetic);
tileHeight = this._defaultTileHeight;
tileHeight = defaultTileHeight;
float titleOverlap = titleY + titleSize.height - subtitleY;
if (titleOverlap > 0.0f) {

}
}
float leadingY = (tileHeight - leadingSize.height) / 2.0f;
float trailingY = (tileHeight - trailingSize.height) / 2.0f;
float leadingY;
float trailingY;
if (tileHeight > 72.0f) {
leadingY = 16.0f;
trailingY = 16.0f;
}
else {
leadingY = Mathf.Min((tileHeight - leadingSize.height) / 2.0f, 16.0f);
trailingY = (tileHeight - trailingSize.height) / 2.0f;
}
if (hasLeading) {
_positionBox(this.leading, new Offset(0.0f, leadingY));

31
Runtime/material/material.cs


TextStyle textStyle = null,
BorderRadius borderRadius = null,
ShapeBorder shape = null,
bool borderOnForeground = true,
D.assert(elevation >= 0.0f);
D.assert(!(shape != null && borderRadius != null));
D.assert(!(type == MaterialType.circle && (borderRadius != null || shape != null)));

this.textStyle = textStyle;
this.borderRadius = borderRadius;
this.shape = shape;
this.borderOnForeground = borderOnForeground;
this.clipBehavior = clipBehavior;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.child = child;

public readonly ShapeBorder shape;
public readonly bool borderOnForeground;
public readonly Clip clipBehavior;
public readonly TimeSpan animationDuration;

defaultValue: new Color(0xFF000000)));
this.textStyle?.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: null));
properties.add(new EnumProperty<BorderRadius>("borderRadius", this.borderRadius, defaultValue: null));
properties.add(new DiagnosticsProperty<bool>("borderOnForeground", this.borderOnForeground,
defaultValue: null));
properties.add(
new DiagnosticsProperty<BorderRadius>("borderRadius", this.borderRadius, defaultValue: null));
}
public const float defaultSplashRadius = 35.0f;

if (this.widget.type == MaterialType.transparency) {
return _transparentInterior(
context: context,
shape: shape,
clipBehavior: this.widget.clipBehavior,
contents: contents);

curve: Curves.fastOutSlowIn,
duration: this.widget.animationDuration,
shape: shape,
borderOnForeground: this.widget.borderOnForeground,
clipBehavior: this.widget.clipBehavior,
elevation: this.widget.elevation,
color: backgroundColor,

static Widget _transparentInterior(
BuildContext context = null,
ShapeBorder shape = null,
Clip? clipBehavior = null,
Widget contents = null) {

Key key = null,
Widget child = null,
ShapeBorder shape = null,
bool borderOnForeground = true,
Clip clipBehavior = Clip.none,
float? elevation = null,
Color color = null,

) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(child != null);
D.assert(shape != null);
D.assert(elevation != null);
D.assert(elevation != null && elevation >= 0.0f);
this.borderOnForeground = borderOnForeground;
this.clipBehavior = clipBehavior;
this.elevation = elevation ?? 0.0f;
this.color = color;

public readonly Widget child;
public readonly ShapeBorder shape;
public readonly bool borderOnForeground;
public readonly Clip clipBehavior;

return new PhysicalShape(
child: new _ShapeBorderPaint(
child: this.widget.child,
shape: shape),
shape: shape,
borderOnForeground: this.widget.borderOnForeground),
clipper: new ShapeBorderClipper(
shape: shape),
clipBehavior: this.widget.clipBehavior,

class _ShapeBorderPaint : StatelessWidget {
public _ShapeBorderPaint(
Widget child = null,
ShapeBorder shape = null) {
ShapeBorder shape = null,
bool borderOnForeground = true) {
this.borderOnForeground = borderOnForeground;
public readonly bool borderOnForeground;
foregroundPainter: new _ShapeBorderPainter(this.shape));
painter: this.borderOnForeground ? null : new _ShapeBorderPainter(this.shape),
foregroundPainter: this.borderOnForeground ? new _ShapeBorderPainter(this.shape) : null);
}
}

1
Runtime/material/material_button.cs


return new RawMaterialButton(
onPressed: this.onPressed,
onHighlightChanged: this.onHighlightChanged,
fillColor: this.color,
textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
highlightColor: this.highlightColor ?? theme.highlightColor,

72
Runtime/material/outline_button.cs


);
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {
_OutlineButton oldWidget = _oldWidget as _OutlineButton;
base.didUpdateWidget(oldWidget);
if (this._pressed && !this.widget.enabled) {
this._pressed = false;
this._controller.reverse();
}
}
void _handleHighlightChanged(bool value) {
if (this._pressed == value) {
return;
}
this.setState(() => {
this._pressed = value;
if (value) {
this._controller.forward();
}
else {
this._controller.reverse();
}
});
}
public override void dispose() {
this._controller.dispose();
base.dispose();

bool themeIsDark = this.widget.brightness == Brightness.dark;
Color color = this.widget.color ?? (themeIsDark
? new Color(0x00000000)
: new Color(0x00FFFFFF));
if (this.widget.highlightElevation == null || this.widget.highlightElevation == 0.0) {
return Colors.transparent;
}
Color color = this.widget.color ?? Theme.of(this.context).canvasColor;
ColorTween colorTween = new ColorTween(
begin: color.withAlpha(0x00),
end: color.withAlpha(0xFF)

BorderSide _getOutline() {
bool isDark = this.widget.brightness == Brightness.dark;
Color color = this.widget.enabled
? (this._pressed
? this.widget.highlightedBorderColor
: (this.widget.borderSide?.color ??
(isDark ? Colors.grey[600] : Colors.grey[200])))
: (this.widget.disabledBorderColor ??
(isDark ? Colors.grey[800] : Colors.grey[100]));
Color specifiedColor = this.widget.enabled
? (this._pressed ? this.widget.highlightedBorderColor : null) ?? this.widget.borderSide?.color
: this.widget.disabledBorderColor;
Color themeColor = Theme.of(this.context).colorScheme.onSurface.withOpacity(0.12f);
color: color,
width: this.widget.borderSide?.width ?? 2.0f
color: specifiedColor ?? themeColor,
width: this.widget.borderSide?.width ?? 1.0f
if (this.widget.highlightElevation == null || this.widget.highlightElevation == 0.0f) {
return 0.0f;
}
return new FloatTween(
begin: 0.0f,
end: this.widget.highlightElevation ?? 2.0f

elevation: 0.0f,
disabledElevation: 0.0f,
highlightElevation: this._getHighlightElevation(),
onHighlightChanged: (bool value) => {
this.setState(() => {
this._pressed = value;
if (value) {
this._controller.forward();
}
else {
this._controller.reverse();
}
});
},
onHighlightChanged: this._handleHighlightChanged,
padding:
this.widget.padding,
shape: new _OutlineBorder(

public bool Equals(_OutlineBorder other) {
return this.side == other.side && this.shape == other.shape;
}
return this.Equals((_OutlineBorder) obj);
}

118
Runtime/material/page_transitions_theme.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

}
}
class _OpenUpwardsPageTransition : StatelessWidget {
public _OpenUpwardsPageTransition(
Key key = null,
Animation<float> animation = null,
Animation<float> secondaryAnimation = null,
Widget child = null
) : base(key: key) {
this.animation = animation;
this.secondaryAnimation = secondaryAnimation;
this.child = child;
}
static readonly OffsetTween _primaryTranslationTween = new OffsetTween(
begin: new Offset(0.0f, 0.05f),
end: Offset.zero
);
static readonly OffsetTween _secondaryTranslationTween = new OffsetTween(
begin: Offset.zero,
end: new Offset(0.0f, -0.025f)
);
static readonly FloatTween _scrimOpacityTween = new FloatTween(
begin: 0.0f,
end: 0.25f
);
static readonly Curve _transitionCurve = new Cubic(0.20f, 0.00f, 0.00f, 1.00f);
public readonly Animation<float> animation;
public readonly Animation<float> secondaryAnimation;
public readonly Widget child;
public override Widget build(BuildContext context) {
return new LayoutBuilder(
builder: (BuildContext _context, BoxConstraints constraints) => {
Size size = constraints.biggest;
CurvedAnimation primaryAnimation = new CurvedAnimation(
parent: this.animation,
curve: _transitionCurve,
reverseCurve: _transitionCurve.flipped
);
Animation<float> clipAnimation = new FloatTween(
begin: 0.0f,
end: size.height
).animate(primaryAnimation);
Animation<float> opacityAnimation = _scrimOpacityTween.animate(primaryAnimation);
Animation<Offset> primaryTranslationAnimation = _primaryTranslationTween.animate(primaryAnimation);
Animation<Offset> secondaryTranslationAnimation = _secondaryTranslationTween.animate(
new CurvedAnimation(
parent: this.secondaryAnimation,
curve: _transitionCurve,
reverseCurve: _transitionCurve.flipped
)
);
return new AnimatedBuilder(
animation: this.animation,
builder: (BuildContext _, Widget child) => {
return new Container(
color: Colors.black.withOpacity(opacityAnimation.value),
alignment: Alignment.bottomLeft,
child: new ClipRect(
child: new SizedBox(
height: clipAnimation.value,
child: new OverflowBox(
alignment: Alignment.bottomLeft,
maxHeight: size.height,
child: child
)
)
)
);
},
child: new AnimatedBuilder(
animation: this.secondaryAnimation,
child: new FractionalTranslation(
translation: primaryTranslationAnimation.value,
child: this.child
),
builder: (BuildContext _, Widget child) => {
return new FractionalTranslation(
translation: secondaryTranslationAnimation.value,
child: child
);
}
)
);
}
);
}
}
public abstract class PageTransitionsBuilder {
public PageTransitionsBuilder() {
}

return new _FadeUpwardsPageTransition(
routeAnimation: animation,
child: child);
}
}
public class OpenUpwardsPageTransitionsBuilder : PageTransitionsBuilder {
public OpenUpwardsPageTransitionsBuilder() {
}
public override Widget buildTransitions(
PageRoute route,
BuildContext context,
Animation<float> animation,
Animation<float> secondaryAnimation,
Widget child
) {
return new _OpenUpwardsPageTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child
);
}
}

50
Runtime/material/reorderable_list.cs


List<Widget> children = null,
ReorderCallback onReorder = null,
Axis scrollDirection = Axis.vertical,
EdgeInsets padding = null
EdgeInsets padding = null,
bool reverse = false
) {
D.assert(onReorder != null);
D.assert(children != null);

this.scrollDirection = scrollDirection;
this.padding = padding;
this.onReorder = onReorder;
this.reverse = reverse;
}
public readonly Widget header;

public readonly ReorderCallback onReorder;
public readonly bool reverse;
public override State createState() {
return new _ReorderableListViewState();
}

children: this.widget.children,
scrollDirection: this.widget.scrollDirection,
onReorder: this.widget.onReorder,
padding: this.widget.padding
padding: this.widget.padding,
reverse: this.widget.reverse
);
}
);

List<Widget> children,
Axis scrollDirection,
EdgeInsets padding,
ReorderCallback onReorder
ReorderCallback onReorder,
bool? reverse = null
) {
this.header = header;
this.children = children;

this.reverse = reverse;
}
public readonly Widget header;

public readonly ReorderCallback onReorder;
public readonly bool? reverse;
public override State createState() {
return new _ReorderableListContentState();

Widget _wrap(Widget toWrap, int index, BoxConstraints constraints) {
D.assert(toWrap.key != null);
GlobalObjectKey<State<_ReorderableListContent>> keyIndexGlobalKey = new GlobalObjectKey<State<_ReorderableListContent>>(toWrap.key);
GlobalObjectKey<State<_ReorderableListContent>> keyIndexGlobalKey =
new GlobalObjectKey<State<_ReorderableListContent>>(toWrap.key);
void onDragStarted() {
this.setState(() => {

void onDragEnded() {
reorder(this._dragStartIndex, this._currentIndex);
}
return new KeyedSubtree(
key: keyIndexGlobalKey,
child: toWrap
);
return new KeyedSubtree(
key: keyIndexGlobalKey,
child: toWrap
);
}
Widget buildDragTarget(BuildContext context, List<Key> acceptedCandidates, List<Key> rejectedCandidates) {

break;
}
wrappedChildren.Add(this._wrap(
finalDropArea, this.widget.children.Count,
constraints)
);
if (this.widget.reverse == true) {
wrappedChildren.Insert(0, this._wrap(
finalDropArea,
this.widget.children.Count,
constraints)
);
}
else {
wrappedChildren.Add(this._wrap(
finalDropArea, this.widget.children.Count,
constraints)
);
}
controller: this._scrollController
controller: this._scrollController,
reverse: this.widget.reverse == true
);
});
}

88
Runtime/material/scaffold.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

float floatingActionButtonMoveAnimationProgress,
FloatingActionButtonAnimator floatingActionButtonMotionAnimator
) {
D.assert(minInsets != null);
D.assert(geometryNotifier != null);
D.assert(previousFloatingActionButtonLocation != null);
D.assert(currentFloatingActionButtonLocation != null);

Widget bottomNavigationBar = null,
Widget bottomSheet = null,
Color backgroundColor = null,
bool resizeToAvoidBottomPadding = true,
bool primary = true
bool? resizeToAvoidBottomPadding = null,
bool? resizeToAvoidBottomInset = null,
bool primary = true,
DragStartBehavior drawerDragStartBehavior = DragStartBehavior.down
) : base(key: key) {
this.appBar = appBar;
this.body = body;

this.bottomSheet = bottomSheet;
this.backgroundColor = backgroundColor;
this.resizeToAvoidBottomPadding = resizeToAvoidBottomPadding;
this.resizeToAvoidBottomInset = resizeToAvoidBottomInset;
this.drawerDragStartBehavior = drawerDragStartBehavior;
}
public readonly PreferredSizeWidget appBar;

public readonly Widget bottomSheet;
public readonly bool resizeToAvoidBottomPadding;
public readonly bool? resizeToAvoidBottomPadding;
public readonly bool? resizeToAvoidBottomInset;
public readonly DragStartBehavior drawerDragStartBehavior;
public static ScaffoldState of(BuildContext context, bool nullOk = false) {
D.assert(context != null);

// INTERNALS
_ScaffoldGeometryNotifier _geometryNotifier;
bool _resizeToAvoidBottomInset {
get { return this.widget.resizeToAvoidBottomInset ?? this.widget.resizeToAvoidBottomPadding ?? true; }
}
public override void initState() {
base.initState();

bool removeLeftPadding,
bool removeTopPadding,
bool removeRightPadding,
bool removeBottomPadding
bool removeBottomPadding,
bool removeBottomInset = false
MediaQueryData data = MediaQuery.of(this.context).removePadding(
removeLeft: removeLeftPadding,
removeTop: removeTopPadding,
removeRight: removeRightPadding,
removeBottom: removeBottomPadding
);
if (removeBottomInset) {
data = data.removeViewInsets(removeBottom: true);
}
child: MediaQuery.removePadding(
context: this.context,
removeLeft: removeLeftPadding,
removeTop: removeTopPadding,
removeRight: removeRightPadding,
removeBottom: removeBottomPadding,
child: child
)
child: new MediaQuery(data: data, child: child)
)
);
}

key: this._endDrawerKey,
alignment: DrawerAlignment.end,
child: this.widget.endDrawer,
drawerCallback: this._endDrawerOpenedCallback
drawerCallback: this._endDrawerOpenedCallback,
dragStartBehavior: this.widget.drawerDragStartBehavior
),
childId: _ScaffoldSlot.endDrawer,
removeLeftPadding: true,

key: this._drawerKey,
alignment: DrawerAlignment.start,
child: this.widget.drawer,
drawerCallback: this._drawerOpenedCallback
drawerCallback: this._drawerOpenedCallback,
dragStartBehavior: this.widget.drawerDragStartBehavior
),
childId: _ScaffoldSlot.drawer,
removeLeftPadding: false,

removeTopPadding: this.widget.appBar != null,
removeRightPadding: false,
removeBottomPadding: this.widget.bottomNavigationBar != null ||
this.widget.persistentFooterButtons != null
this.widget.persistentFooterButtons != null,
removeBottomInset: this._resizeToAvoidBottomInset
);
if (this.widget.appBar != null) {

}
if (this._snackBars.isNotEmpty()) {
bool removeBottomPadding = this.widget.persistentFooterButtons != null ||
this.widget.bottomNavigationBar != null;
this._addIfNonNull(
children: children,
child: this._snackBars.First()._widget,

removeRightPadding: false,
removeBottomPadding: removeBottomPadding
removeBottomPadding: this.widget.bottomNavigationBar != null ||
this.widget.persistentFooterButtons != null
);
}

removeLeftPadding: false,
removeTopPadding: true,
removeRightPadding: false,
removeBottomPadding: this.widget.resizeToAvoidBottomPadding
removeBottomPadding: this._resizeToAvoidBottomInset
);
}

removeBottomPadding: true
);
if (themeData.platform == RuntimePlatform.IPhonePlayer) {
this._addIfNonNull(
children: children,
new GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: this._handleStatusBarTap
),
childId: _ScaffoldSlot.statusBar,
removeLeftPadding: false,
removeTopPadding: true,
removeRightPadding: false,
removeBottomPadding: true
);
switch (themeData.platform) {
case RuntimePlatform.IPhonePlayer:
this._addIfNonNull(
children: children,
new GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: this._handleStatusBarTap
),
childId: _ScaffoldSlot.statusBar,
removeLeftPadding: false,
removeTopPadding: true,
removeRightPadding: false,
removeBottomPadding: true
);
break;
}
if (this._endDrawerOpened) {

}
EdgeInsets minInsets = mediaQuery.padding.copyWith(
bottom: this.widget.resizeToAvoidBottomPadding ? mediaQuery.viewInsets.bottom : 0.0f
bottom: this._resizeToAvoidBottomInset ? mediaQuery.viewInsets.bottom : 0.0f
);
return new _ScaffoldScope(

75
Runtime/material/switch.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;

Color inactiveTrackColor = null,
ImageProvider activeThumbImage = null,
ImageProvider inactiveThumbImage = null,
MaterialTapTargetSize? materialTapTargetSize = null
MaterialTapTargetSize? materialTapTargetSize = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : this(
key: key,
value: value,

activeThumbImage: activeThumbImage,
inactiveThumbImage: inactiveThumbImage,
materialTapTargetSize: materialTapTargetSize,
switchType: _SwitchType.material
switchType: _SwitchType.material,
dragStartBehavior: dragStartBehavior
) {
}

ImageProvider activeThumbImage = null,
ImageProvider inactiveThumbImage = null,
MaterialTapTargetSize? materialTapTargetSize = null,
_SwitchType switchType = _SwitchType.material
_SwitchType switchType = _SwitchType.material,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
D.assert(value != null);
this.value = value.Value;

this.inactiveThumbImage = inactiveThumbImage;
this.materialTapTargetSize = materialTapTargetSize;
this._switchType = switchType;
this.dragStartBehavior = dragStartBehavior;
}
public static Switch adaptive(

Color inactiveTrackColor = null,
ImageProvider activeThumbImage = null,
ImageProvider inactiveThumbImage = null,
MaterialTapTargetSize? materialTapTargetSize = null
MaterialTapTargetSize? materialTapTargetSize = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) {
return new Switch(key: key,
value: value,

internal readonly _SwitchType _switchType;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _SwitchState();
}

properties.add(new FlagProperty("value", value: this.value, ifTrue: "on", ifFalse: "off", showName: true));
properties.add(new ObjectFlagProperty<ValueChanged<bool?>>("onChanged", this.onChanged, ifNull: "disabled"));
properties.add(
new ObjectFlagProperty<ValueChanged<bool?>>("onChanged", this.onChanged, ifNull: "disabled"));
}
}

case MaterialTapTargetSize.shrinkWrap:
return new Size(Switch._kSwitchWidth, Switch._kSwitchHeightCollapsed);
}
D.assert(false);
return null;
}

inactiveThumbColor = this.widget.inactiveThumbColor ??
(isDark ? Colors.grey.shade400 : Colors.grey.shade50);
inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white30 : black32);
} else {
}
else {
inactiveThumbColor = this.widget.inactiveThumbColor ??
(isDark ? Colors.grey.shade800 : Colors.grey.shade400);
inactiveTrackColor = this.widget.inactiveTrackColor ?? (isDark ? Colors.white10 : Colors.black12);

dragStartBehavior: this.widget.dragStartBehavior,
value: this.widget.value,
activeColor: activeThumbColor,
inactiveColor: inactiveThumbColor,

ImageConfiguration configuration = null,
ValueChanged<bool?> onChanged = null,
TickerProvider vsync = null,
BoxConstraints additionalConstraints = null
BoxConstraints additionalConstraints = null,
DragStartBehavior? dragStartBehavior = null
) : base(key: key) {
D.assert(value != null);
this.value = value.Value;

this.onChanged = onChanged;
this.vsync = vsync;
this.additionalConstraints = additionalConstraints;
this.dragStartBehavior = dragStartBehavior;
}
public readonly bool value;

public readonly ValueChanged<bool?> onChanged;
public readonly TickerProvider vsync;
public readonly BoxConstraints additionalConstraints;
public readonly DragStartBehavior? dragStartBehavior;
dragStartBehavior: this.dragStartBehavior,
value: this.value,
activeColor: this.activeColor,
inactiveColor: this.inactiveColor,

renderObject.configuration = this.configuration;
renderObject.onChanged = this.onChanged;
renderObject.additionalConstraints = this.additionalConstraints;
renderObject.dragStartBehavior = this.dragStartBehavior;
renderObject.vsync = this.vsync;
}
}

ImageConfiguration configuration = null,
BoxConstraints additionalConstraints = null,
ValueChanged<bool?> onChanged = null,
TickerProvider vsync = null
TickerProvider vsync = null,
DragStartBehavior? dragStartBehavior = null
) : base(
value: value,
tristate: false,

onStart = this._handleDragStart,
onUpdate = this._handleDragUpdate,
onEnd = this._handleDragEnd,
dragStartBehavior = dragStartBehavior ?? DragStartBehavior.down
};
}

if (value == this._activeThumbImage) {
return;
}
this._activeThumbImage = value;
this.markNeedsPaint();
}

if (value == this._inactiveThumbImage) {
return;
}
this._inactiveThumbImage = value;
this.markNeedsPaint();
}

if (value == this._activeTrackColor) {
return;
}
this._activeTrackColor = value;
this.markNeedsPaint();
}

if (value == this._inactiveTrackColor) {
return;
}
this._inactiveTrackColor = value;
this.markNeedsPaint();
}

if (value == this._configuration) {
return;
}
this._configuration = value;
this.markNeedsPaint();
}

public DragStartBehavior? dragStartBehavior {
get { return this._drag.dragStartBehavior; }
set { this._drag.dragStartBehavior = value ?? DragStartBehavior.down; }
}
public override void detach() {
this._cachedThumbPainter?.Dispose();

void _handleDragEnd(DragEndDetails details) {
if (this.position.value >= 0.5) {
this.positionController.forward();
} else {
}
else {
this.reactionController.reverse();
}

this._drag.addPointer((PointerDownEvent) evt);
}
base.handleEvent(evt, entry);
}

public override void paint(PaintingContext context, Offset offset) {
Canvas canvas = context.canvas;
bool isActive = this.onChanged != null;
bool isEnabled = this.onChanged != null;
Color trackColor = isActive
Color trackColor = isEnabled
Color thumbColor = isEnabled
? Color.lerp(this.inactiveColor, this.activeColor, currentValue)
: this.inactiveColor;
ImageProvider thumbImage = isEnabled
? (currentValue < 0.5 ? this.inactiveThumbImage : this.activeThumbImage)
: this.inactiveThumbImage;
// Paint the track
Paint paint = new Paint {color = trackColor};
float trackHorizontalPadding = Constants.kRadialReactionRadius - Switch._kTrackRadius;

try {
this._isPainting = true;
BoxPainter thumbPainter;
Color thumbColor = isActive
? Color.lerp(this.inactiveColor, this.activeColor, currentValue)
: this.inactiveColor;
ImageProvider thumbImage = isActive
? (currentValue < 0.5 ? this.inactiveThumbImage : this.activeThumbImage)
: this.inactiveThumbImage;
if (this._cachedThumbPainter == null || thumbColor != this._cachedThumbColor ||
thumbImage != this._cachedThumbImage) {
this._cachedThumbColor = thumbColor;

}
thumbPainter = this._cachedThumbPainter;
float inset = 1.0f - (currentValue - 0.5f).abs() * 2.0f;

thumbPosition + offset - new Offset(radius, radius),
this.configuration.copyWith(size: Size.fromRadius(radius))
);
} finally {
}
finally {
}
}

26
Runtime/material/tab_bar_theme.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class TabBarTheme : Diagnosticable, IEquatable<TabBarTheme> {

Color labelColor = null,
Color unselectedLabelColor = null) {
TextStyle labelStyle = null,
Color unselectedLabelColor = null,
TextStyle unselectedLabelStyle = null) {
this.labelStyle = labelStyle;
this.unselectedLabelStyle = unselectedLabelStyle;
}
public readonly Decoration indicator;

public readonly Color labelColor;
public readonly TextStyle labelStyle;
public readonly TextStyle unselectedLabelStyle;
Color unselectedLabelColor = null
TextStyle labelStyle = null,
Color unselectedLabelColor = null,
TextStyle unselectedLabelStyle = null
unselectedLabelColor: unselectedLabelColor ?? this.unselectedLabelColor);
labelStyle: labelStyle ?? this.labelStyle,
unselectedLabelColor: unselectedLabelColor ?? this.unselectedLabelColor,
unselectedLabelStyle: unselectedLabelStyle ?? this.unselectedLabelStyle);
}
public static TabBarTheme of(BuildContext context) {

indicator: Decoration.lerp(a.indicator, b.indicator, t),
indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
labelColor: Color.lerp(a.labelColor, b.labelColor, t),
unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t)
labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),
unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t)
);
}

hashCode = (hashCode * 397) ^ (this.indicatorSize != null ? this.indicatorSize.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.labelColor != null ? this.labelColor.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.labelStyle != null ? this.labelStyle.GetHashCode() : 0);
hashCode = (hashCode * 397) ^
(this.unselectedLabelStyle != null ? this.unselectedLabelStyle.GetHashCode() : 0);
return hashCode;
}
}

44
Runtime/material/tabs.cs


using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

height = TabsUtils._kTabHeight;
label = this._buildLabelText();
}
else if (this.text == null) {
else if (this.text == null && this.child == null) {
height = TabsUtils._kTabHeight;
label = this.icon;
}

ThemeData themeData = Theme.of(context);
TabBarTheme tabBarTheme = TabBarTheme.of(context);
TextStyle defaultStyle = this.labelStyle ?? themeData.primaryTextTheme.body2;
TextStyle defaultUnselectedStyle =
this.unselectedLabelStyle ?? this.labelStyle ?? themeData.primaryTextTheme.body2;
TextStyle defaultStyle = this.labelStyle ?? tabBarTheme.labelStyle ?? themeData.primaryTextTheme.body2;
TextStyle defaultUnselectedStyle = this.unselectedLabelStyle
?? tabBarTheme.unselectedLabelStyle
?? this.labelStyle ?? themeData.primaryTextTheme.body2;
Animation<float> animation = (Animation<float>) this.listenable;
TextStyle textStyle = this.selected
? TextStyle.lerp(defaultStyle, defaultUnselectedStyle, animation.value)

}
public readonly _TabBarState tabBar;
bool _initialViewportDimensionWasZero;
if (!this.havePixels) {
this.correctPixels(this.tabBar._initialScrollOffset(this.viewportDimension, minScrollExtent, maxScrollExtent));
if (this._initialViewportDimensionWasZero != true) {
this._initialViewportDimensionWasZero = this.viewportDimension != 0.0;
this.correctPixels(this.tabBar._initialScrollOffset(this.viewportDimension, minScrollExtent,
maxScrollExtent));
return base.applyContentDimensions(minScrollExtent, maxScrollExtent) && result;
}
}

TextStyle labelStyle = null,
EdgeInsets labelPadding = null,
Color unselectedLabelColor = null,
TextStyle unselectedLabelStyle = null
TextStyle unselectedLabelStyle = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
ValueChanged<int> onTap = null
) : base(key: key) {
indicatorPadding = indicatorPadding ?? EdgeInsets.zero;
D.assert(tabs != null);

this.labelPadding = labelPadding;
this.unselectedLabelColor = unselectedLabelColor;
this.unselectedLabelStyle = unselectedLabelStyle;
this.dragStartBehavior = dragStartBehavior;
this.onTap = onTap;
}
public readonly List<Widget> tabs;

public readonly TextStyle unselectedLabelStyle;
public readonly DragStartBehavior dragStartBehavior;
public readonly ValueChanged<int> onTap;
public override Size preferredSize {
get {
foreach (Widget item in this.tabs) {

}
Color color = this.widget.indicatorColor ?? Theme.of(this.context).indicatorColor;
if (color.value == Material.of(this.context).color.value) {
if (color.value == Material.of(this.context).color?.value) {
color = Colors.white;
}

void _handleTap(int index) {
D.assert(index >= 0 && index < this.widget.tabs.Count);
this._controller.animateTo(index);
if (this.widget.onTap != null) {
this.widget.onTap(index);
}
}
Widget _buildStyledTab(Widget child, bool selected, Animation<float> animation) {

if (this.widget.isScrollable) {
this._scrollController = this._scrollController ?? new _TabBarScrollController(this);
tabBar = new SingleChildScrollView(
dragStartBehavior: this.widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
controller: this._scrollController,
child: tabBar);

Key key = null,
List<Widget> children = null,
TabController controller = null,
ScrollPhysics physics = null
ScrollPhysics physics = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
this.dragStartBehavior = dragStartBehavior;
}
public readonly TabController controller;

public readonly ScrollPhysics physics;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _TabBarViewState();

return new NotificationListener<ScrollNotification>(
onNotification: this._handleScrollNotification,
child: new PageView(
dragStartBehavior: this.widget.dragStartBehavior,
controller: this._pageController,
physics: this.widget.physics == null
? TabsUtils._kTabBarViewPhysics

147
Runtime/material/text_field.cs


using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
public delegate Widget InputCounterWidgetBuilder(
BuildContext buildContext,
int? currentLength,
int? maxLength,
bool? isFocused);
public class TextField : StatefulWidget {
public TextField(Key key = null, TextEditingController controller = null, FocusNode focusNode = null,
InputDecoration decoration = null, bool noDecoration = false, TextInputType keyboardType = null,

ValueChanged<string> onSubmitted = null, List<TextInputFormatter> inputFormatters = null,
bool? enabled = null, float? cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null,
Brightness? keyboardAppearance = null, EdgeInsets scrollPadding = null,
bool enableInteractiveSelection = true,
GestureTapCallback onTap = null
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
bool? enableInteractiveSelection = null,
GestureTapCallback onTap = null,
InputCounterWidgetBuilder buildCounter = null
D.assert(maxLength == null || maxLength > 0);
D.assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0);
this.controller = controller;
this.focusNode = focusNode;

this.onTap = onTap;
this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f);
this.dragStartBehavior = dragStartBehavior;
this.buildCounter = buildCounter;
}
public readonly TextEditingController controller;

public readonly bool autocorrect;
public readonly int? maxLines;
public const long noMaxLength = 9007199254740992; // math.pow(2, 53);
public const long noMaxLength = -1;
public readonly int? maxLength;

public readonly EdgeInsets scrollPadding;
public readonly bool enableInteractiveSelection;
public readonly bool? enableInteractiveSelection;
public readonly DragStartBehavior dragStartBehavior;
public bool selectionEnabled {
get {
return this.enableInteractiveSelection ?? !this.obscureText;
}
}
public readonly InputCounterWidgetBuilder buildCounter;
public override State createState() {
return new _TextFieldState();

new DiagnosticsProperty<TextEditingController>("controller", this.controller, defaultValue: null));
properties.add(new DiagnosticsProperty<FocusNode>("focusNode", this.focusNode, defaultValue: null));
properties.add(new DiagnosticsProperty<bool?>("enabled", this.enabled, defaultValue: null));
properties.add(new DiagnosticsProperty<InputDecoration>("decoration", this.decoration));
properties.add(new DiagnosticsProperty<InputDecoration>("decoration", this.decoration, defaultValue: new InputDecoration()));
properties.add(new DiagnosticsProperty<bool>("autocorrect", this.autocorrect, defaultValue: false));
properties.add(new DiagnosticsProperty<bool>("autocorrect", this.autocorrect, defaultValue: true));
properties.add(new FlagProperty("maxLengthEnforced", value: this.maxLengthEnforced,
ifTrue: "max length enforced"));
properties.add(new DiagnosticsProperty<GestureTapCallback>("onTap", this.onTap, defaultValue: null));
properties.add(new FlagProperty("maxLengthEnforced", value: this.maxLengthEnforced, defaultValue: true,
ifFalse: "maxLength not enforced"));
properties.add(new EnumProperty<TextInputAction?>("textInputAction", this.textInputAction, defaultValue: null));
properties.add(new EnumProperty<TextCapitalization>("textCapitalization", this.textCapitalization, defaultValue: TextCapitalization.none));
properties.add(new EnumProperty<TextAlign>("textAlign", this.textAlign, defaultValue: TextAlign.left));
properties.add(new EnumProperty<TextDirection>("textDirection", this.textDirection, defaultValue: null));
properties.add(new FloatProperty("cursorWidth", this.cursorWidth, defaultValue: 2.0));
properties.add(new DiagnosticsProperty<Radius>("cursorRadius", this.cursorRadius, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("cursorColor", this.cursorColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("keyboardAppearance", this.keyboardAppearance, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("scrollPadding", this.scrollPadding, defaultValue: EdgeInsets.all(20.0f)));
properties.add(new FlagProperty("selectionEnabled", value: this.selectionEnabled, defaultValue: true, ifFalse: "selection disabled"));
}
}

InputDecoration _getEffectiveDecoration() {
MaterialLocalizations localizations = MaterialLocalizations.of(this.context);
ThemeData themeData = Theme.of(this.context);
.applyDefaults(Theme.of(this.context).inputDecorationTheme)
.applyDefaults(themeData.inputDecorationTheme)
enabled: this.widget.enabled
enabled: this.widget.enabled,
hintMaxLines: this.widget.decoration?.hintMaxLines ?? this.widget.maxLines
if (!this.needsCounter) {
if (effectiveDecoration.counter != null || effectiveDecoration.counterText != null) {
Widget counter;
if (effectiveDecoration.counter == null
&& effectiveDecoration.counterText == null
&& this.widget.buildCounter != null) {
bool isFocused = this._effectiveFocusNode.hasFocus;
counter = this.widget.buildCounter(
this.context,
currentLength: currentLength,
maxLength: this.widget.maxLength,
isFocused: isFocused
);
return effectiveDecoration.copyWith(counter: counter);
}
if (this.widget.maxLength == null)
return effectiveDecoration;
if (this.widget.maxLength != TextField.noMaxLength) {
if (this.widget.maxLength > 0) {
if (this._effectiveController.value.text.Length > this.widget.maxLength) {
return effectiveDecoration.copyWith(
errorText: effectiveDecoration.errorText ?? "",
counterStyle: effectiveDecoration.errorStyle
?? themeData.textTheme.caption.copyWith(color: themeData.errorColor),
counterText: counterText
);
}
if (this._effectiveController.value.text.Length > this.widget.maxLength) {
ThemeData themeData = Theme.of(this.context);
return effectiveDecoration.copyWith(
errorText: effectiveDecoration.errorText ?? "",
counterStyle: effectiveDecoration.errorStyle
?? themeData.textTheme.caption.copyWith(color: themeData.errorColor),
counterText: counterText
);
}
return effectiveDecoration.copyWith(
counterText: counterText

}
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) {
if (cause == SelectionChangedCause.longPress) {
// Feedback.forLongPress(context); todo add feedback
if (Theme.of(this.context).platform == RuntimePlatform.IPhonePlayer
&& cause == SelectionChangedCause.longPress) {
this._editableTextKey.currentState?.bringIntoView(selection.basePos);
ThemeData themeData = Theme.of(this.context);
Color color = Theme.of(this.context).splashColor;
Color color = themeData.splashColor;
InteractiveInkFeature splash = null;

} // else we're probably in deactivate()
}
splash = Theme.of(this.context).splashFactory.create(
splash = themeData.splashFactory.create(
controller: inkController,
referenceBox: referenceBox,
position: position,

}
void _handleSingleTapUp(TapUpDetails details) {
if (this.widget.enableInteractiveSelection) {
if (this.widget.enableInteractiveSelection == true) {
this._renderEditable.handleTap();
}

}
void _handleLongPress() {
if (this.widget.enableInteractiveSelection) {
if (this.widget.enableInteractiveSelection == true) {
this._renderEditable.handleLongPress();
}

base.build(context); // See AutomaticKeepAliveClientMixin.
D.assert(MaterialD.debugCheckHasMaterial(context));
D.assert(WidgetsD.debugCheckHasDirectionality(context));
D.assert(
!(this.widget.style != null && this.widget.style.inherit == false &&
(this.widget.style.fontSize == null || this.widget.style.textBaseline == null)),
"inherit false style must supply fontSize and textBaseline"
);
TextStyle style = this.widget.style ?? themeData.textTheme.subhead;
TextStyle style = themeData.textTheme.subhead.merge(this.widget.style);
Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness;
TextEditingController controller = this._effectiveController;
FocusNode focusNode = this._effectiveFocusNode;

}
bool forcePressEnabled = false;
TextSelectionControls textSelectionControls = MaterialUtils.materialTextSelectionControls;;
bool paintCursorAboveText = false;
bool cursorOpacityAnimates = false;
Offset cursorOffset = null;
Color cursorColor = this.widget.cursorColor ?? themeData.cursorColor;
Radius cursorRadius = this.widget.cursorRadius;
Widget child = new RepaintBoundary(
child: new EditableText(

autocorrect: this.widget.autocorrect,
maxLines: this.widget.maxLines,
selectionColor: themeData.textSelectionColor,
selectionControls: this.widget.enableInteractiveSelection
? MaterialUtils.materialTextSelectionControls
: null,
selectionControls: this.widget.selectionEnabled ? textSelectionControls : null,
onSelectionChanged: this._handleSelectionChanged,
onSelectionChanged: this._handleSelectionChanged,
cursorRadius: this.widget.cursorRadius,
cursorColor: this.widget.cursorColor ?? Theme.of(context).cursorColor,
cursorRadius: cursorRadius,
cursorColor: cursorColor,
cursorOpacityAnimates: cursorOpacityAnimates,
cursorOffset: cursorOffset,
paintCursorAboveText: paintCursorAboveText,
backgroundCursorColor: new Color(0xFF8E8E93),// TODO: CupertinoColors.inactiveGray,
enableInteractiveSelection: this.widget.enableInteractiveSelection
enableInteractiveSelection: this.widget.enableInteractiveSelection == true,
dragStartBehavior: this.widget.dragStartBehavior
)
);

ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true),
child: new TextSelectionGestureDetector(
onTapDown: this._handleTapDown,
// onForcePressStart: forcePressEnabled ? this._handleForcePressStarted : null, // TODO: Remove this when force press is added
onSingleTapUp: this._handleSingleTapUp,
onSingleTapCancel: this._handleSingleTapCancel,
onSingleLongTapStart: this._handleLongPress,

54
Runtime/material/text_theme.cs


}
public static TextTheme lerp(TextTheme a, TextTheme b, float t) {
D.assert(a != null);
D.assert(b != null);
display4: TextStyle.lerp(a.display4, b.display4, t),
display3: TextStyle.lerp(a.display3, b.display3, t),
display2: TextStyle.lerp(a.display2, b.display2, t),
display1: TextStyle.lerp(a.display1, b.display1, t),
headline: TextStyle.lerp(a.headline, b.headline, t),
title: TextStyle.lerp(a.title, b.title, t),
subhead: TextStyle.lerp(a.subhead, b.subhead, t),
body2: TextStyle.lerp(a.body2, b.body2, t),
body1: TextStyle.lerp(a.body1, b.body1, t),
caption: TextStyle.lerp(a.caption, b.caption, t),
button: TextStyle.lerp(a.button, b.button, t),
subtitle: TextStyle.lerp(a.subtitle, b.subtitle, t),
overline: TextStyle.lerp(a.overline, b.overline, t)
display4: TextStyle.lerp(a?.display4, b?.display4, t),
display3: TextStyle.lerp(a?.display3, b?.display3, t),
display2: TextStyle.lerp(a?.display2, b?.display2, t),
display1: TextStyle.lerp(a?.display1, b?.display1, t),
headline: TextStyle.lerp(a?.headline, b?.headline, t),
title: TextStyle.lerp(a?.title, b?.title, t),
subhead: TextStyle.lerp(a?.subhead, b?.subhead, t),
body2: TextStyle.lerp(a?.body2, b?.body2, t),
body1: TextStyle.lerp(a?.body1, b?.body1, t),
caption: TextStyle.lerp(a?.caption, b?.caption, t),
button: TextStyle.lerp(a?.button, b?.button, t),
subtitle: TextStyle.lerp(a?.subtitle, b?.subtitle, t),
overline: TextStyle.lerp(a?.overline, b?.overline, t)
);
}

return this._cachedHashCode.Value;
}
unchecked {
var hashCode = this.display4.GetHashCode();
hashCode = (hashCode * 397) ^ this.display3.GetHashCode();
hashCode = (hashCode * 397) ^ this.display2.GetHashCode();
hashCode = (hashCode * 397) ^ this.display1.GetHashCode();
hashCode = (hashCode * 397) ^ this.headline.GetHashCode();
hashCode = (hashCode * 397) ^ this.title.GetHashCode();
hashCode = (hashCode * 397) ^ this.subhead.GetHashCode();
hashCode = (hashCode * 397) ^ this.body2.GetHashCode();
hashCode = (hashCode * 397) ^ this.body1.GetHashCode();
hashCode = (hashCode * 397) ^ this.caption.GetHashCode();
hashCode = (hashCode * 397) ^ this.button.GetHashCode();
hashCode = (hashCode * 397) ^ this.subtitle.GetHashCode();
hashCode = (hashCode * 397) ^ this.overline.GetHashCode();
var hashCode = this.display4?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.display3?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.display2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.display1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.headline?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.title?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.subhead?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.body2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.body1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.caption?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.button?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.subtitle?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.overline?.GetHashCode() ?? 0;
this._cachedHashCode = hashCode;
return hashCode;

50
Runtime/material/theme_data.cs


IconThemeData accentIconTheme = null,
SliderThemeData sliderTheme = null,
TabBarTheme tabBarTheme = null,
CardTheme cardTheme = null,
AppBarTheme appBarTheme = null,
BottomAppBarTheme bottomAppBarTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null

errorColor = errorColor ?? Colors.red[700];
inputDecorationTheme = inputDecorationTheme ?? new InputDecorationTheme();
pageTransitionsTheme = pageTransitionsTheme ?? new PageTransitionsTheme();
appBarTheme = appBarTheme ?? new AppBarTheme();
bottomAppBarTheme = bottomAppBarTheme ?? new BottomAppBarTheme();
primaryIconTheme = primaryIconTheme ??
(primaryIsDark
? new IconThemeData(color: Colors.white)

valueIndicatorTextStyle: accentTextTheme.body2);
tabBarTheme = tabBarTheme ?? new TabBarTheme();
cardTheme = cardTheme ?? new CardTheme();
chipTheme = chipTheme ?? ChipThemeData.fromDefaults(
secondaryColor: primaryColor,
brightness: brightness,

D.assert(accentIconTheme != null);
D.assert(materialTapTargetSize != null);
D.assert(pageTransitionsTheme != null);
D.assert(appBarTheme != null);
D.assert(bottomAppBarTheme != null);
D.assert(cardTheme != null);
D.assert(chipTheme != null);
D.assert(dialogTheme != null);

this.accentIconTheme = accentIconTheme;
this.sliderTheme = sliderTheme;
this.tabBarTheme = tabBarTheme;
this.cardTheme = cardTheme;
this.appBarTheme = appBarTheme;
this.bottomAppBarTheme = bottomAppBarTheme;
this.colorScheme = colorScheme;
this.dialogTheme = dialogTheme;
this.typography = typography;

IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
TabBarTheme tabBarTheme = null,
CardTheme cardTheme = null,
AppBarTheme appBarTheme = null,
BottomAppBarTheme bottomAppBarTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null

D.assert(platform != null);
D.assert(materialTapTargetSize != null);
D.assert(pageTransitionsTheme != null);
D.assert(appBarTheme != null);
D.assert(bottomAppBarTheme != null);
D.assert(cardTheme != null);
D.assert(chipTheme != null);
D.assert(dialogTheme != null);

accentIconTheme: accentIconTheme,
sliderTheme: sliderTheme,
tabBarTheme: tabBarTheme,
cardTheme: cardTheme,
appBarTheme: appBarTheme,
bottomAppBarTheme: bottomAppBarTheme,
colorScheme: colorScheme,
dialogTheme: dialogTheme,
typography: typography);

public readonly TabBarTheme tabBarTheme;
public readonly CardTheme cardTheme;
public readonly ChipThemeData chipTheme;
public readonly RuntimePlatform platform;

public readonly PageTransitionsTheme pageTransitionsTheme;
public readonly AppBarTheme appBarTheme;
public readonly BottomAppBarTheme bottomAppBarTheme;
public readonly ColorScheme colorScheme;
public readonly DialogTheme dialogTheme;

IconThemeData primaryIconTheme = null,
IconThemeData accentIconTheme = null,
TabBarTheme tabBarTheme = null,
CardTheme cardTheme = null,
AppBarTheme appBarTheme = null,
BottomAppBarTheme bottomAppBarTheme = null,
ColorScheme colorScheme = null,
DialogTheme dialogTheme = null,
Typography typography = null

primaryIconTheme: primaryIconTheme ?? this.primaryIconTheme,
accentIconTheme: accentIconTheme ?? this.accentIconTheme,
tabBarTheme: tabBarTheme ?? this.tabBarTheme,
cardTheme: cardTheme ?? this.cardTheme,
appBarTheme: appBarTheme ?? this.appBarTheme,
bottomAppBarTheme: bottomAppBarTheme ?? this.bottomAppBarTheme,
colorScheme: colorScheme ?? this.colorScheme,
dialogTheme: dialogTheme ?? this.dialogTheme,
typography: typography ?? this.typography

accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
sliderTheme: SliderThemeData.lerp(a.sliderTheme, b.sliderTheme, t),
tabBarTheme: TabBarTheme.lerp(a.tabBarTheme, b.tabBarTheme, t),
cardTheme: CardTheme.lerp(a.cardTheme, b.cardTheme, t),
appBarTheme: AppBarTheme.lerp(a.appBarTheme, b.appBarTheme, t),
bottomAppBarTheme: BottomAppBarTheme.lerp(a.bottomAppBarTheme, b.bottomAppBarTheme, t),
colorScheme: ColorScheme.lerp(a.colorScheme, b.colorScheme, t),
dialogTheme: DialogTheme.lerp(a.dialogTheme, b.dialogTheme, t),
typography: Typography.lerp(a.typography, b.typography, t)

other.primaryIconTheme == this.primaryIconTheme &&
other.accentIconTheme == this.accentIconTheme &&
other.tabBarTheme == this.tabBarTheme &&
other.cardTheme == this.cardTheme &&
other.appBarTheme == this.appBarTheme &&
other.bottomAppBarTheme == this.bottomAppBarTheme &&
other.colorScheme == this.colorScheme &&
other.dialogTheme == this.dialogTheme &&
other.typography == this.typography;

if (this._cachedHashCode != null) {
return this._cachedHashCode.Value;
}
unchecked {
var hashCode = this.brightness.GetHashCode();
hashCode = (hashCode * 397) ^ this.primaryColor.GetHashCode();

hashCode = (hashCode * 397) ^ this.accentIconTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.sliderTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.tabBarTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.cardTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.appBarTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.bottomAppBarTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.colorScheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.dialogTheme.GetHashCode();
hashCode = (hashCode * 397) ^ this.typography.GetHashCode();

properties.add(new DiagnosticsProperty<TextTheme>("textTheme", this.textTheme));
properties.add(new DiagnosticsProperty<TextTheme>("primaryTextTheme", this.primaryTextTheme));
properties.add(new DiagnosticsProperty<TextTheme>("accentTextTheme", this.accentTextTheme));
properties.add(new DiagnosticsProperty<InputDecorationTheme>("inputDecorationTheme", this.inputDecorationTheme));
properties.add(
new DiagnosticsProperty<InputDecorationTheme>("inputDecorationTheme", this.inputDecorationTheme));
properties.add(new DiagnosticsProperty<Color>("toggleableActiveColor", this.toggleableActiveColor,
defaultValue: defaultData.toggleableActiveColor));
properties.add(new DiagnosticsProperty<IconThemeData>("iconTheme", this.iconTheme));

properties.add(new DiagnosticsProperty<TabBarTheme>("tabBarTheme", this.tabBarTheme));
properties.add(new DiagnosticsProperty<CardTheme>("cardTheme", this.cardTheme));
properties.add(new DiagnosticsProperty<AppBarTheme>("appBarTheme", this.appBarTheme));
properties.add(new DiagnosticsProperty<BottomAppBarTheme>("bottomAppBarTheme", this.bottomAppBarTheme));
properties.add(new DiagnosticsProperty<ColorScheme>("colorScheme", this.colorScheme,
defaultValue: defaultData.colorScheme));
properties.add(new DiagnosticsProperty<DialogTheme>("dialogTheme", this.dialogTheme,

public V putIfAbsent(K key, Func<V> value) {
D.assert(key != null);
D.assert(value != null);
V get_value;
if (this._cache.TryGetValue(key, out get_value)) {
return get_value;

103
Runtime/painting/image_cache.cs


const int _kDefaultSize = 1000;
const int _kDefaultSizeBytes = 100 << 20; // 100 MiB
readonly Dictionary<object, ImageStreamCompleter> _pendingImages =
new Dictionary<object, ImageStreamCompleter>();
readonly Dictionary<object, _PendingImage> _pendingImages =
new Dictionary<object, _PendingImage>();
readonly Dictionary<object, _CachedImage> _cache = new Dictionary<object, _CachedImage>();
readonly LinkedList<object> _lruKeys = new LinkedList<object>();

public void clear() {
this._cache.Clear();
this._lruKeys.Clear();
this._pendingImages.Clear();
this._lruKeys.Clear();
if (this._pendingImages.TryGetValue(key, out var pendingImage)) {
pendingImage.removeListener();
this._pendingImages.Remove(key);
return true;
}
this._cache.Remove(image.node);
this._cache.Remove(key);
this._lruKeys.Remove(image.node);
return true;
}

public ImageStreamCompleter putIfAbsent(object key, Func<ImageStreamCompleter> loader) {
public ImageStreamCompleter putIfAbsent(object key, Func<ImageStreamCompleter> loader,
ImageErrorListener onError = null) {
if (this._pendingImages.TryGetValue(key, out var result)) {
ImageStreamCompleter result = null;
if (this._pendingImages.TryGetValue(key, out var pendingImage)) {
result = pendingImage.completer;
return result;
}

return image.completer;
}
result = loader();
try {
result = loader();
}
catch (Exception ex) {
if (onError != null) {
onError(ex);
}
else {
throw;
}
}
if (this._maximumSize > 0 && this._maximumSizeBytes > 0) {
D.assert(!this._pendingImages.ContainsKey(key));
this._pendingImages[key] = result;
void listener(ImageInfo info, bool syncCall) {
int imageSize = info?.image == null ? 0 : info.image.height * info.image.width * 4;
_CachedImage cachedImage = new _CachedImage(result, imageSize);
ImageListener listener = null;
listener = (info, syncCall) => {
result.removeListener(listener);
if (this.maximumSizeBytes > 0 && imageSize > this.maximumSizeBytes) {
this._maximumSizeBytes = imageSize + 1000;
}
this._currentSizeBytes += imageSize;
D.assert(this._pendingImages.ContainsKey(key));
if (this._pendingImages.TryGetValue(key, out var loadedPendingImage)) {
loadedPendingImage.removeListener();
int imageSize = info?.image == null ? 0 : info.image.width * info.image.height * 4;
_CachedImage cachedImage = new _CachedImage {
completer = result,
sizeBytes = imageSize,
};
// If the image is bigger than the maximum cache size, and the cache size
// is not zero, then increase the cache size to the size of the image plus
// some change.
if (this._maximumSizeBytes > 0 && imageSize > this._maximumSizeBytes) {
this._maximumSizeBytes = imageSize + 1000;
}
}
this._currentSizeBytes += imageSize;
D.assert(!this._cache.ContainsKey(key));
this._cache[key] = cachedImage;
cachedImage.node = this._lruKeys.AddLast(key);
this._checkCacheSize();
}
D.assert(!this._cache.ContainsKey(key));
this._cache[key] = cachedImage;
cachedImage.node = this._lruKeys.AddLast(key);
this._checkCacheSize();
};
if (this.maximumSize > 0 && this.maximumSizeBytes > 0) {
this._pendingImages[key] = new _PendingImage(result, listener);
result.addListener(listener);
}

}
class _CachedImage {
public _CachedImage(ImageStreamCompleter completer, int sizeBytes) {
this.completer = completer;
this.sizeBytes = sizeBytes;
}
}
class _PendingImage {
public _PendingImage(
ImageStreamCompleter completer,
ImageListener listener
) {
this.completer = completer;
this.listener = listener;
}
public readonly ImageStreamCompleter completer;
public readonly ImageListener listener;
public void removeListener() {
this.completer.removeListener(this.listener);
}
}
}

16
Runtime/painting/image_stream.cs


public ImageInfo currentImage;
public UIWidgetsErrorDetails currentError;
protected bool hasListeners {
get { return this._listeners.isNotEmpty(); }
}
public virtual void addListener(ImageListener listener, ImageErrorListener onError = null) {
this._listeners.Add(new _ImageListenerPair {listener = listener, errorListener = onError});

catch (Exception ex) {
UIWidgetsError.reportError(
new UIWidgetsErrorDetails(
context: "by an image error listener",
context: "when reporting an error to an image listener",
library: "image resource service",
exception: ex
)

}
void _handleAppFrame(TimeSpan timestamp) {
if (!this._hasActiveListeners) {
if (!this.hasListeners) {
return;
}

this._framesEmitted += 1;
}
bool _hasActiveListeners {
get { return this._listeners.isNotEmpty(); }
}
if (!this._hasActiveListeners && this._codec != null) {
if (!this.hasListeners && this._codec != null) {
this._decodeNextFrameAndSchedule();
}

public override void removeListener(ImageListener listener) {
base.removeListener(listener);
if (!this._hasActiveListeners) {
if (!this.hasListeners) {
this._timer?.cancel();
this._timer = null;
}

2
Runtime/painting/notched_shapes.cs


}
public override Path getOuterPath(Rect host, Rect guest) {
if (!host.overlaps(guest)) {
if (guest == null || !host.overlaps(guest)) {
Path path = new Path();
path.addRect(host);
return path;

82
Runtime/painting/text_painter.cs


using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

public TextSpan text {
get { return this._text; }
set {
if ((this._text == null && value == null) || (this._text != null && this.text.Equals(value))) {
if ((this._text == null && value == null) || (this._text != null && this.text.Equals(value))) {
return;
}

return Mathf.Ceil(layoutValue);
}
const int _zwjUtf16 = 0x200d;
var prevCodeUnit = this._text.codeUnitAt(offset - 1);
string flattenedText = this._text.toPlainText();
var prevCodeUnit = this._text.codeUnitAt(Mathf.Max(0, offset - 1));
var prevRuneOffset = _isUtf16Surrogate((int) prevCodeUnit) ? offset - 2 : offset - 1;
var boxes = this._paragraph.getRectsForRange(prevRuneOffset, offset);
if (boxes.Count == 0) {
return null;
bool needsSearch = _isUtf16Surrogate(prevCodeUnit.Value) || this._text.codeUnitAt(offset) == _zwjUtf16;
int graphemeClusterLength = needsSearch ? 2 : 1;
List<TextBox> boxes = null;
while ((boxes == null || boxes.isEmpty()) && flattenedText != null) {
int prevRuneOffset = offset - graphemeClusterLength;
boxes = this._paragraph.getRectsForRange(prevRuneOffset, offset);
if (boxes.isEmpty()) {
if (!needsSearch) {
break;
}
if (prevRuneOffset < -flattenedText.Length) {
break;
}
graphemeClusterLength *= 2;
continue;
}
TextBox box = boxes[0];
const int NEWLINE_CODE_UNIT = 10;
if (prevCodeUnit == NEWLINE_CODE_UNIT) {
return new Offset(this._emptyOffset.dx, box.bottom);
}
float caretEnd = box.end;
float dx = box.direction == TextDirection.rtl ? caretEnd - caretPrototype.width : caretEnd;
return new Offset(dx, box.top);
var box = boxes[0];
var caretEnd = box.end;
var dx = box.direction == TextDirection.rtl ? caretEnd : caretEnd - caretPrototype.width;
return new Offset(dx, box.top);
return null;
var nextCodeUnit = this._text.codeUnitAt(offset - 1);
string flattenedText = this._text.toPlainText();
var nextCodeUnit =
this._text.codeUnitAt(Mathf.Min(offset, flattenedText == null ? 0 : flattenedText.Length - 1));
var nextRuneOffset = _isUtf16Surrogate((int) nextCodeUnit) ? offset + 2 : offset + 1;
var boxes = this._paragraph.getRectsForRange(offset, nextRuneOffset);
if (boxes.Count == 0) {
return null;
bool needsSearch = _isUtf16Surrogate(nextCodeUnit.Value) || nextCodeUnit == _zwjUtf16;
int graphemeClusterLength = needsSearch ? 2 : 1;
List<TextBox> boxes = null;
while ((boxes == null || boxes.isEmpty()) && flattenedText != null) {
int nextRuneOffset = offset + graphemeClusterLength;
boxes = this._paragraph.getRectsForRange(offset, nextRuneOffset);
if (boxes.isEmpty()) {
if (!needsSearch) {
break;
}
if (nextRuneOffset >= flattenedText.Length << 1) {
break;
}
graphemeClusterLength *= 2;
continue;
}
TextBox box = boxes[boxes.Count - 1];
float caretStart = box.start;
float dx = box.direction == TextDirection.rtl ? caretStart - caretPrototype.width : caretStart;
return new Offset(dx, box.top);
var box = boxes[0];
var caretStart = box.start;
var dx = box.direction == TextDirection.rtl ? caretStart - caretPrototype.width : caretStart;
return new Offset(dx, box.top);
return null;
}
Offset _emptyOffset {

3
Runtime/rendering/binding.cs


protected virtual void handleTextScaleFactorChanged() {
}
protected virtual void handlePlatformBrightnessChanged() {
}
protected virtual ViewConfiguration createViewConfiguration() {
var devicePixelRatio = Window.instance.devicePixelRatio;
return new ViewConfiguration(

353
Runtime/rendering/editable.cs


tap,
doubleTap,
longPress,
forcePress,
keyboard,
drag
}

public static readonly char obscuringCharacter = '•';
static readonly float _kCaretGap = 1.0f;
static readonly float _kCaretHeightOffset = 2.0f;
static readonly Offset _kFloatingCaretSizeIncrease = new Offset(0.5f, 1.0f);
static readonly float _kFloatingCaretRadius = 1.0f;
TextPainter _textPainter;
Color _cursorColor;

bool _hasVisualOverflow = false;
Offset _lastTapDownPosition;
public RenderEditable(TextSpan text, TextDirection textDirection, ViewportOffset offset,
public RenderEditable(
TextSpan text,
TextDirection textDirection,
ViewportOffset offset,
TextAlign textAlign = TextAlign.left, float textScaleFactor = 1.0f, Color cursorColor = null,
bool? hasFocus = null, int? maxLines = 1, Color selectionColor = null,
TextSelection selection = null, bool obscureText = false, SelectionChangedHandler onSelectionChanged = null,
CaretChangedHandler onCaretChanged = null, bool ignorePointer = false,
TextAlign textAlign = TextAlign.left,
float textScaleFactor = 1.0f,
Color cursorColor = null,
Color backgroundCursorColor = null,
bool? hasFocus = null,
int? maxLines = 1,
Color selectionColor = null,
TextSelection selection = null,
bool obscureText = false,
SelectionChangedHandler onSelectionChanged = null,
CaretChangedHandler onCaretChanged = null,
bool ignorePointer = false,
bool enableInteractiveSelection = true,
bool? enableInteractiveSelection = null,
bool paintCursorAboveText = false,
Offset cursorOffset = null,
float devicePixelRatio = 1.0f,
EdgeInsets floatingCursorAddedMargin = null,
floatingCursorAddedMargin = floatingCursorAddedMargin ?? EdgeInsets.fromLTRB(4, 4, 4, 5);
this._showCursor = showCursor ?? new ValueNotifier<bool>(false);
this._hasFocus = hasFocus ?? false;
this._maxLines = maxLines;

this._doubleTap.onDoubleTap = this._handleDoubleTap;
this._longPress = new LongPressGestureRecognizer(debugOwner: this);
this._longPress.onLongPress = this._handleLongPress;
this._backgroundCursorColor = backgroundCursorColor;
this._paintCursorOnTop = paintCursorAboveText;
this._cursorOffset = cursorOffset;
this._floatingCursorAddedMargin = floatingCursorAddedMargin;
this._devicePixelRatio = devicePixelRatio;
}
public float devicePixelRatio {
get { return this._devicePixelRatio; }
set {
if (this.devicePixelRatio == value) {
return;
}
this._devicePixelRatio = value;
this.markNeedsTextLayout();
}
}
float _devicePixelRatio;
public Color backgroundCursorColor {
get { return this._backgroundCursorColor; }
set {
if (this.backgroundCursorColor == value) {
return;
}
this._backgroundCursorColor = value;
this.markNeedsPaint();
}
}
Color _backgroundCursorColor;
public bool paintCursorAboveText {
get { return this._paintCursorOnTop; }
set {
if (this._paintCursorOnTop == value) {
return;
}
this._paintCursorOnTop = value;
this.markNeedsLayout();
}
}
bool _paintCursorOnTop;
public Offset cursorOffset {
get { return this._cursorOffset; }
set {
if (this._cursorOffset == value) {
return;
}
this._cursorOffset = value;
this.markNeedsLayout();
}
}
Offset _cursorOffset;
public EdgeInsets floatingCursorAddedMargin {
get { return this._floatingCursorAddedMargin; }
set {
if (this._floatingCursorAddedMargin == value) {
return;
}
this._floatingCursorAddedMargin = value;
this.markNeedsPaint();
}
}
EdgeInsets _floatingCursorAddedMargin;
bool _floatingCursorOn = false;
Offset _floatingCursorOffset;
TextPosition _floatingCursorTextPosition;
public bool selectionEnabled {
get { return this.enableInteractiveSelection ?? !this.obscureText; }
}
public bool obscureText {

}
}
bool _enableInteractiveSelection;
bool? _enableInteractiveSelection;
public bool enableInteractiveSelection {
public bool? enableInteractiveSelection {
get { return this._enableInteractiveSelection; }
set {
if (this._enableInteractiveSelection == value) {

public Rect getLocalRectForCaret(TextPosition caretPosition) {
this._layoutText(this.constraints.maxWidth);
var caretOffset = this._textPainter.getOffsetForCaret(caretPosition, this._caretPrototype);
return Rect.fromLTWH(0.0f, 0.0f, this.cursorWidth, this.preferredLineHeight)
Rect rect = Rect.fromLTWH(0.0f, 0.0f, this.cursorWidth, this.preferredLineHeight)
if (this._cursorOffset != null) {
rect = rect.shift(this._cursorOffset);
}
return rect.shift(this._getPixelPerfectCursorOffset(rect));
}
public TextPosition getPositionDown(TextPosition position) {

protected override float computeMaxIntrinsicWidth(float height) {
this._layoutText(float.PositiveInfinity);
return this._textPainter.maxIntrinsicWidth;
return this._textPainter.maxIntrinsicWidth + this.cursorWidth;
}
protected override float computeMinIntrinsicHeight(float width) {

}
public void handleTapDown(TapDownDetails details) {
this._lastTapDownPosition = details.globalPosition + -this._paintOffset;
this._lastTapDownPosition = details.globalPosition - this._paintOffset;
if (!Application.isMobilePlatform) {
this.selectPosition(SelectionChangedCause.tap);
}

}
void selectPosition(SelectionChangedCause? cause = null) {
D.assert(cause != null);
this._layoutText(this.constraints.maxWidth);
D.assert(this._lastTapDownPosition != null);
if (this.onSelectionChanged != null) {
TextPosition position =
this._textPainter.getPositionForOffset(this.globalToLocal(this._lastTapDownPosition));
this.onSelectionChanged(TextSelection.fromPosition(position), this, cause.Value);
}
this.selectPositionAt(from: this._lastTapDownPosition, cause: cause);
this.selectWordsInRange(from: this._lastTapDownPosition, cause: cause);
}
void selectWordsInRange(Offset from = null, Offset to = null, SelectionChangedCause? cause = null) {
D.assert(cause != null);
D.assert(from != null);
D.assert(this._lastTapDownPosition != null);
TextPosition position =
this._textPainter.getPositionForOffset(this.globalToLocal(this._lastTapDownPosition));
this.onSelectionChanged(this._selectWordAtOffset(position), this, cause.Value);
TextPosition firstPosition =
this._textPainter.getPositionForOffset(this.globalToLocal(from - this._paintOffset));
TextSelection firstWord = this._selectWordAtOffset(firstPosition);
TextSelection lastWord = to == null
? firstWord
: this._selectWordAtOffset(
this._textPainter.getPositionForOffset(this.globalToLocal(to - this._paintOffset)));
this.onSelectionChanged(
new TextSelection(
baseOffset: firstWord.baseOffset,
extentOffset: lastWord.extentOffset,
affinity: firstWord.affinity),
this,
cause.Value);
}
}

this._textLayoutLastWidth = constraintWidth;
}
Rect _getCaretPrototype {
get {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
return Rect.fromLTWH(0.0f, -_kCaretHeightOffset + 0.5f, this.cursorWidth,
this.preferredLineHeight + 2.0f);
default:
return Rect.fromLTWH(0.0f, _kCaretHeightOffset, this.cursorWidth,
this.preferredLineHeight - 2.0f * _kCaretHeightOffset);
}
}
}
this._caretPrototype = Rect.fromLTWH(0.0f, _kCaretHeightOffset, this.cursorWidth,
this.preferredLineHeight - 2.0f * _kCaretHeightOffset);
this._caretPrototype = this._getCaretPrototype;
this._selectionRects = null;
var textPainterSize = this._textPainter.size;

// describeSemanticsConfiguration todo
void _paintCaret(Canvas canvas, Offset effectiveOffset) {
Offset _getPixelPerfectCursorOffset(Rect caretRect) {
Offset caretPosition = this.localToGlobal(caretRect.topLeft);
float pixelMultiple = 1.0f / this._devicePixelRatio;
int quotientX = (caretPosition.dx / pixelMultiple).round();
int quotientY = (caretPosition.dy / pixelMultiple).round();
float pixelPerfectOffsetX = quotientX * pixelMultiple - caretPosition.dx;
float pixelPerfectOffsetY = quotientY * pixelMultiple - caretPosition.dy;
return new Offset(pixelPerfectOffsetX, pixelPerfectOffsetY);
}
void _paintCaret(Canvas canvas, Offset effectiveOffset, TextPosition textPosition) {
var caretOffset = this._textPainter.getOffsetForCaret(this._selection.extendPos, this._caretPrototype);
var paint = new Paint() {color = this._cursorColor};
var caretRect = this._caretPrototype.shift(caretOffset + effectiveOffset);
var caretOffset = this._textPainter.getOffsetForCaret(textPosition, this._caretPrototype);
var paint = new Paint() {color = this._floatingCursorOn ? this.backgroundCursorColor : this._cursorColor};
Rect caretRect = this._caretPrototype.shift(caretOffset + effectiveOffset);
if (this._cursorOffset != null) {
caretRect = caretRect.shift(this._cursorOffset);
}
if (this.cursorRadius == null) {
canvas.drawRect(caretRect, paint);

}
}
public void setFloatingCursor(FloatingCursorDragState? state, Offset boundedOffset, TextPosition lastTextPosition,
float? resetLerpValue = null) {
D.assert(boundedOffset != null);
D.assert(lastTextPosition != null);
if (state == FloatingCursorDragState.Start) {
this._relativeOrigin = new Offset(0, 0);
this._previousOffset = null;
this._resetOriginOnBottom = false;
this._resetOriginOnTop = false;
this._resetOriginOnRight = false;
this._resetOriginOnBottom = false;
}
this._floatingCursorOn = state != FloatingCursorDragState.End;
this._resetFloatingCursorAnimationValue = resetLerpValue;
if (this._floatingCursorOn) {
this._floatingCursorOffset = boundedOffset;
this._floatingCursorTextPosition = lastTextPosition;
}
this.markNeedsPaint();
}
void _paintFloatingCaret(Canvas canvas, Offset effectiveOffset) {
D.assert(this._textLayoutLastWidth == this.constraints.maxWidth);
D.assert(this._floatingCursorOn);
Paint paint = new Paint() {color = this._cursorColor.withOpacity(0.75f)};
float sizeAdjustmentX = _kFloatingCaretSizeIncrease.dx;
float sizeAdjustmentY = _kFloatingCaretSizeIncrease.dy;
if (this._resetFloatingCursorAnimationValue != null) {
sizeAdjustmentX =
MathUtils.lerpFloat(sizeAdjustmentX, 0f, this._resetFloatingCursorAnimationValue.Value);
sizeAdjustmentY =
MathUtils.lerpFloat(sizeAdjustmentY, 0f, this._resetFloatingCursorAnimationValue.Value);
}
Rect floatingCaretPrototype = Rect.fromLTRB(
this._caretPrototype.left - sizeAdjustmentX,
this._caretPrototype.top - sizeAdjustmentY,
this._caretPrototype.right + sizeAdjustmentX,
this._caretPrototype.bottom + sizeAdjustmentY
);
Rect caretRect = floatingCaretPrototype.shift(effectiveOffset);
Radius floatingCursorRadius = Radius.circular(_kFloatingCaretRadius);
RRect caretRRect = RRect.fromRectAndRadius(caretRect, floatingCursorRadius);
canvas.drawRRect(caretRRect, paint);
}
Offset _relativeOrigin = new Offset(0f, 0f);
Offset _previousOffset;
bool _resetOriginOnLeft = false;
bool _resetOriginOnRight = false;
bool _resetOriginOnTop = false;
bool _resetOriginOnBottom = false;
float? _resetFloatingCursorAnimationValue;
public Offset calculateBoundedFloatingCursorOffset(Offset rawCursorOffset) {
Offset deltaPosition = new Offset(0f, 0f);
float topBound = -this.floatingCursorAddedMargin.top;
float bottomBound = this._textPainter.height - this.preferredLineHeight +
this.floatingCursorAddedMargin.bottom;
float leftBound = -this.floatingCursorAddedMargin.left;
float rightBound = this._textPainter.width + this.floatingCursorAddedMargin.right;
if (this._previousOffset != null) {
deltaPosition = rawCursorOffset - this._previousOffset;
}
if (this._resetOriginOnLeft && deltaPosition.dx > 0) {
this._relativeOrigin = new Offset(rawCursorOffset.dx - leftBound, this._relativeOrigin.dy);
this._resetOriginOnLeft = false;
}
else if (this._resetOriginOnRight && deltaPosition.dx < 0) {
this._relativeOrigin = new Offset(rawCursorOffset.dx - rightBound, this._relativeOrigin.dy);
this._resetOriginOnRight = false;
}
if (this._resetOriginOnTop && deltaPosition.dy > 0) {
this._relativeOrigin = new Offset(this._relativeOrigin.dx, rawCursorOffset.dy - topBound);
this._resetOriginOnTop = false;
}
else if (this._resetOriginOnBottom && deltaPosition.dy < 0) {
this._relativeOrigin = new Offset(this._relativeOrigin.dx, rawCursorOffset.dy - bottomBound);
this._resetOriginOnBottom = false;
}
float currentX = rawCursorOffset.dx - this._relativeOrigin.dx;
float currentY = rawCursorOffset.dy - this._relativeOrigin.dy;
float adjustedX = Mathf.Min(Mathf.Max(currentX, leftBound), rightBound);
float adjustedY = Mathf.Min(Mathf.Max(currentY, topBound), bottomBound);
Offset adjustedOffset = new Offset(adjustedX, adjustedY);
if (currentX < leftBound && deltaPosition.dx < 0) {
this._resetOriginOnLeft = true;
}
else if (currentX > rightBound && deltaPosition.dx > 0) {
this._resetOriginOnRight = true;
}
if (currentY < topBound && deltaPosition.dy < 0) {
this._resetOriginOnTop = true;
}
else if (currentY > bottomBound && deltaPosition.dy > 0) {
this._resetOriginOnBottom = true;
}
this._previousOffset = rawCursorOffset;
return adjustedOffset;
}
void _paintSelection(Canvas canvas, Offset effectiveOffset) {
D.assert(this._textLayoutLastWidth == this.constraints.maxWidth);
D.assert(this._selectionRects != null);

D.assert(this._textLayoutLastWidth == this.constraints.maxWidth);
var effectiveOffset = offset + this._paintOffset;
if (this._selection != null && this._selection.isValid) {
bool showSelection = false;
bool showCaret = false;
if (this._selection != null && !this._floatingCursorOn) {
this._paintCaret(context.canvas, effectiveOffset);
showCaret = true;
this._selectionRects =
this._selectionRects ?? this._textPainter.getBoxesForSelection(this._selection);
this._paintSelection(context.canvas, effectiveOffset);
showSelection = true;
this._textPainter.paint(context.canvas, effectiveOffset);
if (showSelection) {
this._selectionRects = this._selectionRects ?? this._textPainter.getBoxesForSelection(this._selection);
this._paintSelection(context.canvas, effectiveOffset);
}
if (this.paintCursorAboveText) {
this._textPainter.paint(context.canvas, effectiveOffset);
}
if (showCaret) {
this._paintCaret(context.canvas, effectiveOffset, this._selection.extendPos);
}
if (!this.paintCursorAboveText) {
this._textPainter.paint(context.canvas, effectiveOffset);
}
if (this._floatingCursorOn) {
if (this._resetFloatingCursorAnimationValue == null) {
this._paintCaret(context.canvas, effectiveOffset, this._floatingCursorTextPosition);
}
this._paintFloatingCaret(context.canvas, this._floatingCursorOffset);
}
}
void markNeedsSemanticsUpdate() {

8
Runtime/rendering/layer.cs


where T : class {
public AnnotatedRegionLayer(
T value = null,
Size size = null) {
Size size = null,
Offset offset = null) {
offset = offset ?? Offset.zero;
this.offset = offset;
}
public readonly T value;

public readonly Offset offset;
properties.add(new DiagnosticsProperty<Offset>("offset", this.offset, defaultValue: null));
}
}

2
Runtime/rendering/object.cs


D.assert(this._debugCanPerformMutations);
D.assert(child != null);
this.setupParentData(child);
base.adoptChild(child);
base.adoptChild(child);
}
protected override void dropChild(AbstractNodeMixinDiagnosticableTree childNode) {

10
Runtime/rendering/proxy_box.cs


float? stepHeight = null,
RenderBox child = null
) : base(child) {
D.assert(stepWidth == null || stepWidth > 0.0f);
D.assert(stepHeight == null || stepHeight > 0.0f);
this._stepWidth = stepWidth;
this._stepHeight = stepHeight;
}

public float? stepWidth {
get { return this._stepWidth; }
set {
D.assert(value == null || value > 0.0f);
if (value == this._stepWidth) {
return;
}

public float? stepHeight {
get { return this._stepHeight; }
set {
D.assert(value == null || value > 0.0f);
if (value == this._stepHeight) {
return;
}

Clip clipBehavior = Clip.none,
CustomClipper<T> clipper = null
) : base(child: child, clipBehavior: clipBehavior, clipper: clipper) {
D.assert(elevation != null);
D.assert(elevation != null && elevation >= 0.0f);
D.assert(color != null);
D.assert(shadowColor != null);
this._elevation = elevation ?? 0.0f;

public float elevation {
get { return this._elevation; }
set {
D.assert(value >= 0.0f);
if (this.elevation == value) {
return;
}

BoxShape shape = BoxShape.rectangle,
Clip clipBehavior = Clip.none,
BorderRadius borderRadius = null,
float elevation = 0.0f,
float? elevation = 0.0f,
D.assert(elevation != null && elevation >= 0.0f);
this._shape = shape;
this._borderRadius = borderRadius;
}

6
Runtime/rendering/sliver.cs


GrowthDirection growthDirection,
ScrollDirection userScrollDirection,
float scrollOffset,
float precedingScrollExtent,
float overlap,
float remainingPaintExtent,
float crossAxisExtent,

this.growthDirection = growthDirection;
this.userScrollDirection = userScrollDirection;
this.scrollOffset = scrollOffset;
this.precedingScrollExtent = precedingScrollExtent;
this.overlap = overlap;
this.remainingPaintExtent = remainingPaintExtent;
this.crossAxisExtent = crossAxisExtent;

GrowthDirection? growthDirection = null,
ScrollDirection? userScrollDirection = null,
float? scrollOffset = null,
float? precedingScrollExtent = null,
float? overlap = null,
float? remainingPaintExtent = null,
float? crossAxisExtent = null,

growthDirection: growthDirection ?? this.growthDirection,
userScrollDirection: userScrollDirection ?? this.userScrollDirection,
scrollOffset: scrollOffset ?? this.scrollOffset,
precedingScrollExtent: precedingScrollExtent ?? this.precedingScrollExtent,
overlap: overlap ?? this.overlap,
remainingPaintExtent: remainingPaintExtent ?? this.remainingPaintExtent,
crossAxisExtent: crossAxisExtent ?? this.crossAxisExtent,

public readonly ScrollDirection userScrollDirection;
public readonly float scrollOffset;
public readonly float precedingScrollExtent;
public readonly float overlap;

2
Runtime/rendering/sliver_multi_box_adaptor.cs


foreach (int index in indices) {
children.Add(this._keepAliveBucket[index].toDiagnosticsNode(
name: "child with index " + index + " (kept alive offstage)",
name: "child with index " + index + " (kept alive but not laid out)",
style: DiagnosticsTreeStyle.offstage
));
}

10
Runtime/rendering/sliver_persistent_header.cs


if (value == null) {
this._controller?.dispose();
this._controller = null;
}
else {
if (this._snapConfiguration != null && value.vsync != this._snapConfiguration.vsync) {

protected override float updateGeometry() {
float? minExtent = this.minExtent;
float? minAllowedExtent = this.constraints.remainingPaintExtent > minExtent
? minExtent
: this.constraints.remainingPaintExtent;
float? clampedPaintExtent =
paintExtent?.clamp(minAllowedExtent ?? 0.0f, this.constraints.remainingPaintExtent);
paintExtent: paintExtent?.clamp(minExtent ?? 0.0f, this.constraints.remainingPaintExtent) ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, this.constraints.remainingPaintExtent - minExtent ?? 0.0f),
paintExtent: clampedPaintExtent ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, clampedPaintExtent ?? 0.0f),
maxPaintExtent: maxExtent ?? 0.0f,
maxScrollObstructionExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true

3
Runtime/rendering/table.cs


float deficit = tableWidth - maxWidthConstraint;
int availableColumns = this.columns;
while (deficit > 0.0f && totalFlex > 0.0f) {
float minimumDeficit = 0.00000001f;
while (deficit > 0.0f && totalFlex > minimumDeficit) {
float newTotalFlex = 0.0f;
for (int x = 0; x < this.columns; x++) {
if (flexes[x] != null) {

51
Runtime/rendering/viewport.cs


GrowthDirectionUtils.applyGrowthDirectionToScrollDirection(
this.offset.userScrollDirection, growthDirection);
float maxPaintOffset = layoutOffset + overlap;
float precedingScrollExtent = 0.0f;
while (child != null) {
float sliverScrollOffset = scrollOffset <= 0.0 ? 0.0f : scrollOffset;

growthDirection: growthDirection,
userScrollDirection: adjustedUserScrollDirection,
scrollOffset: sliverScrollOffset,
precedingScrollExtent: precedingScrollExtent,
overlap: maxPaintOffset - layoutOffset,
remainingPaintExtent: Mathf.Max(0.0f,
remainingPaintExtent - layoutOffset + initialLayoutOffset),

maxPaintOffset = Mathf.Max(effectiveLayoutOffset + childLayoutGeometry.paintExtent,
maxPaintOffset);
scrollOffset -= childLayoutGeometry.scrollExtent;
precedingScrollExtent += childLayoutGeometry.scrollExtent;
layoutOffset += childLayoutGeometry.layoutExtent;
if (childLayoutGeometry.cacheExtent != 0.0) {

public RevealedOffset getOffsetToReveal(RenderObject target, float alignment, Rect rect = null) {
float leadingScrollOffset = 0.0f;
float targetMainAxisExtent = 0.0f;
RenderObject descendant;
if (target is RenderBox) {
RenderBox targetBox = (RenderBox) target;
RenderObject child = target;
RenderBox pivot = null;
bool onlySlivers = target is RenderSliver;
while (child.parent != this) {
D.assert(child.parent != null, $"target must be a descendant of ${this}");
if (child is RenderBox) {
pivot = (RenderBox) child;
}
RenderBox pivot = targetBox;
while (pivot.parent is RenderBox) {
pivot = (RenderBox) pivot.parent;
if (child.parent is RenderSliver) {
RenderSliver parent = (RenderSliver) child.parent;
leadingScrollOffset += parent.childScrollOffset(child);
else {
onlySlivers = false;
leadingScrollOffset = 0.0f;
}
child = (RenderObject) child.parent;
}
if (pivot != null) {
D.assert(pivot.parent != null);
D.assert(pivot.parent != this);
D.assert(pivot != this);

transform = targetBox.getTransformTo(pivot);
transform = target.getTransformTo(pivot);
Rect bounds = transform.mapRect(rect);
float offset = 0.0f;

break;
}
leadingScrollOffset = pivot.size.height - offset;
leadingScrollOffset += pivot.size.height - offset;
leadingScrollOffset = bounds.left;
leadingScrollOffset += bounds.left;
leadingScrollOffset = bounds.top;
leadingScrollOffset += bounds.top;
targetMainAxisExtent = bounds.height;
break;
case AxisDirection.left:

break;
}
leadingScrollOffset = pivot.size.width - offset;
leadingScrollOffset += pivot.size.width - offset;
descendant = pivot;
else if (target is RenderSliver) {
else if (onlySlivers) {
leadingScrollOffset = 0.0f;
descendant = targetSliver;
}
RenderObject child = descendant;
while (child.parent is RenderSliver) {
var parent = (RenderSliver) child.parent;
leadingScrollOffset += parent.childScrollOffset(child);
child = parent;
}
D.assert(child.parent == this);

4
Runtime/service/text_formatter.cs


public class LengthLimitingTextInputFormatter : TextInputFormatter {
public LengthLimitingTextInputFormatter(int? maxLength) {
D.assert(maxLength == null || maxLength > 0);
D.assert(maxLength == null || maxLength == -1 || maxLength > 0);
this.maxLength = maxLength;
}

if (this.maxLength != null && newValue.text.Length > this.maxLength) {
if (this.maxLength != null && this.maxLength > 0 && newValue.text.Length > this.maxLength) {
TextSelection newSelection = newValue.selection.copyWith(
baseOffset: Math.Min(newValue.selection.start, this.maxLength.Value),
extentOffset: Math.Min(newValue.selection.end, this.maxLength.Value)

79
Runtime/service/text_input.cs


using UnityEngine;
namespace Unity.UIWidgets.service {
public enum FloatingCursorDragState {
Start,
Update,
End
}
public class RawFloatingCursorPoint {
public RawFloatingCursorPoint(
Offset offset = null,
FloatingCursorDragState? state = null
) {
D.assert(state != null);
D.assert(state == FloatingCursorDragState.Update ? offset != null : true);
this.offset = offset;
this.state = state;
}
public readonly Offset offset;
public readonly FloatingCursorDragState? state;
}
public class TextInputType : IEquatable<TextInputType> {
public readonly int index;
public readonly bool? signed;

case "TextAffinity.upstream":
return TextAffinity.upstream;
}
return null;
}

case "TextInputAction.newline":
return TextInputAction.newline;
}
public static FloatingCursorDragState _toTextCursorAction(string state) {
switch (state) {
case "FloatingCursorDragState.start":
return FloatingCursorDragState.Start;
case "FloatingCursorDragState.update":
return FloatingCursorDragState.Update;
case "FloatingCursorDragState.end":
return FloatingCursorDragState.End;
}
throw new UIWidgetsError("Unknown text cursor action: $state");
}
public static RawFloatingCursorPoint _toTextPoint(FloatingCursorDragState state,
Dictionary<string, float?> encoded) {
D.assert(encoded.getOrDefault("X") != null,
"You must provide a value for the horizontal location of the floating cursor.");
D.assert(encoded.getOrDefault("Y") != null,
"You must provide a value for the vertical location of the floating cursor.");
Offset offset = state == FloatingCursorDragState.Update
? new Offset(encoded["X"] ?? 0.0f, encoded["Y"] ?? 0.0f)
: new Offset(0, 0);
return new RawFloatingCursorPoint(offset: offset, state: state);
}
public TextEditingValue(string text = "", TextSelection selection = null, TextRange composing = null) {
this.text = text;
this.selection = selection ?? TextSelection.collapsed(-1);

)
);
}
public TextEditingValue copyWith(string text = null, TextSelection selection = null,
TextRange composing = null) {
return new TextEditingValue(

if (selection.start < 0) {
selection = TextSelection.collapsed(0, this.selection.affinity);
}
newText = selection.textBefore(this.text) + text + selection.textAfter(this.text);
newSelection = TextSelection.collapsed(selection.start + text.Length);
return new TextEditingValue(

}
return this.copyWith(text: this.text.Substring(0, this.selection.start) +
this.text.Substring(this.selection.start + 1),
this.text.Substring(this.selection.start + 1),
return this.copyWith(text: newText, selection: TextSelection.collapsed(this.selection.start),
return this.copyWith(text: newText, selection: TextSelection.collapsed(this.selection.start),
composing: TextRange.empty);
}
}

void updateEditingValue(TextEditingValue value);
void performAction(TextInputAction action);
void updateFloatingCursor(RawFloatingCursorPoint point);
}
public enum TextInputAction {

class TextInputConfiguration {
public TextInputConfiguration(TextInputType inputType = null,
bool obscureText = false, bool autocorrect = true, TextInputAction inputAction = TextInputAction.done,
Brightness keyboardAppearance = Brightness.light, TextCapitalization textCapitalization = TextCapitalization.none,
Brightness keyboardAppearance = Brightness.light,
TextCapitalization textCapitalization = TextCapitalization.none,
bool unityTouchKeyboard = false) {
this.inputType = inputType ?? TextInputType.text;
this.inputAction = inputAction;

D.assert(this.imeRequired());
TextInput.keyboardDelegate.setIMEPos(imeGlobalPos);
}
public bool imeRequired() {
return TextInput.keyboardDelegate != null && TextInput.keyboardDelegate.imeRequired();
}

if (Application.isEditor) {
keyboardDelegate = new DefaultKeyboardDelegate();
} else {
}
else {
#if UNITY_IOS || UNITY_ANDROID
if (configuration.unityTouchKeyboard) {
keyboardDelegate = new UnityTouchScreenKeyboardDelegate();

keyboardDelegate = new DefaultKeyboardDelegate();
#endif
}
keyboardDelegate.setClient(connection._id, configuration);
return connection;
}

(keyboardDelegate as TextInputUpdateListener)?.Update();
}
}
internal static void _updateEditingState(int client, TextEditingValue value) {
if (_currentConnection == null) {
return;

_currentConnection._client.updateEditingValue(value);
}
internal static void _performAction(int client, TextInputAction action) {
internal static void _performAction(int client, TextInputAction action) {
if (_currentConnection == null) {
return;
}

keyboardDelegate.hide();
}
});
}
}
}
}

5
Runtime/widgets/app.cs


public void didChangeTextScaleFactor() {
this.setState();
}
public void didChangePlatformBrightness() {
this.setState(() => {
});
}
public void didChangeLocales(List<Locale> locale) {
Locale newLocale = this._resolveLocales(locale, this.widget.supportedLocales);

45
Runtime/widgets/basic.cs


this.clipBehavior = clipBehavior;
}
public static Widget shape(
Key key = null,
ShapeBorder shape = null,
Clip clipBehavior = Clip.antiAlias,
Widget child = null
) {
D.assert(shape != null);
return new Builder(
key: key,
builder: (BuildContext context) => {
return new ClipPath(
clipper: new ShapeBorderClipper(
shape: shape
),
clipBehavior: clipBehavior,
child: child
);
}
);
}
public readonly CustomClipper<Path> clipper;
public readonly Clip clipBehavior;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", this.alignment));
properties.add(new DiagnosticsProperty<Axis>("constrainedAxis", null));
properties.add(new EnumProperty<Axis?>("constrainedAxis", null));
}
}

public class IntrinsicWidth : SingleChildRenderObjectWidget {
public IntrinsicWidth(Key key = null, float? stepWidth = null, float? stepHeight = null, Widget child = null)
: base(key: key, child: child) {
D.assert(stepWidth == null || stepWidth >= 0.0f);
D.assert(stepHeight == null || stepHeight >= 0.0f);
this.stepWidth = stepWidth;
this.stepHeight = stepHeight;
}

public readonly float? stepHeight;
float? _stepWidth {
get {
return this.stepWidth == 0.0f ? null : this.stepWidth;
}
}
float? _stepHeight {
get {
return this.stepHeight == 0.0f ? null : this.stepHeight;
}
}
return new RenderIntrinsicWidth(stepWidth: this.stepWidth, stepHeight: this.stepHeight);
return new RenderIntrinsicWidth(stepWidth: this._stepWidth, stepHeight: this._stepHeight);
renderObject.stepWidth = this.stepWidth;
renderObject.stepHeight = this.stepHeight;
renderObject.stepWidth = this._stepWidth;
renderObject.stepHeight = this._stepHeight;
}
}

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

Widget child = null) : base(key: key, child: child) {
D.assert(clipper != null);
D.assert(color != null);
D.assert(elevation >= 0.0f);
this.clipper = clipper;
this.clipBehavior = clipBehavior;
this.elevation = elevation;

8
Runtime/widgets/binding.cs


void didChangeTextScaleFactor();
void didChangePlatformBrightness();
void didChangeLocales(List<Locale> locale);
IPromise<bool> didPopRoute();

foreach (WidgetsBindingObserver observer in this._observers) {
observer.didChangeTextScaleFactor();
}
}
protected override void handlePlatformBrightnessChanged() {
base.handlePlatformBrightnessChanged();
foreach (WidgetsBindingObserver observer in this._observers)
observer.didChangePlatformBrightness();
}
protected virtual void handleLocaleChanged() {

11
Runtime/widgets/debug.cs


if (nonUniqueKey != null) {
throw new UIWidgetsError($"Duplicate key found: {nonUniqueKey}.");
}
return true;
});
return false;

"To return an empty space that takes as little room as possible, return \"new Container(width: 0.0, height: 0.0)\".");
}
if (widget == built) {
throw new UIWidgetsError(
"A build function returned context.widget.\n" +
"The offending widget is: $widget\n" +
"Build functions must never return their BuildContext parameter\'s widget or a child that contains 'context.widget'. " +
"Doing so introduces a loop in the widget tree that can cause the app to crash."
);
}
return true;
});
}

"WidgetsApp widget at the top of your application widget tree."
);
}
return true;
});
return true;

117
Runtime/widgets/dismissible.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

namespace Unity.UIWidgets.widgets {
public delegate void DismissDirectionCallback(DismissDirection? direction);
public delegate Promise<bool> ConfirmDismissCallback(DismissDirection? direction);
public enum DismissDirection {
vertical,

Widget child = null,
Widget background = null,
Widget secondaryBackground = null,
ConfirmDismissCallback confirmDismiss = null,
VoidCallback onResize = null,
DismissDirectionCallback onDismissed = null,
DismissDirection direction = DismissDirection.horizontal,

float crossAxisEndOffset = 0.0f
float crossAxisEndOffset = 0.0f,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
D.assert(key != null);
D.assert(secondaryBackground != null ? background != null : true);

this.child = child;
this.background = background;
this.secondaryBackground = secondaryBackground;
this.confirmDismiss = confirmDismiss;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Widget child;

public readonly DismissDirectionCallback onDismissed;
public readonly ConfirmDismissCallback confirmDismiss;
public readonly TimeSpan resizeDuration;
public readonly TimeSpan? resizeDuration;
public readonly TimeSpan movementDuration;
public readonly TimeSpan? movementDuration;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _DismissibleState();

}
this._dragUnderway = false;
if (this._moveController.isCompleted) {
this._startResizeAnimation();
return;
}
this._confirmStartResizeAnimation().Then((value) => {
if (this._moveController.isCompleted && value) {
this._startResizeAnimation();
}
else {
float flingVelocity = this._directionIsXAxis
? details.velocity.pixelsPerSecond.dx
: details.velocity.pixelsPerSecond.dy;
switch (this._describeFlingGesture(details.velocity)) {
case _FlingGestureKind.forward:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
if ((this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ??
_kDismissThreshold) >= 1.0) {
this._moveController.reverse();
break;
}
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.reverse:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.none:
if (!this._moveController.isDismissed) {
// we already know it's not completed, we check that above
if (this._moveController.value >
(this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ??
_kDismissThreshold)) {
this._moveController.forward();
}
else {
this._moveController.reverse();
}
}
float flingVelocity = this._directionIsXAxis
? details.velocity.pixelsPerSecond.dx
: details.velocity.pixelsPerSecond.dy;
switch (this._describeFlingGesture(details.velocity)) {
case _FlingGestureKind.forward:
D.assert(this._dragExtent != 0.0f);
D.assert(!this._moveController.isDismissed);
if ((this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold) >= 1.0) {
this._moveController.reverse();
break;
break;
}
});
}
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.reverse:
D.assert(this._dragExtent != 0.0);
D.assert(!this._moveController.isDismissed);
this._dragExtent = flingVelocity.sign();
this._moveController.fling(velocity: -flingVelocity.abs() * _kFlingVelocityScale);
break;
case _FlingGestureKind.none:
if (!this._moveController.isDismissed) {
// we already know it's not completed, we check that above
if (this._moveController.value >
(this.widget.dismissThresholds.getOrDefault(this._dismissDirection) ?? _kDismissThreshold)) {
this._moveController.forward();
}
else {
this._moveController.reverse();
}
void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !this._dragUnderway) {
this._confirmStartResizeAnimation().Then((value) => {
if (value) {
this._startResizeAnimation();
}
else {
this._moveController.reverse();
break;
this.updateKeepAlive();
});
void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !this._dragUnderway) {
this._startResizeAnimation();
IPromise<bool> _confirmStartResizeAnimation() {
if (this.widget.confirmDismiss != null) {
DismissDirection? direction = this._dismissDirection;
D.assert(direction != null);
return this.widget.confirmDismiss(direction);
this.updateKeepAlive();
return Promise<bool>.Resolved(true);
}
void _startResizeAnimation() {

: (GestureDragUpdateCallback) this._handleDragUpdate,
onVerticalDragEnd: this._directionIsXAxis ? null : (GestureDragEndCallback) this._handleDragEnd,
behavior: HitTestBehavior.opaque,
child: content
child: content,
dragStartBehavior: this.widget.dragStartBehavior
);
}
}

321
Runtime/widgets/editable_text.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler;

public readonly Color cursorColor;
public readonly Color backgroundCursorColor;
public readonly int? maxLines;
public readonly bool autofocus;

public readonly bool unityTouchKeyboard;
public EditableText(TextEditingController controller, FocusNode focusNode, TextStyle style,
Color cursorColor, bool obscureText = false, bool autocorrect = false,
Color cursorColor, Color backgroundCursorColor = null, bool obscureText = false, bool autocorrect = false,
TextAlign textAlign = TextAlign.left, TextDirection? textDirection = null,
float? textScaleFactor = null, int? maxLines = 1,
bool autofocus = false, Color selectionColor = null, TextSelectionControls selectionControls = null,

ValueChanged<string> onSubmitted = null, SelectionChangedCallback onSelectionChanged = null,
List<TextInputFormatter> inputFormatters = null, bool rendererIgnoresPointer = false,
EdgeInsets scrollPadding = null, bool unityTouchKeyboard = false,
Key key = null, float? cursorWidth = 2.0f, Radius cursorRadius = null, Brightness? keyboardAppearance = Brightness.light,
bool enableInteractiveSelection = true
) : base(key) {
Key key = null, float? cursorWidth = 2.0f, Radius cursorRadius = null, bool cursorOpacityAnimates = false,
Offset cursorOffset = null, bool paintCursorAboveText = false,
Brightness? keyboardAppearance = Brightness.light,
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
bool? enableInteractiveSelection = null
) : base(key) {
// D.assert(backgroundCursorColor != null); // TODO: remove comment
this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f);

this.textInputAction = textInputAction;
this.textCapitalization = textCapitalization;
this.cursorColor = cursorColor;
this.backgroundCursorColor = backgroundCursorColor ?? Colors.grey; // TODO: remove ??
this.maxLines = maxLines;
this.autofocus = autofocus;
this.selectionColor = selectionColor;

this.cursorWidth = cursorWidth;
this.cursorRadius = cursorRadius;
this.cursorOpacityAnimates = cursorOpacityAnimates;
this.cursorOffset = cursorOffset;
this.paintCursorAboveText = paintCursorAboveText;
this.dragStartBehavior = dragStartBehavior;
public readonly bool cursorOpacityAnimates;
public readonly Offset cursorOffset;
public readonly bool paintCursorAboveText;
public readonly DragStartBehavior dragStartBehavior;
public readonly bool enableInteractiveSelection;
public readonly bool? enableInteractiveSelection;
public bool selectionEnabled {
get { return this.enableInteractiveSelection ?? !this.obscureText; }
}
public static bool debugDeterministicCursor = false;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

}
}
public class EditableTextState : AutomaticKeepAliveClientMixin<EditableText>, WidgetsBindingObserver, TextInputClient,
public class EditableTextState : AutomaticKeepAliveClientWithTickerProviderStateMixin<EditableText>,
WidgetsBindingObserver, TextInputClient,
static TimeSpan _kCursorBlinkWaitForStart = TimeSpan.FromMilliseconds(150);
ValueNotifier<bool> _showCursor = new ValueNotifier<bool>(false);
bool _targetCursorVisibility = false;
ValueNotifier<bool> _cursorVisibilityNotifier = new ValueNotifier<bool>(false);
LayerLink _layerLink = new LayerLink();
bool _didAutoFocus = false;
public ScrollController _scrollController = new ScrollController();
int _obscureShowCharTicksPending = 0;
int _obscureLatestCharIndex;
public ScrollController _scrollController = new ScrollController();
AnimationController _cursorBlinkOpacityController;
LayerLink _layerLink = new LayerLink();
bool _didAutoFocus = false;
static readonly TimeSpan _fadeDuration = TimeSpan.FromMilliseconds(250);
static readonly TimeSpan _floatingCursorResetTime = TimeSpan.FromMilliseconds(125);
AnimationController _floatingCursorResetController;
Color _cursorColor {
get { return this.widget.cursorColor.withOpacity(this._cursorBlinkOpacityController.value); }
}
this._cursorBlinkOpacityController = new AnimationController(vsync: this, duration: _fadeDuration);
this._cursorBlinkOpacityController.addListener(this._onCursorColorTick);
this._floatingCursorResetController = new AnimationController(vsync: this);
this._floatingCursorResetController.addListener(this._onFloatingCursorResetTick);
}
public override void didChangeDependencies() {

public override void dispose() {
this.widget.controller.removeListener(this._didChangeTextEditingValue);
this._cursorBlinkOpacityController.removeListener(this._onCursorColorTick);
this._floatingCursorResetController.removeListener(this._onFloatingCursorResetTick);
this._closeInputConnectionIfNeeded();
D.assert(!this._hasInputConnection);
this._stopCursorTimer();

this._lastKnownRemoteTextEditingValue = value;
this._formatAndSetValue(value);
this._stopCursorTimer(resetCharTicks: false);
this._startCursorTimer();
}
public void performAction(TextInputAction action) {

}
}
Rect _startCaretRect;
TextPosition _lastTextPosition;
Offset _pointOffsetOrigin;
Offset _lastBoundedOffset;
Offset _floatingCursorOffset {
get { return new Offset(0, this.renderEditable.preferredLineHeight / 2); }
}
public void updateFloatingCursor(RawFloatingCursorPoint point) {
switch (point.state) {
case FloatingCursorDragState.Start:
TextPosition currentTextPosition =
new TextPosition(offset: this.renderEditable.selection.baseOffset);
this._startCaretRect = this.renderEditable.getLocalRectForCaret(currentTextPosition);
this.renderEditable.setFloatingCursor(point.state,
this._startCaretRect.center - this._floatingCursorOffset, currentTextPosition);
break;
case FloatingCursorDragState.Update:
// We want to send in points that are centered around a (0,0) origin, so we cache the
// position on the first update call.
if (this._pointOffsetOrigin != null) {
Offset centeredPoint = point.offset - this._pointOffsetOrigin;
Offset rawCursorOffset =
this._startCaretRect.center + centeredPoint - this._floatingCursorOffset;
this._lastBoundedOffset =
this.renderEditable.calculateBoundedFloatingCursorOffset(rawCursorOffset);
this._lastTextPosition = this.renderEditable.getPositionForPoint(
this.renderEditable.localToGlobal(this._lastBoundedOffset + this._floatingCursorOffset));
this.renderEditable.setFloatingCursor(point.state, this._lastBoundedOffset,
this._lastTextPosition);
}
else {
this._pointOffsetOrigin = point.offset;
}
break;
case FloatingCursorDragState.End:
this._floatingCursorResetController.setValue(0.0f);
this._floatingCursorResetController.animateTo(1.0f, duration: _floatingCursorResetTime,
curve: Curves.decelerate);
break;
}
}
void _onFloatingCursorResetTick() {
Offset finalPosition = this.renderEditable.getLocalRectForCaret(this._lastTextPosition).centerLeft - this._floatingCursorOffset;
if (this._floatingCursorResetController.isCompleted) {
this.renderEditable.setFloatingCursor(FloatingCursorDragState.End, finalPosition, this._lastTextPosition);
if (this._lastTextPosition.offset != this.renderEditable.selection.baseOffset)
this._handleSelectionChanged(TextSelection.collapsed(offset: this._lastTextPosition.offset), this.renderEditable, SelectionChangedCause.forcePress);
this._startCaretRect = null;
this._lastTextPosition = null;
this._pointOffsetOrigin = null;
this._lastBoundedOffset = null;
} else {
float lerpValue = this._floatingCursorResetController.value;
float lerpX = MathUtils.lerpFloat(this._lastBoundedOffset.dx, finalPosition.dx, lerpValue);
float lerpY = MathUtils.lerpFloat(this._lastBoundedOffset.dy, finalPosition.dy, lerpValue);
this.renderEditable.setFloatingCursor(FloatingCursorDragState.Update, new Offset(lerpX, lerpY), this._lastTextPosition, resetLerpValue: lerpValue);
}
}
void _finalizeEditing(bool shouldUnfocus) {
if (this.widget.onEditingComplete != null) {
this.widget.onEditingComplete();

// Calculate the new scroll offset so the cursor remains visible.
float _getScrollOffsetForCaret(Rect caretRect) {
float caretStart = this._isMultiline ? caretRect.top : caretRect.left;
float caretEnd = this._isMultiline ? caretRect.bottom : caretRect.right;
float caretStart;
float caretEnd;
if (this._isMultiline) {
// The caret is vertically centered within the line. Expand the caret's
// height so that it spans the line because we're going to ensure that the entire
// expanded caret is scrolled into view.
float lineHeight = this.renderEditable.preferredLineHeight;
float caretOffset = (lineHeight - caretRect.height) / 2;
caretStart = caretRect.top - caretOffset;
caretEnd = caretRect.bottom + caretOffset;
}
else {
caretStart = caretRect.left;
caretEnd = caretRect.right;
}
float scrollOffset = this._scrollController.offset;
float viewportExtent = this._scrollController.position.viewportDimension;
if (caretStart < 0.0) {

? TextInputAction.newline
: TextInputAction.done),
textCapitalization: this.widget.textCapitalization,
keyboardAppearance: this.widget.keyboardAppearance??Brightness.light,
keyboardAppearance: this.widget.keyboardAppearance ?? Brightness.light,
));
this._textInputConnection.setEditingState(localValue);
this._updateImePosIfNeed();

this._openInputConnection();
}
else {
List<FocusScopeNode> ancestorScopes = FocusScope.ancestorsOf(this.context);
for (int i = ancestorScopes.Count - 1; i >= 1; i -= 1)
ancestorScopes[i].setFirstFocus(ancestorScopes[i - 1]);
FocusScope.of(this.context).requestFocus(this.widget.focusNode);
}
}

layerLink: this._layerLink,
renderObject: renderObject,
selectionControls: this.widget.selectionControls,
selectionDelegate: this
selectionDelegate: this,
dragStartBehavior: this.widget.dragStartBehavior
);
bool longPress = cause == SelectionChangedCause.longPress;
if (cause != SelectionChangedCause.keyboard && (this._value.text.isNotEmpty() || longPress)) {

);
});
}
if (this._lastBottomViewInset < Window.instance.viewInsets.bottom) {
this._showCaretOnScreen();
if (this._lastBottomViewInset < Window.instance.viewInsets.bottom) {
this._showCaretOnScreen();
this._lastBottomViewInset = Window.instance.viewInsets.bottom;
this._lastBottomViewInset = Window.instance.viewInsets.bottom;
public void didChangeTextScaleFactor() {}
public void didChangeTextScaleFactor() {
}
public void didChangeLocales(List<Locale> locale) {}
public void didChangePlatformBrightness() {
}
public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);

}
void _formatAndSetValue(TextEditingValue value) {
var textChanged = (this._value == null ? null : this._value.text) != (value == null ? null : value.text);
if (this.widget.inputFormatters != null && this.widget.inputFormatters.isNotEmpty()) {
var textChanged = this._value?.text != value?.text;
if (textChanged && this.widget.inputFormatters != null && this.widget.inputFormatters.isNotEmpty()) {
foreach (var formatter in this.widget.inputFormatters) {
value = formatter.formatEditUpdate(this._value, value);
}

}
}
void _onCursorColorTick() {
this.renderEditable.cursorColor =
this.widget.cursorColor.withOpacity(this._cursorBlinkOpacityController.value);
this._cursorVisibilityNotifier.value = this._cursorBlinkOpacityController.value > 0;
}
get { return this._showCursor.value; }
get { return this._cursorBlinkOpacityController.value > 0; }
}
public TimeSpan cursorBlinkInterval {

public TextSelectionOverlay selectionOverlay {
get { return this._selectionOverlay; }
}
int _obscureShowCharTicksPending = 0;
int _obscureLatestCharIndex;
this._showCursor.value = !this._unityKeyboard() && !this._showCursor.value;
this._targetCursorVisibility = !this._unityKeyboard() && !this._targetCursorVisibility;
float targetOpacity = this._targetCursorVisibility ? 1.0f : 0.0f;
if (this.widget.cursorOpacityAnimates) {
this._cursorBlinkOpacityController.animateTo(targetOpacity, curve: Curves.easeOut);
}
else {
this._cursorBlinkOpacityController.setValue(targetOpacity);
}
void _startCursorTimer() {
this._showCursor.value = !this._unityKeyboard();
this._cursorTimer = Window.instance.run(_kCursorBlinkHalfPeriod, this._cursorTick,
periodic: true);
void _cursorWaitForStart() {
D.assert(_kCursorBlinkHalfPeriod > _fadeDuration);
this._cursorTimer?.cancel();
this._cursorTimer = Window.instance.run(_kCursorBlinkHalfPeriod, this._cursorTick, periodic: true);
void _stopCursorTimer() {
if (this._cursorTimer != null) {
this._cursorTimer.cancel();
void _startCursorTimer() {
this._targetCursorVisibility = true;
this._cursorBlinkOpacityController.setValue(1.0f);
if (EditableText.debugDeterministicCursor) {
return;
if (this.widget.cursorOpacityAnimates) {
this._cursorTimer =
Window.instance.run(_kCursorBlinkWaitForStart, this._cursorWaitForStart, periodic: true);
}
else {
this._cursorTimer = Window.instance.run(_kCursorBlinkHalfPeriod, this._cursorTick, periodic: true);
}
}
void _stopCursorTimer(bool resetCharTicks = true) {
this._cursorTimer?.cancel();
this._showCursor.value = false;
this._obscureShowCharTicksPending = 0;
this._targetCursorVisibility = false;
this._cursorBlinkOpacityController.setValue(0.0f);
if (EditableText.debugDeterministicCursor) {
return;
}
if (resetCharTicks) {
this._obscureShowCharTicksPending = 0;
}
if (this.widget.cursorOpacityAnimates) {
this._cursorBlinkOpacityController.stop();
this._cursorBlinkOpacityController.setValue(0.0f);
}
}
void _startOrStopCursorTimerIfNeeded() {

WidgetsBinding.instance.removeObserver(this);
this._value = new TextEditingValue(text: this._value.text);
}
this.updateKeepAlive();
}

}
}
float _devicePixelRatio {
get { return MediaQuery.of(this.context).devicePixelRatio; }
}
bool showToolbar() {
if (this._selectionOverlay == null) {
return false;
}
this._selectionOverlay.showToolbar();
return true;
}
public void hideToolbar() {
this._selectionOverlay?.hide();
}

axisDirection: this._isMultiline ? AxisDirection.down : AxisDirection.right,
controller: this._scrollController,
physics: new ClampingScrollPhysics(),
dragStartBehavior: this.widget.dragStartBehavior,
viewportBuilder: (BuildContext _context, ViewportOffset offset) =>
new CompositedTransformTarget(
link: this._layerLink,

value: this._value,
cursorColor: this.widget.cursorColor,
showCursor: this._showCursor,
cursorColor: this._cursorColor,
backgroundCursorColor: this.widget.backgroundCursorColor,
showCursor: EditableText.debugDeterministicCursor
? new ValueNotifier<bool>(true)
: this._cursorVisibilityNotifier,
hasFocus: this._hasFocus,
maxLines: this.widget.maxLines,
selectionColor: this.widget.selectionColor,

rendererIgnoresPointer: this.widget.rendererIgnoresPointer,
cursorWidth: this.widget.cursorWidth,
cursorRadius: this.widget.cursorRadius,
enableInteractiveSelection: this.widget.enableInteractiveSelection,
textSelectionDelegate: this
cursorOffset: this.widget.cursorOffset,
paintCursorAboveText: this.widget.paintCursorAboveText,
enableInteractiveSelection: this.widget.enableInteractiveSelection == true,
textSelectionDelegate: this,
devicePixelRatio: this._devicePixelRatio
)
)
);

}
bool _imePosUpdateScheduled = false;
void _updateImePosIfNeed() {
if (!this._hasInputConnection || !this._textInputConnection.imeRequired()) {
return;

return;
}
this._imePosUpdateScheduled = true;
SchedulerBinding.instance.addPostFrameCallback(_ => {
this._imePosUpdateScheduled = false;

this._textInputConnection.setIMEPos(this._getImePos());
});
}

public readonly TextSpan textSpan;
public readonly TextEditingValue value;
public readonly Color cursorColor;
public readonly Color backgroundCursorColor;
public readonly ValueNotifier<bool> showCursor;
public readonly bool hasFocus;
public readonly int? maxLines;

public readonly bool rendererIgnoresPointer;
public readonly float? cursorWidth;
public readonly Radius cursorRadius;
public readonly Offset cursorOffset;
public readonly bool? paintCursorAboveText;
public readonly float? devicePixelRatio;
Color cursorColor = null, ValueNotifier<bool> showCursor = null, bool hasFocus = false,
Color cursorColor = null, Color backgroundCursorColor = null, ValueNotifier<bool> showCursor = null,
bool hasFocus = false,
Key key = null, TextSelectionDelegate textSelectionDelegate = null, float? cursorWidth = null,
Radius cursorRadius = null, bool enableInteractiveSelection = true) : base(key) {
Key key = null, TextSelectionDelegate textSelectionDelegate = null, float? cursorWidth = null,
Radius cursorRadius = null, Offset cursorOffset = null, bool enableInteractiveSelection = true,
bool? paintCursorAboveText = null, float? devicePixelRatio = null) : base(key) {
this.backgroundCursorColor = backgroundCursorColor;
this.showCursor = showCursor;
this.hasFocus = hasFocus;
this.maxLines = maxLines;

this.textSelectionDelegate = textSelectionDelegate;
this.cursorWidth = cursorWidth;
this.cursorRadius = cursorRadius;
this.cursorOffset = cursorOffset;
this.paintCursorAboveText = paintCursorAboveText;
this.devicePixelRatio = devicePixelRatio;
}
public override RenderObject createRenderObject(BuildContext context) {

offset: this.offset,
showCursor: this.showCursor,
cursorColor: this.cursorColor,
backgroundCursorColor: this.backgroundCursorColor,
hasFocus: this.hasFocus,
maxLines: this.maxLines,
selectionColor: this.selectionColor,

onSelectionChanged: this.onSelectionChanged,
onCaretChanged: this.onCaretChanged,
ignorePointer: this.rendererIgnoresPointer,
cursorWidth: this.cursorWidth??1.0f,
cursorWidth: this.cursorWidth ?? 1.0f,
cursorOffset: this.cursorOffset,
textSelectionDelegate: this.textSelectionDelegate
textSelectionDelegate: this.textSelectionDelegate,
paintCursorAboveText: this.paintCursorAboveText == true,
devicePixelRatio: this.devicePixelRatio ?? 1.0f
);
}

edit.cursorColor = this.cursorColor;
edit.backgroundCursorColor = this.backgroundCursorColor;
edit.showCursor = this.showCursor;
edit.hasFocus = this.hasFocus;
edit.maxLines = this.maxLines;

edit.textSelectionDelegate = this.textSelectionDelegate;
edit.cursorWidth = this.cursorWidth ?? 1.0f;
edit.cursorRadius = this.cursorRadius;
edit.cursorOffset = this.cursorOffset;
edit.paintCursorAboveText = this.paintCursorAboveText == true;
edit.devicePixelRatio = this.devicePixelRatio ?? 1.0f;
}
}
}

30
Runtime/widgets/focus_manager.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Unity.UIWidgets.widgets {
public class FocusNode : ChangeNotifier {

internal FocusScopeNode _lastChild;
internal FocusNode _focus;
internal List<FocusScopeNode> _focusPath;
}
internal List<FocusScopeNode> _getFocusPath() {
List<FocusScopeNode> nodes = new List<FocusScopeNode> {this};
FocusScopeNode node = this._parent;
while (node != null && node != this._manager?.rootScope) {
nodes.Add(node);
node = node._parent;
}
return nodes;
}
internal void _prepend(FocusScopeNode child) {

public void requestFocus(FocusNode node) {
D.assert(node != null);
if (this._focus == node) {
var focusPath = this._manager?._getCurrentFocusPath();
if (this._focus == node &&
(this._focusPath == focusPath || (focusPath != null && this._focusPath != null &&
this._focusPath.SequenceEqual(focusPath)))) {
return;
}

this._focus._manager = this._manager;
this._focus._hasKeyboardToken = true;
this._didChangeFocusChain();
this._focusPath = this._getFocusPath();
}
internal void _resignFocus(FocusNode node) {

public FocusNode currentFocus {
get { return this._currentFocus; }
}
internal FocusNode _currentFocus;
internal void _willDisposeFocusNode(FocusNode node) {

}
}
internal List<FocusScopeNode> _getCurrentFocusPath() {
return this._currentFocus?._parent?._getFocusPath();
}
this.rootScope.setFirstFocus(this._noneScope);
}
else {

public override string ToString() {
var status = this._haveScheduledUpdate ? " UPDATE SCHEDULED" : "";
var indent = " ";

22
Runtime/widgets/focus_scope.cs


using Unity.UIWidgets.foundation;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
class _FocusScopeMarker : InheritedWidget {

public readonly Widget child;
public static FocusScopeNode of(BuildContext context) {
D.assert(context != null);
var scope = (_FocusScopeMarker) context.inheritFromWidgetOfExactType(typeof(_FocusScopeMarker));
if (scope != null && scope.node != null) {
return scope.node;

}
public static List<FocusScopeNode> ancestorsOf(BuildContext context) {
D.assert(context != null);
List<FocusScopeNode> ancestors = new List<FocusScopeNode> { };
while (true) {
context = context.ancestorInheritedElementForWidgetOfExactType(typeof(_FocusScopeMarker));
if (context == null) {
return ancestors;
}
_FocusScopeMarker scope = (_FocusScopeMarker) context.widget;
ancestors.Add(scope.node);
context.visitAncestorElements((Element parent) => {
context = parent;
return false;
});
}
}
public override State createState() {

10
Runtime/widgets/framework.cs


static readonly Dictionary<CompositeKey, Element> _registry =
new Dictionary<CompositeKey, Element>();
static readonly HashSet<CompositeKey> _removedKeys = new HashSet<CompositeKey>();
static readonly HashSet<Element> _debugIllFatedElements = new HashSet<Element>();
static readonly Dictionary<CompositeKey, Element> _debugReservations =

});
if (_registry[compKey] == element) {
_registry.Remove(compKey);
_removedKeys.Add(compKey);
}
}

}
properties.add(new FlagProperty("dirty", value: this.dirty, ifTrue: "dirty"));
if (this._dependencies != null && this._dependencies.isNotEmpty()) {
List<DiagnosticsNode> diagnosticsDependencies = this._dependencies
.Select((InheritedElement element) => element.widget.toDiagnosticsNode(style: DiagnosticsTreeStyle.sparse))
.ToList();
properties.add(new DiagnosticsProperty<List<DiagnosticsNode>>("dependencies", diagnosticsDependencies));
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {

"the inherited widget is in a constructor or an initState() method, " +
"then the rebuilt dependent widget will not reflect the changes in the " +
"inherited widget.\n" +
"Typically references to to inherited widgets should occur in widget build() methods. Alternatively, " +
"Typically references to inherited widgets should occur in widget build() methods. Alternatively, " +
"initialization based on inherited widgets can be placed in the didChangeDependencies method, which " +
"is called after initState and whenever the dependencies change thereafter."
);

50
Runtime/widgets/gesture_detector.cs


GestureTapCancelCallback onTapCancel = null,
GestureDoubleTapCallback onDoubleTap = null,
GestureLongPressCallback onLongPress = null,
GestureLongPressUpCallback onLongPressUp = null,
GestureLongPressDragStartCallback onLongPressDragStart = null,
GestureLongPressDragUpdateCallback onLongPressDragUpdate = null,
GestureLongPressDragUpCallback onLongPressDragUp = null,
GestureDragDownCallback onVerticalDragDown = null,
GestureDragStartCallback onVerticalDragStart = null,
GestureDragUpdateCallback onVerticalDragUpdate = null,

GestureDragUpdateCallback onPanUpdate = null,
GestureDragEndCallback onPanEnd = null,
GestureDragCancelCallback onPanCancel = null,
HitTestBehavior behavior = HitTestBehavior.deferToChild) : base(key) {
HitTestBehavior behavior = HitTestBehavior.deferToChild,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key) {
D.assert(() => {
bool haveVerticalDrag =
onVerticalDragStart != null || onVerticalDragUpdate != null ||

onHorizontalDragEnd != null;
bool haveLongPress = onLongPress != null || onLongPressUp != null;
bool haveLongPressDrag = onLongPressDragStart != null || onLongPressDragUpdate != null || onLongPressDragUp != null;
bool havePan = onPanStart != null || onPanUpdate != null || onPanEnd != null;
if (havePan) {
if (haveVerticalDrag && haveHorizontalDrag) {

);
}
}
if (haveLongPress && haveLongPressDrag) {
throw new UIWidgetsError(
"Incorrect GestureDetector arguments.\n" +
"Having both a long press and a long press drag recognizer is " +
"redundant as the long press drag is a superset of long press. " +
"Except long press drag allows for drags after the long press is " +
"triggered."
);
}
return true;
});

this.onTapCancel = onTapCancel;
this.onDoubleTap = onDoubleTap;
this.onLongPress = onLongPress;
this.onLongPressUp = onLongPressUp;
this.onLongPressDragStart = onLongPressDragStart;
this.onLongPressDragUpdate = onLongPressDragUpdate;
this.onLongPressDragUp = onLongPressDragUp;
this.onVerticalDragDown = onVerticalDragDown;
this.onVerticalDragStart = onVerticalDragStart;
this.onVerticalDragUpdate = onVerticalDragUpdate;

this.onPanEnd = onPanEnd;
this.onPanCancel = onPanCancel;
this.behavior = behavior;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Widget child;

public readonly GestureTapCancelCallback onTapCancel;
public readonly GestureDoubleTapCallback onDoubleTap;
public readonly GestureLongPressCallback onLongPress;
public readonly GestureLongPressUpCallback onLongPressUp;
public readonly GestureLongPressDragStartCallback onLongPressDragStart;
public readonly GestureLongPressDragUpdateCallback onLongPressDragUpdate;
public readonly GestureLongPressDragUpCallback onLongPressDragUp;
public readonly GestureDragDownCallback onVerticalDragDown;
public readonly GestureDragStartCallback onVerticalDragStart;
public readonly GestureDragUpdateCallback onVerticalDragUpdate;

public readonly GestureDragEndCallback onPanEnd;
public readonly GestureDragCancelCallback onPanCancel;
public readonly HitTestBehavior behavior;
public readonly DragStartBehavior dragStartBehavior;
public override Widget build(BuildContext context) {
var gestures = new Dictionary<Type, GestureRecognizerFactory>();

);
}
if (this.onLongPress != null) {
if (this.onLongPress != null || this.onLongPressUp != null) {
gestures[typeof(LongPressGestureRecognizer)] =
new GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
() => new LongPressGestureRecognizer(debugOwner: this),

if (this.onLongPressDragStart != null || this.onLongPressDragUpdate != null || this.onLongPressDragUp != null) {
gestures[typeof(LongPressDragGestureRecognizer)] = new GestureRecognizerFactoryWithHandlers<LongPressDragGestureRecognizer>(
() => new LongPressDragGestureRecognizer(debugOwner: this),
(LongPressDragGestureRecognizer instance) => {
instance.onLongPressStart = this.onLongPressDragStart;
instance.onLongPressDragUpdate = this.onLongPressDragUpdate;
instance.onLongPressUp = this.onLongPressDragUp;
}
);
}
if (this.onVerticalDragDown != null ||
this.onVerticalDragStart != null ||

instance.onUpdate = this.onVerticalDragUpdate;
instance.onEnd = this.onVerticalDragEnd;
instance.onCancel = this.onVerticalDragCancel;
instance.dragStartBehavior = this.dragStartBehavior;
}
);
}

instance.onUpdate = this.onHorizontalDragUpdate;
instance.onEnd = this.onHorizontalDragEnd;
instance.onCancel = this.onHorizontalDragCancel;
instance.dragStartBehavior = this.dragStartBehavior;
}
);
}

instance.onUpdate = this.onPanUpdate;
instance.onEnd = this.onPanEnd;
instance.onCancel = this.onPanCancel;
instance.dragStartBehavior = this.dragStartBehavior;
}
);
}

behavior: this.behavior,
child: this.child
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<DragStartBehavior>("startBehavior", this.dragStartBehavior));
}
}

6
Runtime/widgets/icon_theme_data.cs


public static IconThemeData lerp(IconThemeData a, IconThemeData b, float t) {
return new IconThemeData(
color: Color.lerp(a.color, b.color, t),
opacity: MathUtils.lerpNullableFloat(a.opacity, b.opacity, t),
size: MathUtils.lerpNullableFloat(a.size, b.size, t));
color: Color.lerp(a?.color, b?.color, t),
opacity: MathUtils.lerpNullableFloat(a?.opacity, b?.opacity, t),
size: MathUtils.lerpNullableFloat(a?.size, b?.size, t));
}

3
Runtime/widgets/image.cs


void listener(ImageInfo image, bool sync) {
completer.Resolve();
stream.removeListener(listener);
stream.removeListener(listener);
if (onError != null) {
onError(exception);
}

}
stream.addListener(listener, onError: errorListener);
completer.Then(() => { stream.removeListener(listener); });
return completer;
}
}

2
Runtime/widgets/implicit_animations.cs


) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(child != null);
D.assert(shape != null);
D.assert(elevation != null);
D.assert(elevation != null && elevation >= 0.0f);
D.assert(color != null);
D.assert(shadowColor != null);
D.assert(duration != null);

17
Runtime/widgets/media_query.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {

Size size = null,
float devicePixelRatio = 1.0f,
float textScaleFactor = 1.0f,
Brightness platformBrightness = Brightness.light,
EdgeInsets viewInsets = null,
EdgeInsets padding = null,
bool alwaysUse24HourFormat = false,

this.size = size ?? Size.zero;
this.devicePixelRatio = devicePixelRatio;
this.textScaleFactor = textScaleFactor;
this.platformBrightness = platformBrightness;
this.viewInsets = viewInsets ?? EdgeInsets.zero;
this.padding = padding ?? EdgeInsets.zero;
this.alwaysUse24HourFormat = alwaysUse24HourFormat;

size: window.physicalSize / window.devicePixelRatio,
devicePixelRatio: window.devicePixelRatio,
textScaleFactor: window.textScaleFactor,
// platformBrightness: window.platformBrightness, // TODO: remove comment when window.platformBrightness is ready
viewInsets: EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio),
padding: EdgeInsets.fromWindowPadding(window.padding, window.devicePixelRatio)
// accessibleNavigation: window.accessibilityFeatures.accessibleNavigation,

public readonly float textScaleFactor;
public readonly Brightness platformBrightness;
public readonly EdgeInsets viewInsets;
public readonly EdgeInsets padding;

Size size = null,
float? devicePixelRatio = null,
float? textScaleFactor = null,
Brightness? platformBrightness = null,
EdgeInsets viewInsets = null,
EdgeInsets padding = null,
bool? alwaysUse24HourFormat = null,

size: size ?? this.size,
devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
platformBrightness: platformBrightness ?? this.platformBrightness,
viewInsets: viewInsets ?? this.viewInsets,
padding: padding ?? this.padding,
alwaysUse24HourFormat: alwaysUse24HourFormat ?? this.alwaysUse24HourFormat,

size: this.size,
devicePixelRatio: this.devicePixelRatio,
textScaleFactor: this.textScaleFactor,
platformBrightness: this.platformBrightness,
padding: this.padding.copyWith(
left: removeLeft ? (float?) 0.0 : null,
top: removeTop ? (float?) 0.0 : null,

size: this.size,
devicePixelRatio: this.devicePixelRatio,
textScaleFactor: this.textScaleFactor,
platformBrightness: this.platformBrightness,
padding: this.padding,
viewInsets: this.viewInsets.copyWith(
left: removeLeft ? (float?) 0.0 : null,

return Equals(this.size, other.size) && this.devicePixelRatio.Equals(other.devicePixelRatio) &&
this.textScaleFactor.Equals(other.textScaleFactor) &&
Equals(this.platformBrightness, other.platformBrightness) &&
Equals(this.viewInsets, other.viewInsets) &&
Equals(this.padding, other.padding) &&
this.alwaysUse24HourFormat == other.alwaysUse24HourFormat &&

var hashCode = (this.size != null ? this.size.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.devicePixelRatio.GetHashCode();
hashCode = (hashCode * 397) ^ this.textScaleFactor.GetHashCode();
hashCode = (hashCode * 397) ^ this.platformBrightness.GetHashCode();
hashCode = (hashCode * 397) ^ (this.viewInsets != null ? this.viewInsets.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (this.padding != null ? this.padding.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ this.alwaysUse24HourFormat.GetHashCode();

$"size: {this.size}, " +
$"devicePixelRatio: {this.devicePixelRatio:F1}, " +
$"textScaleFactor: {this.textScaleFactor:F1}, " +
$"platformBrightness: {this.platformBrightness}, " +
$"padding: {this.padding}, " +
$"viewInsets: {this.viewInsets}, " +
$"alwaysUse24HourFormat: {this.alwaysUse24HourFormat}, " +

public static float textScaleFactorOf(BuildContext context) {
return of(context, nullOk: true)?.textScaleFactor ?? 1.0f;
}
public static Brightness platformBrightnessOf(BuildContext context) {
return of(context, nullOk: true)?.platformBrightness ?? Brightness.light;
}
public static bool boldTextOverride(BuildContext context) {

105
Runtime/widgets/navigator.cs


}
public class RouteSettings {
public RouteSettings(string name = null, bool isInitialRoute = false) {
public RouteSettings(string name = null, bool isInitialRoute = false, object arguments = null) {
this.arguments = arguments;
RouteSettings copyWith(string name = null, bool? isInitialRoute = null) {
RouteSettings copyWith(string name = null, bool? isInitialRoute = null, object arguments = null) {
isInitialRoute ?? this.isInitialRoute
isInitialRoute ?? this.isInitialRoute,
arguments ?? this.arguments
);
}

public readonly object arguments;
return $"\"{this.name}\"";
return $"{this.GetType()}(\"{this.name}\", {this.arguments})";
}
}

public static readonly string defaultRouteName = "/";
public static IPromise<object> pushNamed(BuildContext context, string routeName) {
return Navigator.of(context).pushNamed(routeName);
public static IPromise<object> pushNamed(BuildContext context, string routeName, object arguments = null) {
return of(context).pushNamed(routeName, arguments: arguments);
object result = null) {
return Navigator.of(context).pushReplacementNamed(routeName, result: result);
object result = null, object arguments = null) {
return of(context).pushReplacementNamed(routeName, result: result, arguments: arguments);
public static IPromise<object> popAndPushNamed(BuildContext context, string routeName, object result = null) {
return Navigator.of(context).popAndPushNamed(routeName, result: result);
public static IPromise<object> popAndPushNamed(BuildContext context, string routeName, object result = null,
object arguments = null) {
return of(context).popAndPushNamed(routeName, result: result, arguments: arguments);
RoutePredicate predicate) {
return Navigator.of(context).pushNamedAndRemoveUntil(newRouteName, predicate);
RoutePredicate predicate, object arguments = null) {
return of(context).pushNamedAndRemoveUntil(newRouteName, predicate, arguments: arguments);
return Navigator.of(context).push(route);
return of(context).push(route);
return Navigator.of(context).pushReplacement(newRoute, result);
return of(context).pushReplacement(newRoute, result);
return Navigator.of(context).pushAndRemoveUntil(newRoute, predicate);
return of(context).pushAndRemoveUntil(newRoute, predicate);
Navigator.of(context).replace(oldRoute: oldRoute, newRoute: newRoute);
of(context).replace(oldRoute: oldRoute, newRoute: newRoute);
Navigator.of(context).replaceRouteBelow(anchorRoute: anchorRoute, newRoute: newRoute);
of(context).replaceRouteBelow(anchorRoute: anchorRoute, newRoute: newRoute);
NavigatorState navigator = Navigator.of(context, nullOk: true);
NavigatorState navigator = of(context, nullOk: true);
return Navigator.of(context).maybePop(result);
return of(context).maybePop(result);
return Navigator.of(context).pop(result);
return of(context).pop(result);
Navigator.of(context).popUntil(predicate);
of(context).popUntil(predicate);
Navigator.of(context).removeRoute(route);
of(context).removeRoute(route);
Navigator.of(context).removeRouteBelow(anchorRoute);
of(context).removeRouteBelow(anchorRoute);
}
public static NavigatorState of(

readonly GlobalKey<OverlayState> _overlayKey = GlobalKey<OverlayState>.key();
internal readonly List<Route> _history = new List<Route>();
readonly HashSet<Route> _poppedRoutes = new HashSet<Route>();
public readonly FocusScopeNode focusScopeNode = new FocusScopeNode();
readonly List<OverlayEntry> _initialOverlayEntries = new List<OverlayEntry>();

Navigator.defaultRouteName
};
var plannedInitialRoutes = new List<Route> {
this._routeNamed(Navigator.defaultRouteName, true)
this._routeNamed(Navigator.defaultRouteName, arguments: null, true)
};
var routeParts = initialRouteName.Split('/');

routeName += $"/{part}";
plannedInitialRouteNames.Add(routeName);
plannedInitialRoutes.Add(this._routeNamed(routeName, true));
plannedInitialRoutes.Add(this._routeNamed(routeName, arguments: null, true));
}
}

$"ignored and \"{Navigator.defaultRouteName}\" will be used instead.")));
return true;
});
this.push(this._routeNamed(Navigator.defaultRouteName));
} else {
this.push(this._routeNamed(Navigator.defaultRouteName, arguments: null));
}
else {
} else {
}
else {
route = this._routeNamed(initialRouteName, true);
route = this._routeNamed(initialRouteName, arguments: null, true);
route = route ?? this._routeNamed(Navigator.defaultRouteName);
route = route ?? this._routeNamed(Navigator.defaultRouteName, arguments: null);
this.push(route);
}

}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
if (((Navigator) oldWidget).observers != this.widget.observers) {

return true;
});
}
public OverlayState overlay {
get { return this._overlayKey.currentState; }
}

bool _debugLocked;
Route _routeNamed(string name, bool allowNull = false) {
Route _routeNamed(string name, object arguments, bool allowNull = false) {
isInitialRoute: this._history.isEmpty()
isInitialRoute: this._history.isEmpty(),
arguments: arguments
var route = (Route) this.widget.onGenerateRoute(settings);
if (route == null && !allowNull) {
D.assert(() => {

return route;
}
public IPromise<object> pushNamed(string routeName) {
return this.push(this._routeNamed(routeName));
public IPromise<object> pushNamed(string routeName, object arguments = null) {
return this.push(this._routeNamed(routeName, arguments: arguments));
public IPromise<object> pushReplacementNamed(string routeName, object result = null) {
return this.pushReplacement(this._routeNamed(routeName), result);
public IPromise<object> pushReplacementNamed(string routeName, object result = null, object arguments = null) {
return this.pushReplacement(this._routeNamed(routeName, arguments: arguments), result);
public IPromise<object> popAndPushNamed(string routeName, object result = null) {
public IPromise<object> popAndPushNamed(string routeName, object result = null, object arguments = null) {
return this.pushNamed(routeName);
return this.pushNamed(routeName, arguments: arguments);
public IPromise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate) {
return this.pushAndRemoveUntil(this._routeNamed(newRouteName), predicate);
public IPromise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate,
object arguments = null) {
return this.pushAndRemoveUntil(this._routeNamed(newRouteName, arguments: arguments), predicate);
}
public IPromise<object> push(Route route) {

this._poppedRoutes.Remove(route);
route.dispose();
}
public bool userGestureInProgress {
get { return this._userGesturesInProgress > 0; }
}

}
});
}
this._activePointers.ToList().ForEach(WidgetsBinding.instance.cancelPointer);
}

3
Runtime/widgets/notification_listener.cs


}
public void dispatch(BuildContext target) {
D.assert(target != null);
target.visitAncestorElements(this.visitAncestor);
target?.visitAncestorElements(this.visitAncestor);
}
public override string ToString() {

3
Runtime/widgets/overlay.cs


internal void _remove(OverlayEntry entry) {
if (this.mounted) {
this._entries.Remove(entry);
/* entry was removed */
this._entries.Remove(entry);
});
}
}

8
Runtime/widgets/page_view.cs


using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.physics;
using Unity.UIWidgets.rendering;

public float page {
get {
return (Mathf.Max(0.0f, this.pixels.clamp(this.minScrollExtent, this.maxScrollExtent)) /
Mathf.Max(1.0f, this.viewportDimension * this.viewportFraction));
Mathf.Max(1.0f, this.viewportDimension * this.viewportFraction));
}
}

bool pageSnapping = true,
ValueChanged<int> onPageChanged = null,
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
IndexedWidgetBuilder itemBuilder = null,
SliverChildDelegate childDelegate = null,
int itemCount = 0

this.physics = physics;
this.pageSnapping = pageSnapping;
this.onPageChanged = onPageChanged;
this.dragStartBehavior = dragStartBehavior;
this.controller = controller ?? PageViewUtils._defaultPageController;
if (itemBuilder != null) {
this.childrenDelegate = new SliverChildBuilderDelegate(itemBuilder, childCount: itemCount);

public readonly ValueChanged<int> onPageChanged;
public readonly SliverChildDelegate childrenDelegate;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _PageViewState();

return false;
},
child: new Scrollable(
dragStartBehavior: this.widget.dragStartBehavior,
axisDirection: axisDirection,
controller: this.widget.controller,
physics: physics,

1
Runtime/widgets/routes.cs


break;
case AnimationStatus.dismissed:
D.assert(!this.overlayEntries.first().opaque);
// We might still be the current route if a subclass is controlling the
// the transition and hits the dismissed status. For example, the iOS
// back gesture drives this animation to the dismissed status before

120
Runtime/widgets/scroll_view.cs


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

bool? primary = null,
ScrollPhysics physics = null,
bool shrinkWrap = false,
float? cacheExtent = null
Key center = null,
float anchor = 0.0f,
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
D.assert(!shrinkWrap || center == null);
D.assert(anchor >= 0.0f && anchor <= 1.0f);
primary = primary ?? controller == null && scrollDirection == Axis.vertical;
physics = physics ?? (primary.Value ? new AlwaysScrollableScrollPhysics() : null);

this.primary = primary.Value;
this.physics = physics;
this.shrinkWrap = shrinkWrap;
this.center = center;
this.anchor = anchor;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Axis scrollDirection;

public readonly ScrollPhysics physics;
public readonly bool shrinkWrap;
public readonly Key center;
public readonly float anchor;
public readonly DragStartBehavior dragStartBehavior;
protected AxisDirection getDirection(BuildContext context) {
return LayoutUtils.getAxisDirectionFromAxisReverseAndDirectionality(

axisDirection: axisDirection,
offset: offset,
slivers: slivers,
cacheExtent: this.cacheExtent
cacheExtent: this.cacheExtent,
center: this.center,
anchor: this.anchor
);
}

ScrollController scrollController = this.primary ? PrimaryScrollController.of(context) : this.controller;
Scrollable scrollable = new Scrollable(
dragStartBehavior: this.dragStartBehavior,
axisDirection: axisDirection,
controller: scrollController,
physics: this.physics,

bool? primary = null,
ScrollPhysics physics = null,
bool shrinkWrap = false,
Key center = null,
float anchor = 0.0f,
List<Widget> slivers = null
List<Widget> slivers = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
cacheExtent: cacheExtent
center: center,
anchor: anchor,
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
this.slivers = slivers ?? new List<Widget>();
}

ScrollPhysics physics = null,
bool shrinkWrap = false,
EdgeInsets padding = null,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
this.padding = padding;
}

bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null,
List<Widget> children = null
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
this.itemExtent = itemExtent;
this.childrenDelegate = new SliverChildListDelegate(

int? itemCount = null,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key,
scrollDirection: scrollDirection,
reverse: reverse,

shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
this.itemExtent = itemExtent;
this.childrenDelegate = new SliverChildBuilderDelegate(

int? itemCount = null,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
key,
scrollDirection,
reverse,
controller,
primary,
physics,
shrinkWrap,
padding,
itemExtent,
itemBuilder,
itemCount,
addAutomaticKeepAlives,
addRepaintBoundaries
key: key,
scrollDirection: scrollDirection,
reverse: reverse,
controller: controller,
primary: primary,
physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent,
itemExtent: itemExtent,
itemBuilder: itemBuilder,
itemCount: itemCount,
addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
dragStartBehavior: dragStartBehavior
);
}

int itemCount = 0,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
D.assert(itemBuilder != null);
D.assert(separatorBuilder != null);

EdgeInsets padding = null,
SliverGridDelegate gridDelegate = null,
SliverChildDelegate childrenDelegate = null,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
D.assert(gridDelegate != null);
D.assert(childrenDelegate != null);

EdgeInsets padding = null,
SliverGridDelegate gridDelegate = null,
SliverChildDelegate childrenDelegate = null,
float? cacheExtent = null
float? cacheExtent = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) {
return new GridView(
key: key,

padding: padding,
gridDelegate: gridDelegate,
childrenDelegate: childrenDelegate,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
);
}

bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null,
List<Widget> children = null
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent
cacheExtent: cacheExtent,
dragStartBehavior: dragStartBehavior
) {
this.gridDelegate = new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount ?? 0,

bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
float? cacheExtent = null,
List<Widget> children = null
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) {
return new GridView(
key: key,

addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
cacheExtent: cacheExtent,
children: children
children: children,
dragStartBehavior: dragStartBehavior
);
}

bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
bool addSemanticIndexes = true,
List<Widget> children = null
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(
key: key,
scrollDirection: scrollDirection,

physics: physics,
shrinkWrap: shrinkWrap,
padding: padding
padding: padding,
dragStartBehavior: dragStartBehavior
) {
this.gridDelegate = new SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: maxCrossAxisExtent ?? 0,

float childAspectRatio = 1.0f,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
List<Widget> children = null
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) {
return new GridView(
key: key,

childAspectRatio: childAspectRatio,
addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
children: children
children: children,
dragStartBehavior: dragStartBehavior
);
}

28
Runtime/widgets/scrollable.cs


AxisDirection axisDirection = AxisDirection.down,
ScrollController controller = null,
ScrollPhysics physics = null,
ViewportBuilder viewportBuilder = null
ViewportBuilder viewportBuilder = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
D.assert(viewportBuilder != null);

this.viewportBuilder = viewportBuilder;
this.dragStartBehavior = dragStartBehavior;
}
public readonly AxisDirection axisDirection;

public readonly ScrollPhysics physics;
public readonly ViewportBuilder viewportBuilder;
public readonly DragStartBehavior dragStartBehavior;
public Axis axis {
get { return AxisUtils.axisDirectionToAxis(this.axisDirection); }

this._physics == null ? (float?) null : this._physics.minFlingVelocity;
instance.maxFlingVelocity =
this._physics == null ? (float?) null : this._physics.maxFlingVelocity;
instance.dragStartBehavior = this.widget.dragStartBehavior;
}
));
break;

this._physics == null ? (float?) null : this._physics.minFlingVelocity;
instance.maxFlingVelocity =
this._physics == null ? (float?) null : this._physics.maxFlingVelocity;
instance.dragStartBehavior = this.widget.dragStartBehavior;
}
));
break;

public override Widget build(BuildContext context) {
D.assert(this.position != null);
Widget result = new RawGestureDetector(
key: this._gestureDetectorKey,
gestures: this._gestureRecognizers,
behavior: HitTestBehavior.opaque,
child: new IgnorePointer(
key: this._ignorePointerKey,
ignoring: this._shouldIgnorePointer,
child: new _ScrollableScope(
scrollable: this,
position: this.position,
Widget result = new _ScrollableScope(
scrollable: this,
position: this.position,
child: new RawGestureDetector(
key: this._gestureDetectorKey,
gestures: this._gestureRecognizers,
behavior: HitTestBehavior.opaque,
child: new IgnorePointer(
key: this._ignorePointerKey,
ignoring: this._shouldIgnorePointer,
child: this.widget.viewportBuilder(context, this.position)
)
)

3
Runtime/widgets/selectable_text.cs


public void didChangeTextScaleFactor() {
}
public void didChangePlatformBrightness() {
}
public void didChangeLocales(List<Locale> locale) {
}

6
Runtime/widgets/single_child_scroll_view.cs


bool? primary = null,
ScrollPhysics physics = null,
ScrollController controller = null,
Widget child = null
Widget child = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
D.assert(!(controller != null && primary == true),
"Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. " +

this.physics = physics;
this.controller = controller;
this.child = child;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Axis scrollDirection;

public readonly Widget child;
public readonly DragStartBehavior dragStartBehavior;
AxisDirection _getDirection(BuildContext context) {
return AxisDirectionUtils.getAxisDirectionFromAxisReverseAndDirectionality(context, this.scrollDirection,

: this.controller;
Scrollable scrollable = new Scrollable(
dragStartBehavior: this.dragStartBehavior,
axisDirection: axisDirection,
controller: scrollController,
physics: this.physics,

24
Runtime/widgets/text_selection.cs


LayerLink layerLink = null,
RenderEditable renderObject = null,
TextSelectionControls selectionControls = null,
TextSelectionDelegate selectionDelegate = null) {
TextSelectionDelegate selectionDelegate = null,
DragStartBehavior? dragStartBehavior = null) {
D.assert(value != null);
D.assert(context != null);
this.context = context;

D.assert(overlay != null);
this._handleController = new AnimationController(duration: _fadeDuration, vsync: overlay);
this._toolbarController = new AnimationController(duration: _fadeDuration, vsync: overlay);
this.dragStartBehavior = dragStartBehavior;
}
public readonly BuildContext context;

public readonly TextSelectionControls selectionControls;
public readonly TextSelectionDelegate selectionDelegate;
public readonly DragStartBehavior? dragStartBehavior;
public static TimeSpan _fadeDuration = TimeSpan.FromMilliseconds(150);
AnimationController _handleController;

renderObject: this.renderObject,
selection: this._selection,
selectionControls: this.selectionControls,
position: position
position: position,
dragStartBehavior: this.dragStartBehavior ?? DragStartBehavior.down
)
);
}

RenderEditable renderObject = null,
ValueChanged<TextSelection> onSelectionHandleChanged = null,
VoidCallback onSelectionHandleTapped = null,
TextSelectionControls selectionControls = null
TextSelectionControls selectionControls = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.down
) : base(key: key) {
this.selection = selection;
this.position = position;

this.onSelectionHandleTapped = onSelectionHandleTapped;
this.selectionControls = selectionControls;
this.dragStartBehavior = dragStartBehavior;
}
public readonly TextSelection selection;

public readonly ValueChanged<TextSelection> onSelectionHandleChanged;
public readonly VoidCallback onSelectionHandleTapped;
public readonly TextSelectionControls selectionControls;
public readonly DragStartBehavior dragStartBehavior;
public override State createState() {
return new _TextSelectionHandleOverlayState();

link: this.widget.layerLink,
showWhenUnlinked: false,
child: new GestureDetector(
dragStartBehavior: this.widget.dragStartBehavior,
onPanStart: this._handleDragStart,
onPanUpdate: this._handleDragUpdate,
onTap: this._handleTap,

);
if (this.widget.onSingleLongTapStart != null) {
gestures[typeof(LongPressGestureRecognizer)] = new GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
() => new LongPressGestureRecognizer(debugOwner: this, kind: PointerDeviceKind.touch),
instance => {
instance.onLongPress = this._handleLongPressStart;
});
gestures[typeof(LongPressGestureRecognizer)] =
new GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
() => new LongPressGestureRecognizer(debugOwner: this, kind: PointerDeviceKind.touch),
instance => { instance.onLongPress = this._handleLongPressStart; });
}
if (this.widget.onDragSelectionStart != null ||

4
Runtime/widgets/transitions.cs


public class FadeTransition : SingleChildRenderObjectWidget {
public FadeTransition(Key key = null, Animation<float> opacity = null,
Widget child = null) : base(key: key, child: child) {
D.assert(opacity != null);
this.opacity = opacity;
}

float? widthFactor = null,
float? heightFactor = null
) : base(key: key, listenable: alignment) {
D.assert(alignment != null);
D.assert(child != null);
this.child = child;
this.widthFactor = widthFactor;
this.heightFactor = heightFactor;

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

3
Runtime/widgets/widget_inspector.cs


public void didChangeTextScaleFactor() {
}
public void didChangePlatformBrightness() {
}
public void didChangeLocales(List<Locale> locale) {
}

1
Samples/ReduxSample/ObjectFinder/ObjectFinderApp.cs


padding: EdgeInsets.only(left: 8, right: 8),
child: new EditableText(
selectionControls: MaterialUtils.materialTextSelectionControls,
backgroundCursorColor: Colors.transparent,
controller: this._controller,
focusNode: this._focusNode,
style: new TextStyle(

3
Samples/UIWidgetSample/AsScreenSample.cs


fontSize: 16
),
selectionColor: Color.fromARGB(255, 255, 0, 0),
cursorColor: Color.fromARGB(255, 0, 0, 0)
cursorColor: Color.fromARGB(255, 0, 0, 0),
backgroundCursorColor: Colors.blue
)
),
new Container(

163
Samples/UIWidgetSample/MaterialSample.cs


using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;

namespace UIWidgetsSample {
public class MaterialSample : UIWidgetsSamplePanel {
const int testCaseId = 6;
const int testCaseId = 7;
readonly List<Widget> testCases = new List<Widget> {
new MaterialButtonWidget(),

new TableWidget(),
new BottomAppBarWidget(),
new MaterialSliderWidget()
new MaterialSliderWidget(),
new MaterialNavigationBarWidget(),
new MaterialReorderableListViewWidget(),
};
protected override Widget createWidget() {

children: new List<Widget> {
new Material(
child: new Center(
child: new FlatButton(
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)),
color: new Color(0xFF00FF00),
splashColor: new Color(0xFFFF0011),
highlightColor: new Color(0x88FF0011),
child: new Text("Click Me"),
onPressed: () => { Debug.Log("pressed here"); }
child: new Column(
children: new List<Widget> {
new FlatButton(
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)),
color: new Color(0xFF00FF00),
splashColor: new Color(0xFFFF0011),
highlightColor: new Color(0x88FF0011),
child: new Text("Click Me"),
onPressed: () => { Debug.Log("pressed flat button"); }
),
new RaisedButton(
shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(20.0f)),
color: new Color(0xFFFF00FF),
splashColor: new Color(0xFFFF0011),
highlightColor: new Color(0x88FF0011),
elevation: 4.0f,
child: new Text("Click Me"),
onPressed: () => { Debug.Log("pressed raised button"); }
)
}
)
)
),

onChanged: this.onChanged))
}
)
);
}
}
internal class MaterialNavigationBarWidget : StatefulWidget
{
public MaterialNavigationBarWidget(Key key = null) : base(key)
{
}
public override State createState()
{
return new MaterialNavigationBarWidgetState();
}
}
internal class MaterialNavigationBarWidgetState : SingleTickerProviderStateMixin<MaterialNavigationBarWidget> {
int _currentIndex = 0;
public MaterialNavigationBarWidgetState()
{
}
public override Widget build(BuildContext context)
{
return new Scaffold(
bottomNavigationBar: new Container(
height: 100,
color: Colors.blue,
child: new Center(
child: new BottomNavigationBar(
type: BottomNavigationBarType.shifting,
// type: BottomNavigationBarType.fix,
items: new List<BottomNavigationBarItem>
{
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 30),
title: new Text("Work"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.work, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 30),
title: new Text("Home"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.home, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 30),
title: new Text("Shop"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.shop, size: 50),
backgroundColor: Colors.blue
),
new BottomNavigationBarItem(
icon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 30),
title: new Text("School"),
activeIcon: new Icon(icon: Unity.UIWidgets.material.Icons.school, size: 50),
backgroundColor: Colors.blue
),
},
currentIndex: this._currentIndex,
onTap: (value) => { this.setState(() => { this._currentIndex = value; }); }
)
)
)
);
}
}
internal class MaterialReorderableListViewWidget : StatefulWidget
{
public MaterialReorderableListViewWidget(Key key = null) : base(key)
{
}
public override State createState()
{
return new MaterialReorderableListViewWidgetState();
}
}
internal class MaterialReorderableListViewWidgetState : State<MaterialReorderableListViewWidget>
{
private List<string> items = new List<string> {"First", "Second", "Third"};
public override Widget build(BuildContext context)
{
return new Stack(
children: new List<Widget>
{
new Scaffold(
body: new Scrollbar(
child: new ReorderableListView(
header: new Text("Header of list"),
children: this.items.Select<string, Widget>((item) => {
return new Container(
key: Key.key(item),
width: 300.0f,
height: 50.0f,
decoration: new BoxDecoration(
color: Colors.blue,
border: Border.all(
color: Colors.black
)
),
child: new Center(
child: new Text(
item,
style: new TextStyle(
fontSize: 32
)
)
)
);
}).ToList(),
onReorder: (int oldIndex, int newIndex) =>
{
this.setState(() =>
{
if (newIndex > oldIndex) newIndex -= 1;
string item = this.items[oldIndex];
this.items.RemoveAt(oldIndex);
this.items.Insert(newIndex, item);
});
}
)
)
),
new PerformanceOverlay()
}
);
}
}

63
Samples/UIWidgetSample/TextInputSample.cs


using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
class _TextInputSample : StatefulWidget {
public readonly string title;

}
}
protected override Widget createWidget() {
protected override Widget createWidget() {
class _TextInputSampleState : State<_TextInputSample> {
TextEditingController titleController = new TextEditingController("");

child: new EditableText(maxLines: 1,
controller: this.titleController,
selectionControls: MaterialUtils.materialTextSelectionControls,
backgroundCursorColor: Colors.transparent,
autofocus: true,
focusNode: new FocusNode(),
style: new TextStyle(

padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: new EditableText(maxLines: 200,
controller: this.descController,
backgroundCursorColor: Colors.transparent,
selectionControls: MaterialUtils.materialTextSelectionControls,
focusNode: new FocusNode(),
style: new TextStyle(

return new _EditableInputTypeWidgetState();
}
}
class _EditableInputTypeWidgetState : State<EditableInputTypeWidget> {
Widget rowWidgets(string title, Widget widget) {
return new Container(

}
));
}
List<Widget> widgets = new List<Widget>();
List<Widget> widgets = new List<Widget>();
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, onSubmitted: this.textSubmitted
, unityTouchKeyboard: unityKeyboard, selectionControls: MaterialUtils.materialTextSelectionControls)))));
new EditableText(controller, node, style, cursorColor, Colors.blue,
selectionColor: selectionColor, onSubmitted: this.textSubmitted
, unityTouchKeyboard: unityKeyboard,
selectionControls: MaterialUtils.materialTextSelectionControls,
cursorWidth: 5.0f, cursorRadius: Radius.circular(2.5f), cursorOpacityAnimates: true, paintCursorAboveText: true)))));
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, maxLines: 4,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, maxLines: 4,
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, obscureText: true,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, obscureText: true,
onSubmitted: this.textSubmitted, unityTouchKeyboard: unityKeyboard,
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, keyboardType: TextInputType.number,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.number,
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, keyboardType: TextInputType.phone,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.phone,
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, keyboardType: TextInputType.emailAddress,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.emailAddress,
new EditableText(controller, node, style, cursorColor, selectionColor: selectionColor, keyboardType: TextInputType.url,
new EditableText(controller, node, style, cursorColor, Colors.transparent,
selectionColor: selectionColor, keyboardType: TextInputType.url,
widgets.Add(new Text("UIWidgets Touch Keyboard", style: new TextStyle(fontSize:20, height:2.0f), textAlign: TextAlign.center));
widgets.Add(new Text("UIWidgets Touch Keyboard", style: new TextStyle(fontSize: 20, height: 2.0f),
textAlign: TextAlign.center));
widgets.Add(new Text("Unity Touch Keyboard", style: new TextStyle(fontSize:20, height:2.0f), textAlign: TextAlign.center));
widgets.Add(new Text("Unity Touch Keyboard", style: new TextStyle(fontSize: 20, height: 2.0f),
textAlign: TextAlign.center));
crossAxisAlignment: CrossAxisAlignment.stretch,
children: widgets)));
crossAxisAlignment: CrossAxisAlignment.stretch,
children: widgets)));
public class EditStateProvider : StatefulWidget {
public delegate EditableText EditableBuilder(BuildContext context,
TextEditingController controller, FocusNode focusNode);

10
Samples/UIWidgetSample/txt/TextFieldSample.cs


namespace UIWidgetsSample {
public class TextFieldSample : UIWidgetsSamplePanel {
protected override void Awake() {
base.Awake();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
}
}
protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
}
}

2
Samples/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs


}
public override Path getOuterPath(Rect host, Rect guest) {
if (!host.overlaps(guest)) {
if (guest == null || !host.overlaps(guest)) {
Path path = new Path();
path.addRect(host);
return path;

19
Tests/Editor/RenderEditable.cs


using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgets.Tests {
public class RenderEditable : EditorWindow {
public class RenderEditable : EditorWindow, TextSelectionDelegate {
readonly Func<RenderBox>[] _options;
readonly string[] _optionStrings;

new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
maxLines: 100,
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
));
span = new TextSpan("", children:

new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
maxLines: 100,
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
));
span = new TextSpan("", children:

new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr,
new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
, width: 300));
return flexbox;
}

SelectionChangedCause cause) {
Debug.Log($"selection {selection}");
renderObject.selection = selection;
}
public TextEditingValue textEditingValue { get; set; }
public void hideToolbar() {
}
public void bringIntoView(TextPosition textPosition) {
}
}
}

7
Runtime/foundation/constants.cs


using UnityEngine;
namespace Unity.UIWidgets.foundation {
public class FoundationConstants {
public static bool kReleaseMode = !Debug.isDebugBuild;
}
}

3
Runtime/foundation/constants.cs.meta


fileFormatVersion: 2
guid: 36d19e17f3d947f98c7accec2cd5771b
timeCreated: 1556097117

112
Runtime/material/app_bar_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class AppBarTheme : Diagnosticable {
public AppBarTheme(
Brightness? brightness = null,
Color color = null,
float? elevation = null,
IconThemeData iconTheme = null,
TextTheme textTheme = null
) {
this.brightness = brightness;
this.color = color;
this.elevation = elevation;
this.iconTheme = iconTheme;
this.textTheme = textTheme;
}
public readonly Brightness? brightness;
public readonly Color color;
public readonly float? elevation;
public readonly IconThemeData iconTheme;
public readonly TextTheme textTheme;
AppBarTheme copyWith(
Brightness? brightness = null,
Color color = null,
float? elevation = null,
IconThemeData iconTheme = null,
TextTheme textTheme = null
) {
return new AppBarTheme(
brightness: brightness ?? this.brightness,
color: color ?? this.color,
elevation: elevation ?? this.elevation,
iconTheme: iconTheme ?? this.iconTheme,
textTheme: textTheme ?? this.textTheme
);
}
public static AppBarTheme of(BuildContext context) {
return Theme.of(context).appBarTheme;
}
public static AppBarTheme lerp(AppBarTheme a, AppBarTheme b, float t) {
return new AppBarTheme(
brightness: t < 0.5f ? a?.brightness : b?.brightness,
color: Color.lerp(a?.color, b?.color, t),
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t),
textTheme: TextTheme.lerp(a?.textTheme, b?.textTheme, t)
);
}
public override int GetHashCode() {
var hashCode = this.brightness?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.color?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.iconTheme?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.textTheme?.GetHashCode() ?? 0;
return hashCode;
}
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((AppBarTheme) obj);
}
public static bool operator ==(AppBarTheme left, AppBarTheme right) {
return Equals(left, right);
}
public static bool operator !=(AppBarTheme left, AppBarTheme right) {
return !Equals(left, right);
}
public bool Equals(AppBarTheme other) {
return other.brightness == this.brightness
&& other.color == this.color
&& other.elevation == this.elevation
&& other.iconTheme == this.iconTheme
&& other.textTheme == this.textTheme;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Brightness?>("brightness", this.brightness, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<IconThemeData>("iconTheme", this.iconTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<TextTheme>("textTheme", this.textTheme, defaultValue: null));
}
}
}

3
Runtime/material/app_bar_theme.cs.meta


fileFormatVersion: 2
guid: 0c0ee979ef6b4f32a092532c3bdae31e
timeCreated: 1556178331

92
Runtime/material/bottom_app_bar_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class BottomAppBarTheme : Diagnosticable {
public BottomAppBarTheme(
Color color = null,
float? elevation = null,
NotchedShape shape = null
) {
this.color = color;
this.elevation = elevation;
this.shape = shape;
}
public readonly Color color;
public readonly float? elevation;
public readonly NotchedShape shape;
BottomAppBarTheme copyWith(
Color color = null,
float? elevation = null,
NotchedShape shape = null
) {
return new BottomAppBarTheme(
color: color ?? this.color,
elevation: elevation ?? this.elevation,
shape: shape ?? this.shape
);
}
public static BottomAppBarTheme of(BuildContext context) {
return Theme.of(context).bottomAppBarTheme;
}
public static BottomAppBarTheme lerp(BottomAppBarTheme a, BottomAppBarTheme b, float t) {
return new BottomAppBarTheme(
color: Color.lerp(a?.color, b?.color, t),
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
shape: t < 0.5f ? a?.shape : b?.shape
);
}
public override int GetHashCode() {
var hashCode = this.color?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.shape?.GetHashCode() ?? 0;
return hashCode;
}
public bool Equals(BottomAppBarTheme other) {
return other.color == this.color
&& other.elevation == this.elevation
&& other.shape == this.shape;
}
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((BottomAppBarTheme) obj);
}
public static bool operator ==(BottomAppBarTheme left, BottomAppBarTheme right) {
return Equals(left, right);
}
public static bool operator !=(BottomAppBarTheme left, BottomAppBarTheme right) {
return !Equals(left, right);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<NotchedShape>("shape", this.shape, defaultValue: null));
}
}
}

3
Runtime/material/bottom_app_bar_theme.cs.meta


fileFormatVersion: 2
guid: 9c88d19dd1254f4eb6c0c998084832ea
timeCreated: 1556185402

89
Runtime/material/card_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class CardTheme : Diagnosticable {
public CardTheme(
Clip? clipBehavior = null,
Color color = null,
float? elevation = null,
EdgeInsets margin = null,
ShapeBorder shape = null
) {
D.assert(elevation == null || elevation >= 0.0f);
this.clipBehavior = clipBehavior;
this.color = color;
this.elevation = elevation;
this.margin = margin;
this.shape = shape;
}
public readonly Clip? clipBehavior;
public readonly Color color;
public readonly float? elevation;
public readonly EdgeInsets margin;
public readonly ShapeBorder shape;
CardTheme copyWith(
Clip? clipBehavior = null,
Color color = null,
float? elevation = null,
EdgeInsets margin = null,
ShapeBorder shape = null
) {
return new CardTheme(
clipBehavior: clipBehavior ?? this.clipBehavior,
color: color ?? this.color,
elevation: elevation ?? this.elevation,
margin: margin ?? this.margin,
shape: shape ?? this.shape
);
}
public static CardTheme of(BuildContext context) {
return Theme.of(context).cardTheme;
}
public static CardTheme lerp(CardTheme a, CardTheme b, float t) {
return new CardTheme(
clipBehavior: t < 0.5f ? a?.clipBehavior : b?.clipBehavior,
color: Color.lerp(a?.color, b?.color, t),
elevation: MathUtils.lerpFloat(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
margin: EdgeInsets.lerp(a?.margin, b?.margin, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)
);
}
public override int GetHashCode() {
var hashCode = this.clipBehavior?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.color?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.elevation?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.margin?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ this.shape?.GetHashCode() ?? 0;
return hashCode;
}
public bool Equals(CardTheme other) {
return other.clipBehavior == this.clipBehavior
&& other.color == this.color
&& other.elevation == this.elevation
&& other.margin == this.margin
&& other.shape == this.shape;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Clip?>("clipBehavior", this.clipBehavior, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<float?>("elevation", this.elevation, defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("margin", this.margin, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", this.shape, defaultValue: null));
}
}
}

3
Runtime/material/card_theme.cs.meta


fileFormatVersion: 2
guid: d74c4f94f0994a3880425c80ec3d9ba3
timeCreated: 1556187816

45
Samples/UIWidgetSample/LongPressSample.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.material;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsSample {
public class LongPressSample: UIWidgetsSamplePanel {
protected override Widget createWidget() {
return new WidgetsApp(
home: new LongPressSampleWidget(),
pageRouteBuilder: this.pageRouteBuilder);
}
}
public class LongPressSampleWidget: StatefulWidget {
public override State createState() {
return new _LongPressSampleWidgetState();
}
}
class _LongPressSampleWidgetState : State<LongPressSampleWidget> {
public override Widget build(BuildContext context) {
return new GestureDetector(
onLongPressDragStart: (value) => {
Debug.Log($"Long Press Drag Start: {value}");
},
onLongPressDragUpdate: (value) => {
Debug.Log($"Long Press Drag Update: {value}");
},
onLongPressDragUp: (value) => {
Debug.Log($"Long Press Drag Up: {value}");
},
child: new Center(
child: new Container(
width: 200,
height: 200,
color: Colors.blue
)
)
);
}
}
}

3
Samples/UIWidgetSample/LongPressSample.cs.meta


fileFormatVersion: 2
guid: 5bab4c4cc3a446f280edec6a9d0a4f16
timeCreated: 1556594174

468
Samples/UIWidgetSample/LongPressSample.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.49641287, b: 0.5748173, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &332995326
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 332995329}
- component: {fileID: 332995328}
- component: {fileID: 332995327}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &332995327
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 332995326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &332995328
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 332995326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &332995329
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 332995326}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1301752092
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1301752095}
- component: {fileID: 1301752094}
- component: {fileID: 1301752093}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1301752093
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1301752092}
m_Enabled: 1
--- !u!20 &1301752094
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1301752092}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1301752095
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1301752092}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1907726269
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1907726273}
- component: {fileID: 1907726272}
- component: {fileID: 1907726271}
- component: {fileID: 1907726270}
- component: {fileID: 1907726275}
- component: {fileID: 1907726274}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1907726270
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1907726271
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &1907726272
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1907726273
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1907726274
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5bab4c4cc3a446f280edec6a9d0a4f16, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
devicePixelRatioOverride: 0
antiAliasingOverride: 4
--- !u!222 &1907726275
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1907726269}
m_CullTransparentMesh: 0
--- !u!1 &1963403153
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1963403155}
- component: {fileID: 1963403154}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1963403154
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1963403153}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1963403155
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1963403153}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}

7
Samples/UIWidgetSample/LongPressSample.unity.meta


fileFormatVersion: 2
guid: ea79b711dbc434533b52afdbe4e3ec11
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

87
Samples/UIWidgetSample/MaterialThemeSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Image = Unity.UIWidgets.widgets.Image;
namespace UIWidgetsSample {
public class MaterialThemeSample: UIWidgetsSamplePanel {
protected override Widget createWidget() {
return new MaterialApp(
home: new MaterialThemeSampleWidget(),
darkTheme: new ThemeData(primaryColor: Colors.black26)
);
}
protected override void OnEnable() {
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
base.OnEnable();
}
}
public class MaterialThemeSampleWidget: StatefulWidget {
public override State createState() {
return new _MaterialThemeSampleWidgetState();
}
}
class _MaterialThemeSampleWidgetState : State<MaterialThemeSampleWidget> {
int _currentIndex = 0;
public override Widget build(BuildContext context) {
return new Theme(
data: new ThemeData(
appBarTheme: new AppBarTheme(
color: Colors.purple
),
bottomAppBarTheme: new BottomAppBarTheme(
color: Colors.blue
),
cardTheme: new CardTheme(
color: Colors.red,
elevation: 2.0f
)
),
child: new Scaffold(
appBar: new AppBar(title: new Text("Test App Bar Theme")),
body: new Center(
child: new Card(
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.all(5.0f)
),
child: new Container(
height: 250,
child: new Column(
children: new List<Widget> {
Image.asset(
"products/backpack",
fit: BoxFit.cover,
width: 200,
height: 200
),
new Text("Card Theme")
}
)
)
)
),
bottomNavigationBar: new BottomAppBar(
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: new List<Widget> {
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }),
new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), onPressed: () => { })
})
)
)
);
}
}
}

3
Samples/UIWidgetSample/MaterialThemeSample.cs.meta


fileFormatVersion: 2
guid: f5061bd7b85f4179a65c68ac289a4a58
timeCreated: 1556597371

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存