Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Flutter
  2. widgets.dart
  3. TextEditingController
  4. text property
text
description

text property

String gettext

The current string the user is editing.

Implementation

String get text => value.text;
settext(StringnewText)

Updates the currenttext to the givennewText, and removes existingselection and composing range held by the controller.

This setter is typically only used in tests, as it resets the cursorposition and the composing state. For production code,consider using thevalue setter to update thetext value instead, and specify areasonable selection range within the newtext.

Setting this notifies all the listeners of thisTextEditingControllerthat they need to update (it callsnotifyListeners). For this reason,this value should only be set between frames, e.g. in response to useractions, not during the build, layout, or paint phases. This property canbe set from a listener added to thisTextEditingController.

Implementation

set text(String newText) {  value = value.copyWith(    text: newText,    selection: const TextSelection.collapsed(offset: -1),    composing: TextRange.empty,  );}
  1. Flutter
  2. widgets
  3. TextEditingController
  4. text property
TextEditingController class

[8]ページ先頭

©2009-2025 Movatter.jp