浏览代码

Merge branch 'shiyun/cupertino/skia' of github.com:Unity-Technologies/com.unity.uiwidgets into dev_1.17.5

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
d1b803fa
共有 39 个文件被更改,包括 1691 次插入1648 次删除
  1. 120
      Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs
  2. 1
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  3. 54
      com.unity.uiwidgets/Runtime/cupertino/colors.cs
  4. 9
      com.unity.uiwidgets/Runtime/cupertino/cupertinodynamiccolor.mixin.njk
  5. 72
      com.unity.uiwidgets/Runtime/cupertino/date_picker.cs
  6. 69
      com.unity.uiwidgets/Runtime/cupertino/dialog.cs
  7. 53
      com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
  8. 18
      com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs
  9. 61
      com.unity.uiwidgets/Runtime/cupertino/picker.cs
  10. 167
      com.unity.uiwidgets/Runtime/cupertino/route.cs
  11. 325
      com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs
  12. 134
      com.unity.uiwidgets/Runtime/cupertino/slider.cs
  13. 453
      com.unity.uiwidgets/Runtime/cupertino/switch.cs
  14. 63
      com.unity.uiwidgets/Runtime/cupertino/tab_scaffold.cs
  15. 2
      com.unity.uiwidgets/Runtime/cupertino/tab_view.cs
  16. 520
      com.unity.uiwidgets/Runtime/cupertino/text_field.cs
  17. 682
      com.unity.uiwidgets/Runtime/cupertino/text_selection.cs
  18. 41
      com.unity.uiwidgets/Runtime/cupertino/text_theme.cs
  19. 81
      com.unity.uiwidgets/Runtime/cupertino/theme.cs
  20. 71
      com.unity.uiwidgets/Runtime/cupertino/thumb_painter.cs
  21. 12
      com.unity.uiwidgets/Runtime/gestures/drag_details.cs
  22. 16
      com.unity.uiwidgets/Runtime/painting/box_decoration.cs
  23. 1
      com.unity.uiwidgets/Runtime/rendering/custom_paint.cs
  24. 2
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  25. 6
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  26. 2
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk
  27. 5
      com.unity.uiwidgets/Runtime/services/text_editing.cs
  28. 3
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  29. 5
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  30. 18
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  31. 86
      com.unity.uiwidgets/Runtime/widgets/layout_builder.cs
  32. 88
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
  33. 21
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  34. 2
      com.unity.uiwidgets/Runtime/widgets/scroll_activity.cs
  35. 10
      com.unity.uiwidgets/Runtime/widgets/scrollbar.cs
  36. 47
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  37. 12
      com.unity.uiwidgets/Runtime/widgets/text_selection.cs
  38. 5
      com.unity.uiwidgets/Runtime/widgets/visibility.cs
  39. 2
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs

120
Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs


using UIWidgetsGallery.gallery;
using Color = Unity.UIWidgets.ui.Color;
using Random = UnityEngine.Random;
namespace UIWidgetsSample
{
public class TextTest : UIWidgetsPanel

base.OnEnable();
}
home: new HomeScreen()
home: new HomeScreen()//new DetailScreen1("ok")
//color: Color.white
return new CupertinoPageScaffold(
child: new Center(
child: new CupertinoButton(
child: new Text(
"THIS IS TAB #",
style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0))
),
onPressed: () =>
{
Navigator.of(context).push(
new CupertinoPageRoute(builder: (contex3) =>
{
return
new Container(color: Color.fromARGB(255, 0, 255, 0));
})
);
}
)//,
//new Text("hello world!", style: CupertinoTheme.of(context).textTheme.navTitleTextStyle)
),
backgroundColor: Color.fromARGB(255, 255, 255, 0)
);
/*List<BottomNavigationBarItem> items = new List<BottomNavigationBarItem>();
items.Add(new BottomNavigationBarItem(
icon: new Icon(CupertinoIcons.bell),
title: new Text("views")
));
items.Add(new BottomNavigationBarItem(
icon: new Icon(CupertinoIcons.eye_solid),
title: new Text("articles")
));
return new CupertinoTabScaffold(
tabBar: new CupertinoTabBar(
items: items
),
tabBuilder: ((contex, index) =>
{
//return new Center(child: new Text("hello"));
return new CupertinoTabView(
builder: (contex1) =>
{
return new CupertinoPageScaffold(
navigationBar: new CupertinoNavigationBar(
middle: (index == 0) ? new Text("views") : new Text("articles")
),
child: new Center(
child: new CupertinoButton(
child: new Text(
"THIS IS TAB #",
style: CupertinoTheme.of(contex1)
.textTheme
.navTitleTextStyle
//.copyWith(fontSize:32)
),
onPressed: () =>
{
Navigator.of(contex1).push(
new CupertinoPageRoute(builder: (contex3) =>
{
return
new CupertinoAlertDemo(); //DetailScreen1(index == 0 ? "views" : "articles");
})
);
}
)
)
);
}
);
})
);*/
//return new CupertinoNavigationDemo();
//return new CupertinoAlertDemo();
//return new CupertinoPickerDemo();
return new CupertinoSwitchDemo();
{
public DetailScreen1(string topic)
this.topic = topic;
}
public string topic;
public override Widget build(BuildContext context)
{
return new CupertinoPageScaffold(
navigationBar: new CupertinoNavigationBar(
//middle: new Text("Details")
),
child: new Center(
child: new Text("hello world")
)
);
public DetailScreen1(string topic)
{
this.topic = topic;
}
public string topic;
public override Widget build(BuildContext context)
{
return new CupertinoPageScaffold(
//backgroundColor: Color.white,
child: new Center(
child: new Text(
"hello world"
//style : new TextStyle(color: CupertinoColors.activeBlue)
//style : new TextStyle(color: Color.white)
)
)
);
}
}

1
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


public override float value {
get { return _value; }
}
float _value;

54
com.unity.uiwidgets/Runtime/cupertino/colors.cs


