diff --git a/lib/src/widgets/country_selector/country_selector_navigator.dart b/lib/src/widgets/country_selector/country_selector_navigator.dart index b84e45f4..c7d313f8 100644 --- a/lib/src/widgets/country_selector/country_selector_navigator.dart +++ b/lib/src/widgets/country_selector/country_selector_navigator.dart @@ -98,6 +98,7 @@ abstract class CountrySelectorNavigator { TextStyle? searchBoxTextStyle, Color? searchBoxIconColor, ScrollPhysics? scrollPhysics, + ThemeData? appBarTheme, }) = SearchDelegateNavigator._; const factory CountrySelectorNavigator.bottomSheet({ @@ -211,25 +212,30 @@ class SearchDelegateNavigator extends CountrySelectorNavigator { super.searchBoxTextStyle, super.searchBoxIconColor, super.scrollPhysics, + this.appBarTheme, }); + final ThemeData? appBarTheme; + CountrySelectorSearchDelegate _getCountrySelectorSearchDelegate({ required ValueChanged onCountrySelected, required FlagCache flagCache, ScrollController? scrollController, }) { return CountrySelectorSearchDelegate( - onCountrySelected: onCountrySelected, - scrollController: scrollController, - addFavoritesSeparator: addSeparator, - countries: countries, - favoriteCountries: favorites ?? [], - noResultMessage: noResultMessage, - searchAutofocus: searchAutofocus, - showCountryCode: showCountryCode, - titleStyle: titleStyle, - subtitleStyle: subtitleStyle, - flagCache: flagCache); + onCountrySelected: onCountrySelected, + scrollController: scrollController, + addFavoritesSeparator: addSeparator, + countries: countries, + favoriteCountries: favorites ?? [], + noResultMessage: noResultMessage, + searchAutofocus: searchAutofocus, + showCountryCode: showCountryCode, + titleStyle: titleStyle, + subtitleStyle: subtitleStyle, + flagCache: flagCache, + customAppBarTheme: appBarTheme, + ); } @override diff --git a/lib/src/widgets/country_selector/country_selector_page.dart b/lib/src/widgets/country_selector/country_selector_page.dart index 7a322c36..a51769c5 100644 --- a/lib/src/widgets/country_selector/country_selector_page.dart +++ b/lib/src/widgets/country_selector/country_selector_page.dart @@ -58,6 +58,9 @@ class CountrySelectorSearchDelegate extends SearchDelegate { final FlagCache? flagCache; + /// Override default app bar theme + final ThemeData? customAppBarTheme; + CountrySelectorSearchDelegate({ Key? key, required this.onCountrySelected, @@ -73,6 +76,7 @@ class CountrySelectorSearchDelegate extends SearchDelegate { this.flagSize = 40, this.titleStyle, this.subtitleStyle, + this.customAppBarTheme, }) : countriesIso = countries ?? IsoCode.values, favoriteCountriesIso = favoriteCountries; @@ -140,4 +144,9 @@ class CountrySelectorSearchDelegate extends SearchDelegate { Widget buildResults(BuildContext context) { return buildSuggestions(context); } + + @override + ThemeData appBarTheme(BuildContext context) { + return customAppBarTheme ?? super.appBarTheme(context); + } }