MN.
MN.

Reputation: 146

How can I align text input to the far right in flutter

Hi how can I align my text input to the far far right of the colum? The first image is what my current app looks like, and I dont want that(this is the default)

This is what I dont want

I want my input text to look like this, like in the second pic The one I want

I want the top input text to be exactly align with the bottom text. How can I do that?

Here's my code below:

Column(

          crossAxisAlignment: CrossAxisAlignment.end,
          children: <Widget>[
            SizedBox(
              width: 250,
              height: 40,
              child: TextFormField(
                style: Theme.of(context).textTheme.headline4,
                textAlign: TextAlign.right,
                keyboardType: const TextInputType.numberWithOptions(
                  decimal: true,
                ),
                inputFormatters: <TextInputFormatter>[
                  FilteringTextInputFormatter.allow(RegExp(r'[0-9,.]'))
                ],
                decoration: const InputDecoration(
                  border: OutlineInputBorder(
                    borderSide: BorderSide(
                      width: 0,
                      style: BorderStyle.none,
                    ),
                  ),
                ),
                //validator: numberValidator,
              ),
            ),
            Text(
              "words",
              textAlign: TextAlign.right,
            ),
          ],
        )

Upvotes: 0

Views: 277

Answers (1)

Parth Virani
Parth Virani

Reputation: 91

Please column wrap with Row like this

Row(childern:[Expanded(child:your column),SizedBox(width:50)])

Upvotes: 1

Related Questions