title: Display text typed in TextField() when button pressed
body: <p>I want to display the Input given in the <code>TextField</code> to the place instead of the text shown as &quot;result&quot; in the below picture when the <code>FloatingActionButton</code> is pressed.
  <a href="https://i.stack.imgur.com/BBn0O.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BBn0O.jpg" alt="enter image description here" /></a></p>
  <blockquote>
  <blockquote>
  <p>import 'package:flutter/material.dart';</p>
  <pre><code>void main(List&lt;String&gt; args) {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        theme: ThemeData.dark(),
        home: const ScreenHomes(),
      );
    }
  }
  </code></pre>
  </blockquote>
  <pre><code>class ScreenHomes extends StatefulWidget {
    const ScreenHomes({Key? key}) : super(key: key);
  
    @override
    State&lt;ScreenHomes&gt; createState() =&gt; _ScreenHomesState();
  }
  </code></pre>
  </blockquote>
  <pre><code>class _ScreenHomesState extends State&lt;ScreenHomes&gt; {
    @override
    Widget build(BuildContext context) {
      final _textinfield = TextEditingController();
      var newtext = &quot;&quot;;
      return Scaffold(
        appBar: AppBar(backgroundColor: Colors.lightBlue),
        body: SafeArea(
            child: Center(
                child: Column(children: [
          Container(
              child: Text(
            newtext,
            style: TextStyle(fontSize: 50),
          )),
          TextField(
            controller: _textinfield,
            decoration: InputDecoration(
                border: OutlineInputBorder(), hintText: &quot;Type to Print&quot;),
          )
        ]))),
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.print),
            onPressed: () {
              setState(() {
                newtext = _textinfield.text;
              });
            }),
      );
    }
  }
  </code></pre>