title: Variable is not being updated in a widget shown on a bottom sheet built using showModalBottomSheet() method in Flutter
body: <p>I have a widget called <code>testWidget</code> and it has two children: a <code>TextField</code> and a <code>FlatButton</code>. </p>
  
  <p>I want to do something with the text typed in <code>TextField</code> when the user presses <code>FlatButton</code>. Following is the code:</p>
  
  <pre><code>class TestWidget extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      String textVal = '';
      return Scaffold(
        appBar: AppBar(
          title: Text('Testing'),
        ),
        body: Column(
          children: &lt;Widget&gt;[
            TextField(
              textAlign: TextAlign.center,
              onChanged: (String newVal) {
                textVal = newVal;
                print('Typing: ' + textVal);
              },
            ),
            FlatButton(
              child: Text('Press Button'),
              onPressed: () {
                print('Value got: ' + textVal);
              },
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  
  <p>The problem occurs when I show <code>TestWidget</code> on a bottom sheet with  <code>showModalBottomSheet()</code>, as following:</p>
  
  <pre><code>showModalBottomSheet(context: context, builder: (context) =&gt; TestWidget());
  </code></pre>
  
  <p>The variable <code>textVal</code> is updated inside the <code>onChanged</code> callback in <code>TextField</code>, but when the user presses the <code>FlatButton</code> after typing something, the variable <code>textVal</code> is not updated. I have printed the value of <code>textVal</code> updated in <code>onChanged</code>, and <code>onPressed</code> of <code>FlatButton</code>.</p>
  
  <p>The output is:</p>
  
  <pre><code>I/flutter (11067): Typing: N
  I/flutter (11067): Typing: Ne
  I/flutter (11067): Typing: New
  I/flutter (11067): Typing: New 
  I/flutter (11067): Typing: New t
  I/flutter (11067): Typing: New te
  I/flutter (11067): Typing: New tex
  I/flutter (11067): Typing: New text
  I/flutter (11067): Typing: New text 
  I/flutter (11067): Typing: New text T
  I/flutter (11067): Typing: New text Ty
  I/flutter (11067): Typing: New text Typ
  I/flutter (11067): Typing: New text Type
  I/flutter (11067): Typing: New text Typed
  (After typing Text, User pressed FlatButton)
  I/flutter (11067): Value got: 
  </code></pre>
  
  <p>The value printed is ' ', which was the initialization value of textVal, NOT the updated value.</p>
  
  <p>I want TestWidget to be stateless.</p>