Flutter can't move cursor in textformfield

291 views Asked by At

As my title says i can't move cursor anywhere inside TextFormField anyone faced the same issue as me ? could

please help.

i looked everywhere and haven't seen anyone has same issue as me i even tried adding textDirection from Left To Right but it doesn't solve my issue

      textDirection: TextDirection.ltr,

and thanks .

1

There are 1 answers

0
Salih Can On

You should add a listener to textfield. For example;

    _controller.addListener(() {
      _controller.value = _controller.value.copyWith(
        text: _controller.text,
        selection: const TextSelection.collapsed(offset: 2), // Here your position calculate logic
        composing: TextRange.empty,
      );
    });