浏览代码

FIX CUPERTINO

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
908e7a50
共有 11 个文件被更改,包括 415 次插入268 次删除
  1. 1
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  2. 9
      com.unity.uiwidgets/Runtime/cupertino/cupertinodynamiccolor.mixin.njk
  3. 2
      com.unity.uiwidgets/Runtime/cupertino/switch.cs
  4. 520
      com.unity.uiwidgets/Runtime/cupertino/text_field.cs
  5. 41
      com.unity.uiwidgets/Runtime/cupertino/text_theme.cs
  6. 63
      com.unity.uiwidgets/Runtime/cupertino/theme.cs
  7. 16
      com.unity.uiwidgets/Runtime/painting/box_decoration.cs
  8. 1
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  9. 5
      com.unity.uiwidgets/Runtime/services/text_editing.cs
  10. 11
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  11. 14
      com.unity.uiwidgets/Runtime/widgets/text_selection.cs

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


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

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() {

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


);
context.pushClipRRect(needsCompositing, Offset.zero, thumbBounds, trackRRect,
(PaintingContext innerContext, Offset offset) => {
(PaintingContext innerContext, Offset offset1) => {
CupertinoThumbPainter.switchThumb().paint(innerContext.canvas, thumbBounds);
});
}

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,
);
}
}

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;
}

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


darkColor: new Color(0xF01D1D1D)
),
CupertinoColors.systemBackground,
textThemeDefaults :
//new _CupertinoTextThemeDefaults(Color.black,Color.white)
textThemeDefaults :
new _CupertinoTextThemeDefaults(CupertinoColors.label, CupertinoColors.inactiveGray)
);

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() {

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);
}

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/layer.cs


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

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,

11
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];
}

14
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 abstract class TextSelectionGestureDetectorBuilderDelegate {
public GlobalKey<EditableTextState> editableTextKey { get; }
public bool forcePressEnabled {

}*/
public interface TextSelectionGestureDetectorBuilderDelegate {
GlobalKey<EditableTextState> editableTextKey { get; }
bool forcePressEnabled {
get;
}
bool selectionEnabled { get; }
}
public class TextSelectionGestureDetector : StatefulWidget {

正在加载...
取消
保存