public CustomTextField( EdgeInsets padding = null, Decoration decoration = null, Key textFieldKey = null, string hintText = null, TextEditingController controller = null, FocusNode focusNode = null, ValueChanged <string> onSubmitted = null, bool autofocus = false, int?maxLines = null, int?minLines = null, bool loading = false, bool showEmojiBoard = false, bool isShowImageButton = false, GestureTapCallback onPressImage = null, GestureTapCallback onPressEmoji = null, Key key = null ) : base(key: key) { this.padding = padding; this.decoration = decoration; this.textFieldKey = textFieldKey; this.hintText = hintText; this.controller = controller; this.focusNode = focusNode; this.onSubmitted = onSubmitted; this.autofocus = autofocus; this.maxLines = maxLines; this.minLines = minLines; this.loading = loading; this.showEmojiBoard = showEmojiBoard; this.isShowImageButton = isShowImageButton; this.onPressImage = onPressImage; this.onPressEmoji = onPressEmoji; }
private IPromise <object> showTextDialog() { return(DialogUtils.showDialog( context: context, builder: (context) => { TextEditingController textEditingController = new TextEditingController(); return new SimpleDialog( title: new Text("编辑文本内容"), children: new List <Widget> { new TextField( textInputAction: Unity.UIWidgets.service.TextInputAction.go, controller: textEditingController ), new Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: new List <Widget> { new FlatButton( child: new Text("取消"), onPressed: () => { Navigator.of(context).pop(null); } ), new FlatButton( child: new Text("确定"), onPressed: () => { Navigator.of(context).pop(textEditingController.text); } ) } ) }); })); }
public static Widget SettingInputField(string title, string value, ValueChanged <string> valueChanged = null) { TextEditingController _textEditingController = new TextEditingController(text: value); return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container(child: new Text(title)), new Container(width: 20), new Expanded( child: new Container( alignment: Alignment.bottomRight, child: new TextField( //textAlign: TextAlign.right, controller: _textEditingController, onChanged: valueChanged ) ) //container ) //expanded } //list ) //row ));; }
public override void didUpdateWidget(StatefulWidget _oldWidget) { TextFormField oldWidget = _oldWidget as TextFormField; base.didUpdateWidget(oldWidget); if (this.widget.controller != oldWidget.controller) { oldWidget.controller?.removeListener(this._handleControllerChanged); this.widget.controller?.addListener(this._handleControllerChanged); if (oldWidget.controller != null && this.widget.controller == null) { this._controller = TextEditingController.fromValue(oldWidget.controller.value); } if (this.widget.controller != null) { this.setValue(this.widget.controller.text); if (oldWidget.controller == null) { this._controller = null; } } } }
public override void initState() { base.initState(); StatusBarManager.statusBarStyle(false); var user = this.widget.viewModel.user; this._fullNameController = new TextEditingController(text: user.fullName); this._titleController = new TextEditingController(text: user.title); var jobRole = Resources.Load <TextAsset>("files/JobRole").text; this._jobRole = JsonConvert.DeserializeObject <Dictionary <string, string> >(value: jobRole); SchedulerBinding.instance.addPostFrameCallback(_ => { if (this.widget.viewModel.fullName.Length > 0 || this.widget.viewModel.title.Length > 0 || this.widget.viewModel.jobRole != null) { this.widget.actionModel.cleanPersonalInfo(); } this.widget.actionModel.changeFullName(obj: user.fullName); this.widget.actionModel.changeTitle(obj: user.title); var jobRoleIds = user.jobRoleIds ?? new List <string>(); var jobRoleMap = user.jobRoleMap ?? new Dictionary <string, JobRole>(); jobRoleIds.ForEach(jobRoleId => { if (jobRoleMap.ContainsKey(key: jobRoleId)) { var jonRole = jobRoleMap[key: jobRoleId]; this.widget.actionModel.changeJobRole(obj: jonRole); } }); }); }
public MatchConditionWidget(string hintText, VoidCallback startMatchAction, string regexCondition) { HintText = hintText; CondtioinController = new TextEditingController(""); StartMatchAction = startMatchAction; RegexCondition = regexCondition; }
public override void initState() { base.initState(); if (this.widget.controller == null) { this._controller = new TextEditingController(); } }
public override void initState() { base.initState(); this._textFieldKey = (GlobalKey)this.widget.textFieldKey ?? GlobalKey.key("textFieldKey"); this._controller = this.widget.controller ?? new TextEditingController(""); this._focusNode = this.widget.focusNode ?? new FocusNode(); this._controller.addListener(this._onTextChanged); }
public override void initState() { base.initState(); m_MentionCandidates = new HashSet <string>(); m_TextEditingController = new TextEditingController(); widget.focusNode.addListener(OnFocusChanged); m_TextEditingController.addListener(TextControllerListener); }
public override void initState() { base.initState(); if (this.widget.controller == null) { this._controller = new TextEditingController(); this._controller.addListener(this.updateKeepAlive); } }
public override void initState() { base.initState(); _filterType = FilterType.manual; _textEditingController = new TextEditingController(); _focusNode = new FocusNode(); _screenOverlayState = ScreenOverlay.of(context); _screenOverlayState.AddOnTapListener(LoseFocus); }
public InputField( Key key = null, TextEditingController controller = null, FocusNode focusNode = null, bool obscureText = false, bool autocorrect = true, bool enabled = true, TextStyle style = null, TextAlign textAlign = TextAlign.left, int maxLines = 1, bool autofocus = false, string hintText = null, TextStyle hintStyle = null, string labelText = null, TextStyle labelStyle = null, Color cursorColor = null, float cursorWidth = 2, Radius cursorRadius = null, TextInputAction textInputAction = TextInputAction.none, TextInputType keyboardType = null, float height = 44.0f, InputFieldClearButtonMode clearButtonMode = InputFieldClearButtonMode.never, bool enableInteractiveSelection = true, Color selectionColor = null, ValueChanged <string> onChanged = null, ValueChanged <string> onSubmitted = null, EdgeInsets scrollPadding = null ) : base(key) { this.controller = controller; this.textAlign = textAlign; this.focusNode = focusNode; this.obscureText = obscureText; this.autocorrect = autocorrect; this.enabled = enabled; this.style = style; this.textAlign = textAlign; this.maxLines = maxLines; this.autofocus = autofocus; this.hintText = hintText; this.hintStyle = hintStyle; this.labelText = labelText; this.labelStyle = labelStyle; this.height = height; this.clearButtonMode = clearButtonMode; this.enableInteractiveSelection = enableInteractiveSelection; this.selectionColor = selectionColor ?? new Color(0x667FAACF); this.cursorColor = cursorColor; this.cursorWidth = cursorWidth; this.cursorRadius = cursorRadius ?? Radius.circular(1.0f); this.textInputAction = textInputAction; this.keyboardType = keyboardType; this.onChanged = onChanged; this.onSubmitted = onSubmitted; this.scrollPadding = scrollPadding; }
public override void initState() { base.initState(); _selectionGestureDetectorBuilder = new _CupertinoTextFieldSelectionGestureDetectorBuilder(state: this); if (widget.controller == null) { _controller = new TextEditingController(); _controller.addListener(updateKeepAlive); } }
public override void initState() { base.initState(); mTitleController = new TextEditingController(widget.Note.Title); mDescriptionController = new TextEditingController(widget.Note.Description); mPriorityIndex = widget.Note.Priority; mColorIndex = widget.Note.ColorIndex; mNotebookId = widget.Note.NotebookId; }
public override void initState() { base.initState(); _selectionGestureDetectorBuilder = new _TextFieldSelectionGestureDetectorBuilder(state: this); if (widget.controller == null) { _controller = new TextEditingController(); } _effectiveFocusNode.canRequestFocus = _isEnabled; }
public override void initState() { base.initState(); this._textEditingController = this.widget.controller != null ? this.widget.controller : new TextEditingController(""); this._focusNode = this.widget.focusNode != null ? this.widget.focusNode : new FocusNode(); this._isHintTextHidden = false; this._isFocus = this.widget.autofocus; this._textEditingController.addListener(this._controllerListener); this._focusNode.addListener(this._focusNodeListener); }
public override void initState() { base.initState(); if (this.widget.controller == null) { this._controller = new TextEditingController(text: this.widget.initialValue); } else { this.widget.controller.addListener(this._handleControllerChanged); } }
public override void initState() { base.initState(); this._controller = new TextEditingController(""); this._focusNode = new FocusNode(); if (this.widget.doSearch != null) { Window.instance.scheduleMicrotask(() => this.widget.doSearch("")); } this._controller.addListener(this.textChange); }
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, TextAlign textAlign = TextAlign.left, TextDirection textDirection = TextDirection.ltr, bool autofocus = false, bool obscureText = false, bool autocorrect = false, int?maxLines = 1, 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.down, bool?enableInteractiveSelection = null, GestureTapCallback onTap = null, InputCounterWidgetBuilder buildCounter = null ) : base(key: key) { D.assert(maxLines == null || maxLines > 0); D.assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0); this.controller = controller; this.focusNode = focusNode; this.decoration = noDecoration ? null : (decoration ?? new InputDecoration()); this.textInputAction = textInputAction; this.textCapitalization = textCapitalization; this.style = style; this.textAlign = textAlign; this.textDirection = textDirection; this.autofocus = autofocus; this.obscureText = obscureText; this.autocorrect = autocorrect; this.maxLines = maxLines; 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.cursorRadius = cursorRadius; this.onSubmitted = onSubmitted; this.keyboardAppearance = keyboardAppearance; this.enableInteractiveSelection = enableInteractiveSelection; this.onTap = onTap; this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline); this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f); this.dragStartBehavior = dragStartBehavior; this.buildCounter = buildCounter; }
public override void didUpdateWidget(StatefulWidget oldWidget) { base.didUpdateWidget(oldWidget); if (this.widget.controller == null && ((TextField)oldWidget).controller != null) { this._controller = TextEditingController.fromValue(((TextField)oldWidget).controller.value); } else if (this.widget.controller != null && ((TextField)oldWidget).controller == null) { this._controller = null; } bool isEnabled = this.widget.enabled ?? this.widget.decoration?.enabled ?? true; bool wasEnabled = ((TextField)oldWidget).enabled ?? ((TextField)oldWidget).decoration?.enabled ?? true; if (wasEnabled && !isEnabled) { this._effectiveFocusNode.unfocus(); } }
Widget _buildInputItem( string tipText, string placeHold, TextEditingController controller, FocusNode focusNode, ValueChanged <string> onChanged, ValueChanged <string> onSubmitted, int?maxLength, Key key ) { return(new Container( color: CColors.White, height: 60, padding: EdgeInsets.symmetric(horizontal: 16), child: new Row( children: new List <Widget> { new Container( width: 78, child: new Text(data: tipText, style: CTextStyle.PLargeBody4) ), new Expanded( child: new InputField( key: key, height: 60, controller: controller, focusNode: focusNode, maxLength: maxLength, style: CTextStyle.PLargeBody, hintText: placeHold, hintStyle: CTextStyle.PLargeBody4, cursorColor: CColors.PrimaryBlue, clearButtonMode: InputFieldClearButtonMode.whileEditing, onChanged: onChanged, onSubmitted: onSubmitted ) ) } ) )); }
public override void didUpdateWidget(StatefulWidget oldWidget) { base.didUpdateWidget(oldWidget); if (widget.controller == null && ((TextField)oldWidget).controller != null) { _controller = TextEditingController.fromValue(((TextField)oldWidget).controller.value); } else if (widget.controller != null && ((TextField)oldWidget).controller == null) { _controller = null; } _effectiveFocusNode.canRequestFocus = _isEnabled; if (_effectiveFocusNode.hasFocus && widget.readOnly != ((TextField)oldWidget).readOnly) { if (_effectiveController.selection.isCollapsed) { _showSelectionHandles = !widget.readOnly; } } }
public override void didUpdateWidget(StatefulWidget oldWidget) { oldWidget = (CupertinoTextField)oldWidget; base.didUpdateWidget(oldWidget); if (widget.controller == null && ((CupertinoTextField)oldWidget).controller != null) { _controller = TextEditingController.fromValue(((CupertinoTextField)oldWidget).controller.value); _controller.addListener(updateKeepAlive); } else if (widget.controller != null && ((CupertinoTextField)oldWidget).controller == null) { _controller = null; } bool isEnabled = widget.enabled ?? true; bool wasEnabled = ((CupertinoTextField)oldWidget).enabled ?? true; if (wasEnabled && !isEnabled) { _effectiveFocusNode.unfocus(); } }
private IPromise <object> showSelectDialog() { return(DialogUtils.showDialog( context: context, builder: (context) => { TextEditingController textEditingController = new TextEditingController(); return new SimpleDialog( title: new Text("选择来源"), children: new List <Widget> { new SimpleDialogOption( child: new Text("打开相机"), onPressed: () => { Navigator.of(context).pop(false); } ), new SimpleDialogOption( child: new Text("从相册中选择"), onPressed: () => { Navigator.of(context).pop(true); } ), }); })); }
public static Widget SettingPasswordField(string title, string value, ValueChanged <string> valueChanged = null) { bool _showPassword = true; TextEditingController _textEditingController = new TextEditingController(text: value); return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container(child: new Text(title)), new Container(width: 20), new Expanded( child: new Container( alignment: Alignment.bottomRight, child: new TextField( obscureText: _showPassword, controller: _textEditingController, //decoration: new InputDecoration( // labelText:"Password", // suffixIcon: new IconButton( // icon: new Icon(_showPassword ? Unity.UIWidgets.material.Icons.delete : Unity.UIWidgets.material.Icons.accessible), // onPressed:()=>{ // state.setState(()=>{ // _showPassword =!_showPassword; // }); // }//onPressed // )//IconButton //),//InputDecoration onChanged: valueChanged ) ) //container ) //expanded } //list ) //row ));;; }
public TextFieldExtern(string hintText, EdgeInsets margin = null, bool obscureText = false, TextEditingController editingController = null, ValueChanged <string> onChanged = null, int maxLength = 32, string regexCondition = null ) { HintText = hintText; EditingController = editingController; Margin = margin; ObscureText = obscureText; this.onChanged = onChanged; this.MaxLength = maxLength; this.RegexCondition = regexCondition; this.TextInputFormatter = new List <TextInputFormatter>(); TextInputFormatter.Add(new LengthLimitingTextInputFormatter(MaxLength)); if (regexCondition != null) { TextInputFormatter.Add(new RegexMatchTextFormatter(RegexCondition)); } }
public override void initState() { base.initState(); this._focusNode = new FocusNode(); this._controller = new TextEditingController(""); }
public override Widget build(BuildContext context) { base.build(context); // See AutomaticKeepAliveClientMixin. D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(WidgetsD.debugCheckHasDirectionality(context)); ThemeData themeData = Theme.of(context); TextStyle style = this.widget.style ?? themeData.textTheme.subhead; Brightness keyboardAppearance = this.widget.keyboardAppearance ?? themeData.primaryColorBrightness; TextEditingController controller = this._effectiveController; FocusNode focusNode = this._effectiveFocusNode; List <TextInputFormatter> formatters = this.widget.inputFormatters ?? new List <TextInputFormatter>(); if (this.widget.maxLength != null && this.widget.maxLengthEnforced) { formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength)); } Widget child = new RepaintBoundary( child: new EditableText( key: this._editableTextKey, controller: controller, focusNode: focusNode, keyboardType: this.widget.keyboardType, textInputAction: this.widget.textInputAction, textCapitalization: this.widget.textCapitalization, style: style, textAlign: this.widget.textAlign, textDirection: this.widget.textDirection, autofocus: this.widget.autofocus, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, maxLines: this.widget.maxLines, selectionColor: themeData.textSelectionColor, selectionControls: this.widget.enableInteractiveSelection ? MaterialUtils.materialTextSelectionControls : null, onChanged: this.widget.onChanged, onEditingComplete: this.widget.onEditingComplete, onSubmitted: this.widget.onSubmitted, onSelectionChanged: this._handleSelectionChanged, inputFormatters: formatters, rendererIgnoresPointer: true, cursorWidth: this.widget.cursorWidth, cursorRadius: this.widget.cursorRadius, cursorColor: this.widget.cursorColor ?? Theme.of(context).cursorColor, scrollPadding: this.widget.scrollPadding, keyboardAppearance: keyboardAppearance, enableInteractiveSelection: this.widget.enableInteractiveSelection ) ); if (this.widget.decoration != null) { child = new AnimatedBuilder( animation: ListenableUtils.merge(new List <Listenable> { focusNode, controller }), builder: (_context, _child) => { return(new InputDecorator( decoration: this._getEffectiveDecoration(), baseStyle: this.widget.style, textAlign: this.widget.textAlign, isFocused: focusNode.hasFocus, isEmpty: controller.value.text.isEmpty(), child: _child )); }, child: child ); } return(new IgnorePointer( ignoring: !(this.widget.enabled ?? this.widget.decoration?.enabled ?? true), child: new GestureDetector( behavior: HitTestBehavior.translucent, onTapDown: this._handleTapDown, onTap: this._handleTap, onTapCancel: this._handleTapCancel, onLongPress: this._handleLongPress, child: child ) )); }
public override void initState() { base.initState(); _controller = new TextEditingController(Application.productName); _focusNode = new FocusNode(); }
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, TextDirection?textDirection = null, TextAlign textAlign = TextAlign.left, bool autofocus = false, bool obscureText = false, bool autocorrect = true, bool autovalidate = false, bool maxLengthEnforced = true, int maxLines = 1, int?maxLength = 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 ) : 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); return(new TextField( controller: state._effectiveController, focusNode: focusNode, decoration: effectiveDecoration.copyWith(errorText: field.errorText), keyboardType: keyboardType, textInputAction: textInputAction, style: style, textAlign: textAlign, textDirection: textDirection ?? TextDirection.ltr, textCapitalization: textCapitalization, autofocus: autofocus, obscureText: obscureText, autocorrect: autocorrect, maxLengthEnforced: maxLengthEnforced, maxLines: maxLines, maxLength: maxLength, onChanged: field.didChange, onEditingComplete: onEditingComplete, onSubmitted: onFieldSubmitted, inputFormatters: inputFormatters, enabled: enabled, cursorWidth: cursorWidth, cursorRadius: cursorRadius, cursorColor: cursorColor, scrollPadding: scrollPadding ?? EdgeInsets.all(20.0f), keyboardAppearance: keyboardAppearance, enableInteractiveSelection: enableInteractiveSelection, buildCounter: buildCounter )); } ) { D.assert(initialValue == null || controller == null); D.assert(maxLines > 0); D.assert(maxLength == null || maxLength > 0); this.controller = controller; }