Flutter, widget next to the last letter of TextFormField

Viewed 449

enter image description here

I want to move the box that is full of red background over there to the position of the empty box.

In other words, I want to insert a container right next to the point where TextFormField ends.

Is this something that can be implemented in Flutter? Or is there no way?

-- UPDATE

I actually want to add a "send" Icon to the end of the text. All the examples I looked up were always going to the end of the Containers due to Rows, as shown in the photos I posted. Since the position of the send icon will always change, depending on the length of the text, in real time, this problem feels very difficult to me. and also for your information, this is not Text, but TextField or TextFormField widget.

2 Answers

Unfortunately, there is no way of doing this since TextFormField accepts string only and not a widget. Also, according to material guidelines, any such widget should be at the end of the text field as a suffix such as:

TextField(
  controller: _controller,
  decoration: InputDecoration(
    hintText: "Enter a message",
    suffixIcon: IconButton(
      onPressed: () => _controller.clear(),
      icon: Icon(Icons.clear),
    ),
  ),
)

May I ask what is the purpose?! maybe we can help find better solution then?

but if we have to then I can think of 2 ways.

1- Include the box as a Text - For example ▀ (Alt + 223)

var box = ▀
Text("efwewewefwewefe$box"),

2- Option 2: Wrap in a Stack widget

Stack(
children: [
Text("efwewewefwewefe"),
Container(height:5, width:5, color: Colors.red]),
Related