Skip to content

Instantly share code, notes, and snippets.

@ShivamGoyal1899
Created July 18, 2019 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShivamGoyal1899/76996237c4cea653bcecfc0797e63edd to your computer and use it in GitHub Desktop.
Save ShivamGoyal1899/76996237c4cea653bcecfc0797e63edd to your computer and use it in GitHub Desktop.
class _SearchTabState extends State<SearchTab> {
TextEditingController _controller;
FocusNode _focusNode;
String _terms = '';
@override
void initState() {
super.initState();
_controller = TextEditingController()..addListener(_onTextChanged);
_focusNode = FocusNode();
}
@override
void dispose() {
_focusNode.dispose();
_controller.dispose();
super.dispose();
}
void _onTextChanged() {
setState(() {
_terms = _controller.text;
});
}
Widget _buildSearchBox() {
return Padding(
padding: const EdgeInsets.all(8),
child: SearchBar(
controller: _controller,
focusNode: _focusNode,
),
);
} // TO HERE
@override
Widget build(BuildContext context) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment