title: flutter return multiple fields from custom widget
body: <p>I got the below <code>geolocation.dart</code> file, that works perfectly as stand alone widget:</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:flutter/material.dart';
  import 'package:location/location.dart';
  import 'package:flutter/services.dart';
  import 'package:simple_permissions/simple_permissions.dart';
  
  class LocationField extends StatefulWidget {
    const LocationField({
      this.fieldKey,
      this.onSaved,
    });
  
    final Key fieldKey;
    final FormFieldSetter&lt;String&gt; onSaved;
  
    @override
    _LocationFieldState createState() =&gt; _LocationFieldState();
  }
  
  class _LocationFieldState extends State&lt;LocationField&gt; {
    Location _location = new Location();
  
    final lat = TextEditingController();
    final lon = TextEditingController();
  
  
    // @override
    // void initState() {
    //   super.initState();
    //  lat.addListener(_addLatValue);
    //  lon.addListener(_addLonValue);
    //}
  
    @override
    Widget build(BuildContext context) {
      return Row(
        textDirection: TextDirection.rtl,
        children: &lt;Widget&gt;[
          FlatButton(
            child: const Icon(Icons.my_location),
            onPressed: () =&gt; _getLocation(),
          ),
          Expanded(child: Column(
              textDirection: TextDirection.ltr,
              children: &lt;Widget&gt;[
                  TextFormField(
                    controller: lat,
                    decoration: InputDecoration(
                        prefixIcon: Text("Latittude:     ")
                    ),
                  ),
                  TextFormField(
                      controller: lon,
                      decoration: InputDecoration(
                          prefixIcon: Text("Longitude:   ")
                      ),
                  )
              ])
  
          )
        ],
      );
  
    }
  
    _getLocation() async {
      Map&lt;String, double&gt; location;
      var error = null;
  
      try {
        await SimplePermissions.requestPermission(Permission.AccessFineLocation);
        location = await _location.getLocation();
      } on PlatformException catch (e) {
        if (e.code == 'PERMISSION_DENIED') {
          error = 'Permission denied';
        } else if (e.code == 'PERMISSION_DENIED_NEVER_ASK') {
          error =
          'Permission denied - please ask the user to enable it from the app settings';
        }
        location = null;
      }
      print("error $error");
  
      setState(() {
            lat.text = ('${location["latitude"]}');
            lon.text = ('${location["longitude"]}');
      });
    }
  }
  </code></pre>
  
  <p>And display the below, at which the location coordinate appear upon clicking the location icon, as below:</p>
  
  <p><a href="https://i.stack.imgur.com/gTpKb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gTpKb.png" alt="enter image description here"></a> </p>
  
  <p>I can also insert it as a widget in my main app, as:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class _SignUpPageState extends State&lt;SignUpPage&gt; {
       @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: new AppBar(),
        body: Form(
            key: _formKey,
            child: Column(
              children: &lt;Widget&gt;[
                LocationField(),
                RaisedButton(
                  onPressed: signUp,
                  child: Text('Sign up'),
                ),
              ],
            )
        ),
      );
    }
  
    void signUp() {
    // what to write here to get the geolocation points lat/lon printed?
  }
  </code></pre>
  
  <p>My question, is: How can I get the geolocation points lat/lon printed upon clicking the <code>signup</code> button, how can I get the value of the 2 fields from the sub-widget?</p>