Flutter Search Widget

Flutter Search Widget


This is simple Flutter Search Widget using controller

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),
              ),
            ),
          ],
        ));
  }
}

Author: Manoj

Developer and a self-learner, love to work with Reactjs, Angular, Node, Python and C#.Net

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.