简体   繁体   English

Flutter - 如何实现搜索栏

[英]Flutter - How to implement search bar

I want to implement search feature in flutter. When a person clicks on search bar in the home page it should take him to the actual search page.我想在 flutter 中实现搜索功能。当有人点击主页上的搜索栏时,它应该将他带到实际的搜索页面。 In that case, what widget should I use in the home page?在那种情况下,我应该在主页中使用什么小部件? A container having icon and textbutton (on clicking, it will take us to actual search page)?一个有图标和文本按钮的容器(点击后,它会把我们带到实际的搜索页面)? Can someone help?有人可以帮忙吗?

Yeah, a container with an icon and text button should be fine.是的,带有图标和文本按钮的容器应该没问题。 You can navigate the user to the search page on click go the container.您可以通过单击 go 容器将用户导航到搜索页面。

InkWell(
  onTap: () {
    Navigator.of(context).push(MaterialPageRoute(
       builder: (context) {
         return SearchPage();
       }
    ))
  },
)

This is should do.这是应该做的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM