Example of Set Change TextField Width Height in Flutter

Hello friends, In today’s tutorial we would learn about a simple but useful thing in flutter. We have used many times the TextField widget in flutter to get input from user. Now the TextField widget itself does not support width and height. To set width and height of TextField widget we have to use SizedBox widget as its parent widget. Now we would wrap the TextField into SizedBox as its child. Then we would apply both width and height on the SizedBox and it will automatically applied on TextField widget. So in this tutorial we would learn about Example of Set Change TextField Width Height in Flutter.

Contents in this project Example of Set Change TextField Width Height in Flutter :-

1. Open your project’s main.dart file and import Material package.

2. Creating our void main runApp() method and here we would call our main MyApp class.

3. Creating our main class MyApp extends StatelessWidget.

4. Now inside the Widget Build area we would make our SizedBox widget and put TextField as its child. Here we would apply the width and height on SizedBox.

5. Complete source code for main.dart file :-

Screenshot :-

Example of Set Change TextField Width Height in Flutter

Leave a Reply

Your email address will not be published.