public Text(string data, Key key = null, TextStyle style = null, StrutStyle strutStyle = null, TextAlign?textAlign = null, bool?softWrap = null, TextOverflow?overflow = null, float?textScaleFactor = null, int?maxLines = null, TextWidthBasis textWidthBasis = TextWidthBasis.parent, ui.TextHeightBehavior textHeightBehavior = null) : base(key) { D.assert(data != null, () => "A non-null string must be provided to a Text widget."); textSpan = null; this.data = data; this.style = style; this.strutStyle = strutStyle; this.textAlign = textAlign; this.softWrap = softWrap; this.overflow = overflow; this.textScaleFactor = textScaleFactor; this.maxLines = maxLines; this.textWidthBasis = textWidthBasis; this.textHeightBehavior = textHeightBehavior; }
Text(TextSpan textSpan, Key key = null, TextStyle style = null, StrutStyle strutStyle = null, TextAlign?textAlign = null, bool?softWrap = null, TextOverflow?overflow = null, float?textScaleFactor = null, int?maxLines = null, TextWidthBasis textWidthBasis = default, ui.TextHeightBehavior textHeightBehavior = null) : base(key) { D.assert(textSpan != null, () => "A non-null TextSpan must be provided to a Text.rich widget."); this.textSpan = textSpan; data = null; this.style = style; this.strutStyle = strutStyle; this.textAlign = textAlign; this.softWrap = softWrap; this.overflow = overflow; this.textScaleFactor = textScaleFactor; this.maxLines = maxLines; this.textHeightBehavior = textHeightBehavior; this.textWidthBasis = textWidthBasis; }
public RenderComparison compareTo(StrutStyle other) { if (ReferenceEquals(this, other)) { return(RenderComparison.identical); } if (other == null) { return(RenderComparison.layout); } if (fontFamily != other.fontFamily || fontSize != other.fontSize || fontWeight != other.fontWeight || fontStyle != other.fontStyle || height != other.height || leading != other.leading || forceStrutHeight != other.forceStrutHeight || !CollectionUtils.equalsList(fontFamilyFallback, other.fontFamilyFallback)) { return(RenderComparison.layout); } return(RenderComparison.identical); }
SelectableText( string data, TextSpan textSpan, Key key = null, FocusNode focusNode = null, TextStyle style = null, StrutStyle strutStyle = null, TextAlign?textAlign = null, TextDirection?textDirection = null, float?textScaleFactor = null, bool showCursor = false, bool autofocus = false, ToolbarOptions toolbarOptions = null, int?minLines = null, int?maxLines = null, float cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, bool enableInteractiveSelection = true, GestureTapCallback onTap = null, ScrollPhysics scrollPhysics = null, TextWidthBasis?textWidthBasis = null ) : base(key: key) { D.assert(maxLines == null || maxLines > 0); D.assert(minLines == null || minLines > 0); D.assert( (maxLines == null) || (minLines == null) || (maxLines >= minLines), () => "minLines can\'t be greater than maxLines" ); toolbarOptions = toolbarOptions ?? new ToolbarOptions( selectAll: true, copy: true ); this.data = data; this.textSpan = textSpan; this.focusNode = focusNode; this.style = style; this.strutStyle = strutStyle; this.textAlign = textAlign; this.textDirection = textDirection; this.textScaleFactor = textScaleFactor; this.showCursor = showCursor; this.autofocus = autofocus; this.toolbarOptions = toolbarOptions; this.minLines = minLines; this.maxLines = maxLines; this.cursorWidth = cursorWidth; this.cursorRadius = cursorRadius; this.cursorColor = cursorColor; this.dragStartBehavior = dragStartBehavior; this.enableInteractiveSelection = enableInteractiveSelection; this.onTap = onTap; this.scrollPhysics = scrollPhysics; this.textWidthBasis = textWidthBasis; }
public static SelectableText rich( TextSpan textSpan, Key key = null, FocusNode focusNode = null, TextStyle style = null, StrutStyle strutStyle = null, TextAlign?textAlign = null, TextDirection?textDirection = null, float?textScaleFactor = null, bool showCursor = false, bool autofocus = false, ToolbarOptions toolbarOptions = null, int?minLines = null, int?maxLines = null, float cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, bool enableInteractiveSelection = true, GestureTapCallback onTap = null, ScrollPhysics scrollPhysics = null, TextWidthBasis?textWidthBasis = null ) { D.assert( textSpan != null, () => "A non-null TextSpan must be provided to a SelectableText.rich widget." ); return(new SelectableText( data: null, textSpan: textSpan, key: key, focusNode: focusNode, style: style, strutStyle: strutStyle, textAlign: textAlign, textDirection: textDirection, textScaleFactor: textScaleFactor, showCursor: showCursor, autofocus: autofocus, toolbarOptions: toolbarOptions, minLines: minLines, maxLines: maxLines, cursorWidth: cursorWidth, cursorRadius: cursorRadius, cursorColor: cursorColor, dragStartBehavior: dragStartBehavior, enableInteractiveSelection: enableInteractiveSelection, onTap: onTap, scrollPhysics: scrollPhysics, textWidthBasis: textWidthBasis )); }
public TextPainter(TextSpan text = null, TextAlign textAlign = TextAlign.left, TextDirection textDirection = TextDirection.ltr, float textScaleFactor = 1.0f, int?maxLines = null, string ellipsis = "", StrutStyle strutStyle = null) { this._text = text; this._textAlign = textAlign; this._textDirection = textDirection; this._textScaleFactor = textScaleFactor; this._maxLines = maxLines; this._ellipsis = ellipsis; this._strutStyle = strutStyle; }
public ParagraphStyle getParagraphStyle( TextAlign?textAlign = null, TextDirection?textDirection = null, float?textScaleFactor = 1.0f, string ellipsis = null, int?maxLines = null, TextHeightBehavior textHeightBehavior = null, Locale locale = null, string fontFamily = null, float?fontSize = null, FontWeight fontWeight = null, FontStyle?fontStyle = null, float?height = null, StrutStyle strutStyle = null ) { D.assert(textScaleFactor != null); D.assert(maxLines == null || maxLines > 0); return(new ParagraphStyle( textAlign: textAlign, textDirection ?? TextDirection.ltr, fontWeight: fontWeight ?? this.fontWeight, fontStyle: fontStyle ?? this.fontStyle, fontFamily: fontFamily ?? this.fontFamily, fontSize: (fontSize ?? this.fontSize ?? _defaultFontSize) * textScaleFactor, height: height ?? this.height, textHeightBehavior: textHeightBehavior, strutStyle: strutStyle == null ? null : new ui.StrutStyle( fontFamily: strutStyle.fontFamily, fontFamilyFallback: strutStyle.fontFamilyFallback, strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor, height: strutStyle.height, leading: strutStyle.leading, fontWeight: strutStyle.fontWeight, fontStyle: strutStyle.fontStyle, forceStrutHeight: strutStyle.forceStrutHeight ), maxLines: maxLines, ellipsis: ellipsis, locale: locale )); }
public static Text rich(TextSpan textSpan, Key key = null, TextStyle style = null, StrutStyle strutStyle = null, TextAlign?textAlign = null, bool?softWrap = null, TextOverflow?overflow = null, float?textScaleFactor = null, int?maxLines = null) { return(new Text( textSpan, key, style, strutStyle, textAlign, softWrap, overflow, textScaleFactor, maxLines)); }
public bool Equals(StrutStyle other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(fontFamily == other.fontFamily && fontSize == other.fontSize && fontWeight == other.fontWeight && fontStyle == other.fontStyle && height == other.height && leading == other.leading && forceStrutHeight == other.forceStrutHeight); }
public TextPainter(InlineSpan text = null, TextAlign textAlign = TextAlign.left, TextDirection textDirection = TextDirection.ltr, float textScaleFactor = 1.0f, int?maxLines = null, string ellipsis = null, Locale locale = null, StrutStyle strutStyle = null, TextWidthBasis textWidthBasis = TextWidthBasis.parent, TextHeightBehavior textHeightBehavior = null) { D.assert(text == null || text.debugAssertIsValid()); D.assert(maxLines == null || maxLines > 0); _text = text; _textAlign = textAlign; _textDirection = textDirection; _textScaleFactor = textScaleFactor; _maxLines = maxLines; _ellipsis = ellipsis; _locale = locale; _strutStyle = strutStyle; _textWidthBasis = textWidthBasis; _textHeightBehavior = textHeightBehavior; }
public RenderParagraph( InlineSpan text = null, TextAlign textAlign = TextAlign.start, TextDirection textDirection = TextDirection.ltr, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, float textScaleFactor = 1.0f, int?maxLines = null, Locale locale = null, StrutStyle strutStyle = null, TextWidthBasis textWidthBasis = TextWidthBasis.parent, ui.TextHeightBehavior textHeightBehavior = null, List <RenderBox> children = null ) { D.assert(maxLines == null || maxLines > 0); D.assert(text != null); D.assert(text.debugAssertIsValid()); D.assert(maxLines == null || maxLines > 0); _softWrap = softWrap; _overflow = overflow; _textPainter = new TextPainter( text: text, textAlign: textAlign, textDirection: textDirection, textScaleFactor: textScaleFactor, maxLines: maxLines, ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null, locale: locale, strutStyle: strutStyle, textWidthBasis: textWidthBasis, textHeightBehavior: textHeightBehavior ); addAll(children); _extractPlaceholderSpans(text); }
public CupertinoTextField( Key key = null, TextEditingController controller = null, FocusNode focusNode = null, BoxDecoration decoration = null, EdgeInsets padding = null, string placeholder = null, TextStyle placeholderStyle = null, Widget prefix = null, OverlayVisibilityMode prefixMode = OverlayVisibilityMode.always, Widget suffix = null, OverlayVisibilityMode suffixMode = OverlayVisibilityMode.always, OverlayVisibilityMode clearButtonMode = OverlayVisibilityMode.never, TextInputType keyboardType = null, TextInputAction?textInputAction = null, TextCapitalization textCapitalization = TextCapitalization.none, TextStyle style = null, StrutStyle strutStyle = null, TextAlign textAlign = TextAlign.left, TextAlignVertical textAlignVertical = null, bool readOnly = false, ToolbarOptions toolbarOptions = null, bool?showCursor = null, bool autofocus = false, bool obscureText = false, bool autocorrect = true, SmartDashesType?smartDashesType = null, SmartQuotesType?smartQuotesType = null, bool enableSuggestions = true, int?maxLines = 1, int?minLines = null, bool expands = false, int?maxLength = null, bool maxLengthEnforced = true, ValueChanged <string> onChanged = null, VoidCallback onEditingComplete = null, ValueChanged <string> onSubmitted = null, List <TextInputFormatter> inputFormatters = null, bool?enabled = null, float cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null, ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight, ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight, Brightness?keyboardAppearance = null, EdgeInsets scrollPadding = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, 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, () => "minLines can't be greater than maxLines"); D.assert(!expands || (maxLines == null && minLines == null), () => "minLines and maxLines must be null when expands is true."); D.assert(maxLength == null || maxLength > 0); this.controller = controller; this.focusNode = focusNode; this.decoration = decoration ?? CupertinoTextFieldUtils._kDefaultRoundedBorderDecoration; this.padding = padding ?? EdgeInsets.all(6.0f); this.placeholder = placeholder; this.placeholderStyle = placeholderStyle ?? new TextStyle( fontWeight: FontWeight.w400, color: CupertinoColors.placeholderText ); this.prefix = prefix; this.prefixMode = prefixMode; this.suffix = suffix; this.suffixMode = suffixMode; this.clearButtonMode = clearButtonMode; this.textInputAction = textInputAction; this.textCapitalization = textCapitalization; this.style = style; this.strutStyle = strutStyle; this.textAlign = textAlign; this.textAlignVertical = textAlignVertical; this.readOnly = readOnly; this.showCursor = showCursor; this.autofocus = autofocus; this.obscureText = obscureText; this.autocorrect = autocorrect; this.enableSuggestions = enableSuggestions; this.maxLines = maxLines; this.minLines = minLines; this.expands = expands; this.maxLength = maxLength; this.maxLengthEnforced = maxLengthEnforced; this.onChanged = onChanged; this.onEditingComplete = onEditingComplete; this.onSubmitted = onSubmitted; this.inputFormatters = inputFormatters; this.enabled = enabled; this.cursorWidth = cursorWidth; this.cursorRadius = cursorRadius ?? Radius.circular(2.0f); this.cursorColor = cursorColor; this.selectionHeightStyle = selectionHeightStyle; this.selectionWidthStyle = selectionWidthStyle; this.keyboardAppearance = keyboardAppearance; this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); this.dragStartBehavior = dragStartBehavior; this.enableInteractiveSelection = enableInteractiveSelection; this.scrollPhysics = scrollPhysics; this.onTap = onTap; this.scrollController = scrollController; this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline); this.toolbarOptions = toolbarOptions ?? (obscureText ? new ToolbarOptions( selectAll: true, paste: true ) : new ToolbarOptions( copy: true, cut: true, selectAll: true, paste: true )); }
public TextField(Key key = null, TextEditingController controller = null, FocusNode focusNode = null, InputDecoration decoration = null, bool noDecoration = false, TextInputType keyboardType = null, TextInputAction?textInputAction = null, TextCapitalization textCapitalization = TextCapitalization.none, TextStyle style = null, StrutStyle strutStyle = null, TextAlign textAlign = TextAlign.left, TextAlignVertical textAlignVertical = null, TextDirection textDirection = TextDirection.ltr, bool readOnly = false, ToolbarOptions toolbarOptions = null, bool?showCursor = null, bool autofocus = false, bool obscureText = false, bool autocorrect = false, SmartDashesType?smartDashesType = null, SmartQuotesType?smartQuotesType = null, bool enableSuggestions = true, int?maxLines = 1, int?minLines = null, bool expands = false, int?maxLength = null, bool maxLengthEnforced = true, ValueChanged <string> onChanged = null, VoidCallback onEditingComplete = null, ValueChanged <string> onSubmitted = null, List <TextInputFormatter> inputFormatters = null, bool?enabled = null, float?cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null, BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight, BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight, Brightness?keyboardAppearance = null, EdgeInsets scrollPadding = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, bool enableInteractiveSelection = true, GestureTapCallback onTap = null, InputCounterWidgetBuilder buildCounter = null, ScrollController scrollController = null, ScrollPhysics scrollPhysics = null ) : base(key: key) { D.assert(maxLines == null || maxLines > 0); D.assert(minLines == null || minLines > 0); D.assert((maxLines == null) || (minLines == null) || (maxLines >= minLines), () => "minLines can't be greater than maxLines"); D.assert(!expands || (maxLines == null && minLines == null), () => "minLines and maxLines must be null when expands is true."); D.assert(maxLength == null || maxLength == noMaxLength || maxLength > 0); D.assert(!obscureText || maxLines == 1, () => "Obscured fields cannot be multiline."); this.smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled); this.smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled); this.controller = controller; this.focusNode = focusNode; this.decoration = noDecoration ? null : (decoration ?? new InputDecoration()); this.textInputAction = textInputAction; this.textCapitalization = textCapitalization; this.style = style; this.strutStyle = strutStyle; this.textAlign = textAlign; this.textAlignVertical = textAlignVertical; this.textDirection = textDirection; this.readOnly = readOnly; this.showCursor = showCursor; this.autofocus = autofocus; this.obscureText = obscureText; this.autocorrect = autocorrect; this.enableSuggestions = enableSuggestions; this.maxLines = maxLines; this.minLines = minLines; this.expands = expands; this.maxLength = maxLength; this.maxLengthEnforced = maxLengthEnforced; this.onChanged = onChanged; this.onEditingComplete = onEditingComplete; this.onSubmitted = onSubmitted; this.inputFormatters = inputFormatters; this.enabled = enabled; this.cursorWidth = cursorWidth; this.cursorColor = cursorColor; this.selectionHeightStyle = selectionHeightStyle; this.selectionWidthStyle = selectionWidthStyle; this.cursorRadius = cursorRadius; this.onSubmitted = onSubmitted; this.keyboardAppearance = keyboardAppearance; this.enableInteractiveSelection = enableInteractiveSelection; this.onTap = onTap; this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline); this.toolbarOptions = toolbarOptions ?? (obscureText ? new ToolbarOptions( selectAll: true, paste: true ) : new ToolbarOptions( copy: true, cut: true, selectAll: true, paste: true )); this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); this.dragStartBehavior = dragStartBehavior; this.enableInteractiveSelection = enableInteractiveSelection; this.buildCounter = buildCounter; this.scrollPhysics = scrollPhysics; this.scrollController = scrollController; }
public TextFormField( Key key = null, TextEditingController controller = null, string initialValue = null, FocusNode focusNode = null, InputDecoration decoration = null, TextInputType keyboardType = null, TextCapitalization textCapitalization = TextCapitalization.none, TextInputAction?textInputAction = null, TextStyle style = null, StrutStyle strutStyle = null, TextDirection?textDirection = null, TextAlign textAlign = TextAlign.left, TextAlignVertical textAlignVertical = null, bool autofocus = false, bool readOnly = false, ToolbarOptions toolbarOptions = null, bool?showCursor = null, bool obscureText = false, bool autocorrect = true, SmartDashesType?smartDashesType = null, SmartQuotesType?smartQuotesType = null, bool enableSuggestions = true, bool autovalidate = false, bool maxLengthEnforced = true, int?maxLines = 1, int?minLines = null, bool expands = false, int?maxLength = null, ValueChanged <string> onChanged = null, GestureTapCallback onTap = null, VoidCallback onEditingComplete = null, ValueChanged <string> onFieldSubmitted = null, FormFieldSetter <string> onSaved = null, FormFieldValidator <string> validator = null, List <TextInputFormatter> inputFormatters = null, bool enabled = true, float cursorWidth = 2.0f, Radius cursorRadius = null, Color cursorColor = null, Brightness?keyboardAppearance = null, EdgeInsets scrollPadding = null, bool enableInteractiveSelection = true, InputCounterWidgetBuilder buildCounter = null, ScrollPhysics scrollPhysics = null ) : base( key: key, initialValue: controller != null ? controller.text : (initialValue ?? ""), onSaved: onSaved, validator: validator, autovalidate: autovalidate, enabled: enabled, builder: (FormFieldState <string> field) => { _TextFormFieldState state = (_TextFormFieldState)field; InputDecoration effectiveDecoration = (decoration ?? new InputDecoration()) .applyDefaults(Theme.of(field.context).inputDecorationTheme); void onChangedHandler(string value) { if (onChanged != null) { onChanged(value); } field.didChange(value); } return(new TextField( controller: state._effectiveController, focusNode: focusNode, decoration: effectiveDecoration.copyWith(errorText: field.errorText), keyboardType: keyboardType, textInputAction: textInputAction, style: style, strutStyle: strutStyle, textAlign: textAlign, textAlignVertical: textAlignVertical, textDirection: textDirection ?? TextDirection.ltr, textCapitalization: textCapitalization, autofocus: autofocus, toolbarOptions: toolbarOptions, readOnly: readOnly, showCursor: showCursor, obscureText: obscureText, autocorrect: autocorrect, smartDashesType: smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled), smartQuotesType: smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled), enableSuggestions: enableSuggestions, maxLengthEnforced: maxLengthEnforced, maxLines: maxLines, minLines: minLines, expands: expands, maxLength: maxLength, onChanged: onChangedHandler, onTap: onTap, onEditingComplete: onEditingComplete, onSubmitted: onFieldSubmitted, inputFormatters: inputFormatters, enabled: enabled, cursorWidth: cursorWidth, cursorRadius: cursorRadius, cursorColor: cursorColor, scrollPadding: scrollPadding ?? EdgeInsets.all(20.0f), scrollPhysics: scrollPhysics, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: enableInteractiveSelection, buildCounter: buildCounter )); } ) { D.assert(initialValue == null || controller == null); D.assert(maxLines > 0); D.assert(maxLines == null || maxLines > 0); D.assert(minLines == null || minLines > 0); D.assert((maxLines == null) || (minLines == null) || (maxLines >= minLines), () => "minLines can't be greater than maxLines"); D.assert(!expands || (maxLines == null && minLines == null), () => "minLines and maxLines must be null when expands is true."); D.assert(!obscureText || maxLines == 1, () => "Obscured fields cannot be multiline."); D.assert(maxLength == null || maxLength > 0); this.controller = controller; }