Skip to content

Instantly share code, notes, and snippets.

@devmnj
Created January 18, 2022 17:49
Show Gist options
  • Select an option

  • Save devmnj/ee5e0ed076204c7a3fe23af8e67012bd to your computer and use it in GitHub Desktop.

Select an option

Save devmnj/ee5e0ed076204c7a3fe23af8e67012bd to your computer and use it in GitHub Desktop.
Flutter search widget
class SearchBox extends StatelessWidget {
const SearchBox({Key? key, required this.hintText, required this.controller})
: super(key: key);
final String hintText;
final TextEditingController controller;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
TextField(
controller: controller,
decoration: InputDecoration(
border: const OutlineInputBorder(
borderSide: BorderSide(width: 2),
borderRadius: BorderRadius.all(Radius.circular(30.0)),
),
hintText: hintText,
suffixIcon: const Icon(Icons.search),
),
),
],
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment