internal MovieClipTextBoxObject( string id, string text, TextStyle style = null, Color color = null, TextAlign textAlign = TextAlign.center, int?maxLines = null, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null, int layer = 0) : base(id, layer) { this.text = text; this.textAlign = textAlign; this.maxLines = maxLines; this.padding = padding ?? EdgeInsets.all(10); this.decoration = decoration; this.maxWidth = maxWidth; this.maxHeight = maxHeight; this.minWidth = minWidth; this.minHeight = minHeight; initConstantTextStyle(style); initConstantColor(color); }
public TextBox( string text, TextStyle style, Color color = null, TextAlign textAlign = TextAlign.center, int?maxLines = null, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null) : base(texts: new List <string> { text }, style: style, textAlign: textAlign, maxLines: maxLines, maxWidth: maxWidth, maxHeight: maxHeight, minWidth: minWidth, minHeight: minHeight, padding: padding, decoration: decoration ?? new BoxDecoration( color: color ?? Colors.white, border: Border.all(color: Colors.black) )) { }
public static IEnumerable <Widget> divideTiles(BuildContext context = null, IEnumerable <Widget> tiles = null, Color color = null) { D.assert(tiles != null); D.assert(color != null || context != null); IEnumerator <Widget> enumerator = tiles.GetEnumerator(); List <Widget> result = new List <Widget> { }; Decoration decoration = new BoxDecoration( border: new Border( bottom: Divider.createBorderSide(context, color: color) ) ); Widget tile = enumerator.Current; while (enumerator.MoveNext()) { result.Add(new DecoratedBox( position: DecorationPosition.foreground, decoration: decoration, child: tile )); tile = enumerator.Current; } return(result); }
public MovieClipTypingEffect( string id, List <string> texts, TextStyle style = null, Color color = null, TextAlign textAlign = TextAlign.left, int?maxLines = null, Axis direction = Axis.vertical, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null, int layer = 0) : base(id, texts.Count, layer) { D.assert(!(texts?.isEmpty() ?? true)); D.assert(texts.TrueForAll((s => !string.IsNullOrEmpty(s)))); this.texts = texts; this.textAlign = textAlign; this.maxLines = maxLines; this.direction = direction; this.padding = padding ?? EdgeInsets.all(10); this.decoration = decoration; this.maxWidth = maxWidth; this.maxHeight = maxHeight; this.minWidth = minWidth; this.minHeight = minHeight; initConstantTextStyle(style); initConstantColor(color); initConstantProgresses(texts.Count); }
public TextList( List <string> texts, TextStyle style, TextAlign textAlign = TextAlign.center, int?maxLines = null, Axis direction = Axis.vertical, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null) { this.texts = texts; this.style = style; this.textAlign = textAlign; this.maxLines = maxLines; this.direction = direction; this.maxWidth = maxWidth; this.minWidth = minWidth; this.maxHeight = maxHeight; this.minHeight = minHeight; this.padding = padding ?? EdgeInsets.all(10); this.decoration = decoration; }
public override Widget build(BuildContext context) { D.assert(Overlay.of(context, debugRequiredFor: widget) != null); ThemeData theme = Theme.of(context); TooltipThemeData tooltipTheme = TooltipTheme.of(context); TextStyle defaultTextStyle; BoxDecoration defaultDecoration; if (theme.brightness == Brightness.dark) { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.black ); defaultDecoration = new BoxDecoration( color: Colors.white.withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } else { defaultTextStyle = theme.textTheme.bodyText2.copyWith( color: Colors.white ); defaultDecoration = new BoxDecoration( color: Colors.grey[700].withOpacity(0.9f), borderRadius: BorderRadius.all(Radius.circular(4)) ); } height = widget.height ?? tooltipTheme?.height ?? _defaultTooltipHeight; padding = widget.padding ?? tooltipTheme?.padding ?? _defaultPadding; margin = widget.margin ?? tooltipTheme?.margin ?? _defaultMargin; verticalOffset = widget.verticalOffset ?? tooltipTheme?.verticalOffset ?? _defaultVerticalOffset; preferBelow = widget.preferBelow ?? tooltipTheme?.preferBelow ?? _defaultPreferBelow; excludeFromSemantics = widget.excludeFromSemantics ?? tooltipTheme?.excludeFromSemantics ?? _defaultExcludeFromSemantics; decoration = widget.decoration ?? tooltipTheme?.decoration ?? defaultDecoration; textStyle = widget.textStyle ?? tooltipTheme?.textStyle ?? defaultTextStyle; waitDuration = widget.waitDuration ?? tooltipTheme?.waitDuration ?? _defaultWaitDuration; showDuration = widget.showDuration ?? tooltipTheme?.showDuration ?? _defaultShowDuration; Widget result = new GestureDetector( behavior: HitTestBehavior.opaque, onLongPress: _handleLongPress, child: widget.child ); if (_mouseIsConnected) { result = new MouseRegion( onEnter: (PointerEnterEvent _event) => _showTooltip(), onExit: (PointerExitEvent _event) => _hideTooltip(), child: result ); } return(result); }
public Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding) { BoxDecoration decoration = null; if (ShrineHomeUtils._shoppingCart.getOrDefault(this.product) != null) { decoration = new BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor); } return(new Container( padding: padding, decoration: decoration, child: new Text(this.product.priceString, style: style) )); }
public static void createTypingEffect( this MovieClipSnapshot snapshot, string id, string text, TextStyle style = null, Color color = null, TextAlign textAlign = TextAlign.left, int?maxLines = null, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null, int layer = 0, Offset position = null, Offset pivot = null, Size scale = null, float rotation = 0, float opacity = 1, float delay = 0, float appearTime = MovieClipSnapshot.kDefaultAppearTime) { snapshot.createTypingEffect( id: id, texts: new List <string> { text }, style: style, color: color, textAlign: textAlign, maxLines: maxLines, maxWidth: maxWidth, maxHeight: maxHeight, minWidth: minWidth, minHeight: minHeight, padding: padding ?? EdgeInsets.all(10), decoration: decoration ?? new BoxDecoration(), layer: layer, position: position, pivot: pivot ?? new Offset(0, 0.5f), scale: scale, rotation: rotation, opacity: opacity, delay: delay, appearTime: appearTime ); }
public static void createTextBox( this MovieClipSnapshot snapshot, string id, string text, TextStyle style = null, Color color = null, TextAlign textAlign = TextAlign.center, int?maxLines = null, float?maxWidth = null, float?maxHeight = null, float?minWidth = null, float?minHeight = null, EdgeInsets padding = null, BoxDecoration decoration = null, AppearAnimation animation = AppearAnimation.none, int layer = 0, Offset position = null, Offset pivot = null, Size scale = null, float rotation = 0, float opacity = 1, float delay = 0, float appearTime = MovieClipSnapshot.kDefaultAppearTime) { snapshot.createObject(new MovieClipTextBoxObject(id, text, style, color: color, textAlign: textAlign, maxLines: maxLines, maxWidth: maxWidth, maxHeight: maxHeight, minWidth: minWidth, minHeight: minHeight, padding: padding ?? EdgeInsets.all(10), decoration: decoration, layer: layer ), position: position, pivot: pivot, scale: scale, rotation: rotation, opacity: opacity, delay: delay, animation: animation, appearTime: appearTime ); }
public _DropdownMenuPainter( Color color = null, int?elevation = null, int?selectedIndex = null, Animation <float> resize = null, ValueGetter <float> getSelectedItemOffset = null ) : base(repaint: resize) { D.assert(elevation != null); _painter = new BoxDecoration( color: color, borderRadius: BorderRadius.circular(2.0f), boxShadow: material_.kElevationToShadow[elevation ?? 0] ).createBoxPainter(); this.color = color; this.elevation = elevation; this.selectedIndex = selectedIndex; this.resize = resize; this.getSelectedItemOffset = getSelectedItemOffset; }
public static Ink image( Key key = null, EdgeInsetsGeometry padding = null, ImageProvider image = null, ImageErrorListener onImageError = null, ColorFilter colorFilter = null, BoxFit?fit = null, AlignmentGeometry alignment = null, Rect centerSlice = null, ImageRepeat repeat = ImageRepeat.noRepeat, float?width = null, float?height = null, Widget child = null ) { D.assert(padding == null || padding.isNonNegative); D.assert(image != null); alignment = alignment ?? Alignment.center; Decoration decoration = new BoxDecoration( image: new DecorationImage( image: image, onError: onImageError, colorFilter: colorFilter, fit: fit, alignment: alignment, centerSlice: centerSlice, repeat: repeat) ); return(new Ink( key: key, padding: padding, decoration: decoration, width: width, height: height, child: child)); }
public override Widget build(BuildContext context) { ThemeData themeData = Theme.of(context); MaterialLocalizations localizations = MaterialLocalizations.of(context); int year = this.displayedMonth.Year; int month = this.displayedMonth.Month; int daysInMonth = getDaysInMonth(year, month); int firstDayOffset = this._computeFirstDayOffset(year, month, localizations); List <Widget> labels = new List <Widget>(); labels.AddRange(this._getDayHeaders(themeData.textTheme.caption, localizations)); for (int i = 0; true; i += 1) { int day = i - firstDayOffset + 1; if (day > daysInMonth) { break; } if (day < 1) { labels.Add(new Container()); } else { DateTime dayToBuild = new DateTime(year, month, day); bool disabled = dayToBuild > this.lastDate || dayToBuild < this.firstDate || (this.selectableDayPredicate != null && !this.selectableDayPredicate(dayToBuild)); BoxDecoration decoration = null; TextStyle itemStyle = themeData.textTheme.body1; bool isSelectedDay = this.selectedDate.Year == year && this.selectedDate.Month == month && this.selectedDate.Day == day; if (isSelectedDay) { itemStyle = themeData.accentTextTheme.body2; decoration = new BoxDecoration( color: themeData.accentColor, shape: BoxShape.circle ); } else if (disabled) { itemStyle = themeData.textTheme.body1.copyWith(color: themeData.disabledColor); } else if (this.currentDate.Year == year && this.currentDate.Month == month && this.currentDate.Day == day) { itemStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor); } Widget dayWidget = new Container( decoration: decoration, child: new Center( child: new Text(localizations.formatDecimal(day), style: itemStyle) ) ); if (!disabled) { dayWidget = new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => { this.onChanged(dayToBuild); }, child: dayWidget, dragStartBehavior: this.dragStartBehavior ); } labels.Add(dayWidget); } } return(new Padding( padding: EdgeInsets.symmetric(horizontal: 8.0f), child: new Column( children: new List <Widget> { new Container( height: DatePickerUtils._kDayPickerRowHeight, child: new Center( child: new Text( localizations.formatMonthYear(this.displayedMonth), style: themeData.textTheme.subhead ) ) ), new Flexible( child: GridView.custom( gridDelegate: DatePickerUtils._kDayPickerGridDelegate, childrenDelegate: new SliverChildListDelegate(labels, addRepaintBoundaries: false) ) ) } ) )); }
Widget _buildYearItem(BuildContext context, int index) { ColorScheme colorScheme = Theme.of(context).colorScheme; TextTheme textTheme = Theme.of(context).textTheme; // Backfill the _YearPicker with disabled years if necessary. int offset = _itemCount < minYears ? (int)(1.0f * (minYears - _itemCount) / 2) : 0; int year = widget.firstDate.Year + index - offset; bool isSelected = year == widget.selectedDate.Year; bool isCurrentYear = year == widget.currentDate.Year; bool isDisabled = year <widget.firstDate.Year || year> widget.lastDate.Year; const float decorationHeight = 36.0f; const float decorationWidth = 72.0f; Color textColor; if (isSelected) { textColor = colorScheme.onPrimary; } else if (isDisabled) { textColor = colorScheme.onSurface.withOpacity(0.38f); } else if (isCurrentYear) { textColor = colorScheme.primary; } else { textColor = colorScheme.onSurface.withOpacity(0.87f); } TextStyle itemStyle = textTheme.bodyText1?.apply(color: textColor); BoxDecoration decoration = null; if (isSelected) { decoration = new BoxDecoration( color: colorScheme.primary, borderRadius: BorderRadius.circular(decorationHeight / 2), shape: BoxShape.rectangle ); } else if (isCurrentYear && !isDisabled) { decoration = new BoxDecoration( border: Border.all( color: colorScheme.primary, width: 1 ), borderRadius: BorderRadius.circular(decorationHeight / 2), shape: BoxShape.rectangle ); } Widget yearItem = new Center( child: new Container( decoration: decoration, height: decorationHeight, width: decorationWidth, child: new Center( child: new Text(year.ToString(), style: itemStyle) ) ) ); if (!isDisabled) { yearItem = new InkWell( key: new ValueKey <int>(year), onTap: () => { widget.onChanged( new DateTime( year, widget.initialDate.Month, widget.initialDate.Day ) ); }, child: yearItem ); } return(yearItem); }
public override Widget build(BuildContext context) { ColorScheme colorScheme = Theme.of(context).colorScheme; MaterialLocalizations localizations = MaterialLocalizations.of(context); TextTheme textTheme = Theme.of(context).textTheme; TextStyle dayStyle = textTheme.caption; Color enabledDayColor = colorScheme.onSurface.withOpacity(0.87f); Color disabledDayColor = colorScheme.onSurface.withOpacity(0.38f); Color selectedDayColor = colorScheme.onPrimary; Color selectedDayBackground = colorScheme.primary; Color todayColor = colorScheme.primary; int year = displayedMonth.Year; int month = displayedMonth.Month; int daysInMonth = utils.getDaysInMonth(year, month); int dayOffset = utils.firstDayOffset(year, month, localizations); List <Widget> dayItems = new List <Widget>(); // 1-based day of month, e.g. 1-31 for January, and 1-29 for February on // a leap year. int day = -dayOffset; while (day < daysInMonth) { day++; if (day < 1) { dayItems.Add(new Container()); } else { DateTime dayToBuild = new DateTime(year, month, day); bool isDisabled = dayToBuild > lastDate || dayToBuild < firstDate || (selectableDayPredicate != null && !selectableDayPredicate(dayToBuild)); BoxDecoration decoration = null; Color dayColor = enabledDayColor; bool isSelectedDay = utils.isSameDay(selectedDate, dayToBuild); if (isSelectedDay) { // The selected day gets a circle background highlight, and a // contrasting text color. dayColor = selectedDayColor; decoration = new BoxDecoration( color: selectedDayBackground, shape: BoxShape.circle ); } else if (isDisabled) { dayColor = disabledDayColor; } else if (utils.isSameDay(currentDate, dayToBuild)) { // The current day gets a different text color and a circle stroke // border. dayColor = todayColor; decoration = new BoxDecoration( border: Border.all(color: todayColor, width: 1), shape: BoxShape.circle ); } Widget dayWidget = new Container( decoration: decoration, child: new Center( child: new Text(localizations.formatDecimal(day), style: dayStyle.apply(color: dayColor)) ) ); if (!isDisabled) { dayWidget = new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => onChanged(dayToBuild), child: dayWidget ); } dayItems.Add(dayWidget); } } return(new Padding( padding: EdgeInsets.symmetric( horizontal: material_._monthPickerHorizontalPadding ), child: GridView.custom( physics: new ClampingScrollPhysics(), gridDelegate: material_._dayPickerGridDelegate, childrenDelegate: new SliverChildListDelegate( dayItems, addRepaintBoundaries: false ) ) )); }
public override Widget build(BuildContext context) { D.assert(!_debugInteractive || material_.debugCheckHasMaterial(context)); ThemeData theme = Theme.of(context); BoxDecoration _kSelectedDecoration = new BoxDecoration( border: new Border(bottom: Divider.createBorderSide(context, width: dividerThickness)), // The backgroundColor has to be transparent so you can see the ink on the material color: (Theme.of(context).brightness == Brightness.light) ? _grey100Opacity : _grey300Opacity ); BoxDecoration _kUnselectedDecoration = new BoxDecoration( border: new Border(bottom: Divider.createBorderSide(context, width: dividerThickness)) ); bool displayCheckboxColumn = showCheckboxColumn && rows.Any((DataRow row) => row.onSelectChanged != null); bool allChecked = displayCheckboxColumn && !rows.Any((DataRow row) => row.onSelectChanged != null && !row.selected); List <TableColumnWidth> tableColumns = new List <TableColumnWidth>(new TableColumnWidth[columns.Count + (displayCheckboxColumn ? 1 : 0)]); List <TableRow> tableRows = LinqUtils <TableRow, int> .SelectList(Enumerable.Range(0, rows.Count + 1), (index) => { return(new TableRow( key: index == 0 ? _headingRowKey : rows[index - 1].key, decoration: index > 0 && rows[index - 1].selected ? _kSelectedDecoration : _kUnselectedDecoration, children: new List <Widget>(new Widget[tableColumns.Count]) )); }); int rowIndex; int displayColumnIndex = 0; if (displayCheckboxColumn) { tableColumns[0] = new FixedColumnWidth(horizontalMargin + Checkbox.width + horizontalMargin / 2.0f); tableRows[0].children[0] = _buildCheckbox( color: theme.accentColor, isChecked: allChecked, onCheckboxChanged: _check => _handleSelectAll(_check ?? false) ); rowIndex = 1; foreach (DataRow row in rows) { tableRows[rowIndex].children[0] = _buildCheckbox( color: theme.accentColor, isChecked: row.selected, onRowTap: () => { if (row.onSelectChanged != null) { row.onSelectChanged(!row.selected); } }, onCheckboxChanged: _select => row.onSelectChanged(_select ?? false) ); rowIndex += 1; } displayColumnIndex += 1; } for (int dataColumnIndex = 0; dataColumnIndex < columns.Count; dataColumnIndex += 1) { DataColumn column = columns[dataColumnIndex]; float paddingStart; if (dataColumnIndex == 0 && displayCheckboxColumn) { paddingStart = horizontalMargin / 2.0f; } else if (dataColumnIndex == 0 && !displayCheckboxColumn) { paddingStart = horizontalMargin; } else { paddingStart = columnSpacing / 2.0f; } float paddingEnd; if (dataColumnIndex == columns.Count - 1) { paddingEnd = horizontalMargin; } else { paddingEnd = columnSpacing / 2.0f; } EdgeInsetsDirectional padding = EdgeInsetsDirectional.only( start: paddingStart, end: paddingEnd ); if (dataColumnIndex == _onlyTextColumn) { tableColumns[displayColumnIndex] = new IntrinsicColumnWidth(flex: 1.0f); } else { tableColumns[displayColumnIndex] = new IntrinsicColumnWidth(); } var currentColumnIndex = dataColumnIndex; tableRows[0].children[displayColumnIndex] = _buildHeadingCell( context: context, padding: padding, label: column.label, tooltip: column.tooltip, numeric: column.numeric, onSort: column.onSort != null ? () => column.onSort(currentColumnIndex, sortColumnIndex != currentColumnIndex || !sortAscending) : (VoidCallback)null, sorted: dataColumnIndex == sortColumnIndex, ascending: sortAscending ); rowIndex = 1; foreach (DataRow row in rows) { DataCell cell = row.cells[dataColumnIndex]; var curRow = row; tableRows[rowIndex].children[displayColumnIndex] = _buildDataCell( context: context, padding: padding, label: cell.child, numeric: column.numeric, placeholder: cell.placeholder, showEditIcon: cell.showEditIcon, onTap: cell.onTap, onSelectChanged: () => { if (curRow.onSelectChanged != null) { curRow.onSelectChanged(!curRow.selected); } }); rowIndex += 1; } displayColumnIndex += 1; } return(new Table( columnWidths: LinqUtils <int, TableColumnWidth> .SelectDictionary(tableColumns, ((TableColumnWidth x) => tableColumns.IndexOf(x))), children: tableRows )); }
public override Widget build(BuildContext context) { base.build(context); D.assert(WidgetsD.debugCheckHasDirectionality(context)); TextEditingController controller = _effectiveController; List <TextInputFormatter> formatters = widget.inputFormatters ?? new List <TextInputFormatter>(); bool enabled = widget.enabled ?? true; Offset cursorOffset = new Offset( CupertinoTextFieldUtils._iOSHorizontalCursorOffsetPixels / MediaQuery.of(context).devicePixelRatio, 0); if (widget.maxLength != null && widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(widget.maxLength)); } CupertinoThemeData themeData = CupertinoTheme.of(context); 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) ); Widget paddedEditable = new Padding( padding: widget.padding, child: new RepaintBoundary( child: new EditableText( 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 ) ) ); return(new IgnorePointer( ignoring: !enabled, child: new Container( decoration: effectiveDecoration, child: _selectionGestureDetectorBuilder.buildGestureDetector( behavior: HitTestBehavior.translucent, child: new Align( alignment: new Alignment(-1.0f, _textAlignVertical.y), widthFactor: 1.0f, heightFactor: 1.0f, child: _addTextDependentAttachments(paddedEditable, textStyle, placeholderStyle) ) ) ) )); }
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 override Widget build(BuildContext context) { BoxDecoration decoration = null; if (backgroundColor != null) { decoration = new BoxDecoration(color: backgroundColor); } EdgeInsetsDirectional padding = EdgeInsetsDirectional.only( start: leading != null ? 8.0f : 16.0f, end: trailing != null ? 8.0f : 16.0f ); ThemeData theme = Theme.of(context); ThemeData darkTheme = new ThemeData( brightness: Brightness.dark, accentColor: theme.accentColor, accentColorBrightness: theme.accentColorBrightness ); var expandChildren = new List <widgets.Widget>(); if (leading != null) { expandChildren.Add(new Padding( padding: EdgeInsetsDirectional.only(end: 8.0f), child: leading)); } if (title != null && subtitle != null) { expandChildren.Add(new Expanded( child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new DefaultTextStyle( style: darkTheme.textTheme.subtitle1, softWrap: false, overflow: TextOverflow.ellipsis, child: title ), new DefaultTextStyle( style: darkTheme.textTheme.caption, softWrap: false, overflow: TextOverflow.ellipsis, child: subtitle ) } ) )); } else if (title != null || subtitle != null) { expandChildren.Add(new Expanded( child: new DefaultTextStyle( style: darkTheme.textTheme.subtitle1, softWrap: false, overflow: TextOverflow.ellipsis, child: title ?? subtitle ) )); } if (trailing != null) { expandChildren.Add(new Padding( padding: EdgeInsetsDirectional.only(start: 8.0f), child: trailing)); } return(new Container( padding: padding, decoration: decoration, height: (title != null && subtitle != null) ? 68.0f : 48.0f, child: new Theme( data: darkTheme, child: IconTheme.merge( data: new IconThemeData(color: Colors.white), child: new Row( crossAxisAlignment: CrossAxisAlignment.center, children: expandChildren ) ) ) )); }
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, bool autofocus = false, bool obscureText = false, bool autocorrect = 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, Brightness?keyboardAppearance = null, EdgeInsets scrollPadding = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, 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 > 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.w300, color: CupertinoTextFieldUtils._kInactiveTextColor ); 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.autofocus = autofocus; this.obscureText = obscureText; this.autocorrect = autocorrect; 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.keyboardAppearance = keyboardAppearance; this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); this.dragStartBehavior = dragStartBehavior; this.scrollPhysics = scrollPhysics; this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline); }