I think this is probably not too complicated, but I am new to coding and don't understand this, nor could I find an explanation online that I could understand.
In my app my AppBar includes both a title and a bottom, the title has been just text, and the bottom was a TextFormField users used to search through my database.
Recently I updated the title to a DropdownButton, and I wanted to use what the user selected there to change the the search parameters in my TextFormField (so that it would search different columns in my database).
I built the DropdownButton in a separate document, and then inserted it into title. Finding how to use it has been more tricky.
I built some sort of callback, which worked to print in my console, but I couldn't figure out how to pass the information into my TextFormField.
class HomePage extends StatelessWidget {
HomePage({Key key, this.title}) : super(key: key);
_handleValueReturned(value) {
if (value == 1) {print('This works');} if (value == 2) {print('This works not');} else {return null;}
}
...
appBar: AppBar(
title: DropDownButton(
valueReturned: _handleValueReturned,
),
bottom:...
...
Do I have to use some sort of provider or "of" or packages like Eventifier or ChangeNotifier? I couldn't figure out how all these things worked.