Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom theme for search box decoration not applied. #228

Open
aelrahmanashraf opened this issue Mar 24, 2024 · 6 comments
Open

Custom theme for search box decoration not applied. #228

aelrahmanashraf opened this issue Mar 24, 2024 · 6 comments

Comments

@aelrahmanashraf
Copy link

I tried to make the search box look different in CountrySelectorNavigator, but it's not working. When I checked the code, it seems like the search box design settings are not reaching the PageNavigator, which might be why it's not working.

@cedvdb
Copy link
Owner

cedvdb commented Mar 26, 2024

Need repro

@aelrahmanashraf
Copy link
Author

aelrahmanashraf commented Mar 29, 2024

After checking again, I can't add custom style to the searchBoxDecoration. The code is missing the part where the custom style is applied to the page. At the end, I forked the repo and applied the style myself here.

image

I had to assign the searchBoxDecoration and searchBoxTextStyle from the PageNavigator constructor.

@cedvdb
Copy link
Owner

cedvdb commented Mar 30, 2024

Can't you do it by changing the Theme around phone form field ?

@aelrahmanashraf
Copy link
Author

Doing this will just change the form field theme itself but not the search box inside the country selector page.

@aelrahmanashraf
Copy link
Author

I have forked the repo and applied it anyway. You can take a look at the pull request.

@cedvdb
Copy link
Owner

cedvdb commented Mar 30, 2024

So if I understand you correctly when wrapping the PhoneFormField with a Theme, the theme values are not applied to the country selection page search bar, right ?

If that the case a workaround to explore is to pass the local theme into the overlay similar to how the locale is passed currently. As it is done here https://github.com/cedvdb/phone_form_field/blob/main/lib/src/country_selector_navigator.dart#L235

This fix would not add things to the public api of phone_form_fields and would therefor be prefered.

So something like the pseudo code:

    return Localizations.override(
      context: inputContext,
      locale: Localizations.localeOf(inputContext),
      child: Theme(  // <== add this 
          data: Theme.of(inputContext),
          child: CountrySelector.page(
                // ...
           ),
         ),
       )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants