title: Insert into TextField using buttons from another widget - Flutter
body: <p>I have a TextField that serves as a search bar where the user can use the built in Android/iOS keyboard to type but also has the possibility to insert a special characters in the search bar from a button. In a way the typing and the other insertion is combined into one string</p>
  
  <p><em>use case:</em> The user types <em>hell</em> in the search bar then presses the button widget the search bar value becomes : hellö</p>
  
  <p>I set up everything but when I click the button nothing happens (the typing from the keyboard works fine)</p>
  
  <p>Here's my code: </p>
  
  <pre><code>//I have this as a global variable
  TextEditingController _searchInputControllor = TextEditingController();
  
  //This is the TextField
  class _SearchBarState extends State&lt;SearchBar&gt; { 
    @override
    Widget build(BuildContext context) {
      return TextField( 
      enableInteractiveSelection: false,                     
      controller: _searchInputControllor,
      cursorColor: primaryDark,
      decoration: InputDecoration(
        contentPadding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 15.0),
        border: InputBorder.none,
        hintText: "Search...",
        suffixIcon: Material(                     
          color: Colors.white,
          elevation: 6.0,
          borderRadius: BorderRadius.all(Radius.circular(6.0),),
          child: InkWell(
            splashColor: Colors.greenAccent,
            onTap: () {},
            child: Icon(Icons.search, color: primaryDark,),
           ),
         ),
       ),
     );
    }
  } 
  
  //This is the button widget
  //It is supposed to add to the search bar but nothing happens
  class _SpecialCharState extends State&lt;SpecialChar&gt; {
    @override
    Widget build(BuildContext context) {
      return ButtonTheme(
        minWidth: 40.0,
        child: FlatButton(
          color: Colors.transparent,
          textColor: Colors.black,
          padding: EdgeInsets.all(8.0),
          splashColor: Colors.blue,
          onPressed: () {
            setState(() {
              _searchInputControllor.text = _searchInputControllor.text + widget.btnVal.toLowerCase();
            });
          },
          child: Text(
            widget.btnVal
          ),
        )
      );
     }
    }
  </code></pre>