PerfectTextController constructor
PerfectTextController({})
Implementation
PerfectTextController({
FocusNode? focusNode,
bool selectAllOnFocus = false,
bool readyOnly = false,
this.onTextChange,
this.onFocusChange,
this.decorations = const [],
}) : focusNode = focusNode ??
(readyOnly
? FocusNode(
skipTraversal: true,
canRequestFocus: false,
descendantsAreFocusable: false,
descendantsAreTraversable: false,
)
: FocusNode()) {
this.focusNode.addListener(() {
PerfectTextController.focused =
this.focusNode.hasPrimaryFocus ? this : null;
if (selectAllOnFocus) {
onFocusChange?.call(this.focusNode.hasPrimaryFocus);
if (this.focusNode.hasPrimaryFocus) {
selectAll();
}
}
});
}