lzhuor/auto_size_text_field

Using fullWidth causes unwanted behaviour...

oodavid opened this issue · 5 comments

newlines-a

In this example, I trimmed by Theme data back to nothing

    AutoSizeTextField(
      fullwidth: false,
      minLines: 1,
      maxLines: 10,
    );

newlines-b

In my app, I noticed the issue more prominently with more theming / styling:

    MaterialApp(
      ...
      theme: ThemeData(
        inputDecorationTheme: InputDecorationTheme(
          fillColor: Colors.white,
          filled: true,
          enabledBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(4),
            borderSide: BorderSide(color: Colors.grey),
          ),
          focusedBorder: OutlineInputBorder(
            borderRadius: BorderRadius.circular(4),
            borderSide: BorderSide(color: Colors.blue, width: 3),
          ),
          border: OutlineInputBorder(),
          labelStyle: TextStyle(
            color: Colors.black,
            fontSize: 18,
          ),
          hintStyle: TextStyle(
            color: Colors.black,
            fontSize: 13,
          ),
          contentPadding: EdgeInsets.only(
            left: 15,
            bottom: 11,
            top: 11,
            right: 15,
          ),
        ),
      ),
    );

  ... and in my homescreen ...

    AutoSizeTextField(
      fullwidth: false,
      style: Theme.of(context).textTheme.subtitle1,
      minLines: 1,
      maxLines: 10,
    );

@oodavid Thanks for reporting it. I will take a look.

No problem. I made a pull-request on a similar plugin here:

https://github.com/huyffs/fitted_text_field_container/pull/3

the functional change:
https://github.com/huyffs/fitted_text_field_container/pull/3/files#diff-ca5b9e5f9a78c48e981a6f01a9c6959e

In this case the plugin wasn't taking into account decoration padding, I imagine borders may need to be factored in too.

Selfishly speaking, I'm looking for a plugin that keeps the font size fixed, but the TextField will expand to fit the contents and be able to flow onto multiple lines. I've not tested auto_size_text_field in any other conditions :)

+1 need include padding and border

Thanks @callmejm Could you please provide any runnable code sample about the padding part so I can look into it further?

Resolved by PR #9