How to create toolbar searchview in flutter

With the help @aziza answer i write detail code snippet of search view with list filter below. it will help for others import ‘package:flutter/material.dart’; class SearchList extends StatefulWidget { SearchList({ Key key }) : super(key: key); @override _SearchListState createState() => new _SearchListState(); } class _SearchListState extends State<SearchList> { Widget appBarTitle = new Text(“Search Sample”, style: … Read more

Styling a SearchView in Android Action Bar

I have been spending many time for this but finally: 🙂 To change the text color : ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setTextColor(Color.WHITE); or this one for AndroidX: ((EditText)searchView.findViewById(androidx.appcompat.R.id.search_src_text)).setTextColor(Color.WHITE); To change the text hint: ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setHintTextColor(Color.WHITE); or this one for AndroidX: ((EditText)searchView.findViewById(androidx.appcompat.R.id.search_src_text)).setHintTextColor(Color.WHITE);

How to set SearchView TextSize?

You can achieve this using a theme: in styles.xml <style name=”AppSearchView” parent=”Widget.AppCompat.SearchView” > <item name=”android:textSize”>60sp</item> </style> And using a SearchView <android.support.v7.widget.SearchView android:id=”@+id/searchView” android:layout_width=”350dp” app:theme=”@style/AppSearchView” android:layout_height=”80dp” android:layout_marginTop=”15dp”/>

SearchView in OptionsMenu not full width

Instead of creating a new layout I set the MaxWidth programmatically in onCreateOptionsMenu(): @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_search, menu); SearchView searchView = (SearchView)menu.findItem(R.id.menu_search).getActionView(); searchView.setMaxWidth(Integer.MAX_VALUE); ….