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

Add ability to set custom background color #17

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ To use this plugin, add `country_list_pick` as a [dependency in your pubspec.yam
isDownIcon: true,
// to show country in English
showEnglishName: true,
// to initial code number countrey
// to initial code number country
initialSelection: '+62',
// to change background color of the widget
backgroundColor: Colors.transparent,
// to get feedback data from picker
onChanged: (CountryCode code) {
// name of country
Expand Down Expand Up @@ -76,6 +78,7 @@ class _MyAppState extends State<MyApp> {
isShowCode: true,
isDownIcon: true,
initialSelection: '+62',
backgroundColor: Colors.transparent,
onChanged: (CountryCode code) {
print(code.name);
print(code.code);
Expand Down
4 changes: 3 additions & 1 deletion lib/country_list_pick.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ class CountryListPick extends StatefulWidget {
this.isShowCode,
this.isShowTitle,
this.initialSelection,
this.showEnglishName});
this.showEnglishName, this.backgroundColor});
final bool isShowTitle;
final bool isShowFlag;
final bool isShowCode;
final bool isDownIcon;
final String initialSelection;
final bool showEnglishName;
final ValueChanged<CountryCode> onChanged;
final Color backgroundColor;

@override
_CountryListPickState createState() {
Expand Down Expand Up @@ -75,6 +76,7 @@ class _CountryListPickState extends State<CountryListPick> {
@override
Widget build(BuildContext context) {
return FlatButton(
color: widget.backgroundColor,
onPressed: () {
_awaitFromSelectScreen(context);
},
Expand Down