TextField/TextFormField keeps displaying the beginning of input string when the input string doesn't fit in the text field entirely

Viewed 133

I want to display the end of the input string when the input doesn't fit in the TextField anymore.

As seen in the above screen recording, as soon as the input text gets big enough to not fit in the TextField, the view is stuck at the beginning of the field. I want to somehow keep displaying the end of the text (as the input gets bigger) and scrollable to the beginning (the exact opposite of what it is now). Is this possible?

This is my code:

Consumer(
  builder: (context, ref, _) {
    current.text = ref.watch(historyProvider.state).state;
    return Align(
      alignment: Alignment.topRight,
      child: TextField(
        toolbarOptions: const ToolbarOptions(
          copy: true,
          selectAll: true,
        ),
        decoration: const InputDecoration(
          border: InputBorder.none,
        ),
        keyboardType: TextInputType.none,
        controller: current,
        showCursor: false,
        textAlign: TextAlign.end,
        cursorColor: Colors.transparent,
        style: const TextStyle(
            fontSize: 28, color: Color(0xFF7F7FA5)),
      ),
    );
  },
),
1 Answers

Try this one----

 SingleChildScrollView(
        scrollDirection: Axis.horizontal,
        child: ConstrainedBox(
          constraints: BoxConstraints.expand(width: 100),
          child: TextField(
            maxLines: 1,
            // controller and etc.
          ),
        ),
      )
Related