LoritoTiago / awesome_place_search

The awesome_place_search package is a Flutter library that provides a user interface for searching places using the Google Places API. With this package, you can easily implement a location search bar that shows suggestions as the user types.
MIT License
6 stars 7 forks source link

How to given custom textfield color and how background color change. ( Also support app theme) #22

Open SaritaAgravat opened 2 months ago

LoritoTiago commented 2 months ago

You can configure the searchTextFieldDecoration options.

Here is an example of how to do this:

AwesomePlaceSearch(
  hint: "Search places...",
  searchTextFieldDecoration: InputDecoration(
    filled: true,
    fillColor: Theme.of(context).colorScheme.surface, // Background color for the text field
    border: OutlineInputBorder(
      borderRadius: BorderRadius.circular(12.0),
    ),
  ),
  modalBorderRadius: BorderRadius.circular(12.0),
  // Other properties...
).show();
SaritaAgravat commented 2 months ago

I worked on given code. But full screen background color not support. f1385f3c-cd44-4c91-8405-8f647692ddc1

How to change text color only. not want to text filed border

code is here

AwesomePlaceSearch( context: context, apiKey: ConstantValue.value_google_api, countries: [], hint: "Search", dividerItemColor: Colors.grey.withOpacity(.5), dividerItemWidth: .5, elevation: 5, indicatorColor: Colors.blue, modalBorderRadius: 50.0, searchTextFieldDecoration: InputDecoration( filled: true, fillColor: backColor , // Background color for the text field border: OutlineInputBorder( borderRadius: BorderRadius.circular(12.0), ), ), placeIconWidget: Container( margin: EdgeInsets.fromLTRB(AppUiSize.margin_10.toDouble(), 0, 0, 0), child: SvgPicture.asset(ImageData.ic_location_icon, semanticsLabel: 'yewllow check icon', height: 20, width: 20,), ),

  onTap: (suggestion) async {
    // Use the suggestion object here
    // String placeId = suggestion.placeId!; // Get the place ID
    // String description = suggestion.description!; // Get the description
    PredictionModel? prediction;
    print("place data suggestion value : ${suggestion.toString()}");
    var result = await suggestion;
    prediction = result;
  },
).show();