> For the complete documentation index, see [llms.txt](https://kodestat.gitbook.io/flutter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kodestat.gitbook.io/flutter/flutter-using-onsubmitted-to-show-input-text-after-submit.md).

# 06 Flutter: Using onSubmitted to show input text after submit

{% code title="main.dart" %}

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(
    home: new MyTextInput()
  ));
}

class MyTextInput extends StatefulWidget {
  @override
  MyTextInputState createState() => new MyTextInputState();
}
  
  class MyTextInputState extends State<MyTextInput>{

    String result = "";

    @override
    Widget build(BuildContext context){
      return new Scaffold(
        appBar: new AppBar(title: new Text("Input Text"), backgroundColor: Colors.deepOrange),
        body: new Container(
          child: new Center(
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                new TextField(
                  decoration: new InputDecoration(
                    hintText: "Type in here"
                  ),
                  //onChanged is called whenever we add or delete something on Text Field
                  onSubmitted: (String str){
                    setState((){
                      result = str;
                    });
                  }
                ),
                //displaying input text
                new Text(result)
                ]
              )
          )
        )
      );
    }
}

```

{% endcode %}
