Input Field or TextField is the most important thing in any programming language. Input fields are used to take any input from the user and there is no programming language that does not provide the facility for user input. Flutter also provides an input field and forms to get or collect input from the user. 

TextField Widget in Flutter

TextField is the most commonly used text input widget in flutter applications.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
          child: TextField(decoration: InputDecoration(hintText: 'Enter something',),),
          // Text Field Widget with InputDecoration
        ),
    );
  }
}

Form Class in Flutter

An optional container for grouping together multiple form field widgets (e.g. TextField widgets) is known as Form class in Flutter.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
            child: Form( //Flutter Form
              child: Column(
                children: [
                  TextField(decoration: InputDecoration(hintText: "Enter your Name"),), //TextField
                  RaisedButton(onPressed: (){
                    //Process data
                  }, child: Text("Submit")),
                ],
              )
            ),
        ),
    );
  }
}

Output of Form and TextField Widget in Flutter

TextField and Form Widget in Flutter

Complete Flutter Series List: Click here 

Categories: Blog Tags: flutter, review2tech flutter series, textbox widget, form class, textbox in flutter, form in flutter, flutter android, flutter ios


1 Comments

  • Comment

    jordans

    2020-08-23 02:05:34

    I have to voice my affection for your kind-heartedness for those who really need guidance on that area of interest. Your special commitment to getting the message up and down has been remarkably practical and have truly helped many people much like me to reach their endeavors. The important guideline signifies a great deal a person like me and substantially more to my colleagues. Many thanks; from each one of us.

    Reply

Leave a comment