lzhuor / auto_size_text_field

Flutter TextField widget that automatically resizes text field to fit perfectly within its bounds.
https://pub.dev/packages/auto_size_text_field
MIT License
52 stars 35 forks source link

AutoSizeTextField not working at all !!! #3

Closed salonikohse2001 closed 4 years ago

salonikohse2001 commented 4 years ago

**I have just copy pasted the code provided in the example section ->https://pub.dev/packages/auto_size_text_field/example . It is not auto resizing at all.

Please look into it at the earliest.**

Here is the code: `import 'package:auto_size_text_field/auto_size_text_field.dart'; import 'package:flutter/material.dart';

class NotWorking extends StatefulWidget { NotWorking({Key key, this.title}) : super(key: key); final String title;

@override _NotWorkingState createState() => _NotWorkingState(); }

class _NotWorkingState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Not Working'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Fixed width (full width of parent\'s BoxConstraints)', ), Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: AutoSizeTextField( controller: TextEditingController(), minFontSize: 24, style: TextStyle(fontSize: 64), ), ), SizedBox( height: 48, ), Text( 'Auto adjusted width based on contents', ), Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: AutoSizeTextField( textAlign: TextAlign.center, fullwidth: false, controller: TextEditingController(), minFontSize: 24, style: TextStyle(fontSize: 64), ), ), SizedBox( height: 48, ), Text('Auto adjusted width with hintText and minWidth'), Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: AutoSizeTextField( controller: TextEditingController(), decoration: InputDecoration(hintText: 'Hint Text'), fullwidth: false, minFontSize: 24, minWidth: 280, style: TextStyle(fontSize: 64), textAlign: TextAlign.center, ), ) ], ), ), // This trailing comma makes auto-formattig nicer for build methods. ); } } `

Image attached:

not_working

vasurana commented 4 years ago

Hey did you find any solution? I am facing the same issue. Please help. It's urgent.

lzhuor commented 4 years ago

Hey @vasurana , could you please post some reproducible code so I can take a look?

It's very likely that you do not have a layout container outside which can limit the size of the children.

lzhuor commented 4 years ago

Hi @vasurana @salonikohse2001 this should have been fixed as part of this commit https://github.com/lzhuor/auto_size_text_field/commit/20a7f8f343abfedba9d5b08be5ac9082f962b3a1