Posts

Showing posts from November, 2018

Add New Widget on Button Click

Flutter - Add new Widget on click add a new Widget every time the user clicks a button. Here's my code: class ResponsavelProfilePage extends StatefulWidget { @override _ResponsavelProfilePageState createState () => new _ResponsavelProfilePageState (); } class _ResponsavelProfilePageState extends State < ResponsavelProfilePage > { int _count = 1 ; @override Widget build ( BuildContext context ) { List < Widget > _contatos = new List . generate ( _count , ( int i ) => new ContactRow ()); return new Scaffold ( appBar : new AppBar ( title : new Text ( GlobalConstants . appName ), ), body : new LayoutBuilder ( builder : ( context , constraint ) { final _maxHeight = constraint . biggest . height / 3 ; final _biggerFont = TextStyle ( fontSize : _maxHeight / 6 ); return new Center ( child : new Column ( ...