public static readonly CupertinoDynamicColor label = new CupertinoDynamicColor(
debugLabel: "label",
//effectiveColor:Color.fromARGB(255, 0, 0, 0),
effectiveColor:Color.fromARGB(255, 0, 0, 0),
color: Color.fromARGB(255, 0, 0, 0),
darkColor: Color.fromARGB(255, 255, 255, 255),
highContrastColor: Color.fromARGB(255, 0, 0, 0),

public static readonly CupertinoDynamicColor secondaryLabel = new CupertinoDynamicColor(
debugLabel: "secondaryLabel",
//effectiveColor:Color.fromARGB(153, 60, 60, 67),
effectiveColor:Color.fromARGB(153, 60, 60, 67),
color: Color.fromARGB(153, 60, 60, 67),
darkColor: Color.fromARGB(153, 235, 235, 245),
highContrastColor: Color.fromARGB(173, 60, 60, 67),

/// [UIColor.tertiaryLabel](https://developer.apple.com/documentation/uikit/uicolor/3173153-tertiarylabel).
public static readonly CupertinoDynamicColor tertiaryLabel = new CupertinoDynamicColor(
debugLabel: "tertiaryLabel",
//effectiveColor: Color.fromARGB(76, 60, 60, 67),
effectiveColor: Color.fromARGB(76, 60, 60, 67),
color: Color.fromARGB(76, 60, 60, 67),
darkColor: Color.fromARGB(76, 235, 235, 245),
highContrastColor: Color.fromARGB(96, 60, 60, 67),

public static readonly CupertinoDynamicColor quaternaryLabel = new CupertinoDynamicColor(
debugLabel: "quaternaryLabel",
//effectiveColor:Color.fromARGB(45, 60, 60, 67),
effectiveColor:Color.fromARGB(45, 60, 60, 67),
color: Color.fromARGB(45, 60, 60, 67),
darkColor: Color.fromARGB(40, 235, 235, 245),
highContrastColor: Color.fromARGB(66, 60, 60, 67),

public static readonly CupertinoDynamicColor systemFill = new CupertinoDynamicColor(
debugLabel: "systemFill",
//effectiveColor:Color.fromARGB(51, 120, 120, 128),
effectiveColor:Color.fromARGB(51, 120, 120, 128),
color: Color.fromARGB(51, 120, 120, 128),
darkColor: Color.fromARGB(91, 120, 120, 128),
highContrastColor: Color.fromARGB(71, 120, 120, 128),

public static readonly CupertinoDynamicColor secondarySystemFill = new CupertinoDynamicColor(
debugLabel: "secondarySystemFill",
//effectiveColor: Color.fromARGB(40, 120, 120, 128),
effectiveColor: Color.fromARGB(40, 120, 120, 128),
color: Color.fromARGB(40, 120, 120, 128),
darkColor: Color.fromARGB(81, 120, 120, 128),
highContrastColor: Color.fromARGB(61, 120, 120, 128),

public static readonly CupertinoDynamicColor tertiarySystemFill = new CupertinoDynamicColor(
debugLabel: "tertiarySystemFill",
//effectiveColor:Color.fromARGB(30, 118, 118, 128),
effectiveColor:Color.fromARGB(30, 118, 118, 128),
color: Color.fromARGB(30, 118, 118, 128),
darkColor: Color.fromARGB(61, 118, 118, 128),
highContrastColor: Color.fromARGB(51, 118, 118, 128),

public static readonly CupertinoDynamicColor quaternarySystemFill = new CupertinoDynamicColor(
debugLabel: "quaternarySystemFill",
//effectiveColor:Color.fromARGB(20, 116, 116, 128),
effectiveColor:Color.fromARGB(20, 116, 116, 128),
color: Color.fromARGB(20, 116, 116, 128),
darkColor: Color.fromARGB(45, 118, 118, 128),
highContrastColor: Color.fromARGB(40, 116, 116, 128),

/// [UIColor.placeholderText](https://developer.apple.com/documentation/uikit/uicolor/3173134-placeholdertext).
public static readonly CupertinoDynamicColor placeholderText = new CupertinoDynamicColor(
debugLabel: "placeholderText",
//effectiveColor:Color.fromARGB(76, 60, 60, 67),
effectiveColor:Color.fromARGB(76, 60, 60, 67),
color: Color.fromARGB(76, 60, 60, 67),
darkColor: Color.fromARGB(76, 235, 235, 245),
highContrastColor: Color.fromARGB(96, 60, 60, 67),

public static readonly CupertinoDynamicColor systemBackground = new CupertinoDynamicColor(
debugLabel: "systemBackground",
//effectiveColor:Color.fromARGB(255, 255, 255, 255),
effectiveColor:Color.fromARGB(255, 255, 255, 255),
color: Color.fromARGB(255, 255, 255, 255),
darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: Color.fromARGB(255, 255, 255, 255),

public static readonly CupertinoDynamicColor secondarySystemBackground = new CupertinoDynamicColor(
debugLabel: "secondarySystemBackground",
//effectiveColor:Color.fromARGB(255, 242, 242, 247),
effectiveColor:Color.fromARGB(255, 242, 242, 247),
color: Color.fromARGB(255, 242, 242, 247),
darkColor: Color.fromARGB(255, 28, 28, 30),
highContrastColor: Color.fromARGB(255, 235, 235, 240),

public static readonly CupertinoDynamicColor tertiarySystemBackground = new CupertinoDynamicColor(
debugLabel: "tertiarySystemBackground",
//effectiveColor:Color.fromARGB(255, 255, 255, 255),
effectiveColor:Color.fromARGB(255, 255, 255, 255),
color: Color.fromARGB(255, 255, 255, 255),
darkColor: Color.fromARGB(255, 44, 44, 46),
highContrastColor: Color.fromARGB(255, 255, 255, 255),

public static readonly CupertinoDynamicColor systemGroupedBackground = new CupertinoDynamicColor(
debugLabel: "systemGroupedBackground",
//effectiveColor:Color.fromARGB(255, 242, 242, 247),
effectiveColor:Color.fromARGB(255, 242, 242, 247),
color: Color.fromARGB(255, 242, 242, 247),
darkColor: Color.fromARGB(255, 0, 0, 0),
highContrastColor: Color.fromARGB(255, 235, 235, 240),

public static readonly CupertinoDynamicColor secondarySystemGroupedBackground = new CupertinoDynamicColor(
debugLabel: "secondarySystemGroupedBackground",
//effectiveColor:Color.fromARGB(255, 255, 255, 255),
effectiveColor:Color.fromARGB(255, 255, 255, 255),
color: Color.fromARGB(255, 255, 255, 255),
darkColor: Color.fromARGB(255, 28, 28, 30),
highContrastColor: Color.fromARGB(255, 255, 255, 255),

public static readonly CupertinoDynamicColor tertiarySystemGroupedBackground = new CupertinoDynamicColor(
debugLabel: "tertiarySystemGroupedBackground",
//effectiveColor:Color.fromARGB(255, 242, 242, 247),
effectiveColor:Color.fromARGB(255, 242, 242, 247),
color: Color.fromARGB(255, 242, 242, 247),
darkColor: Color.fromARGB(255, 44, 44, 46),
highContrastColor: Color.fromARGB(255, 235, 235, 240),

public static readonly CupertinoDynamicColor separator = new CupertinoDynamicColor(
debugLabel: "separator",
//effectiveColor:Color.fromARGB(73, 60, 60, 67),
effectiveColor:Color.fromARGB(73, 60, 60, 67),
color: Color.fromARGB(73, 60, 60, 67),
darkColor: Color.fromARGB(153, 84, 84, 88),
highContrastColor: Color.fromARGB(94, 60, 60, 67),

/// equivalent to [UIColor.opaqueSeparator](https://developer.apple.com/documentation/uikit/uicolor/3173133-opaqueseparator).
public static readonly CupertinoDynamicColor opaqueSeparator = new CupertinoDynamicColor(
debugLabel: "opaqueSeparator",
//effectiveColor:Color.fromARGB(255, 198, 198, 200),
effectiveColor:Color.fromARGB(255, 198, 198, 200),
color: Color.fromARGB(255, 198, 198, 200),
darkColor: Color.fromARGB(255, 56, 56, 58),
highContrastColor: Color.fromARGB(255, 198, 198, 200),

public static readonly CupertinoDynamicColor link =
new CupertinoDynamicColor(
debugLabel: "link",
//effectiveColor:Color.fromARGB(255, 0, 122, 255),
effectiveColor:Color.fromARGB(255, 0, 122, 255),
color: Color.fromARGB(255, 0, 122, 255),
darkColor: Color.fromARGB(255, 9, 132, 255),
highContrastColor: Color.fromARGB(255, 0, 122, 255),

if (resolvable == null)
return null;
D.assert(context != null);
var resolveColor = (resolvable is CupertinoDynamicColor)
? ((CupertinoDynamicColor)resolvable).resolveFrom(context, nullOk: nullOk)
: resolvable;
//var resolveColor = (resolvable is CupertinoDynamicColor) ? ((CupertinoDynamicColor)resolvable).resolveFrom(context, nullOk: nullOk) : resolvable;
Color resolveColor = null;
if (resolvable is CupertinoDynamicColor) {
int i = 0;
resolveColor = ((CupertinoDynamicColor) resolvable).resolveFrom(context, nullOk: nullOk)._effectiveColor;
}
else {
int j = 0;
resolveColor = resolvable;
}
return resolveColor;
}

}
public CupertinoDynamicColor resolveFrom(BuildContext context, bool nullOk = true) {
Brightness brightness = _isPlatformBrightnessDependent
? CupertinoTheme.brightnessOf(context, nullOk: nullOk) ?? Brightness.light
: Brightness.light;

9
com.unity.uiwidgets/Runtime/cupertino/cupertinodynamiccolor.mixin.njk


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.painting;
protected {{className}}() {
protected {{className}}(uint value) :base(value){
}
public virtual string toStringShort() {

72
com.unity.uiwidgets/Runtime/cupertino/date_picker.cs


}
return false;
},
child: CupertinoPicker.builder(
child: new CupertinoPicker(
scrollController: dateController,
offAxisFraction: offAxisFraction,
itemExtent: CupertinoDatePickerUtils._kItemExtent,

onSelectedItemChanged: (int index)=> {
_onSelectedItemChange(index);
},
itemBuilder: (BuildContext context, int index) =>{
DateTime rangeStart = new DateTime(
initialDateTime.Year,
initialDateTime.Month,
initialDateTime.Day + index
);
DateTime rangeEnd = new DateTime(
initialDateTime.Year,
initialDateTime.Month,
initialDateTime.Day + index + 1
itemBuilder: (BuildContext context, int index) => {
var rangeStart = new DateTime(
year:initialDateTime.Year,
month:initialDateTime.Month,
day:initialDateTime.Day
rangeStart.AddDays(index);
var rangeEnd = rangeStart.AddDays(1);
if (widget.minimumDate?.CompareTo(rangeEnd) > 0 )
if (widget.minimumDate?.CompareTo(rangeEnd) > 0 )
return null;
if (widget.maximumDate?.CompareTo(rangeStart) > 0)
return null;

if (textDirectionFactor == -1)
padding = padding.flipped;
pickers.Add(new LayoutId(
id: i,
child: pickerBuilders[i](
offAxisFraction,
(BuildContext context1, Widget child) =>{
return new Container(
alignment: i == columnWidths.Count - 1
? alignCenterLeft
: alignCenterRight,
padding: padding,
child: new Container(
alignment: i == columnWidths.Count - 1 ? alignCenterLeft : alignCenterRight,
width: i == 0 || i == columnWidths.Count - 1
? (float?) null : (float)(columnWidths[i] + CupertinoDatePickerUtils._kDatePickerPadSize),
child: child
)
);
}
float width = columnWidths[i];
pickers.Add(
new LayoutId(
id: i,
child: pickerBuilders[i](
offAxisFraction,
(BuildContext context1, Widget child) =>{
return new Container(
alignment: i == columnWidths.Count - 1
? alignCenterLeft
: alignCenterRight,
padding: padding,
child: new Container(
alignment: i == columnWidths.Count - 1 ? alignCenterLeft : alignCenterRight,
width: i == 0 || i == columnWidths.Count - 1
? (float?) null : (float)(width + CupertinoDatePickerUtils._kDatePickerPadSize),
child: child
)
);
}
)
));
}

CupertinoDatePicker._getColumnWidth(_PickerColumnType.year, localizations, context);
}
DateTime _lastDayInMonth(int year, int month) => new DateTime(year, month + 1, 0);
DateTime _lastDayInMonth(int year, int month) {
//new DateTime(year, month + 1, 0);
var date = new DateTime(year,month,1);
date.AddMonths(1);
date.Subtract(new TimeSpan(1, 0, 0, 0));
return date;
}
Widget _buildDayPicker(float offAxisFraction, TransitionBuilder itemPositioningBuilder) {
int daysInCurrentMonth = _lastDayInMonth(selectedYear, selectedMonth).Day;

return false;
},
child: CupertinoPicker.builder(
child: new CupertinoPicker (
scrollController: yearController,
itemExtent: CupertinoDatePickerUtils._kItemExtent,
offAxisFraction: offAxisFraction,

69
com.unity.uiwidgets/Runtime/cupertino/dialog.cs


content: content,
scrollController: scrollController
);
children.Add(new Flexible(flex: 3, child: titleSection));
children.Add(new Flexible
(
flex: 3,
child: titleSection));
}
return new Container(

public override Widget build(BuildContext context) {
CupertinoLocalizations localizations = CupertinoLocalizations.of(context);
bool isInAccessibilityMode = CupertinoDialogUtils._isInAccessibilityMode(context);
float textScaleFactor = MediaQuery.of(context).textScaleFactor;
return new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,

removeBottom: true,
context: _context,
child: new Center(
child: new Container(
margin: EdgeInsets.symmetric(vertical: CupertinoDialogUtils._kEdgePadding),
width: isInAccessibilityMode
? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth,
child: new CupertinoPopupSurface(
isSurfacePainted: false,
child: new _CupertinoDialogRenderWidget(
contentSection: _buildContent(_context),
actionsSection: _buildActions()
child: new Container(
margin: EdgeInsets.symmetric(vertical: CupertinoDialogUtils._kEdgePadding),
width: isInAccessibilityMode
? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth,
child: new CupertinoPopupSurface(
isSurfacePainted: false,
child: new _CupertinoDialogRenderWidget(
contentSection: _buildContent(_context),
actionsSection: _buildActions()
)
)
)
)
);

protected override void insertChildRenderObject(RenderObject child, object slot) {
D.assert(slot != null);
switch (slot) {
switch ((_AlertDialogSections)slot) {
case _AlertDialogSections.contentSection:
renderObject.contentSection = child as RenderBox;
break;

}
}
protected override void moveChildRenderObject(RenderObject child, object slot) {
D.assert(false);
protected override void moveChildRenderObject(RenderObject child,object slot) {
//D.assert(false);
newWidget = (RenderObjectWidget) newWidget;
base.update(newWidget);
_contentElement = updateChild(_contentElement, widget.contentSection,
_AlertDialogSections.contentSection);

);
}
}
//ParentDataWidget<_DialogActionButtonParentData>
class _DialogActionButtonParentDataWidget : ParentDataWidget<_ActionButtonParentData> {
public _DialogActionButtonParentDataWidget(
Key key = null,

public readonly bool isPressed;
public override void applyParentData(RenderObject renderObject) {
D.assert(renderObject.parentData is _DialogActionButtonParentData);
_DialogActionButtonParentData parentData = renderObject.parentData as _DialogActionButtonParentData;
D.assert(renderObject.parentData is _ActionButtonParentData);
_ActionButtonParentData parentData = renderObject.parentData as _ActionButtonParentData;
if (parentData.isPressed != isPressed) {
parentData.isPressed = isPressed;
AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;

}
}
class _DialogActionButtonParentData : MultiChildLayoutParentData {
/*class _DialogActionButtonParentData : MultiChildLayoutParentData {
public _DialogActionButtonParentData(
bool isPressed = false
) {

public bool isPressed;
}
}*/
public class CupertinoDialogAction : StatelessWidget {
public CupertinoDialogAction(

RenderBox currentChild = firstChild;
while (currentChild != null) {
D.assert(currentChild.parentData is _DialogActionButtonParentData);
_DialogActionButtonParentData parentData = currentChild.parentData as _DialogActionButtonParentData;
D.assert(currentChild.parentData is _ActionButtonParentData);
_ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
if (parentData.isPressed) {
childList.Add(currentChild);
}

get {
RenderBox currentChild = firstChild;
while (currentChild != null) {
D.assert(currentChild.parentData is _DialogActionButtonParentData);
_DialogActionButtonParentData parentData = currentChild.parentData as _DialogActionButtonParentData;
D.assert(currentChild.parentData is _ActionButtonParentData);
_ActionButtonParentData parentData = currentChild.parentData as _ActionButtonParentData;
if (parentData.isPressed) {
return true;
}

}
public override void setupParentData(RenderObject child) {
if (!(child.parentData is _DialogActionButtonParentData)) {
child.parentData = new _DialogActionButtonParentData();
if (!(child.parentData is _ActionButtonParentData)) {
child.parentData = new _ActionButtonParentData();
}
}

RenderBox prevChild = null;
while (child != null) {
D.assert(child.parentData is _DialogActionButtonParentData);
_DialogActionButtonParentData currentButtonParentData =
child.parentData as _DialogActionButtonParentData;
D.assert(child.parentData is _ActionButtonParentData);
_ActionButtonParentData currentButtonParentData =
child.parentData as _ActionButtonParentData;
D.assert(prevChild.parentData is _DialogActionButtonParentData);
_DialogActionButtonParentData previousButtonParentData =
prevChild.parentData as _DialogActionButtonParentData;
D.assert(prevChild.parentData is _ActionButtonParentData);
_ActionButtonParentData previousButtonParentData =
prevChild.parentData as _ActionButtonParentData;
isPrevButtonPressed = previousButtonParentData.isPressed;
}

53
com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs


class _NavigationBarComponentsTransition {
public _NavigationBarComponentsTransition(
Animation<float> animation,
_TransitionableNavigationBar bottomNavBar,
_TransitionableNavigationBar topNavBar,
TextDirection directionality
Animation<float> animation = null,
_TransitionableNavigationBar bottomNavBar = null,
_TransitionableNavigationBar topNavBar = null,
TextDirection? directionality = null
) {
this.animation = animation;
bottomComponents = bottomNavBar.componentsKeys;

GlobalKey key = null,
RenderBox from = null
) {
//RenderBox componentBox = (RenderBox) key.currentContext.findRenderObject();
return RelativeRect.fromRect(
componentBox.localToGlobal(Offset.zero, ancestor: from) & componentBox.size, transitionBox
);

RenderBox toNavBarBox = null
) {
RelativeRect fromRect = positionInTransitionBox(fromKey, from: fromNavBarBox);
//RenderBox fromBox = (RenderBox) fromKey.currentContext.findRenderObject();
//RenderBox toBox = (RenderBox) toKey.currentContext.findRenderObject();
Rect toRect =
toBox.localToGlobal(
Offset.zero,

-fromBox.size.height / 2 + toBox.size.height / 2
- fromBox.size.height / 2 + toBox.size.height / 2
) & fromBox.size; // Keep the from render object"s size.
if (forwardDirection < 0) {

}
public Widget bottomLeading {
get {
//KeyedSubtree bottomLeading = (KeyedSubtree) bottomComponents.leadingKey.currentWidget;
get {
KeyedSubtree bottomLeading = bottomComponents.leadingKey.currentWidget as KeyedSubtree;
if (bottomLeading == null) {
return null;

public Widget bottomBackChevron {
get {
//KeyedSubtree bottomBackChevron = (KeyedSubtree) bottomComponents.backChevronKey.currentWidget;
rect: positionInTransitionBox(bottomComponents.backChevronKey,
from: bottomNavBarBox),
rect: positionInTransitionBox(bottomComponents.backChevronKey, from: bottomNavBarBox),
child: new FadeTransition(
opacity: fadeOutBy(0.6f),
child: new DefaultTextStyle(

public Widget bottomBackLabel {
get {
//KeyedSubtree bottomBackLabel = (KeyedSubtree) bottomComponents.backLabelKey.currentWidget;
KeyedSubtree bottomBackLabel = bottomComponents.backLabelKey.currentWidget as KeyedSubtree;
if (bottomBackLabel == null) {

public Widget bottomMiddle {
get {
//KeyedSubtree bottomMiddle = (KeyedSubtree) bottomComponents.middleKey.currentWidget;
//KeyedSubtree topBackLabel = (KeyedSubtree) topComponents.backLabelKey.currentWidget;
//KeyedSubtree topLeading = (KeyedSubtree) topComponents.leadingKey.currentWidget;
KeyedSubtree bottomMiddle = bottomComponents.middleKey.currentWidget as KeyedSubtree;
KeyedSubtree topBackLabel = topComponents.backLabelKey.currentWidget as KeyedSubtree;
KeyedSubtree topLeading = topComponents.leadingKey.currentWidget as KeyedSubtree;

child: new FadeTransition(
opacity: fadeOutBy(bottomHasUserMiddle == true ? 0.4f : 0.7f),
child: new Align(
alignment: Alignment.centerLeft,
alignment: AlignmentDirectional.centerStart,
child: new DefaultTextStyleTransition(
style: animation.drive(new TextStyleTween(
begin: bottomTitleTextStyle,

child: new FadeTransition(
opacity: fadeOutBy(0.6f),
child: new Align(
alignment: Alignment.centerLeft,
alignment: AlignmentDirectional.centerStart,
child: new DefaultTextStyleTransition(
style: animation.drive(new TextStyleTween(
begin: bottomLargeTitleTextStyle,

}
if (bottomLargeTitle != null && topLeading != null) {
RelativeRect from = positionInTransitionBox(bottomComponents.largeTitleKey,
from: bottomNavBarBox);
RelativeRect from = positionInTransitionBox(bottomComponents.largeTitleKey, from: bottomNavBarBox);
RelativeRectTween positionTween = new RelativeRectTween(
begin: from,
end: from.shift(

return null;
}
RelativeRect to =
positionInTransitionBox(topComponents.backChevronKey, from: topNavBarBox);
RelativeRect to = positionInTransitionBox(topComponents.backChevronKey, from: topNavBarBox);
RelativeRect from = to;
if (bottomBackChevron == null) {

RenderAnimatedOpacity topBackLabelOpacity =
(RenderAnimatedOpacity) topComponents.backLabelKey.currentContext?.findAncestorRenderObjectOfType<RenderAnimatedOpacity>();
/*ancestorRenderObjectOfType(
new TypeMatcher<RenderAnimatedOpacity>()
);*/
Animation<float> midClickOpacity = null;
if (topBackLabelOpacity != null && topBackLabelOpacity.opacity.value < 1.0f) {
midClickOpacity = animation.drive(new FloatTween(

return null;
}
RelativeRect to =
positionInTransitionBox(topComponents.largeTitleKey, from: topNavBarBox);
RelativeRect to = positionInTransitionBox(topComponents.largeTitleKey, from: topNavBarBox);
RelativeRectTween positionTween = new RelativeRectTween(
begin: to.shift(

18
com.unity.uiwidgets/Runtime/cupertino/page_scaffold.cs


public class CupertinoPageScaffold : StatefulWidget {
/// Creates a layout for pages with a navigation bar at the top.
public CupertinoPageScaffold(
Widget child,
bool resizeToAvoidBottomInset = true
bool resizeToAvoidBottomInset = true,
Widget child = null
) : base(key: key) {
D.assert(child != null);
this.child = child;

public readonly ScrollController _primaryScrollController = new ScrollController();
void _handleStatusBarTap() {
// Only act on the scroll controller if it has any attached scroll positions.
duration: new TimeSpan(0, 0, 0, 0, 500),
duration: TimeSpan.FromMilliseconds(500),
curve: Curves.linearToEaseOut
);
}

//List<Widget> stacked = new List<Widget>();
Widget paddedContent = widget.child;
MediaQueryData existingMediaQuery = MediaQuery.of(context);

: existingMediaQuery.viewInsets;
bool fullObstruction = widget.navigationBar.shouldFullyObstruct(context);
/*widget.navigationBar.fullObstruction == false
? CupertinoTheme.of(context).barBackgroundColor.alpha == 0xFF
: widget.navigationBar.fullObstruction;*/
if (fullObstruction == true) {
paddedContent = new MediaQuery(
data: existingMediaQuery

right: 0.0f,
height: existingMediaQuery.padding.top,
child: new GestureDetector(
//excludeFromSemantics: true,
onTap: _handleStatusBarTap
)

}
public abstract class ObstructingPreferredSizeWidget : PreferredSizeWidget {
protected ObstructingPreferredSizeWidget(Key key = null) : base(key: key) {}
// public virtual bool? fullObstruction { get; }
protected ObstructingPreferredSizeWidget(Key key = null) : base(key: key) {}
public abstract bool shouldFullyObstruct(BuildContext context);
}
}

61
com.unity.uiwidgets/Runtime/cupertino/picker.cs


namespace Unity.UIWidgets.cupertino {
static class CupertinoPickerUtils {
public static Color _kHighlighterBorder = new Color(0xFF7F7F7F);
public static Color _kHighlighterBorder = CupertinoDynamicColor.withBrightness(
color: new Color(0x33000000),
darkColor: new Color(0x33FFFFFF)
);
public const float _kDefaultDiameterRatio = 1.07f;
public const float _kDefaultPerspective = 0.003f;
public const float _kSqueeze = 1.45f;
public const float _kOverAndUnderCenterOpacity = 0.447f;
public const float _kDefaultDiameterRatio = 1.35f;
public const float _kDefaultPerspective = 0.004f;
public const float _kOverAndUnderCenterOpacity = 0.447f;
List<Widget> children,
Key key = null,
float? diameterRatio = null,
Color backgroundColor = null,

float? squeeze = null,
float? itemExtent = null,
ValueChanged<int> onSelectedItemChanged = null,
List<Widget> children = null,
squeeze = squeeze == null ? CupertinoDatePickerUtils._kSqueeze : squeeze;
D.assert(children != null);
squeeze = squeeze == null ? CupertinoPickerUtils._kSqueeze : squeeze;
// D.assert(children != null);
D.assert(diameterRatio > 0.0f, ()=>RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(magnification > 0);
D.assert(itemExtent != null);

childDelegate = looping
? (ListWheelChildDelegate) new ListWheelChildLoopingListDelegate(children: children)
: new ListWheelChildListDelegate(children: children);
public static CupertinoPicker builder(
public CupertinoPicker(
Key key = null,
float? diameterRatio = null,
Color backgroundColor = null,

int? childCount = null
) {
diameterRatio = diameterRatio == null ? CupertinoPickerUtils._kDefaultDiameterRatio : diameterRatio;
squeeze = squeeze == null ? CupertinoDatePickerUtils._kSqueeze : squeeze;
squeeze = squeeze == null ? CupertinoPickerUtils._kSqueeze : squeeze;
D.assert(itemBuilder != null);
D.assert(diameterRatio > 0.0f,()=> RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(magnification > 0);

CupertinoPicker picker = new CupertinoPicker(
key,
diameterRatio ,
backgroundColor,
offAxisFraction ,
useMagnifier ,
magnification ,
scrollController,
squeeze ,
itemExtent,
onSelectedItemChanged);
picker.childDelegate = new ListWheelChildBuilderDelegate(builder: itemBuilder, childCount: childCount);
return picker;
this.diameterRatio = diameterRatio;
this.backgroundColor = backgroundColor;
this.offAxisFraction = offAxisFraction;
this.useMagnifier = useMagnifier;
this.magnification = magnification;
this.scrollController = scrollController;
this.squeeze = squeeze;
this.itemExtent = itemExtent;
this.onSelectedItemChanged = onSelectedItemChanged;
childDelegate =new ListWheelChildBuilderDelegate(builder: itemBuilder, childCount: childCount);
}
public readonly float? diameterRatio;

Positioned.fill(
child: new _CupertinoPickerSemantics(
scrollController: widget.scrollController ?? _controller,
child: ListWheelScrollView.useDelegate(
child: new ListWheelScrollView(
diameterRatio: (float)widget.diameterRatio,
diameterRatio: widget.diameterRatio ?? CupertinoPickerUtils._kDefaultDiameterRatio,
itemExtent: (float)widget.itemExtent,
squeeze: (float)widget.squeeze,
itemExtent: widget.itemExtent ?? 1f,
squeeze: widget.squeeze ?? CupertinoPickerUtils._kSqueeze,
onSelectedItemChanged: _handleSelectedItemChanged,
childDelegate: widget.childDelegate
)

public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (_RenderCupertinoPickerSemantics) renderObject;
((_RenderCupertinoPickerSemantics)renderObject).textDirection = Directionality.of(context);
((_RenderCupertinoPickerSemantics) renderObject).controller = scrollController;
((_RenderCupertinoPickerSemantics)renderObject).controller = scrollController;
}
}
public class _RenderCupertinoPickerSemantics : RenderProxyBox {

_currentIndex = controller.selectedItem;
//markNeedsSemanticsUpdate();
}
}

167
com.unity.uiwidgets/Runtime/cupertino/route.cs


public const int _kMaxPageBackAnimationTime = 300; // Milliseconds.
public static readonly Color _kModalBarrierColor = new Color(0x6604040F);
public static readonly Color _kModalBarrierColor = CupertinoDynamicColor.withBrightness(
color: new Color(0x33000000),
darkColor: new Color(0x7A000000)
);
public static readonly TimeSpan _kModalPopupTransitionDuration = new TimeSpan(0, 0, 0, 0, 335);
public static readonly TimeSpan _kModalPopupTransitionDuration = TimeSpan.FromMilliseconds(335);
public static readonly Animatable<Offset> _kRightMiddleTween = new OffsetTween(
begin: new Offset(1.0f, 0.0f),

);
/*public static Future showCupertinoModalPopup(
BuildContext context,
WidgetBuilder builder
) {
return Navigator.of(context, rootNavigator: true).push(
new _CupertinoModalPopupRoute(
builder: builder,
barrierLabel: "Dismiss"
)
);
}*/
public static Future showCupertinoModalPopup(
BuildContext context = null,
WidgetBuilder builder = null,

) {
D.assert(useRootNavigator != null);
filter: filter,
semanticsDismissible: semanticsDismissible
)
filter: filter
)
);
}

public static Widget _buildCupertinoDialogTransitions(BuildContext context, Animation<float> animation,
Animation<float>
secondaryAnimation, Widget child) {
public static Widget _buildCupertinoDialogTransitions(
BuildContext context,
Animation<float> animation,
Animation<float> secondaryAnimation,
Widget child) {
CurvedAnimation fadeAnimation = new CurvedAnimation(
parent: animation,
curve: Curves.easeInOut

RouteSettings routeSettings = null
) {
D.assert(builder != null);
D.assert(useRootNavigator != null);
// This transition duration was eyeballed comparing with iOS
transitionDuration: new TimeSpan(0, 0, 0, 0, 250),
transitionDuration: TimeSpan.FromMilliseconds(250),
return builder(context1);
},
transitionBuilder: _buildCupertinoDialogTransitions,
useRootNavigator: useRootNavigator,
routeSettings: routeSettings
);
/*return _DialogRoute.showGeneralDialog(
context: context,
barrierDismissible: false,
barrierColor: _kModalBarrierColor,
transitionDuration: new TimeSpan(0, 0, 0, 0, 250),
pageBuilder:
(BuildContext _context, Animation<float> animation, Animation<float> secondaryAnimation) => {
return builder(_context);
return builder(context1);
transitionBuilder: _buildCupertinoDialogTransitions
);*/
transitionBuilder: _buildCupertinoDialogTransitions,
useRootNavigator: useRootNavigator,
routeSettings: routeSettings
);
}
}

return !Equals(left, right);
}
public int hashCode {
get { return edgeGradient.GetHashCode(); }
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<LinearGradient>("edgeGradient", edgeGradient));

if (gradient == null) {
return;
}
float deltaX = -configuration.size.width;
TextDirection textDirection = configuration.textDirection;
D.assert(textDirection != null);
float deltaX = 0.0f;
switch (textDirection) {
case TextDirection.rtl:
deltaX = configuration.size.width;
break;
case TextDirection.ltr:
deltaX = -configuration.size.width;
break;
}
Paint paint = new Paint();
paint.shader = gradient.createShader(rect);
Paint paint = new Paint() {
shader = gradient.createShader(rect, textDirection: textDirection)
};
canvas.drawRect(rect, paint);
}
}

string title = "",
bool maintainState = true,
bool fullscreenDialog = false
) :
base(settings: settings, fullscreenDialog: fullscreenDialog) {
) : base(settings: settings, fullscreenDialog: fullscreenDialog) {
D.assert(builder != null);
D.assert(opaque);
this.builder = builder;

public override bool maintainState { get; }
public override TimeSpan transitionDuration {
get { return new TimeSpan(0, 0, 0, 0, 400); }
get { return TimeSpan.FromMilliseconds(400); }
}
public override Color barrierColor {

get { return null; }
}
/*public override bool canTransitionFrom(TransitionRoute<object> previousRoute) {
return previousRoute is CupertinoPageRoute<object>;
}*/
/*public override bool canTransitionTo(TransitionRoute<object> nextRoute) {
return nextRoute is CupertinoPageRoute<object> && !((CupertinoPageRoute<object>) nextRoute).fullscreenDialog;
}*/
public override bool canTransitionTo(TransitionRoute nextRoute) {
return nextRoute is CupertinoPageRoute && !((CupertinoPageRoute) nextRoute).fullscreenDialog;
}
static bool isPopGestureInProgress(PageRoute route) {
return route.navigator.userGestureInProgress;

}
public override Widget buildPage(BuildContext context, Animation<float> animation,
Animation<float> secondaryAnimation) {
Widget result = builder(context);
public override Widget buildPage(BuildContext context, Animation<float> animation, Animation<float> secondaryAnimation) {
D.assert(() => {
Widget result = builder(context);
D.assert(() =>{
throw new UIWidgetsError(
$"The builder for route {settings.name} returned null.\nRoute builders must never return null.");
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"The builder for route \"{settings.name}\" returned null."),
new ErrorDescription("Route builders must never return null."),
});
return true;
});
return result;

bool linearTransition = isPopGestureInProgress(route);
if (route.fullscreenDialog) {
return new CupertinoFullscreenDialogTransition(
//animation: animation,
//child: child
primaryRouteAnimation: animation,
secondaryRouteAnimation: secondaryAnimation,
child: child,

class CupertinoPageTransition : StatelessWidget {
public CupertinoPageTransition(
Animation<float> primaryRouteAnimation,
Animation<float> secondaryRouteAnimation,
Widget child,
Animation<float> primaryRouteAnimation = null,
Animation<float> secondaryRouteAnimation = null,
Widget child = null,
Key key = null
) : base(key: key) {
_primaryPositionAnimation =

Animation<float> primaryRouteAnimation = null,
Animation<float> secondaryRouteAnimation = null,
Widget child = null,
bool linearTransition =false
bool linearTransition = false
) : base(key: key) {
_positionAnimation = new CurvedAnimation(

public readonly Widget child;
public override Widget build(BuildContext context) {
/*return new SlideTransition(
position: _positionAnimation,
child: child
);*/
D.assert(WidgetsD.debugCheckHasDirectionality(context));
TextDirection textDirection = Directionality.of(context);
return new SlideTransition(

class _CupertinoBackGestureDetector : StatefulWidget {
public _CupertinoBackGestureDetector(
Widget child,
ValueGetter<bool> enabledCallback,
ValueGetter<_CupertinoBackGestureController> onStartPopGesture,
Key key = null
Key key = null,
ValueGetter<bool> enabledCallback = null,
ValueGetter<_CupertinoBackGestureController> onStartPopGesture = null,
Widget child = null
) : base(key: key) {
D.assert(enabledCallback != null);
D.assert(onStartPopGesture != null);

class _CupertinoBackGestureDetectorState : State<_CupertinoBackGestureDetector> {
_CupertinoBackGestureController _backGestureController;
HorizontalDragGestureRecognizer _recognizer;
public override void initState() {
base.initState();

void _handleDragEnd(DragEndDetails details) {
D.assert(mounted);
D.assert(_backGestureController != null);
_backGestureController.dragEnd(
_convertToLogical(details.velocity.pixelsPerSecond.dx / context.size.width) ?? 0);
_backGestureController.dragEnd(_convertToLogical(details.velocity.pixelsPerSecond.dx / context.size.width) ?? 0);
_backGestureController = null;
}

animateForward = velocity <= 0;
}
else {
animateForward = controller.value > 0.5;
animateForward = controller.value > 0.5f;
/* animateForward = velocity > 0 ? false : true;
}
else {
animateForward = controller.value > 0.5 ? true : false;
}*/
if (animateForward) {
int droppedPageForwardAnimationTime = Mathf.Min(
Mathf.Lerp(CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime, 0f,

controller.animateTo(1.0f, duration: new TimeSpan(0, 0, 0, 0, droppedPageForwardAnimationTime),
controller.animateTo(1.0f, duration: TimeSpan.FromMilliseconds(droppedPageForwardAnimationTime),
curve: animationCurve);
}
else {

int droppedPageBackAnimationTime =
Mathf.Lerp(0f, CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime,
controller.value).floor();
controller.animateBack(0.0f, duration: new TimeSpan(0, 0, 0, 0, droppedPageBackAnimationTime),
controller.animateBack(0.0f, duration: TimeSpan.FromMilliseconds(droppedPageBackAnimationTime),
curve: animationCurve);
}
}

Color barrierColor = null,
string barrierLabel = null,
WidgetBuilder builder = null,
bool? semanticsDismissible = null,
ImageFilter filter = null,
RouteSettings settings = null
) : base(filter:filter,settings: settings) {

_semanticsDismissible = semanticsDismissible;
}
public readonly WidgetBuilder builder;

public bool? _semanticsDismissible;
public new Color barrierColor;
/*{
get { return CupertinoRouteUtils._kModalBarrierColor; }
}*/
public readonly Color barrierColor;
}
public bool semanticsDismissible {
get { return _semanticsDismissible ?? false; }
}
public override TimeSpan transitionDuration {

}
public override Widget buildPage(BuildContext context, Animation<float> animation,
Animation<float> secondaryAnimation) {
//return builder(context);
public override Widget buildPage(BuildContext context, Animation<float> animation, Animation<float> secondaryAnimation) {
return new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,
child: new Builder(builder: builder)

325
com.unity.uiwidgets/Runtime/cupertino/scrollbar.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
public static readonly Color _kScrollbarColor = new Color(0x99777777);
public const float _kScrollbarThickness = 2.5f;
public const float _kScrollbarMainAxisMargin = 4.0f;
public const float _kScrollbarCrossAxisMargin = 2.5f;
public static readonly Radius _kScrollbarRadius = Radius.circular(1.25f);
public static readonly TimeSpan _kScrollbarTimeToFade = new TimeSpan(0, 0, 0, 0, 50);
public static readonly TimeSpan _kScrollbarFadeDuration = new TimeSpan(0, 0, 0, 0, 250);
public static readonly TimeSpan _kScrollbarTimeToFade = TimeSpan.FromMilliseconds(1200);
public static readonly TimeSpan _kScrollbarFadeDuration = TimeSpan.FromMilliseconds(250);
public static readonly TimeSpan _kScrollbarResizeDuration = TimeSpan.FromMilliseconds(100);
public static readonly Color _kScrollbarColor = CupertinoDynamicColor.withBrightness(
color: new Color(0x59000000),
darkColor: new Color(0x80FFFFFF)
);
public const float _kScrollbarThickness = 3f;
public const float _kScrollbarThicknessDragging = 8.0f;
public static Radius _kScrollbarRadius = Radius.circular(1.5f);
public static Radius _kScrollbarRadiusDragging = Radius.circular(4.0f);
public const float _kScrollbarMainAxisMargin = 3.0f;
public const float _kScrollbarCrossAxisMargin = 3.0f;
public static bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset) {
if (customPaintKey.currentContext == null) {
return false;
}
CustomPaint customPaint = customPaintKey.currentContext.widget as CustomPaint;
ScrollbarPainter painter = customPaint.foregroundPainter as ScrollbarPainter;
RenderBox renderBox = customPaintKey.currentContext.findRenderObject() as RenderBox;
Offset localOffset = renderBox.globalToLocal(offset);
return painter.hitTestInteractive(localOffset);
}
Widget child,
Key key = null
Key key = null,
ScrollController controller = null,
bool isAlwaysShown = false,
Widget child = null
this.controller = controller;
this.isAlwaysShown = isAlwaysShown;
}
public readonly Widget child;

}
class _CupertinoScrollbarState : TickerProviderStateMixin<CupertinoScrollbar> {
GlobalKey _customPaintKey = GlobalKey.key();
ScrollbarPainter _painter;
TextDirection _textDirection;

AnimationController _thicknessAnimationController;
Drag _drag;
float _thickness {
get {
return CupertinoScrollbarUtils._kScrollbarThickness + _thicknessAnimationController.value * (CupertinoScrollbarUtils._kScrollbarThicknessDragging - CupertinoScrollbarUtils._kScrollbarThickness);
}
}
Radius _radius {
get {
return Radius.lerp(CupertinoScrollbarUtils._kScrollbarRadius, CupertinoScrollbarUtils._kScrollbarRadiusDragging, _thicknessAnimationController.value);
}
}
ScrollController _currentController;
ScrollController _controller {
get {
return widget.controller ?? PrimaryScrollController.of(context);
}
}
public override void initState() {
base.initState();

parent: _fadeoutAnimationController,
curve: Curves.fastOutSlowIn
);
_thicknessAnimationController = new AnimationController(
vsync: this,
duration: CupertinoScrollbarUtils._kScrollbarResizeDuration
);
_thicknessAnimationController.addListener(() => {
_painter.updateThickness(_thickness, _radius);
});
_textDirection = Directionality.of(context);
_painter = _buildCupertinoScrollbarPainter();
if (_painter == null) {
_painter = _buildCupertinoScrollbarPainter(context);
} else {
_painter.textDirection = Directionality.of(context);
_painter.color = CupertinoDynamicColor.resolve(CupertinoScrollbarUtils._kScrollbarColor, context);
_painter.padding = MediaQuery.of(context).padding;
}
WidgetsBinding.instance.addPostFrameCallback((TimeSpan duration)=> {
if (widget.isAlwaysShown) {
D.assert(widget.controller != null);
widget.controller.position.didUpdateScrollPositionBy(0);
}
});
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
oldWidget = (CupertinoScrollbar) oldWidget;
base.didUpdateWidget(oldWidget);
if (widget.isAlwaysShown != ((CupertinoScrollbar)oldWidget).isAlwaysShown) {
if (widget.isAlwaysShown == true) {
D.assert(widget.controller != null);
_fadeoutAnimationController.animateTo(1.0f);
} else {
_fadeoutAnimationController.reverse();
}
}
ScrollbarPainter _buildCupertinoScrollbarPainter() {
public ScrollbarPainter _buildCupertinoScrollbarPainter(BuildContext context) {
color: CupertinoScrollbarUtils._kScrollbarColor,
textDirection: _textDirection,
thickness: CupertinoScrollbarUtils._kScrollbarThickness,
color: CupertinoDynamicColor.resolve(CupertinoScrollbarUtils._kScrollbarColor, context),
textDirection: Directionality.of(context),
thickness: _thickness,
radius: CupertinoScrollbarUtils._kScrollbarRadius,
radius: _radius,
padding: MediaQuery.of(context).padding,
void _dragScrollbar(float primaryDelta) {
D.assert(_currentController != null);
float scrollOffsetLocal = _painter.getTrackToScroll(primaryDelta);
float scrollOffsetGlobal = scrollOffsetLocal + _currentController.position.pixels;
if (_drag == null) {
_drag = _currentController.position.drag(
new DragStartDetails(
globalPosition: new Offset(0.0f, scrollOffsetGlobal)
),
() =>{}
);
} else {
_drag.update(
new DragUpdateDetails(
delta: new Offset(0.0f, -scrollOffsetLocal),
primaryDelta: (float?) -1f * scrollOffsetLocal,
globalPosition: new Offset(0.0f, scrollOffsetGlobal)
)
);
}
}
void _startFadeoutTimer() {
if (!widget.isAlwaysShown) {
_fadeoutTimer?.cancel();
_fadeoutTimer = Timer.create(CupertinoScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutAnimationController.reverse();
_fadeoutTimer = null;
});
}
}
bool _checkVertical() {
return _currentController.position.axis() == Axis.vertical;
}
float _pressStartY = 0.0f;
void _handleLongPressStart(LongPressStartDetails details) {
_currentController = _controller;
if (!_checkVertical()) {
return;
}
_pressStartY = details.localPosition.dy;
_fadeoutTimer?.cancel();
_fadeoutAnimationController.forward();
_dragScrollbar(details.localPosition.dy);
_dragScrollbarPositionY = details.localPosition.dy;
}
void _handleLongPress() {
if (!_checkVertical()) {
return;
}
_fadeoutTimer?.cancel();
_thicknessAnimationController.forward().then(
(_) => { return; }
);
}
void _handleLongPressMoveUpdate(LongPressMoveUpdateDetails details) {
if (!_checkVertical()) {
return;
}
_dragScrollbar(details.localPosition.dy - _dragScrollbarPositionY);
_dragScrollbarPositionY = details.localPosition.dy;
}
void _handleLongPressEnd(LongPressEndDetails details) {
if (!_checkVertical()) {
return;
}
_handleDragScrollEnd(details.velocity.pixelsPerSecond.dy);
if (details.velocity.pixelsPerSecond.dy.abs() < 10 &&
(details.localPosition.dy - _pressStartY).abs() > 0) {
//HapticFeedback.mediumImpact();
}
_currentController = null;
}
void _handleDragScrollEnd(float trackVelocityY) {
_startFadeoutTimer();
_thicknessAnimationController.reverse();
_dragScrollbarPositionY = 0.0f;
float scrollVelocityY = _painter.getTrackToScroll(trackVelocityY);
_drag?.end(new DragEndDetails(
primaryVelocity: -scrollVelocityY,
velocity: new Velocity(
pixelsPerSecond: new Offset(
0.0f,
-scrollVelocityY
)
)
));
_drag = null;
}
ScrollMetrics metrics = notification.metrics;
if (metrics.maxScrollExtent <= metrics.minScrollExtent) {
return false;
}
}
else if (notification is ScrollEndNotification) {
if (_dragScrollbarPositionY.Equals(0f)) {
} else if (notification is ScrollEndNotification) {
if (_dragScrollbarPositionY == null) {
/*_fadeoutTimer?.cancel();
_fadeoutTimer = Window.instance.run(CupertinoScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutAnimationController.reverse();
_fadeoutTimer = null;
});*/
Dictionary<Type, GestureRecognizerFactory> _gestures {
get {
Dictionary<Type, GestureRecognizerFactory> gestures =
new Dictionary<Type, GestureRecognizerFactory>();
gestures[typeof(_ThumbPressGestureRecognizer)] =
new GestureRecognizerFactoryWithHandlers<_ThumbPressGestureRecognizer>(
() => new _ThumbPressGestureRecognizer(
debugOwner: this,
customPaintKey: _customPaintKey
),
(_ThumbPressGestureRecognizer instance)=> {
instance.onLongPressStart = _handleLongPressStart;
instance.onLongPress = _handleLongPress;
instance.onLongPressMoveUpdate = _handleLongPressMoveUpdate;
instance.onLongPressEnd = _handleLongPressEnd;
}
);
return gestures;
}
}
_thicknessAnimationController.dispose();
void _startFadeoutTimer() {
if (!widget.isAlwaysShown) {
_fadeoutTimer?.cancel();
_fadeoutTimer = Timer.create(CupertinoScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutAnimationController.reverse();
_fadeoutTimer = null;
});
}
ScrollbarPainter _buildCupertinoScrollbarPainter() {
return new ScrollbarPainter(
color: CupertinoScrollbarUtils._kScrollbarColor,
textDirection: _textDirection,
thickness: CupertinoScrollbarUtils._kScrollbarThickness,
fadeoutOpacityAnimation: _fadeoutOpacityAnimation,
mainAxisMargin: CupertinoScrollbarUtils._kScrollbarMainAxisMargin,
crossAxisMargin: CupertinoScrollbarUtils._kScrollbarCrossAxisMargin,
radius: CupertinoScrollbarUtils._kScrollbarRadius,
minLength: CupertinoScrollbarUtils._kScrollbarMinLength,
minOverscrollLength: CupertinoScrollbarUtils._kScrollbarMinOverscrollLength
);
public override Widget build(BuildContext context) {

child: new CustomPaint(
foregroundPainter: _painter,
child: new RepaintBoundary(
child: widget.child
child: new RawGestureDetector(
gestures: _gestures,
child: new CustomPaint(
key: _customPaintKey,
foregroundPainter: _painter,
child: new RepaintBoundary(child: widget.child)
)
)
)

public class _ThumbPressGestureRecognizer : LongPressGestureRecognizer {
public _ThumbPressGestureRecognizer(
float? postAcceptSlopTolerance = null,
PointerDeviceKind kind = default,
object debugOwner = null,
GlobalKey customPaintKey = null
) : base(
postAcceptSlopTolerance: postAcceptSlopTolerance,
kind: kind,
debugOwner: debugOwner,
duration: TimeSpan.FromMilliseconds(100)
) {
_customPaintKey = customPaintKey;
}
public readonly GlobalKey _customPaintKey;
protected override bool isPointerAllowed(PointerDownEvent _event) {
if (!CupertinoScrollbarUtils._hitTestInteractive(_customPaintKey, _event.position)) {
return false;
}
return base.isPointerAllowed(_event);
}
}
}

134
com.unity.uiwidgets/Runtime/cupertino/slider.cs


public static readonly Color _kTrackColor = new Color(0xFFB5B5B5);
public const float _kSliderHeight = 2.0f * (CupertinoThumbPainter.radius + _kPadding);
public const float _kSliderWidth = 176.0f; // Matches Material Design slider.
public static readonly TimeSpan _kDiscreteTransitionDuration = new TimeSpan(0, 0, 0, 0, 500);
public static readonly TimeSpan _kDiscreteTransitionDuration = TimeSpan.FromMilliseconds(500);
public const float _kAdjustmentUnit = 0.1f; // Matches iOS implementation of material slider.
}

float min = 0.0f,
float max = 1.0f,
int? divisions = null,
Color activeColor = null
Color activeColor = null,
Color thumbColor = null
this.value = value.Value;
this.onChanged = onChanged;
this.onChangeStart = onChangeStart;

this.divisions = divisions;
this.activeColor = activeColor;
this.thumbColor = thumbColor ?? CupertinoColors.white;
}
public readonly float value;

public readonly int? divisions;
public readonly Color activeColor;
public readonly Color thumbColor;
public override State createState() {
return new _CupertinoSliderState();

return new _CupertinoSliderRenderObjectWidget(
value: (widget.value - widget.min) / (widget.max - widget.min),
divisions: widget.divisions,
activeColor: widget.activeColor ?? CupertinoTheme.of(context).primaryColor,
activeColor: CupertinoDynamicColor.resolve(
widget.activeColor ?? CupertinoTheme.of(context).primaryColor,
context
),
thumbColor: widget.thumbColor,
onChanged: widget.onChanged != null ? (ValueChanged<float>) _handleChanged : null,
onChangeStart: widget.onChangeStart != null ? (ValueChanged<float>) _handleDragStart : null,
onChangeEnd: widget.onChangeEnd != null ? (ValueChanged<float>) _handleDragEnd : null,

float? value = null,
int? divisions = null,
Color activeColor = null,
Color thumbColor = null,
ValueChanged<float> onChanged = null,
ValueChanged<float> onChangeStart = null,
ValueChanged<float> onChangeEnd = null,

this.onChangeStart = onChangeStart;
this.onChangeEnd = onChangeEnd;
this.vsync = vsync;
this.thumbColor = thumbColor;
public readonly Color thumbColor;
public readonly ValueChanged<float> onChanged;
public readonly ValueChanged<float> onChangeStart;
public readonly ValueChanged<float> onChangeEnd;

value: value ?? 0.0f,
divisions: divisions,
activeColor: activeColor,
thumbColor: CupertinoDynamicColor.resolve(thumbColor, context),
trackColor: CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context),
vsync: vsync
vsync: vsync,
textDirection: Directionality.of(context)
);
}

renderObject.divisions = divisions;
renderObject.activeColor = activeColor;
renderObject.thumbColor = CupertinoDynamicColor.resolve(thumbColor, context);
renderObject.trackColor = CupertinoDynamicColor.resolve(CupertinoColors.systemFill, context);
renderObject.textDirection = Directionality.of(context);
}
}

int? divisions = null,
Color activeColor = null,
Color thumbColor = null,
Color trackColor = null,
TickerProvider vsync = null
TickerProvider vsync = null,
TextDirection? textDirection = null
D.assert(value >= 0.0f && value <= 1.0f);
D.assert(value >= 0.0f && value <= 1.0f && value != null) ;
_thumbColor = thumbColor;
_trackColor = trackColor;
_textDirection = textDirection;
_drag = new HorizontalDragGestureRecognizer();
_drag.onStart = _handleDragStart;
_drag.onUpdate = _handleDragUpdate;

Color _activeColor;
public Color thumbColor {
get {
return _thumbColor;
}
set {
if (value == _thumbColor)
return;
_thumbColor = value;
markNeedsPaint();
}
}
Color _thumbColor;
public Color trackColor {
get {
return _trackColor;
}
set {
if (value == _trackColor)
return;
_trackColor = value;
markNeedsPaint();
}
}
Color _trackColor;
public ValueChanged<float> onChanged {
get { return _onChanged; }
set {

public ValueChanged<float> onChangeStart;
public ValueChanged<float> onChangeEnd;
public TextDirection? textDirection {
get {
return _textDirection;
}
set {
D.assert(value != null);
if (_textDirection == value)
return;
_textDirection = value;
markNeedsPaint();
}
}
TextDirection? _textDirection;
AnimationController _position;

float _thumbCenter {
get {
float visualPosition = _value;
return Mathf.Lerp(_trackLeft + CupertinoThumbPainter.radius,
_trackRight - CupertinoThumbPainter.radius,
visualPosition);
float visualPosition = 0.0f;
switch (textDirection) {
case TextDirection.rtl:
visualPosition = 1.0f - _value;
break;
case TextDirection.ltr:
visualPosition = _value;
break;
}
return MathUtils.lerpFloat(_trackLeft + CupertinoThumbPainter.radius, _trackRight - CupertinoThumbPainter.radius, visualPosition);
}
}

float extent = Mathf.Max(SliderUtils._kPadding,
size.width - 2.0f * (SliderUtils._kPadding + CupertinoThumbPainter.radius));
float? valueDelta = details.primaryDelta / extent;
_currentDragValue += valueDelta ?? 0.0f;
switch (textDirection) {
case TextDirection.rtl:
_currentDragValue -= valueDelta ?? 0.0f;
break;
case TextDirection.ltr:
_currentDragValue += valueDelta ?? 0.0f;
break;
}
}
}

CupertinoThumbPainter _thumbPainter = new CupertinoThumbPainter();
public override
void paint(PaintingContext context, Offset offset) {
float visualPosition;
Color leftColor;
Color rightColor;
visualPosition = _position.value;
leftColor = SliderUtils._kTrackColor;
rightColor = _activeColor;
public override void paint(PaintingContext context, Offset offset) {
float visualPosition = 0.0f;
Color leftColor = null ;
Color rightColor = null;
switch (textDirection) {
case TextDirection.rtl:
visualPosition = 1.0f - _position.value;
leftColor = _activeColor;
rightColor = trackColor;
break;
case TextDirection.ltr:
visualPosition = _position.value;
leftColor = trackColor;
rightColor = _activeColor;
break;
}
float trackCenter = offset.dy + size.height / 2.0f;
float trackLeft = offset.dx + _trackLeft;

}
Offset thumbCenter = new Offset(trackActive, trackCenter);
_thumbPainter.paint(canvas,
Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius));
new CupertinoThumbPainter(color: thumbColor).paint(canvas, Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius));
}
}
}

453
com.unity.uiwidgets/Runtime/cupertino/switch.cs


public const float _kSwitchHeight = 39.0f;
public const float _kCupertinoSwitchDisabledOpacity = 0.5f;
public static readonly Color _kTrackColor = CupertinoColors.lightBackgroundGray;
public static readonly TimeSpan _kReactionDuration = new TimeSpan(0, 0, 0, 0, 300);
public static readonly TimeSpan _kToggleDuration = new TimeSpan(0, 0, 0, 0, 200);
public static readonly TimeSpan _kReactionDuration = TimeSpan.FromMilliseconds(300);
public static readonly TimeSpan _kToggleDuration = TimeSpan.FromMilliseconds(200);
}
public class CupertinoSwitch : StatefulWidget {

Key key = null,
Color activeColor = null,
Color trackColor = null,
this.trackColor = trackColor;
this.dragStartBehavior = dragStartBehavior;
}

public readonly Color activeColor;
public readonly Color trackColor;
public readonly DragStartBehavior dragStartBehavior;

}
class _CupertinoSwitchState : TickerProviderStateMixin<CupertinoSwitch> {
public TapGestureRecognizer _tap;
public HorizontalDragGestureRecognizer _drag;
AnimationController _positionController;
public CurvedAnimation position;
AnimationController _reactionController;
public Animation<float> _reaction;
bool isInteractive {
get {
return widget.onChanged != null;
}
}
bool needsPositionAnimation = false;
public override void initState() {
base.initState();
_tap = new TapGestureRecognizer();
_tap.onTapDown = _handleTapDown;
_tap.onTapUp = _handleTapUp;
_tap.onTap = _handleTap;
_tap.onTapCancel = _handleTapCancel;
_drag = new HorizontalDragGestureRecognizer();
_drag.onStart = _handleDragStart;
_drag.onUpdate = _handleDragUpdate;
_drag.onEnd = _handleDragEnd;
_drag.dragStartBehavior = widget.dragStartBehavior;
_positionController = new AnimationController(
duration: CupertinoSwitchUtils._kToggleDuration,
value: widget.value ? 1.0f : 0.0f,
vsync: this
);
position = new CurvedAnimation(
parent: _positionController,
curve: Curves.linear
);
_reactionController = new AnimationController(
duration: CupertinoSwitchUtils._kReactionDuration,
vsync: this
);
_reaction = new CurvedAnimation(
parent: _reactionController,
curve: Curves.ease
);
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
oldWidget = (CupertinoSwitch) oldWidget;
base.didUpdateWidget(oldWidget);
_drag.dragStartBehavior = widget.dragStartBehavior;
if (needsPositionAnimation || ((CupertinoSwitch) oldWidget).value != widget.value)
_resumePositionAnimation(isLinear: needsPositionAnimation);
}
void _resumePositionAnimation( bool isLinear = true ) {
needsPositionAnimation = false;
position.curve = isLinear ? null : Curves.ease;
position.reverseCurve = isLinear ? null : Curves.ease.flipped;
if (widget.value)
_positionController.forward();
else
_positionController.reverse();
}
void _handleTapDown(TapDownDetails details) {
if (isInteractive)
needsPositionAnimation = false;
_reactionController.forward();
}
void _handleTap() {
if (isInteractive) {
widget.onChanged(!widget.value);
//_emitVibration();
}
}
void _handleTapUp(TapUpDetails details) {
if (isInteractive) {
needsPositionAnimation = false;
_reactionController.reverse();
}
}
void _handleTapCancel() {
if (isInteractive)
_reactionController.reverse();
}
void _handleDragStart(DragStartDetails details) {
if (isInteractive) {
needsPositionAnimation = false;
_reactionController.forward();
//_emitVibration();
}
}
void _handleDragUpdate(DragUpdateDetails details) {
if (isInteractive) {
position.curve = null;
position.reverseCurve = null;
float? delta = details.primaryDelta / CupertinoSwitchUtils._kTrackInnerLength;
switch (Directionality.of(context)) {
case TextDirection.rtl:
_positionController.setValue( _positionController.value - delta ?? 0.0f);
break;
case TextDirection.ltr:
_positionController.setValue( _positionController.value + delta ?? 0.0f);
break;
}
}
}
void _handleDragEnd(DragEndDetails details) {
setState(()=> { needsPositionAnimation = true; });
if (position.value >= 0.5 != widget.value)
widget.onChanged(!widget.value);
_reactionController.reverse();
}
if (needsPositionAnimation)
_resumePositionAnimation();
activeColor: widget.activeColor ?? CupertinoColors.activeGreen,
activeColor: CupertinoDynamicColor.resolve(
widget.activeColor ?? CupertinoColors.systemGreen,
context
),
trackColor: CupertinoDynamicColor.resolve(widget.trackColor ?? CupertinoColors.secondarySystemFill, context),
vsync: this,
dragStartBehavior: widget.dragStartBehavior
textDirection: Directionality.of(context),
state: this
public override void dispose() {
_tap.dispose();
_drag.dispose();
_positionController.dispose();
_reactionController.dispose();
base.dispose();
}
}
class _CupertinoSwitchRenderObjectWidget : LeafRenderObjectWidget {

Color activeColor = null,
Color trackColor = null,
TickerProvider vsync = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start
TextDirection? textDirection = null,
_CupertinoSwitchState state = null
this.trackColor = trackColor;
this.vsync = vsync;
this.dragStartBehavior = dragStartBehavior;
this.state = state;
this.textDirection = textDirection;
public readonly Color trackColor;
public readonly TickerProvider vsync;
public readonly DragStartBehavior dragStartBehavior;
public readonly _CupertinoSwitchState state;
public readonly TextDirection? textDirection;
trackColor: trackColor,
textDirection: Directionality.of(context),
vsync: vsync,
dragStartBehavior: dragStartBehavior
textDirection: textDirection,
state: state
);
}

_renderObject.activeColor = activeColor;
_renderObject.trackColor = trackColor;
_renderObject.textDirection = Directionality.of(context);
_renderObject.vsync = vsync;
_renderObject.dragStartBehavior = dragStartBehavior;
_renderObject.textDirection = textDirection;
}
}

bool value,
Color activeColor,
TextDirection textDirection,
TickerProvider vsync,
Color trackColor = null,
TextDirection? textDirection = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start
_CupertinoSwitchState state = null
D.assert(activeColor != null);
D.assert(vsync != null);
D.assert(state != null);
_trackColor = trackColor;
_vsync = vsync;
_tap = new TapGestureRecognizer() {
onTapDown = _handleTapDown,
onTap = _handleTap,
onTapUp = _handleTapUp,
onTapCancel = _handleTapCancel,
};
_drag = new HorizontalDragGestureRecognizer() {
onStart = _handleDragStart,
onUpdate = _handleDragUpdate,
onEnd = _handleDragEnd,
dragStartBehavior = dragStartBehavior
};
_state = state;
state.position.addListener(markNeedsPaint);
state._reaction.addListener(markNeedsPaint);
_positionController = new AnimationController(
duration: CupertinoSwitchUtils._kToggleDuration,
value: value ? 1.0f : 0.0f,
vsync: vsync
);
_position = new CurvedAnimation(
parent: _positionController,
curve: Curves.linear
);
_position.addListener(markNeedsPaint);
_position.addStatusListener(_handlePositionStateChanged);
_reactionController = new AnimationController(
duration: CupertinoSwitchUtils._kReactionDuration,
vsync: vsync
);
_reaction = new CurvedAnimation(
parent: _reactionController,
curve: Curves.ease
);
_reaction.addListener(markNeedsPaint);
}
AnimationController _positionController;

public readonly _CupertinoSwitchState _state;
if (value == _value) {
D.assert(value != null);
if (value == _value)
}
// this.markNeedsSemanticsUpdate();
_position.curve = Curves.ease;
_position.reverseCurve = Curves.ease.flipped;
if (value) {
_positionController.forward();
}
else {
_positionController.reverse();
}
//markNeedsSemanticsUpdate();
public TickerProvider vsync {
get { return _vsync; }
public Color activeColor {
get { return _activeColor; }
if (value == _vsync) {
if (value == _activeColor) {
_vsync = value;
_positionController.resync(vsync);
_reactionController.resync(vsync);
_activeColor = value;
markNeedsPaint();
TickerProvider _vsync;
Color _activeColor;
public Color activeColor {
get { return _activeColor; }
public Color trackColor {
get { return _trackColor; }
if (value == _activeColor) {
if (value == _trackColor)
}
_activeColor = value;
_trackColor = value;
Color _activeColor;
Color _trackColor;
public ValueChanged<bool> onChanged {
get { return _onChanged; }

ValueChanged<bool> _onChanged;
public TextDirection textDirection {
public TextDirection? textDirection {
get { return _textDirection; }
set {
if (_textDirection == value) {

}
}
TextDirection _textDirection;
public DragStartBehavior dragStartBehavior {
get { return _drag.dragStartBehavior; }
set {
if (_drag.dragStartBehavior == value) {
return;
}
_drag.dragStartBehavior = value;
}
}
TextDirection? _textDirection;
TapGestureRecognizer _tap;
HorizontalDragGestureRecognizer _drag;
public override void attach(object _owner) {
base.attach(_owner);
if (value) {
_positionController.forward();
}
else {
_positionController.reverse();
}
if (isInteractive) {
switch (_reactionController.status) {
case AnimationStatus.forward:
_reactionController.forward();
break;
case AnimationStatus.reverse:
_reactionController.reverse();
break;
case AnimationStatus.dismissed:
case AnimationStatus.completed:
break;
}
}
}
public override void detach() {
_positionController.stop();
_reactionController.stop();
base.detach();
}
void _handlePositionStateChanged(AnimationStatus status) {
if (isInteractive) {
if (status == AnimationStatus.completed && !_value) {
onChanged(true);
}
else if (status == AnimationStatus.dismissed && _value) {
onChanged(false);
}
}
}
void _handleTapDown(TapDownDetails details) {
if (isInteractive) {
_reactionController.forward();
}
}
void _handleTap() {
if (isInteractive) {
onChanged(!_value);
_emitVibration();
}
}
void _handleTapUp(TapUpDetails details) {
if (isInteractive) {
_reactionController.reverse();
}
}
void _handleTapCancel() {
if (isInteractive) {
_reactionController.reverse();
}
}
void _handleDragStart(DragStartDetails details) {
if (isInteractive) {
_reactionController.forward();
_emitVibration();
}
}
void _handleDragUpdate(DragUpdateDetails details) {
if (isInteractive) {
_position.curve = null;
_position.reverseCurve = null;
float delta = details.primaryDelta / CupertinoSwitchUtils._kTrackInnerLength ?? 0f;
_positionController.setValue(_positionController.value + delta);
// switch (this.textDirection) {
// case TextDirection.rtl:
// this._positionController.setValue(this._positionController.value - delta);
// break;
// case TextDirection.ltr:
// this._positionController.setValue(this._positionController.value + delta);
// break;
// }
}
}
void _handleDragEnd(DragEndDetails details) {
if (_position.value >= 0.5) {
_positionController.forward();
}
else {
_positionController.reverse();
}
_reactionController.reverse();
}
void _emitVibration() {
// switch (Platform defaultTargetPlatform) {
// case TargetPlatform.iOS:
// HapticFeedback.lightImpact();
// break;
// case TargetPlatform.fuchsia:
// case TargetPlatform.android:
// break;
// }
return;
}
protected override bool hitTestSelf(Offset position) {
return true;
}

if (evt is PointerDownEvent && isInteractive) {
_drag.addPointer(evt as PointerDownEvent);
_tap.addPointer(evt as PointerDownEvent);
_state._drag.addPointer((PointerDownEvent) evt);
_state._tap.addPointer((PointerDownEvent) evt);
// public override void describeSemanticsConfiguration(SemanticsConfiguration config) {
// base.describeSemanticsConfiguration(config);
//
// if (isInteractive)
// config.onTap = _handleTap;
//
// config.isEnabled = isInteractive;
// config.isToggled = _value;
// }
public readonly CupertinoThumbPainter _thumbPainter = new CupertinoThumbPainter();
float currentValue = _state.position.value;
float currentReactionValue = _state._reaction.value;
float currentValue = _position.value;
float currentReactionValue = _reaction.value;
float visualPosition = 0f;
float visualPosition = 0.0f;
switch (textDirection) {
case TextDirection.rtl:
visualPosition = 1.0f - currentValue;

break;
}
Color trackColor = _value ? activeColor : CupertinoSwitchUtils._kTrackColor;
float borderThickness =
1.5f + (CupertinoSwitchUtils._kTrackRadius - 1.5f) * Mathf.Max(currentReactionValue, currentValue);
Paint paint = new Paint();
paint.color = trackColor;
Paint paint = new Paint() {color = Color.lerp(trackColor, activeColor, currentValue)};
Rect trackRect = Rect.fromLTWH(
offset.dx + (size.width - CupertinoSwitchUtils._kTrackWidth) / 2.0f,
offset.dy + (size.height - CupertinoSwitchUtils._kTrackHeight) / 2.0f,

RRect outerRRect = RRect.fromRectAndRadius(trackRect, Radius.circular(CupertinoSwitchUtils
._kTrackRadius));
RRect innerRRect = RRect.fromRectAndRadius(trackRect.deflate(borderThickness), Radius.circular
(CupertinoSwitchUtils._kTrackRadius));
canvas.drawDRRect(outerRRect, innerRRect, paint);
RRect trackRRect = RRect.fromRectAndRadius(trackRect, Radius.circular(CupertinoSwitchUtils._kTrackRadius));
canvas.drawRRect(trackRRect, paint);
float currentThumbExtension = CupertinoThumbPainter.extension * currentReactionValue;
float thumbLeft = Mathf.Lerp(

visualPosition
);
float thumbCenterY = offset.dy + size.height / 2.0f;
_thumbPainter.paint(canvas, Rect.fromLTRB(
Rect thumbBounds = Rect.fromLTRB(
));
}
);
context.pushClipRRect(needsCompositing, Offset.zero, thumbBounds, trackRRect,
(PaintingContext innerContext, Offset offset1) => {
CupertinoThumbPainter.switchThumb().paint(innerContext.canvas, thumbBounds);
});
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);

ifFalse: "disabled",
showName: true, defaultValue: true));
}
}
}

63
com.unity.uiwidgets/Runtime/cupertino/tab_scaffold.cs


public class CupertinoTabController : ChangeNotifier {
public CupertinoTabController(int initialIndex = 0) {
_index = initialIndex;
_index = initialIndex;
}
public bool _isDisposed = false;

D.assert(tabBuilder != null);
D.assert(
controller == null || controller.index < tabBar.items.Count, () =>
"The CupertinoTabController's current index ${controller.index} is " +
"out of bounds for the tab bar with ${tabBar.items.length} tabs"
$"The CupertinoTabController's current index {controller.index} is " +
$"out of bounds for the tab bar with {tabBar.items.Count} tabs"
);
this.tabBar = tabBar;
this.controller = controller;

public override void initState() {
base.initState();
//_currentPage = widget.tabBar.currentIndex;
_updateTabController();
}
void _updateTabController( bool shouldDisposeOldController = false ) {

void _onCurrentIndexChange() {
D.assert(
_controller.index >= 0 && _controller.index < widget.tabBar.items.Count,()=>
"The $runtimeType's current index ${_controller.index} is " +
$"The {GetType()}'s current index {_controller.index} is " +
$"out of bounds for the tab bar with {widget.tabBar.items.Count} tabs"
);
setState(()=> {});

_controller.index = widget.tabBar.items.Count - 1;
}
}
/*public override void didUpdateWidget(StatefulWidget _oldWidget) {
CupertinoTabScaffold oldWidget = _oldWidget as CupertinoTabScaffold;
base.didUpdateWidget(oldWidget);
if (_currentPage >= widget.tabBar.items.Count) {
_currentPage = widget.tabBar.items.Count - 1;
D.assert(_currentPage >= 0,
() => "CupertinoTabBar is expected to keep at least 2 tabs after updating"
);
}
if (widget.tabBar.currentIndex != oldWidget.tabBar.currentIndex) {
_currentPage = widget.tabBar.currentIndex;
}
}*/
public override Widget build(BuildContext context) {
List<Widget> stacked = new List<Widget> { };

/*Widget content = new _TabSwitchingView(
currentTabIndex: _currentPage,
tabNumber: widget.tabBar.items.Count,
tabBuilder: widget.tabBuilder
);*/
Widget content = new _TabSwitchingView(
currentTabIndex: _controller.index,
tabNumber: widget.tabBar.items.Count,

child: content
)
);
/*if (widget.tabBar != null) {
stacked.Add(new Align(
alignment: Alignment.bottomCenter,
child: widget.tabBar.copyWith(
currentIndex: _currentPage,
onTap: (int newIndex) => {
setState(() => { _currentPage = newIndex; });
if (widget.tabBar.onTap != null) {
widget.tabBar.onTap(newIndex);
}
}
)
));
}*/
stacked.Add(
new MediaQuery(
data: existingMediaQuery.copyWith(textScaleFactor: 1),

decoration: new BoxDecoration(
color: CupertinoDynamicColor.resolve(widget.backgroundColor, context)
?? CupertinoTheme.of(context).scaffoldBackgroundColor
//color: widget.backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor
),
child: new Stack(
children: stacked

public override void dispose() {
// Only dispose `_controller` when the state instance owns it.
if (widget.controller == null) {
_controller?.dispose();
} else if (_controller?._isDisposed == false) {

base.dispose();
base.dispose();
}
}

}
class _TabSwitchingViewState : State<_TabSwitchingView> {
//List<Widget> tabs;
public readonly List<bool> shouldBuildTab = new List<bool>();
public readonly List<FocusScopeNode> tabFocusNodes = new List<FocusScopeNode>();
public readonly List<FocusScopeNode> discardedNodes = new List<FocusScopeNode>();

for (int i = widget.tabNumber; i < shouldBuildTab.Count; i++) {
shouldBuildTab.RemoveAt(i);
}
;
}
_focusActiveTab();
}

}
else {
tabFocusNodes.Add(new FocusScopeNode());
tabFocusNodes.Add(new FocusScopeNode(debugLabel: $"CupertinoTabScaffold Tab {i + tabFocusNodes.Count}")
);
}
}

foreach(FocusScopeNode focusScopeNode in tabFocusNodes) {
focusScopeNode.dispose();
}
foreach( FocusScopeNode focusScopeNode in discardedNodes) {
focusScopeNode.dispose();
}
List<Widget> stages = new List<Widget>();
int count = widget.tabNumber;
for (int i = 0; i < count; i++) {

2
com.unity.uiwidgets/Runtime/cupertino/tab_view.cs


}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
base.didUpdateWidget(oldWidget);
if (widget.navigatorKey != _oldWidget.navigatorKey
|| widget.navigatorObservers != _oldWidget.navigatorObservers) {
_updateObservers();

520
com.unity.uiwidgets/Runtime/cupertino/text_field.cs


namespace Unity.UIWidgets.cupertino {
class CupertinoTextFieldUtils {
public static readonly BorderSide _kDefaultRoundedBorderSide = new BorderSide(
color: CupertinoColors.lightBackgroundGray,
color: CupertinoDynamicColor.withBrightness(
color: new Color(0x33000000),
darkColor: new Color(0x33FFFFFF)
),
public static readonly Border _kDefaultRoundedBorder = new Border(
top: _kDefaultRoundedBorderSide,
bottom: _kDefaultRoundedBorderSide,

public static readonly BoxDecoration _kDefaultRoundedBorderDecoration = new BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: CupertinoColors.white,
darkColor: CupertinoColors.black
),
borderRadius: BorderRadius.all(Radius.circular(4.0f))
borderRadius: BorderRadius.all(Radius.circular(5.0f))
);
public static readonly Color _kDisabledBackground = CupertinoDynamicColor.withBrightness(
color: new Color(0xFFFAFAFA),
darkColor: new Color(0xFF050505)
public static readonly Color _kSelectionHighlightColor = new Color(0x667FAACF);
public static readonly Color _kInactiveTextColor = new Color(0xFFC2C2C2);
public static readonly CupertinoDynamicColor _kClearButtonColor = CupertinoDynamicColor.withBrightness(
color: new Color(0xFF636366),
darkColor: new Color(0xFFAEAEB2)
);
public static readonly Color _kDisabledBackground = new Color(0xFFFAFAFA);
public static TextSelectionControls cupertinoTextSelectionControls = new _CupertinoTextSelectionControls();
}
public enum OverlayVisibilityMode {

always
}
public class _CupertinoTextFieldSelectionGestureDetectorBuilder : TextSelectionGestureDetectorBuilder {
public _CupertinoTextFieldSelectionGestureDetectorBuilder(
_CupertinoTextFieldState state = null) : base(_delegate: state) {
_state = state;
}
public readonly _CupertinoTextFieldState _state;
protected override void onSingleTapUp(TapUpDetails details) {
if (_state._clearGlobalKey.currentContext != null) {
RenderBox renderBox = _state._clearGlobalKey.currentContext.findRenderObject() as RenderBox;
Offset localOffset = renderBox.globalToLocal(details.globalPosition);
if (renderBox.hitTest(new BoxHitTestResult(), position: localOffset)) {
return;
}
}
base.onSingleTapUp(details);
_state._requestKeyboard();
if (_state.widget.onTap != null)
_state.widget.onTap();
}
protected override void onDragSelectionEnd(DragEndDetails details) {
//(DragStartDetails details)
_state._requestKeyboard();
}
}
public class CupertinoTextField : StatefulWidget {
public CupertinoTextField(

TextStyle style = null,
StrutStyle strutStyle = null,
TextAlign textAlign = TextAlign.left,
TextAlignVertical textAlignVertical = null,
bool readOnly = false,
ToolbarOptions toolbarOptions = null,
bool? showCursor = null,
SmartDashesType? smartDashesType = null,
SmartQuotesType? smartQuotesType = null,
bool enableSuggestions = true,
int? maxLines = 1,
int? minLines = null,
bool expands = false,

float cursorWidth = 2.0f,
Radius cursorRadius = null,
Color cursorColor = null,
ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
ScrollPhysics scrollPhysics = null) : base(key: key) {
bool enableInteractiveSelection = true,
GestureTapCallback onTap = null,
ScrollController scrollController = null,
ScrollPhysics scrollPhysics = null
) : base(key: key) {
this.smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled);
this.smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled);
D.assert(maxLines == null || maxLines > 0);
D.assert(minLines == null || minLines > 0);
D.assert(maxLines == null || minLines == null || maxLines >= minLines,

this.padding = padding ?? EdgeInsets.all(6.0f);
this.placeholder = placeholder;
this.placeholderStyle = placeholderStyle ?? new TextStyle(
fontWeight: FontWeight.w300,
color: CupertinoTextFieldUtils._kInactiveTextColor
fontWeight: FontWeight.w400,
color: CupertinoColors.placeholderText
);
this.prefix = prefix;
this.prefixMode = prefixMode;

this.style = style;
this.strutStyle = strutStyle;
this.textAlign = textAlign;
this.textAlignVertical = textAlignVertical;
this.readOnly = readOnly;
this.showCursor = showCursor;
this.enableSuggestions = enableSuggestions;
this.maxLines = maxLines;
this.minLines = minLines;
this.expands = expands;

this.cursorWidth = cursorWidth;
this.cursorRadius = cursorRadius ?? Radius.circular(2.0f);
this.cursorColor = cursorColor;
this.selectionHeightStyle = selectionHeightStyle;
this.selectionWidthStyle = selectionWidthStyle;
this.dragStartBehavior = dragStartBehavior;
this.dragStartBehavior = dragStartBehavior ;
this.enableInteractiveSelection = enableInteractiveSelection;
this.onTap = onTap;
this.scrollController = scrollController;
this.toolbarOptions = toolbarOptions ?? (obscureText
? new ToolbarOptions(
selectAll: true,
paste: true
)
: new ToolbarOptions(
copy: true,
cut: true,
selectAll: true,
paste: true
));
public readonly ToolbarOptions toolbarOptions;
public readonly BoxDecoration decoration;

public readonly ScrollPhysics scrollPhysics;
public readonly ui.BoxHeightStyle selectionHeightStyle;
public readonly ui.BoxWidthStyle selectionWidthStyle;
public readonly TextAlignVertical textAlignVertical;
public readonly bool readOnly;
public readonly bool enableInteractiveSelection;
public readonly bool? showCursor;
public readonly bool enableSuggestions;
public readonly GestureTapCallback onTap;
public readonly ScrollController scrollController;
public readonly SmartDashesType smartDashesType;
public readonly SmartQuotesType smartQuotesType;
public bool selectionEnabled {
get {
return enableInteractiveSelection;
}
}
public override State createState() {
return new _CupertinoTextFieldState();
}

properties.add( new DiagnosticsProperty<TextEditingController>("controller", controller, defaultValue: null));
properties.add( new DiagnosticsProperty<FocusNode>("focusNode", focusNode, defaultValue: null));
properties.add( new DiagnosticsProperty<BoxDecoration>("decoration", decoration));
properties.add( new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding));
properties.add( new StringProperty("placeholder", placeholder));
properties.add( new DiagnosticsProperty<TextStyle>("placeholderStyle", placeholderStyle));
properties.add( new DiagnosticsProperty<OverlayVisibilityMode>("prefix", prefix == null ? default(OverlayVisibilityMode) : prefixMode));
properties.add( new DiagnosticsProperty<OverlayVisibilityMode>("suffix", suffix == null ? default(OverlayVisibilityMode) : suffixMode));
properties.add( new DiagnosticsProperty<OverlayVisibilityMode>("clearButtonMode", clearButtonMode));
properties.add( new DiagnosticsProperty<TextInputType>("keyboardType", keyboardType, defaultValue: TextInputType.text));
properties.add( new DiagnosticsProperty<TextStyle>("style", style, defaultValue: null));
properties.add( new DiagnosticsProperty<bool>("autofocus", autofocus, defaultValue: false));
properties.add( new DiagnosticsProperty<bool>("obscureText", obscureText, defaultValue: false));
properties.add( new DiagnosticsProperty<bool>("autocorrect", autocorrect, defaultValue: true));
properties.add( new EnumProperty<SmartDashesType>("smartDashesType", smartDashesType, defaultValue: obscureText ? SmartDashesType.disabled : SmartDashesType.enabled));
properties.add( new EnumProperty<SmartQuotesType>("smartQuotesType", smartQuotesType, defaultValue: obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled));
properties.add( new DiagnosticsProperty<bool>("enableSuggestions", enableSuggestions, defaultValue: true));
properties.add( new IntProperty("maxLines", maxLines, defaultValue: 1));
properties.add( new IntProperty("minLines", minLines, defaultValue: null));
properties.add( new DiagnosticsProperty<bool>("expands", expands, defaultValue: false));
properties.add( new IntProperty("maxLength", maxLength, defaultValue: null));
properties.add( new FlagProperty("maxLengthEnforced", value: maxLengthEnforced, ifTrue: "max length enforced"));
// properties.add( new createCupertinoColorProperty("cursorColor", cursorColor, defaultValue: null));
properties.add( new FlagProperty("selectionEnabled", value: selectionEnabled, defaultValue: true, ifFalse: "selection disabled"));
properties.add( new DiagnosticsProperty<ScrollController>("scrollController", scrollController, defaultValue: null));
properties.add( new DiagnosticsProperty<ScrollPhysics>("scrollPhysics", scrollPhysics, defaultValue: null));
properties.add( new EnumProperty<TextAlign>("textAlign", textAlign, defaultValue: TextAlign.start));
properties.add( new DiagnosticsProperty<TextAlignVertical>("textAlignVertical", textAlignVertical, defaultValue: null));
properties.add(
new DiagnosticsProperty<TextEditingController>("controller", controller, defaultValue: null));
properties.add(new DiagnosticsProperty<FocusNode>("focusNode", focusNode, defaultValue: null));
properties.add(new DiagnosticsProperty<BoxDecoration>("decoration", decoration));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
properties.add(new StringProperty("placeholder", placeholder));
properties.add(new DiagnosticsProperty<TextStyle>("placeholderStyle", placeholderStyle));
properties.add(new DiagnosticsProperty<OverlayVisibilityMode>("prefix",
prefix == null ? OverlayVisibilityMode.never : prefixMode));
properties.add(new DiagnosticsProperty<OverlayVisibilityMode>("suffix",
suffix == null ? OverlayVisibilityMode.never : suffixMode));
properties.add(new DiagnosticsProperty<OverlayVisibilityMode>("clearButtonMode", clearButtonMode));
properties.add(new DiagnosticsProperty<TextInputType>("keyboardType", keyboardType,
defaultValue: TextInputType.text));
properties.add(new DiagnosticsProperty<TextStyle>("style", style, defaultValue: null));
properties.add(new DiagnosticsProperty<bool>("autofocus", autofocus, defaultValue: false));
properties.add(new DiagnosticsProperty<bool>("obscureText", obscureText, defaultValue: false));
properties.add(new DiagnosticsProperty<bool>("autocorrect", autocorrect, defaultValue: false));
properties.add(new IntProperty("maxLines", maxLines, defaultValue: 1));
properties.add(new IntProperty("minLines", minLines, defaultValue: null));
properties.add(new DiagnosticsProperty<bool>("expands", expands, defaultValue: false));
properties.add(new IntProperty("maxLength", maxLength, defaultValue: null));
properties.add(new FlagProperty("maxLengthEnforced", value: maxLengthEnforced,
ifTrue: "max length enforced"));
properties.add(new DiagnosticsProperty<Color>("cursorColor", cursorColor, defaultValue: null));
properties.add(
new DiagnosticsProperty<ScrollPhysics>("scrollPhysics", scrollPhysics, defaultValue: null));
class _CupertinoTextFieldState : AutomaticKeepAliveClientMixin<CupertinoTextField> {
GlobalKey<EditableTextState> _editableTextKey = GlobalKey<EditableTextState>.key();
public class _CupertinoTextFieldState : AutomaticKeepAliveClientMixin<CupertinoTextField>, TextSelectionGestureDetectorBuilderDelegate{
public GlobalKey _clearGlobalKey = GlobalKey.key();
bool _showSelectionHandles = false;
_CupertinoTextFieldSelectionGestureDetectorBuilder _selectionGestureDetectorBuilder;
public GlobalKey<EditableTextState> editableTextKey {
get {
return GlobalKey<EditableTextState>.key();
}
}
public bool forcePressEnabled {
get { return true; }
}
//public readonly GlobalKey<EditableTextState> editableTextKey = GlobalKey<EditableTextState>.key();
public bool selectionEnabled {
get { return widget.selectionEnabled;}
}
_selectionGestureDetectorBuilder = new _CupertinoTextFieldSelectionGestureDetectorBuilder(state: this);
if (widget.controller == null) {
_controller = new TextEditingController();
_controller.addListener(updateKeepAlive);

public override void didUpdateWidget(StatefulWidget oldWidget) {
oldWidget = (CupertinoTextField) oldWidget;
CupertinoTextField _oldWidget = (CupertinoTextField) oldWidget;
if (widget.controller == null && _oldWidget.controller != null) {
_controller = TextEditingController.fromValue(_oldWidget.controller.value);
if (widget.controller == null && ((CupertinoTextField)oldWidget).controller != null) {
_controller = TextEditingController.fromValue(((CupertinoTextField)oldWidget).controller.value);
}
else if (widget.controller != null && _oldWidget.controller == null) {
} else if (widget.controller != null &&((CupertinoTextField)oldWidget).controller == null) {
bool wasEnabled = _oldWidget.enabled ?? true;
bool wasEnabled = ((CupertinoTextField)oldWidget).enabled ?? true;
public override void dispose() {
_focusNode?.dispose();
_controller?.removeListener(updateKeepAlive);

void _requestKeyboard() {
_editableTextKey.currentState?.requestKeyboard();
}
RenderEditable _renderEditable {
get { return _editableTextKey.currentState.renderEditable; }
public EditableTextState _editableText {
get {
return editableTextKey.currentState;
}
void _handleTapDown(TapDownDetails details) {
_renderEditable.handleTapDown(details);
}
void _handleSingleTapUp(TapUpDetails details) {
_renderEditable.selectWordEdge(cause: SelectionChangedCause.tap);
_requestKeyboard();
}
void _handleSingleLongTapStart(LongPressStartDetails details) {
_renderEditable.selectPositionAt(
from: details.globalPosition,
cause: SelectionChangedCause.longPress
);
public void _requestKeyboard() {
_editableText?.requestKeyboard();
void _handleSingleLongTapMoveUpdate(LongPressMoveUpdateDetails details) {
_renderEditable.selectPositionAt(
from: details.globalPosition,
cause: SelectionChangedCause.longPress
);
}
bool _shouldShowSelectionHandles(SelectionChangedCause cause) {
// When the text field is activated by something that doesn't trigger the
// selection overlay, we shouldn't show the handles either.
if (!_selectionGestureDetectorBuilder.shouldShowSelectionToolbar)
return false;
void _handleSingleLongTapEnd(LongPressEndDetails details) {
_editableTextKey.currentState.showToolbar();
}
// On iOS, we don't show handles when the selection is collapsed.
if (_effectiveController.selection.isCollapsed)
return false;
void _handleDoubleTapDown(TapDownDetails details) {
_renderEditable.selectWord(cause: SelectionChangedCause.tap);
_editableTextKey.currentState.showToolbar();
}
if (cause == SelectionChangedCause.keyboard)
return false;
void _handleMouseDragSelectionStart(DragStartDetails details) {
_renderEditable.selectPositionAt(
from: details.globalPosition,
cause: SelectionChangedCause.drag
);
}
if (_effectiveController.text.isNotEmpty())
return true;
void _handleMouseDragSelectionUpdate(
DragStartDetails startDetails,
DragUpdateDetails updateDetails
) {
_renderEditable.selectPositionAt(
from: startDetails.globalPosition,
to: updateDetails.globalPosition,
cause: SelectionChangedCause.drag
);
return false;
void _handleMouseDragSelectionEnd(DragEndDetails details) {
_requestKeyboard();
}
_editableTextKey.currentState?.bringIntoView(selection.basePos);
_editableText?.bringIntoView(selection._base);
}
bool willShowSelectionHandles = _shouldShowSelectionHandles(cause);
if (willShowSelectionHandles != _showSelectionHandles) {
setState(()=> {
_showSelectionHandles = willShowSelectionHandles;
});
protected override bool wantKeepAlive {
get { return _controller?.text?.isNotEmpty() == true; }
protected override bool wantKeepAlive {
get {
return _controller?.text?.isNotEmpty() == true;
}
}
bool _shouldShowAttachment(

case OverlayVisibilityMode.notEditing:
return !hasText;
}
D.assert(false);
return false;
}

attachment: widget.prefixMode,
hasText: text.text.isNotEmpty()
);
attachment: widget.prefixMode,
hasText: text.text.isNotEmpty()
);
attachment: widget.suffixMode,
hasText: text.text.isNotEmpty()
);
attachment: widget.suffixMode,
hasText: text.text.isNotEmpty()
);
}
bool _showClearButton(TextEditingValue text) {

);
}
// True if any surrounding decoration widgets will be shown.
bool _hasDecoration {
get {
return widget.placeholder != null ||
widget.clearButtonMode != OverlayVisibilityMode.never ||
widget.prefix != null ||
widget.suffix != null;
}
}
TextAlignVertical _textAlignVertical {
get {
if (widget.textAlignVertical != null) {
return widget.textAlignVertical;
}
return _hasDecoration ? TextAlignVertical.center : TextAlignVertical.top;
}
}
Widget _addTextDependentAttachments(Widget editableText, TextStyle textStyle, TextStyle placeholderStyle) {
D.assert(editableText != null);
D.assert(textStyle != null);

List<Widget> stackChildren = new List<Widget>();
if (widget.placeholder != null && text.text.isEmpty()) {
stackChildren.Add(
new Padding(
padding: widget.padding,
child: new Text(
widget.placeholder,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: placeholderStyle
new SizedBox(
width : float.PositiveInfinity,
child: new Padding(
padding: widget.padding,
child: new Text(
widget.placeholder,
maxLines: widget.maxLines,
overflow: TextOverflow.ellipsis,
style: placeholderStyle,
textAlign: widget.textAlign
)
)
)
);
}

child: new Icon(
CupertinoIcons.clear_thick_circled,
size: 18.0f,
color: CupertinoTextFieldUtils._kInactiveTextColor
color: CupertinoDynamicColor.resolve(CupertinoTextFieldUtils._kClearButtonColor, context)
)
)
)

}
);
}
D.assert(WidgetsD.debugCheckHasDirectionality(context));
TextEditingController controller = _effectiveController;
List<TextInputFormatter> formatters = widget.inputFormatters ?? new List<TextInputFormatter>();
bool enabled = widget.enabled ?? true;

}
CupertinoThemeData themeData = CupertinoTheme.of(context);
TextStyle textStyle = themeData.textTheme.textStyle.merge(widget.style);
TextStyle placeholderStyle = textStyle.merge(widget.placeholderStyle);
Brightness? keyboardAppearance = widget.keyboardAppearance ?? themeData.brightness;
Color cursorColor = widget.cursorColor ?? themeData.primaryColor;
TextStyle resolvedStyle = widget.style?.copyWith(
color: CupertinoDynamicColor.resolve(widget.style?.color, context),
backgroundColor: CupertinoDynamicColor.resolve(widget.style?.backgroundColor, context)
);
TextStyle textStyle = themeData.textTheme.textStyle.merge(resolvedStyle);
TextStyle resolvedPlaceholderStyle = widget.placeholderStyle?.copyWith(
color: CupertinoDynamicColor.resolve(widget.placeholderStyle?.color, context),
backgroundColor: CupertinoDynamicColor.resolve(widget.placeholderStyle?.backgroundColor, context)
);
TextStyle placeholderStyle = textStyle.merge(resolvedPlaceholderStyle);
Brightness? keyboardAppearance = widget.keyboardAppearance ?? CupertinoTheme.brightnessOf(context);
Color cursorColor = CupertinoDynamicColor.resolve(widget.cursorColor, context) ?? themeData.primaryColor;
Color disabledColor = CupertinoDynamicColor.resolve(CupertinoTextFieldUtils._kDisabledBackground, context);
Color decorationColor = CupertinoDynamicColor.resolve(widget.decoration?.color, context);
BoxBorder border = widget.decoration?.border;
Border resolvedBorder = border as Border;
if (border is Border) {
BorderSide resolveBorderSide(BorderSide side) {
return side == BorderSide.none
? side
: side.copyWith(color: CupertinoDynamicColor.resolve(side.color, context));
}
resolvedBorder = (Border) (border == null || border.GetType() != typeof(Border)
? border
: new Border(
top: resolveBorderSide(((Border)border).top),
left: resolveBorderSide(((Border)border).left),
bottom: resolveBorderSide(((Border)border).bottom),
right: resolveBorderSide(((Border)border).right)
));
}
BoxDecoration effectiveDecoration = widget.decoration?.copyWith(
border: resolvedBorder,
color: enabled ? decorationColor : (decorationColor == null ? disabledColor : decorationColor)
);
padding: widget.padding,
child: new RepaintBoundary(
padding: widget.padding,
child: new RepaintBoundary(
smartDashesType: SmartDashesType.disabled,
smartQuotesType:SmartQuotesType.disabled,
key: _editableTextKey,
controller: controller,
focusNode: _effectiveFocusNode,
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
textCapitalization: widget.textCapitalization,
style: textStyle,
strutStyle: widget.strutStyle,
textAlign: widget.textAlign,
autofocus: widget.autofocus,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
maxLines: widget.maxLines,
minLines: widget.minLines,
expands: widget.expands,
selectionColor: CupertinoTextFieldUtils._kSelectionHighlightColor,
selectionControls: CupertinoTextSelectionUtils.cupertinoTextSelectionControls,
onChanged: widget.onChanged,
onSelectionChanged: _handleSelectionChanged,
onEditingComplete: widget.onEditingComplete,
onSubmitted: widget.onSubmitted,
inputFormatters: formatters,
rendererIgnoresPointer: true,
cursorWidth: widget.cursorWidth,
cursorRadius: widget.cursorRadius,
cursorColor: cursorColor,
cursorOpacityAnimates: true,
cursorOffset: cursorOffset,
paintCursorAboveText: true,
backgroundCursorColor: CupertinoColors.inactiveGray,
scrollPadding: widget.scrollPadding,
keyboardAppearance: keyboardAppearance,
dragStartBehavior: widget.dragStartBehavior,
scrollPhysics: widget.scrollPhysics
key: editableTextKey,
controller: controller,
readOnly: widget.readOnly,
toolbarOptions: widget.toolbarOptions,
showCursor: widget.showCursor,
showSelectionHandles: _showSelectionHandles,
focusNode: _effectiveFocusNode,
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
textCapitalization: widget.textCapitalization,
style: textStyle,
strutStyle: widget.strutStyle,
textAlign: widget.textAlign,
autofocus: widget.autofocus,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
smartDashesType: widget.smartDashesType,
smartQuotesType: widget.smartQuotesType,
enableSuggestions: widget.enableSuggestions,
maxLines: widget.maxLines,
minLines: widget.minLines,
expands: widget.expands,
selectionColor: CupertinoTheme.of(context).primaryColor.withOpacity(0.2f),
selectionControls: widget.selectionEnabled
? CupertinoTextFieldUtils.cupertinoTextSelectionControls : null,
onChanged: widget.onChanged,
onSelectionChanged: _handleSelectionChanged,
onEditingComplete: widget.onEditingComplete,
onSubmitted: widget.onSubmitted,
inputFormatters: formatters,
rendererIgnoresPointer: true,
cursorWidth: widget.cursorWidth,
cursorRadius: widget.cursorRadius,
cursorColor: cursorColor,
cursorOpacityAnimates: true,
cursorOffset: cursorOffset,
paintCursorAboveText: true,
backgroundCursorColor: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context),
selectionHeightStyle: widget.selectionHeightStyle,
selectionWidthStyle: widget.selectionWidthStyle,
scrollPadding: widget.scrollPadding,
keyboardAppearance: keyboardAppearance,
dragStartBehavior: widget.dragStartBehavior,
scrollController: widget.scrollController,
scrollPhysics: widget.scrollPhysics,
enableInteractiveSelection: widget.enableInteractiveSelection
)
);
)
);
decoration: widget.decoration,
child: new Container(
color: enabled
? null
: CupertinoTheme.of(context).brightness == Brightness.light
? CupertinoTextFieldUtils._kDisabledBackground
: CupertinoColors.darkBackgroundGray,
child: new TextSelectionGestureDetector(
onTapDown: _handleTapDown,
onSingleTapUp: _handleSingleTapUp,
onSingleLongTapStart: _handleSingleLongTapStart,
onSingleLongTapMoveUpdate: _handleSingleLongTapMoveUpdate,
onSingleLongTapEnd: _handleSingleLongTapEnd,
onDoubleTapDown: _handleDoubleTapDown,
onDragSelectionStart: _handleMouseDragSelectionStart,
onDragSelectionUpdate: _handleMouseDragSelectionUpdate,
onDragSelectionEnd: _handleMouseDragSelectionEnd,
behavior: HitTestBehavior.translucent,
decoration: effectiveDecoration,
child: _selectionGestureDetectorBuilder.buildGestureDetector(
behavior: HitTestBehavior.translucent,
child: new Align(
alignment: new Alignment(-1.0f, _textAlignVertical.y),
widthFactor: 1.0f,
heightFactor: 1.0f,
);
}
}

682
com.unity.uiwidgets/Runtime/cupertino/text_selection.cs


namespace Unity.UIWidgets.cupertino {
public static class CupertinoTextSelectionUtils {
public static readonly TextSelectionControls cupertinoTextSelectionControls = new _CupertinoTextSelectionControls();
// public static readonly TextSelectionControls cupertinoTextSelectionControls = new _CupertinoTextSelectionControls();
public const float _kSelectionHandleOverlap = 1.5f;

public const float _kToolbarHeight = 43.0f;
public static readonly Size _kToolbarArrowSize = new Size(14.0f, 7.0f);
//public static readonly Radius _kToolbarBorderRadius = Radius.circular(8);
public static readonly BorderRadius _kToolbarBorderRadius = BorderRadius.all(Radius.circular(7.5f));
public static readonly Radius _kToolbarBorderRadius = Radius.circular(8);
public static readonly Color _kToolbarBackgroundColor = new Color(0xFF2E2E2E);
public static readonly Color _kToolbarDividerColor = new Color(0xFFB9B9B9);
public static readonly Color _kToolbarBackgroundColor = new Color(0xEB202020);
public static readonly Color _kToolbarDividerColor = new Color(0xFF808080);
public static readonly Color _kHandlesColor = new Color(0xFF136FE0);

public static readonly EdgeInsets _kToolbarButtonPadding =
EdgeInsets.symmetric(vertical: 10.0f, horizontal: 18.0f);
//public static readonly BorderRadius _kToolbarBorderRadius = BorderRadius.all(Radius.circular(7.5f));
inherit: false,
fontSize: 14.0f,
letterSpacing: -0.15f,
fontWeight: FontWeight.w400,

/* class CupertinoTextSelectionToolbar : SingleChildRenderObjectWidget {
class CupertinoTextSelectionToolbar : SingleChildRenderObjectWidget {
public CupertinoTextSelectionToolbar(
Key key = null,
float barTopY = 0.0f,

public override string ToString() => $"offset = {offset}," + $"arrowXOffsetFromCenter={arrowXOffsetFromCenter}";
}
class _ToolbarRenderBox : RenderShiftedBox {
public _ToolbarRenderBox(
float _barTopY = 0.0f,
float _arrowTipX = 0.0f,
bool _isArrowPointingDown = false,
RenderBox child = null
) : base(child) {
this._barTopY = _barTopY;
this._arrowTipX = _arrowTipX;
this._isArrowPointingDown = _isArrowPointingDown;
}
class _ToolbarRenderBox : RenderShiftedBox {
public _ToolbarRenderBox(
float _barTopY = 0.0f,
float _arrowTipX = 0.0f,
bool _isArrowPointingDown = false,
RenderBox child = null) : base(child) {
this._barTopY = _barTopY;
this._arrowTipX = _arrowTipX;
this._isArrowPointingDown = _isArrowPointingDown;
}
public override bool isRepaintBoundary {
public override bool isRepaintBoundary {
get { return true; }
}

child.parentData = new _ToolbarParentData();
}
}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
size = constraints.biggest;

child.layout(heightConstraint.enforce(enforcedConstraint), parentUsesSize: true);
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
// The local x-coordinate of the center of the toolbar.
childParentData.offset = new Offset(adjustedCenterX - child.size.width / 2, _barTopY);
childParentData.arrowXOffsetFromCenter = _arrowTipX - adjustedCenterX;
childParentData.offset = new Offset(adjustedCenterX - child.size.width / 2, _barTopY );
childParentData.arrowXOffsetFromCenter = _arrowTipX - adjustedCenterX ;
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
Path rrect = new Path();
rrect.addRRect(
RRect.fromRectAndRadius(
new Offset(0, _isArrowPointingDown ? 0 : CupertinoTextSelectionUtils._kToolbarArrowSize.height)
& new Size(child.size.width, child.size.height - CupertinoTextSelectionUtils._kToolbarArrowSize.height),
CupertinoTextSelectionUtils._kToolbarBorderRadius
));
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
Path rrect = new Path();
rrect.addRRect(
RRect.fromRectAndRadius(
new Offset(0, _isArrowPointingDown ? 0 : CupertinoTextSelectionUtils._kToolbarArrowSize.height)
& new Size(child.size.width, child.size.height - CupertinoTextSelectionUtils._kToolbarArrowSize.height),
CupertinoTextSelectionUtils._kToolbarBorderRadius
));
float arrowTipX = child.size.width / 2 + childParentData.arrowXOffsetFromCenter;
float arrowTipX = child.size.width / 2 + childParentData.arrowXOffsetFromCenter;
float arrowBottomY = _isArrowPointingDown
? child.size.height - CupertinoTextSelectionUtils._kToolbarArrowSize.height
: CupertinoTextSelectionUtils._kToolbarArrowSize.height;
float arrowBottomY = _isArrowPointingDown
? child.size.height - CupertinoTextSelectionUtils._kToolbarArrowSize.height
: CupertinoTextSelectionUtils._kToolbarArrowSize.height;
float arrowTipY = _isArrowPointingDown ? child.size.height : 0;
float arrowTipY = _isArrowPointingDown ? child.size.height : 0;
Path arrow = new Path();
arrow.moveTo(arrowTipX, arrowTipY);
arrow.lineTo(arrowTipX - CupertinoTextSelectionUtils._kToolbarArrowSize.width / 2, arrowBottomY);
arrow.lineTo(arrowTipX + CupertinoTextSelectionUtils._kToolbarArrowSize.width / 2, arrowBottomY);
arrow.close();
Path arrow = new Path();
arrow.moveTo(arrowTipX, arrowTipY);
arrow.lineTo(arrowTipX - CupertinoTextSelectionUtils._kToolbarArrowSize.width / 2, arrowBottomY);
arrow.lineTo(arrowTipX + CupertinoTextSelectionUtils._kToolbarArrowSize.width / 2, arrowBottomY);
arrow.close();
return Path.combine(PathOperation.union, rrect, arrow);
return Path.combine(PathOperation.union, rrect, arrow);
if (child == null) {
return;
}
if (child == null) {
return;
}
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.pushClipPath(
needsCompositing,
offset + childParentData.offset,
Offset.zero & child.size,
_clipPath(),
(PaintingContext innerContext, Offset innerOffset) => innerContext.paintChild(child, innerOffset),
);
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.pushClipPath(
needsCompositing,
offset + childParentData.offset,
Offset.zero & child.size,
_clipPath(),
(PaintingContext innerContext, Offset innerOffset) => innerContext.paintChild(child, innerOffset)
);
}
Paint _debugPaint;

D.assert(() => {
if (child == null) {
D.assert(() => {
if (child == null) {
return true;
}
//_debugPaint ??= new Paint()
if (_debugPaint == null) {
_debugPaint = new Paint();
}
_debugPaint.shader = ui.Gradient.linear(
new Offset(0.0f, 0.0f),
new Offset(10.0f, 10.0f),
new List<Color> {
new Color(0x00000000), new Color(0xFFFF00FF), new Color(0xFFFF00FF),
new Color(0x00000000)
},
new List<float> {0.25f, 0.25f, 0.75f, 0.75f},
TileMode.repeated
);
_debugPaint.strokeWidth = 2.0f;
_debugPaint.style = PaintingStyle.stroke;
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.canvas.drawPath(_clipPath().shift(offset + childParentData.offset), _debugPaint);
});
//_debugPaint ??= new Paint()
if (_debugPaint == null) {
_debugPaint = new Paint();
}
_debugPaint.shader = ui.Gradient.linear(
new Offset(0.0f, 0.0f),
new Offset(10.0f, 10.0f),
new List<Color> {
new Color(0x00000000), new Color(0xFFFF00FF), new Color(0xFFFF00FF),
new Color(0x00000000)
},
new List<float> {0.25f, 0.25f, 0.75f, 0.75f},
TileMode.repeated
);
_debugPaint.strokeWidth = 2.0f;
_debugPaint.style = PaintingStyle.stroke;
_ToolbarParentData childParentData = child.parentData as _ToolbarParentData;
context.canvas.drawPath(_clipPath().shift(offset + childParentData.offset), _debugPaint);
return true;
});
}
/// Draws a single text selection handle with a bar and a ball.
public class _TextSelectionHandlePainter : CustomPainter {
public class _TextSelectionHandlePainter : AbstractCustomPainter {
public _TextSelectionHandlePainter(Color color) {
this.color = color;
}

oldPainter = (_TextSelectionHandlePainter)oldPainter;
return color != ((_TextSelectionHandlePainter)oldPainter).color;
}
public bool? hitTest(Offset position) {
return null;
}
public void addListener(VoidCallback listener) {
base.addListener(listener);
}
public void removeListener(VoidCallback listener) {
base.removeListener(listener);
}
public delegate bool Predicate(TextSelectionDelegate _delegate);
public delegate void OnPressed(TextSelectionDelegate _delegate);
/// Returns the size of the Cupertino handle.
public override Size getHandleSize(float textLineHeight) {
return new Size(
CupertinoTextSelectionUtils._kSelectionHandleRadius * 2,
textLineHeight + CupertinoTextSelectionUtils._kSelectionHandleRadius * 2 - CupertinoTextSelectionUtils._kSelectionHandleOverlap
);
}
public new Widget buildToolbar(
BuildContext context,
Rect globalEditableRegion,
float textLineHeight,
Offset position,
List<TextSelectionPoint> endpoints
//TextSelectionDelegate delegate
)
{
D.assert(debugCheckHasMediaQuery(context));
MediaQueryData mediaQuery = MediaQuery.of(context);
float toolbarHeightNeeded = mediaQuery.padding.top
+ CupertinoTextSelectionUtils._kToolbarScreenPadding
+ CupertinoTextSelectionUtils._kToolbarHeight
+ CupertinoTextSelectionUtils._kToolbarContentDistance;
float availableHeight = globalEditableRegion.top + endpoints.first().point.dy - textLineHeight;
bool isArrowPointingDown = toolbarHeightNeeded <= availableHeight;
public override Size getHandleSize(float textLineHeight) {
return new Size(
CupertinoTextSelectionUtils._kSelectionHandleRadius * 2,
textLineHeight + CupertinoTextSelectionUtils._kSelectionHandleRadius * 2 - CupertinoTextSelectionUtils._kSelectionHandleOverlap
);
}
public override Widget buildToolbar(
BuildContext context,
Rect globalEditableRegion,
float textLineHeight,
Offset position,
List<TextSelectionPoint> endpoints,
TextSelectionDelegate _delegate
)
{
D.assert(WidgetsD.debugCheckHasMediaQuery(context));
MediaQueryData mediaQuery = MediaQuery.of(context);
float arrowTipX = (position.dx + globalEditableRegion.left).clamp(
CupertinoTextSelectionUtils._kArrowScreenPadding + mediaQuery.padding.left,
mediaQuery.size.width - mediaQuery.padding.right - CupertinoTextSelectionUtils._kArrowScreenPadding
) ;
float localBarTopY = isArrowPointingDown
? endpoints.first().point.dy - textLineHeight - CupertinoTextSelectionUtils._kToolbarContentDistance - CupertinoTextSelectionUtils._kToolbarHeight
: endpoints.last().point.dy + CupertinoTextSelectionUtils._kToolbarContentDistance;
List<Widget> items = new List<Widget>{};
Widget onePhysicalPixelVerticalDivider =
new SizedBox(width: 1.0f / MediaQuery.of(context).devicePixelRatio);
CupertinoLocalizations localizations = CupertinoLocalizations.of(context);
EdgeInsets arrowPadding = isArrowPointingDown
? EdgeInsets.only(bottom: CupertinoTextSelectionUtils._kToolbarArrowSize.height)
: EdgeInsets.only(top: CupertinoTextSelectionUtils._kToolbarArrowSize.height);
float toolbarHeightNeeded = mediaQuery.padding.top
+ CupertinoTextSelectionUtils._kToolbarScreenPadding
+ CupertinoTextSelectionUtils._kToolbarHeight
+ CupertinoTextSelectionUtils._kToolbarContentDistance;
float availableHeight = globalEditableRegion.top + endpoints.first().point.dy - textLineHeight;
bool isArrowPointingDown = toolbarHeightNeeded <= availableHeight;
void addToolbarButtonIfNeeded(
string text,
bool Function(TextSelectionDelegate) predicate,
void Function(TextSelectionDelegate) onPressed) {
if (!predicate(delegate)) {
return;
}
if (items.isNotEmpty()) {
items.Add(onePhysicalPixelVerticalDivider);
}
float arrowTipX = (position.dx + globalEditableRegion.left).clamp(
CupertinoTextSelectionUtils._kArrowScreenPadding + mediaQuery.padding.left,
mediaQuery.size.width - mediaQuery.padding.right - CupertinoTextSelectionUtils._kArrowScreenPadding
) ;
float localBarTopY = isArrowPointingDown
? endpoints.first().point.dy - textLineHeight - CupertinoTextSelectionUtils._kToolbarContentDistance - CupertinoTextSelectionUtils._kToolbarHeight
: endpoints.last().point.dy + CupertinoTextSelectionUtils._kToolbarContentDistance;
items.Add(new CupertinoButton(
child: new Text(text, style:CupertinoTextSelectionUtils. _kToolbarButtonFontStyle),
color: CupertinoTextSelectionUtils._kToolbarBackgroundColor,
minSize: CupertinoTextSelectionUtils._kToolbarHeight,
padding: CupertinoTextSelectionUtils._kToolbarButtonPadding.add(arrowPadding),
borderRadius: null,
pressedOpacity: 0.7f,
onPressed: () => onPressed(delegate)
));
}
List<Widget> items = new List<Widget>{};
Widget onePhysicalPixelVerticalDivider = new SizedBox(width: 1.0f / MediaQuery.of(context).devicePixelRatio);
CupertinoLocalizations localizations = CupertinoLocalizations.of(context);
EdgeInsets arrowPadding = isArrowPointingDown
? EdgeInsets.only(bottom: CupertinoTextSelectionUtils._kToolbarArrowSize.height)
: EdgeInsets.only(top: CupertinoTextSelectionUtils._kToolbarArrowSize.height);
void addToolbarButtonIfNeeded(
string text,
Predicate predicate,
OnPressed onPressed) {
if (!predicate(_delegate)) {
return;
}
addToolbarButtonIfNeeded(localizations.cutButtonLabel, canCut, handleCut);
addToolbarButtonIfNeeded(localizations.copyButtonLabel, canCopy, handleCopy);
addToolbarButtonIfNeeded(localizations.pasteButtonLabel, canPaste, handlePaste);
addToolbarButtonIfNeeded(localizations.selectAllButtonLabel, canSelectAll, handleSelectAll);
if (items.isNotEmpty()) {
items.Add(onePhysicalPixelVerticalDivider);
}
return new CupertinoTextSelectionToolbar(
barTopY: localBarTopY + globalEditableRegion.top,
arrowTipX: arrowTipX,
isArrowPointingDown: isArrowPointingDown,
child: items.isEmpty() ? null : new DecoratedBox(
decoration: new BoxDecoration(color: CupertinoTextSelectionUtils._kToolbarDividerColor),
child: new Row(mainAxisSize: MainAxisSize.min, children: items)
)
);
items.Add(new CupertinoButton(
child: new Text(text, style:CupertinoTextSelectionUtils. _kToolbarButtonFontStyle),
color: CupertinoTextSelectionUtils._kToolbarBackgroundColor,
minSize: CupertinoTextSelectionUtils._kToolbarHeight,
padding: CupertinoTextSelectionUtils._kToolbarButtonPadding.add(arrowPadding),
borderRadius: null,
pressedOpacity: 0.7f,
onPressed: () => onPressed(_delegate)
));
}
addToolbarButtonIfNeeded(localizations.cutButtonLabel, canCut, handleCut);
addToolbarButtonIfNeeded(localizations.copyButtonLabel, canCopy, handleCopy);
addToolbarButtonIfNeeded(localizations.pasteButtonLabel, canPaste, handlePaste);
addToolbarButtonIfNeeded(localizations.selectAllButtonLabel, canSelectAll, handleSelectAll);
return new CupertinoTextSelectionToolbar(
barTopY: localBarTopY + globalEditableRegion.top,
arrowTipX: arrowTipX,
isArrowPointingDown: isArrowPointingDown,
child: items.isEmpty() ? null : new DecoratedBox(
decoration: new BoxDecoration(color: CupertinoTextSelectionUtils._kToolbarDividerColor),
child: new Row(mainAxisSize: MainAxisSize.min, children: items)
)
);
size: desiredSize,
child: new CustomPaint(
painter: new _TextSelectionHandlePainter(CupertinoTheme.of(context).primaryColor)
)
);
switch (type) {
case TextSelectionHandleType.left:
return handle;
case TextSelectionHandleType.right:
// Right handle is a vertical mirror of the left.
return new Transform(
transform: Matrix4.identity()
..translate(desiredSize.width / 2, desiredSize.height / 2)
..rotateZ(math.pi)
..translate(-desiredSize.width / 2, -desiredSize.height / 2),
child: handle
);
// iOS doesn't draw anything for collapsed selections.
case TextSelectionHandleType.collapsed:
return new SizedBox();
size: desiredSize,
child: new CustomPaint(
painter: new _TextSelectionHandlePainter(CupertinoTheme.of(context).primaryColor)
)
);
var result = Matrix4.identity();
result.translate(desiredSize.width / 2, desiredSize.height / 2);
result.rotateZ(Mathf.PI);
result.translate(-desiredSize.width / 2, -desiredSize.height / 2);
switch (type) {
case TextSelectionHandleType.left:
return handle;
case TextSelectionHandleType.right:
return new Transform(
transform: result,
child: handle
);
case TextSelectionHandleType.collapsed:
return new SizedBox();
}
D.assert(type != null);
return null;
D.assert(type != null);
return null;
}
public override Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight) {
public override Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight) {
// The circle is at the top for the left handle, and the anchor point is
// all the way at the bottom of the line.
// The right handle is vertically flipped, and the anchor point is near
// the top of the circle to give slight overlap.
// A collapsed handle anchors itself so that it's centered.
default:
return new Offset(
handleSize.width / 2,

}
}*/
/// Text selection controls that follows iOS design conventions.
class _TextSelectionToolbarNotchPainter : AbstractCustomPainter {
public override void paint(Canvas canvas, Size size) {
Paint paint = new Paint();
paint.color = CupertinoTextSelectionUtils._kToolbarBackgroundColor;
paint.style = PaintingStyle.fill;
Path triangle = new Path();
triangle.lineTo(CupertinoTextSelectionUtils._kToolbarTriangleSize.width / 2, 0.0f);
triangle.lineTo(0.0f, CupertinoTextSelectionUtils._kToolbarTriangleSize.height);
triangle.lineTo(-(CupertinoTextSelectionUtils._kToolbarTriangleSize.width / 2), 0.0f);
triangle.close();
canvas.drawPath(triangle, paint);
}
public override bool shouldRepaint(CustomPainter oldPainter) {
return false;
}
class _TextSelectionToolbar : StatelessWidget {
public _TextSelectionToolbar(
Key key = null,
VoidCallback handleCut = null,
VoidCallback handleCopy = null,
VoidCallback handlePaste = null,
VoidCallback handleSelectAll = null
) : base(key: key) {
this.handleCut = handleCut;
this.handleCopy = handleCopy;
this.handlePaste = handlePaste;
this.handleSelectAll = handleSelectAll;
}
readonly VoidCallback handleCut;
readonly VoidCallback handleCopy;
readonly VoidCallback handlePaste;
readonly VoidCallback handleSelectAll;
public override Widget build(BuildContext context) {
List<Widget> items = new List<Widget>();
Widget onePhysicalPixelVerticalDivider =
new SizedBox(width: 1.0f / MediaQuery.of(context).devicePixelRatio);
CupertinoLocalizations localizations = CupertinoLocalizations.of(context);
if (handleCut != null) {
items.Add(_buildToolbarButton(localizations.cutButtonLabel, handleCut));
}
if (handleCopy != null) {
if (items.isNotEmpty()) {
items.Add(onePhysicalPixelVerticalDivider);
}
items.Add(_buildToolbarButton(localizations.copyButtonLabel, handleCopy));
}
if (handlePaste != null) {
if (items.isNotEmpty()) {
items.Add(onePhysicalPixelVerticalDivider);
}
items.Add(_buildToolbarButton(localizations.pasteButtonLabel, handlePaste));
}
if (handleSelectAll != null) {
if (items.isNotEmpty()) {
items.Add(onePhysicalPixelVerticalDivider);
}
items.Add(_buildToolbarButton(localizations.selectAllButtonLabel, handleSelectAll));
}
Widget triangle = SizedBox.fromSize(
size: CupertinoTextSelectionUtils._kToolbarTriangleSize,
child: new CustomPaint(
painter: new _TextSelectionToolbarNotchPainter()
)
);
return new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
new ClipRRect(
borderRadius: CupertinoTextSelectionUtils._kToolbarBorderRadius,
child: new DecoratedBox(
decoration: new BoxDecoration(
color: CupertinoTextSelectionUtils._kToolbarDividerColor,
borderRadius: CupertinoTextSelectionUtils._kToolbarBorderRadius,
border: Border.all(color: CupertinoTextSelectionUtils._kToolbarBackgroundColor,
width: 0)
),
child: new Row(mainAxisSize: MainAxisSize.min, children: items)
)
),
triangle,
new Padding(padding: EdgeInsets.only(bottom: 10.0f))
}
);
}
CupertinoButton _buildToolbarButton(string text, VoidCallback onPressed) {
return new CupertinoButton(
child: new Text(text, style: CupertinoTextSelectionUtils._kToolbarButtonFontStyle),
color: CupertinoTextSelectionUtils._kToolbarBackgroundColor,
minSize: CupertinoTextSelectionUtils._kToolbarHeight,
padding: CupertinoTextSelectionUtils._kToolbarButtonPadding,
borderRadius: null,
pressedOpacity: 0.7f,
onPressed: onPressed
);
}
}
class _TextSelectionToolbarLayout : SingleChildLayoutDelegate {
public _TextSelectionToolbarLayout(
Size screenSize,
Rect globalEditableRegion,
Offset position) {
this.screenSize = screenSize;
this.globalEditableRegion = globalEditableRegion;
this.position = position;
}
readonly Size screenSize;
readonly Rect globalEditableRegion;
readonly Offset position;
public override BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return constraints.loosen();
}
public override Offset getPositionForChild(Size size, Size childSize) {
Offset globalPosition = globalEditableRegion.topLeft + position;
float x = globalPosition.dx - childSize.width / 2.0f;
float y = globalPosition.dy - childSize.height;
if (x < CupertinoTextSelectionUtils._kToolbarScreenPadding) {
x = CupertinoTextSelectionUtils._kToolbarScreenPadding;
}
else if (x + childSize.width > screenSize.width - CupertinoTextSelectionUtils._kToolbarScreenPadding) {
x = screenSize.width - childSize.width - CupertinoTextSelectionUtils._kToolbarScreenPadding;
}
if (y < CupertinoTextSelectionUtils._kToolbarScreenPadding) {
y = CupertinoTextSelectionUtils._kToolbarScreenPadding;
}
else if (y + childSize.height >
screenSize.height - CupertinoTextSelectionUtils._kToolbarScreenPadding) {
y = screenSize.height - childSize.height - CupertinoTextSelectionUtils._kToolbarScreenPadding;
}
return new Offset(x, y);
}
public override bool shouldRelayout(SingleChildLayoutDelegate oldDelegate) {
_TextSelectionToolbarLayout _oldDelegate = (_TextSelectionToolbarLayout) oldDelegate;
return screenSize != _oldDelegate.screenSize
|| globalEditableRegion != _oldDelegate.globalEditableRegion
|| position != _oldDelegate.position;
}
}
class _TextSelectionHandlePainter : AbstractCustomPainter {
public _TextSelectionHandlePainter(Offset origin) {
this.origin = origin;
}
readonly Offset origin;
public override void paint(Canvas canvas, Size size) {
Paint paint = new Paint();
paint.color = CupertinoTextSelectionUtils._kHandlesColor;
paint.strokeWidth = 2.0f;
canvas.drawCircle(origin.translate(0.0f, 4.0f), 5.5f, paint);
canvas.drawLine(
origin,
origin.translate(
0.0f,
-(size.height - 2.0f * CupertinoTextSelectionUtils._kHandlesPadding)
),
paint
);
}
public override bool shouldRepaint(CustomPainter oldPainter) {
_TextSelectionHandlePainter _oldPainter = (_TextSelectionHandlePainter) oldPainter;
return origin != _oldPainter.origin;
}
}
class _CupertinoTextSelectionControls : TextSelectionControls {
public override Size getHandleSize(float textLineHeight) {
return new Size(
CupertinoTextSelectionUtils._kSelectionHandleRadius * 2,
textLineHeight + CupertinoTextSelectionUtils._kSelectionHandleRadius * 2 -
CupertinoTextSelectionUtils._kSelectionHandleOverlap
);
}
public override Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight) {
Size handleSize = getHandleSize(textLineHeight);
switch (type) {
case TextSelectionHandleType.left:
return new Offset(
handleSize.width / 2,
handleSize.height
);
case TextSelectionHandleType.right:
return new Offset(
handleSize.width / 2,
handleSize.height - 2 * CupertinoTextSelectionUtils._kSelectionHandleRadius + CupertinoTextSelectionUtils._kSelectionHandleOverlap
);
default:
return new Offset(
handleSize.width / 2,
textLineHeight + (handleSize.height - textLineHeight) / 2
);
}
}
public override Widget buildToolbar(
BuildContext context,
Rect globalEditableRegion,
float textLineHeight,
Offset position,
List<TextSelectionPoint> endpoints,
TextSelectionDelegate del) {
D.assert(WidgetsD.debugCheckHasMediaQuery(context));
return new ConstrainedBox(
constraints: BoxConstraints.tight(globalEditableRegion.size),
child: new CustomSingleChildLayout(
layoutDelegate: new _TextSelectionToolbarLayout(
MediaQuery.of(context).size,
globalEditableRegion,
position
),
child: new _TextSelectionToolbar(
handleCut: canCut(del) ? () => handleCut(del) : (VoidCallback) null,
handleCopy: canCopy(del) ? () => handleCopy(del) : (VoidCallback) null,
handlePaste: canPaste(del) ? () => handlePaste(del) : (VoidCallback) null,
handleSelectAll: canSelectAll(del) ? () => handleSelectAll(del) : (VoidCallback) null
)
)
);
}
public override Widget buildHandle(BuildContext context, TextSelectionHandleType type, float textLineHeight) {
Size desiredSize = new Size(
2.0f * CupertinoTextSelectionUtils._kHandlesPadding,
textLineHeight + 2.0f * CupertinoTextSelectionUtils._kHandlesPadding
);
Widget handle = SizedBox.fromSize(
size: desiredSize,
child: new CustomPaint(
painter: new _TextSelectionHandlePainter(
origin: new Offset(CupertinoTextSelectionUtils._kHandlesPadding,
textLineHeight + CupertinoTextSelectionUtils._kHandlesPadding)
)
)
);
switch (type) {
case TextSelectionHandleType.left:
Matrix4 matrix = Matrix4.rotationZ(Mathf.PI);
matrix.translate(-CupertinoTextSelectionUtils._kHandlesPadding,
-CupertinoTextSelectionUtils._kHandlesPadding);
return new Transform(
transform: matrix,
child: handle
);
case TextSelectionHandleType.right:
return new Transform(
transform:Matrix4.translationValues(
-CupertinoTextSelectionUtils._kHandlesPadding,
-(textLineHeight + CupertinoTextSelectionUtils._kHandlesPadding),
0
),
child: handle
);
case TextSelectionHandleType.collapsed:
return new Container();
}
return null;
}
}
}

41
com.unity.uiwidgets/Runtime/cupertino/text_theme.cs


_pickerTextStyle = pickerTextStyle;
_dateTimePickerTextStyle = dateTimePickerTextStyle;
}
/*public static CupertinoTextThemeData _raw(
public static CupertinoTextThemeData _raw(
TextStyle textStyle = null,
TextStyle actionTextStyle = null,
TextStyle tabLabelTextStyle = null,
TextStyle navTitleTextStyle = null,
TextStyle navLargeTitleTextStyle = null,
TextStyle navActionTextStyle = null,
TextStyle pickerTextStyle = null,
TextStyle dateTimePickerTextStyle = null
TextStyle textStyle,
TextStyle actionTextStyle ,
TextStyle tabLabelTextStyle ,
TextStyle navTitleTextStyle ,
TextStyle navLargeTitleTextStyle ,
TextStyle navActionTextStyle ,
TextStyle pickerTextStyle,
TextStyle dateTimePickerTextStyle
_defaults,
null,
textStyle,
actionTextStyle,
tabLabelTextStyle,

pickerTextStyle,
dateTimePickerTextStyle
);
textThemeData._defaults = _defaults;
}*/
}
public readonly _TextThemeDefaultsBuilder _defaults;
public _TextThemeDefaultsBuilder _defaults;
public TextStyle textStyle {
public virtual TextStyle textStyle {
get {
return _textStyle ?? _defaults.textStyle;
}

public TextStyle actionTextStyle {
public virtual TextStyle actionTextStyle {
get {
return _actionTextStyle ?? _defaults.actionTextStyle(primaryColor: _primaryColor);

readonly TextStyle _tabLabelTextStyle;
public TextStyle tabLabelTextStyle {
public virtual TextStyle tabLabelTextStyle {
public TextStyle navTitleTextStyle {
public virtual TextStyle navTitleTextStyle {
get {
return _navTitleTextStyle ?? _defaults.navTitleTextStyle;

readonly TextStyle _navLargeTitleTextStyle;
/// Typography of large titles in sliver navigation bars.
public TextStyle navLargeTitleTextStyle {
public virtual TextStyle navLargeTitleTextStyle {
get {
return _navLargeTitleTextStyle ?? _defaults.navLargeTitleTextStyle;
}

public TextStyle navActionTextStyle {
public virtual TextStyle navActionTextStyle {
get {
return _navActionTextStyle ?? _defaults.navActionTextStyle(primaryColor: _primaryColor);
}

public TextStyle pickerTextStyle {
public virtual TextStyle pickerTextStyle {
get {
return _pickerTextStyle ?? _defaults.pickerTextStyle;
}

public TextStyle dateTimePickerTextStyle {
public virtual TextStyle dateTimePickerTextStyle {
get {
return _dateTimePickerTextStyle ?? _defaults.dateTimePickerTextStyle;
}

81
com.unity.uiwidgets/Runtime/cupertino/theme.cs


public static readonly _CupertinoThemeDefaults _kDefaultTheme =
new _CupertinoThemeDefaults(
brightness:null,
null,
color: new Color(0xF0F9F9F9),
darkColor: new Color(0xF01D1D1D)
),
color: new Color(0xF0F9F9F9),
darkColor: new Color(0xF01D1D1D)
// Values extracted from navigation bar. For toolbar or tabbar the dark color is 0xF0161616.
),
textThemeDefaults :
//new _CupertinoTextThemeDefaults(Color.black,Color.white)
}

public readonly Widget child;
public static CupertinoThemeData of(BuildContext context) {
_InheritedCupertinoTheme inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedCupertinoTheme>();
return ((inheritedTheme?.theme?.data) ?? new CupertinoThemeData()).resolveFrom(context, nullOk: true);
_InheritedCupertinoTheme inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedCupertinoTheme>();
var result = (inheritedTheme?.theme?.data ?? new CupertinoThemeData()).resolveFrom(context, nullOk: true);
return result;
}
public static Brightness? brightnessOf(BuildContext context, bool nullOk = false) {

Color primaryContrastingColor = null,
CupertinoTextThemeData textTheme = null,
Color barBackgroundColor = null,
Color scaffoldBackgroundColor = null
//,_CupertinoThemeDefaults defaults = null
Color scaffoldBackgroundColor = null,
_CupertinoThemeDefaults defaults = null
) {
this.brightness = brightness;// ?? Brightness.light;
_primaryColor = primaryColor;

_scaffoldBackgroundColor = scaffoldBackgroundColor;
_defaults = CupertinoThemeDataUtils._kDefaultTheme;
_defaults = defaults ?? CupertinoThemeDataUtils._kDefaultTheme;
}

primaryContrastingColor: primaryContrastingColor,
textTheme: textTheme,
barBackgroundColor: barBackgroundColor,
scaffoldBackgroundColor: scaffoldBackgroundColor);
themeData._defaults = defaults;
//, defaults : defaults);
scaffoldBackgroundColor: scaffoldBackgroundColor,
defaults);
return themeData;
}

/*public bool _isLight {
get { return brightness == Brightness.light; }
}*/
//return (_isLight ? CupertinoColors.activeBlue : CupertinoColors.activeOrange);
// return (_isLight ? CupertinoColors.white : CupertinoColors.black);
/* return new CupertinoTextThemeData(
brightness: brightness,
primaryColor: primaryColor
);*/
readonly CupertinoTextThemeData _textTheme;
public Color barBackgroundColor {

}
//return (_isLight ? CupertinoColors.white : CupertinoColors.black);
readonly Color _scaffoldBackgroundColor;
public CupertinoThemeData noDefault() {

public CupertinoThemeData resolveFrom(BuildContext context, bool nullOk = false ) {
Color convertColor(Color color) => CupertinoDynamicColor.resolve(color, context, nullOk: nullOk);
return _rawWithDefaults(
return new CupertinoThemeData(
brightness:brightness,
primaryColor:convertColor(_primaryColor),
primaryContrastingColor:convertColor(_primaryContrastingColor),

CupertinoTextThemeData textTheme,
Color barBackgroundColor,
Color scaffoldBackgroundColor
) : base(
brightness,
primaryColor,

scaffoldBackgroundColor) {
_defaults = null;
}
/*{
this.brightness = brightness;
scaffoldBackgroundColor,
null) {
_defaults = null;
}*/
}
public new readonly Brightness? brightness;
public new readonly Color primaryColor;

public new CupertinoThemeData copyWith(
Brightness? brightness = null,
Color primaryColor = null,
Color primaryColor = null,
CupertinoTextThemeData textTheme = null,
CupertinoTextThemeData textTheme = null,
Color scaffoldBackgroundColor = null
Color scaffoldBackgroundColor = null
) {
return new _NoDefaultCupertinoThemeData(
brightness ?? this.brightness,

public readonly Color inactiveGray;
public new TextStyle textStyle {
public override TextStyle textStyle {
get {
return base.textStyle.copyWith(color: labelColor);

public new TextStyle tabLabelTextStyle {
public override TextStyle tabLabelTextStyle {
get {
return base.tabLabelTextStyle.copyWith(color: inactiveGray);
}

public new TextStyle navTitleTextStyle {
public override TextStyle navTitleTextStyle {
get {
return base.navTitleTextStyle.copyWith(color: labelColor);
}

public new TextStyle navLargeTitleTextStyle {
public override TextStyle navLargeTitleTextStyle {
get {
return base.navLargeTitleTextStyle.copyWith(color: labelColor);
}

public new TextStyle pickerTextStyle {
public override TextStyle pickerTextStyle {
get {
return base.pickerTextStyle.copyWith(color: labelColor);
}

public new TextStyle dateTimePickerTextStyle {
public override TextStyle dateTimePickerTextStyle {
get {
return base.dateTimePickerTextStyle.copyWith(color: labelColor);
}

71
com.unity.uiwidgets/Runtime/cupertino/thumb_painter.cs


using System.Collections.Generic;
public class CupertinoThumbPainterUtils {
public static Color _kThumbBorderColor = new Color(0x0A000000);
public static List<BoxShadow> _kSwitchBoxShadows = new List<BoxShadow> {
new BoxShadow(
color: new Color(0x26000000),
offset: new Offset(0, 3),
blurRadius: 8.0f
),
new BoxShadow(
color: new Color(0x0F000000),
offset: new Offset(0, 3),
blurRadius: 1.0f
),
};
public static List<BoxShadow> _kSliderBoxShadows = new List<BoxShadow>(){
new BoxShadow(
color: new Color(0x26000000),
offset: new Offset(0, 3),
blurRadius: 8.0f
),
new BoxShadow(
color: new Color(0x29000000),
offset: new Offset(0, 1),
blurRadius: 1.0f
),
new BoxShadow(
color: new Color(0x1A000000),
offset: new Offset(0, 3),
blurRadius: 1.0f
)
};
}
Color shadowColor = null
List<BoxShadow> shadows = null
_shadowPaint = new BoxShadow(
color: shadowColor,
blurRadius: 1.0f
).toPaint();
this.shadowColor = shadowColor ?? new Color(0x2C000000);
this.shadows = shadows ?? CupertinoThumbPainterUtils._kSliderBoxShadows;
}
public static CupertinoThumbPainter switchThumb(
Color color = null,
List<BoxShadow> shadows = null
) {
return new CupertinoThumbPainter(
color : color ?? CupertinoColors.white,
shadows : shadows ?? CupertinoThumbPainterUtils._kSwitchBoxShadows);
public readonly Color shadowColor;
public readonly List<BoxShadow> shadows;
public readonly Paint _shadowPaint;

public void paint(Canvas canvas, Rect rect) {
RRect rrect = RRect.fromRectAndRadius(

canvas.drawRRect(rrect, _shadowPaint);
canvas.drawRRect(rrect.shift(new Offset(0.0f, 3.0f)), _shadowPaint);
var _paint = new Paint();
_paint.color = color;
canvas.drawRRect(rrect, _paint);
foreach (BoxShadow shadow in shadows)
canvas.drawRRect(rrect.shift(shadow.offset), shadow.toPaint());
canvas.drawRRect(
rrect.inflate(0.5f),
new Paint(){color = CupertinoThumbPainterUtils._kThumbBorderColor}
);
canvas.drawRRect(rrect, new Paint(){color = color});
}
}
}

12
com.unity.uiwidgets/Runtime/gestures/drag_details.cs


public class DragStartDetails {
public DragStartDetails(
TimeSpan sourceTimeStamp,
TimeSpan? sourceTimeStamp = null,
Offset globalPosition = null,
Offset localPosition = null
) {

}
public readonly TimeSpan sourceTimeStamp;
public readonly TimeSpan? sourceTimeStamp;
public readonly Offset globalPosition;
public readonly Offset localPosition;

public class DragUpdateDetails {
public DragUpdateDetails(
TimeSpan sourceTimeStamp,
TimeSpan? sourceTimeStamp = null,
bool isScroll = false) {
bool isScroll = false
)
{
this.sourceTimeStamp = sourceTimeStamp;
this.delta = delta ?? Offset.zero;
this.primaryDelta = primaryDelta;

|| primaryDelta == this.delta.dy && this.delta.dx == 0.0);
}
public readonly TimeSpan sourceTimeStamp;
public readonly TimeSpan? sourceTimeStamp;
public readonly Offset delta;

16
com.unity.uiwidgets/Runtime/painting/box_decoration.cs


}
public BoxDecoration copyWith(
Color color,
DecorationImage image,
Border border,
BorderRadius borderRadius,
List<BoxShadow> boxShadow,
Gradient gradient,
BlendMode? backgroundBlendMode,
BoxShape? shape
Color color = null,
DecorationImage image = null,
Border border = null,
BorderRadius borderRadius = null,
List<BoxShadow> boxShadow = null,
Gradient gradient = null,
BlendMode? backgroundBlendMode = null,
BoxShape? shape = null
) {
return new BoxDecoration(
color: color ?? this.color,

1
com.unity.uiwidgets/Runtime/rendering/custom_paint.cs


namespace Unity.UIWidgets.widgets {
public interface CustomPainter : Listenable {
void paint(Canvas canvas, Size size);
bool shouldRepaint(CustomPainter oldDelegate);

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


Rect clipRect = null,
Clip clipBehavior = Clip.hardEdge
) {
D.assert(clipRect != null);
D.assert(clipBehavior != Clip.none);
_clipRect = clipRect;
_clipBehavior = clipBehavior;

RRect clipRRect = null,
Clip clipBehavior = Clip.antiAlias
) {
D.assert(clipRRect != null);
D.assert(clipBehavior != Clip.none);
_clipRRect = clipRRect;
_clipBehavior = clipBehavior;

6
com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs


public abstract class RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderObject<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : Constraints
where ChildType : RenderObject {

}
public class RenderConstrainedLayoutBuilderMixinRenderBox<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderBox<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : BoxConstraints
where ChildType : RenderBox {

}
public abstract class RenderConstrainedLayoutBuilderMixinRenderSliver<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderSliver<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : SliverConstraints
where ChildType : RenderSliver {

2
com.unity.uiwidgets/Runtime/rendering/object.mixin.njk


{% macro RenderConstrainedLayoutBuilderMixin(abstract, with, constraint) %}
public {{abstract}} class RenderConstrainedLayoutBuilderMixin{{with}}<ConstraintType, ChildType> : RenderObjectWithChildMixin{{with}}<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : {{constraint}}
where ChildType : {{with}} {

5
com.unity.uiwidgets/Runtime/services/text_editing.cs


public readonly int extentOffset;
public readonly TextAffinity affinity;
public readonly bool isDirectional;
public TextPosition _base {
get{
return new TextPosition(offset: baseOffset, affinity: affinity);
}
}
public TextSelection(int baseOffset, int extentOffset, TextAffinity affinity = TextAffinity.downstream,
bool isDirectional = false) : base(baseOffset < extentOffset ? baseOffset : extentOffset,

3
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


return Future.value(false).to<bool>();
}
void _formatAndSetValue(TextEditingValue value, bool isIMEInput = false) {
//whitespaceFormatter ??= new _WhitespaceDirectionalityFormatter(textDirection: _textDirection);

5
com.unity.uiwidgets/Runtime/widgets/focus_manager.cs


}
if (oldScope != null && child.context != null && child.enclosingScope != oldScope) {
UnityEngine.Debug.Log(
"FocusTraversalGroup.of(child.context, nullOk: true)?.changedScope(node: child, oldScope: oldScope);");
//FocusTraversalGroup.of(child.context, nullOk: true)?.changedScope(node: child, oldScope: oldScope);
//UnityEngine.Debug.Log("FocusTraversalGroup.of(child.context, nullOk: true)?.changedScope(node: child, oldScope: oldScope);");
FocusTraversalGroup.of(child.context, nullOk: true)?.changedScope(node: child, oldScope: oldScope);
}
if (child._requestFocusWhenReparented) {

18
com.unity.uiwidgets/Runtime/widgets/framework.cs


D.assert(!_debugBuilding);
D.assert(() => {
if (WidgetsD.debugPrintBuildScope) {
Debug.LogFormat("buildScope called with context {0}; dirty list is: {1}",
context, _dirtyElements);
Debug.LogFormat($"buildScope called with context {context}; dirty list is: {_dirtyElements}");
_debugStateLockLevel += 1;
_debugBuilding = true;
return true;

debugPreviousBuildTarget = _debugCurrentBuildTarget;
_debugCurrentBuildTarget = context;
return true;
});
});
try {
callback();
}

D.assert(child != null);
D.assert(child._parent == this);
ElementVisitor visit = null;
visit = (element) => {
void visit(Element element) {
if (!(element is RenderObjectElement)) {
if (!(element is RenderObjectElement))
}
};
}
visit(child);
}

get { return _renderObject; }
}
bool _debugDoingBuild = false;
public bool _debugDoingBuild = false;
public override bool debugDoingBuild {
get { return _debugDoingBuild; }

86
com.unity.uiwidgets/Runtime/widgets/layout_builder.cs


using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.UIWidgets.widgets {
public delegate Widget LayoutWidgetBuilder(BuildContext context, BoxConstraints constraints);

}
public class _LayoutBuilderElement<ConstraintType> : RenderObjectElement
where ConstraintType : Constraints {
public class _LayoutBuilderElement<ConstraintType> : RenderObjectElement where ConstraintType : Constraints {
public _LayoutBuilderElement(ConstrainedLayoutBuilder<ConstraintType> widget)
: base(widget) {
}

return base.widget as ConstrainedLayoutBuilder<ConstraintType>;
return (ConstrainedLayoutBuilder<ConstraintType>)base.widget ;
public new RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject> renderObject {
get { return base.renderObject as RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject>;}
public RenderConstrainedLayoutBuilder<ConstraintType> renderObject_builder {
get {
return base.renderObject as RenderConstrainedLayoutBuilder<ConstraintType> ;
}
public RenderObjectWithChildMixin renderObject_childMxin {
get { return base.renderObject as RenderObjectWithChildMixin; }
}
Element _child;
public override void visitChildren(ElementVisitor visitor) {

}
public override void mount(Element parent, object newSlot) {
base.mount(parent, newSlot); // Creates the renderObject.
renderObject.updateCallback(_layout);
renderObject_builder.updateCallback(_layout);
}
public override void update(Widget newWidget) {

D.assert(widget == newWidget);
renderObject.updateCallback(_layout);
renderObject_builder.updateCallback(_layout);
renderObject.markNeedsLayout();
}

}
public override void unmount() {
renderObject.updateCallback(null);
renderObject_builder.updateCallback(null);
base.unmount();
}

built = widget.builder(this, constraints);
WidgetsD.debugWidgetBuilderValue(widget, built);
try {
built = widget.builder(this, constraints);
WidgetsD.debugWidgetBuilderValue(widget, built);
} catch (Exception e) {
_debugDoingBuild = false;
IEnumerable<DiagnosticsNode> informationCollector() {
yield return new DiagnosticsDebugCreator(new DebugCreator(this));
}
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
}
_child = updateChild(_child, built, null);
D.assert(_child != null);
try {
_child = updateChild(_child, built, null);
D.assert(_child != null);
} catch (Exception e) {
_debugDoingBuild = false;
IEnumerable<DiagnosticsNode> informationCollector() {
yield return new DiagnosticsDebugCreator(new DebugCreator(this));
}
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
}
RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
RenderObjectWithChildMixin renderObject = renderObject_childMxin;
D.assert(slot == null);
D.assert(renderObject.debugValidateChild(child));
renderObject.child = child;

}
protected override void removeChildRenderObject(RenderObject child) {
RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject> renderObject = this.renderObject;
RenderObjectWithChildMixin renderObject = renderObject_childMxin;
D.assert(renderObject.child == child);
renderObject.child = null;
D.assert(renderObject == this.renderObject);

public interface RenderConstrainedLayoutBuilder<ConstraintType,ChildType>
where ConstraintType : Constraints
where ChildType : RenderObject
public interface RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : Constraints
{
LayoutCallback<ConstraintType> _callback { get; set; }

}
public class _RenderLayoutBuilder : RenderConstrainedLayoutBuilderMixinRenderBox<BoxConstraints, RenderBox> {
public _RenderLayoutBuilder(
LayoutCallback<BoxConstraints> callback = null) {
_callback = callback;
}
public LayoutCallback<BoxConstraints> callback {
get { return _callback; }
set {
if (value == _callback) {
return;
}
_callback = value;
markNeedsLayout();
}
}
LayoutCallback<BoxConstraints> _callback;
bool _debugThrowIfNotCheckingIntrinsics() {
D.assert(() => {
if (!debugCheckingIntrinsics) {

}
protected override void performLayout() {
D.assert(callback != null);
invokeLayoutCallback(callback);
D.assert(_callback != null);
invokeLayoutCallback(_callback);
if (child != null) {
child.layout(constraints, parentUsesSize: true);
size = constraints.constrain(child.size);

88
com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs


}
public int trueIndexOf(int index) {
while (index < 0) {
index += children.Count;
}
return index % children.Count;
}

}
while (index < 0) {
index += children.Count;
}
return new Container(child: children[index % children.Count]);
return new Container(child: children[Mathf.Abs(index % children.Count)]);
}
public bool shouldRebuild(ListWheelChildDelegate oldDelegate) {

}
public void jumpToItem(int itemIndex) {
foreach (_FixedExtentScrollPosition position in positions) {
foreach (_FixedExtentScrollPosition position in positions.Cast<_FixedExtentScrollPosition>()) {
position.jumpTo(itemIndex * position.itemExtent);
}
}

public class ListWheelScrollView : StatefulWidget {
public ListWheelScrollView(
List<Widget> children,
Key key = null,
ScrollController controller = null,
ScrollPhysics physics = null,

float squeeze = 1.0f,
ValueChanged<int> onSelectedItemChanged = null,
bool clipToSize = true,
bool renderChildrenOutsideViewport = false,
List<Widget> children = null
bool renderChildrenOutsideViewport = false
D.assert(children != null || childDelegate != null);
//D.assert(children != null);
D.assert(diameterRatio > 0.0, () => RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(perspective > 0);
D.assert(perspective <= 0.01f, () => RenderListWheelViewport.perspectiveTooHighMessage);

this.renderChildrenOutsideViewport = renderChildrenOutsideViewport;
}
public static ListWheelScrollView useDelegate(
public ListWheelScrollView (
Key key = null,
ScrollController controller = null,
ScrollPhysics physics = null,

bool clipToSize = true,
bool renderChildrenOutsideViewport = false,
ListWheelChildDelegate childDelegate = null
) {
) : base(key: key) {
D.assert(childDelegate != null);
D.assert(diameterRatio > 0.0, ()=>RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(perspective > 0);

!renderChildrenOutsideViewport || !clipToSize,()=>
RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict
);
var view = new ListWheelScrollView(
itemExtent: itemExtent,
key: key,
controller: controller,
physics: physics,
diameterRatio: diameterRatio,
perspective: perspective,
offAxisFraction: offAxisFraction,
useMagnifier: useMagnifier,
magnification: magnification,
onSelectedItemChanged: onSelectedItemChanged,
clipToSize: clipToSize,
renderChildrenOutsideViewport: renderChildrenOutsideViewport
);
view.childDelegate = childDelegate;
return view;
this.controller = controller;
this.physics = physics;
this.diameterRatio = diameterRatio;
this.perspective = perspective;
this.offAxisFraction = offAxisFraction;
this.useMagnifier = useMagnifier;
this.magnification = magnification;
this.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
this.itemExtent = itemExtent;
this.squeeze = squeeze;
this.onSelectedItemChanged = onSelectedItemChanged;
this.clipToSize = clipToSize;
this.renderChildrenOutsideViewport = renderChildrenOutsideViewport;
this.childDelegate = childDelegate;
}
public readonly ScrollController controller;

useMagnifier: widget.useMagnifier,
magnification: widget.magnification,
overAndUnderCenterOpacity: widget.overAndUnderCenterOpacity,
itemExtent: widget.itemExtent ?? 0.0f,
itemExtent: widget.itemExtent ,
squeeze: widget.squeeze,
clipToSize: widget.clipToSize,
renderChildrenOutsideViewport: widget.renderChildrenOutsideViewport,

}
public new RenderListWheelViewport renderObject {
get { return (RenderListWheelViewport) base.renderObject; }
get { return (RenderListWheelViewport)base.renderObject; }
}

}
int firstIndex = _childElements.First()?.Key ?? 0;
int lastIndex = _childElements.Last()?.Key ?? 0;
int lastIndex = _childElements.Last()?.Key ?? _childElements.Count;
for (int index = firstIndex; index <= lastIndex; ++index) {
Element newChild = updateChild(_childElements[index], retrieveWidget(index), index);

public void createChild(int index, RenderBox after) {
owner.buildScope(this, () => {
bool insertFirst = after == null;
D.assert(insertFirst || _childElements[index - 1] != null);
Element newChild = updateChild(_childElements.getOrDefault(index), retrieveWidget(index),
index);
D.assert(insertFirst || _childElements.getOrDefault(index - 1) != null);
Element newChild = updateChild(_childElements.getOrDefault(index), retrieveWidget(index), index);
if (newChild != null) {
_childElements[index] = newChild;
}

protected override void insertChildRenderObject(RenderObject child, object slot) {
RenderListWheelViewport renderObject = this.renderObject;
D.assert(renderObject.debugValidateChild(child));
renderObject.insert(child as RenderBox, after: _childElements[(int)slot - 1]?.renderObject as RenderBox);
int slotNum = (int) slot;
if(slotNum >= 1)
renderObject.insert(child as RenderBox, after: _childElements.getOrDefault(slotNum - 1).renderObject as RenderBox);
protected override void moveChildRenderObject(RenderObject child, dynamic slot) {
const string moveChildRenderObjectErrorMessage =
protected override void moveChildRenderObject(RenderObject child, dynamic slot) {
string moveChildRenderObjectErrorMessage =
"Currently we maintain the list in contiguous increasing order, so " +
"moving children around is not allowed.";
D.assert(false, () => moveChildRenderObjectErrorMessage);

!renderChildrenOutsideViewport || !clipToSize,
() => RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict
);
this.itemExtent = itemExtent;
this.offset = offset;
this.childDelegate = childDelegate;
this.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
this.itemExtent = itemExtent;
this.squeeze = squeeze;
this.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
this.squeeze = squeeze;
this.offset = offset;
this.childDelegate = childDelegate;
}
public readonly float diameterRatio;

useMagnifier: useMagnifier,
magnification: magnification,
overAndUnderCenterOpacity: overAndUnderCenterOpacity,
itemExtent: itemExtent ?? 0.0f,
itemExtent: itemExtent ?? 1.0f ,
squeeze: squeeze,
clipToSize: clipToSize,
renderChildrenOutsideViewport: renderChildrenOutsideViewport

viewport.useMagnifier = useMagnifier;
viewport.magnification = magnification;
viewport.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
viewport.itemExtent = itemExtent ?? 0.0f;
viewport.itemExtent = itemExtent ?? 1.0f;
viewport.squeeze = squeeze;
viewport.clipToSize = clipToSize;
viewport.renderChildrenOutsideViewport = renderChildrenOutsideViewport;

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


public static Future<T> showGeneralDialog<T>(
BuildContext context = null,
RoutePageBuilder pageBuilder = null,
bool barrierDismissible = false,
bool? barrierDismissible = null,
string barrierLabel = null,
Color barrierColor = null,
TimeSpan? transitionDuration = null,

) {
//D.assert(!barrierDismissible || barrierLabel != null);
return Navigator.of(context, rootNavigator: true).push<T>(
return Navigator.of(context, rootNavigator: true).push(
pageBuilder: pageBuilder,
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
settings: routeSettings) as Route<T>
); //.to<object>();
pageBuilder: pageBuilder,
barrierDismissible: barrierDismissible ?? false,
barrierLabel: barrierLabel,
barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
settings: routeSettings) as Route
).to<T>();
}
}

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


public readonly float? motionStartDistanceThreshold;
TimeSpan _lastNonStationaryTimestamp;
TimeSpan? _lastNonStationaryTimestamp;
bool _retainMomentum;

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


notifyListeners();
}
void updateThickness(float nextThickness, Radius nextRadius) {
public void updateThickness(float nextThickness, Radius nextRadius) {
thickness = nextThickness;
radius = nextRadius;
notifyListeners();

+ _lastMetrics.viewportDimension;
}
}
float getTrackToScroll(float thumbOffsetLocal) {
public float getTrackToScroll(float thumbOffsetLocal) {
float scrollableExtent = _lastMetrics.maxScrollExtent - _lastMetrics.minScrollExtent;
float thumbMovableExtent = _trackExtent - _thumbExtent();

_paintThumbCrossAxis(canvas, size, thumbOffset, thumbExtent, _lastAxisDirection.Value);
}
bool hitTestInteractive(Offset position) {
public bool hitTestInteractive(Offset position) {
if (_thumbRect == null) {
return false;
}

47
com.unity.uiwidgets/Runtime/widgets/sliver.cs


this.children = children;
this.addAutomaticKeepAlives = addAutomaticKeepAlives;
this.addRepaintBoundaries = addRepaintBoundaries;
_keyToIndex = new Dictionary<Key, int>(){{null,0}};
_keyToIndex = new Dictionary<Key, int>(){{Key.key("null"), 0}};
}
public readonly bool addAutomaticKeepAlives;

if (_isConstantInstance) {
return null;
}
// Lazily fill the [_keyToIndex].
int index = _keyToIndex.getOrDefault(null);
int index = _keyToIndex.getOrDefault(Key.key("null"));
if (child.key != null) {
if (child.key != Key.key("null")) {
_keyToIndex[null] = index + 1;
_keyToIndex[Key.key("null")] = index + 1;
_keyToIndex[null] = index;
_keyToIndex[Key.key("null")] = index;
} else {
return _keyToIndex[key];
}

RenderBox _currentBeforeChild;
protected override void performRebuild() {
//_didUnderflow = false;
_childWidgets.Clear();
base.performRebuild();
_currentBeforeChild = null;

SplayTree<int, Element> newChildren = new SplayTree<int, Element>();
if (_childElements[index] != null && _childElements[index] != newChildren[index]) {
if(_childElements.getOrDefault(index) != null &&
_childElements.getOrDefault(index) != newChildren.getOrDefault(index))
// if (_childElements[index] != null && _childElements[index] != newChildren[index])
{
Element newChild = updateChild(newChildren[index], _build(index), index);
Element newChild = updateChild(newChildren.getOrDefault(index), _build(index), index);
if (newChild != null) {
_childElements[index] = newChild;
SliverMultiBoxAdaptorParentData parentData = newChild.renderObject.parentData as SliverMultiBoxAdaptorParentData;

_childElements.Remove(index);
}
}
foreach ( int index in _childElements.Keys.ToList()) {
Key key = _childElements[index].widget.key;
int? newIndex = key == null ? null : widget.del.findIndexByKey(key);

if (childParentData != null)
childParentData.layoutOffset = null;
newChildren[newIndex ?? 0] = _childElements[index];
newChildren[(int)newIndex] = _childElements[index];
} else {
}
else {
newChildren.putIfAbsent(index, () => _childElements[index]);
}
}

if (_didUnderflow) {
int lastKey = _childElements.Count == 0 ? -1 : _childElements.Keys.Last();
int rightBoundary = lastKey + 1;
newChildren[rightBoundary] = _childElements[rightBoundary];
if(newChildren.ContainsKey(rightBoundary))
newChildren[rightBoundary] = _childElements.getOrDefault(rightBoundary);
processElement(rightBoundary);
}
} finally {

}
protected override Element updateChild(Element child, Widget newWidget, object newSlot) {
SliverMultiBoxAdaptorParentData oldParentData = null;
SliverMultiBoxAdaptorParentData oldParentData = child?.renderObject?.parentData as SliverMultiBoxAdaptorParentData;
Element newChild = base.updateChild(child, newWidget, newSlot);
SliverMultiBoxAdaptorParentData newParentData = newChild?.renderObject?.parentData as SliverMultiBoxAdaptorParentData;
// Preserve the old layoutOffset if the renderObject was swapped out.
if (oldParentData != newParentData && oldParentData != null && newParentData != null) {
newParentData.layoutOffset = oldParentData.layoutOffset;
}
return newChild;
/*SliverMultiBoxAdaptorParentData oldParentData = null;
if (child != null && child.renderObject != null) {
oldParentData = (SliverMultiBoxAdaptorParentData) child.renderObject.parentData;
}

newParentData.layoutOffset = oldParentData.layoutOffset;
}
return newChild;
return newChild;*/
}
internal override void forgetChild(Element child) {

childParentData.index = _currentlyUpdatingChildIndex.Value;
}
bool _didUnderflow = false;
public bool _didUnderflow = false;
public void setDidUnderflow(bool value) {
_didUnderflow = value;

12
com.unity.uiwidgets/Runtime/widgets/text_selection.cs


);
}
protected void onDragSelectionEnd(DragEndDetails details) {/* Subclass should override this method if needed. */}
protected virtual void onDragSelectionEnd(DragEndDetails details)
{/* Subclass should override this method if needed. */}
public Widget buildGestureDetector(
Key key = null,

);
}
}
/*public abstract class TextSelectionGestureDetectorBuilderDelegate {
public GlobalKey<EditableTextState> editableTextKey { get; }
public bool forcePressEnabled {
get;
}
public bool selectionEnabled { get; }
}*/
public interface TextSelectionGestureDetectorBuilderDelegate {
GlobalKey<EditableTextState> editableTextKey { get; }

5
com.unity.uiwidgets/Runtime/widgets/visibility.cs


bool maintainInteractivity = false
) : base(key: key) {
D.assert(child != null);
D.assert(replacement != null);
D.assert(visible != null);
D.assert(maintainState != null);
D.assert(maintainAnimation != null);
D.assert(maintainSize != null);
D.assert(maintainState == true || maintainAnimation == false,
() => "Cannot maintain animations if the state is not also maintained.");
D.assert(maintainAnimation == true || maintainSize == false,

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


return Future.value(false).to<bool>();
}
void _selectionChangedCallback() {
setState(() => { });

正在加载...
取消
保存