Skip to content

Commit

Permalink
Merge pull request #27 from luis-cruzt/padding-parameter
Browse files Browse the repository at this point in the history
feat: padding parameter added
  • Loading branch information
lcuis authored Mar 6, 2021
2 parents 48d3fb3 + 71a77c5 commit cb4bfe7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ factory SearchChoices.single({
bool rightToLeft,
bool autofocus,
Function selectedAggregateWidgetFn,
double padding = 10.0,
}
)
```
Expand Down Expand Up @@ -141,6 +142,7 @@ factory SearchChoices.single({
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to false.
* autofocus bool automatically focuses on the search field bringing up the keyboard defaulted to true.
* selectedAggregateWidgetFn Function with parameter: list of widgets presenting selected values, returning Widget to be displayed to present the selected items.
* padding double sets the padding around the DropdownButton, defaults to 10.0

#### Multiple choice constructor

Expand Down Expand Up @@ -182,6 +184,7 @@ SearchChoices<T>.multiple(
bool rightToLeft,
bool autofocus,
Function selectedAggregateWidgetFn,
double padding: 10.0,
}
)
```
Expand Down Expand Up @@ -218,6 +221,7 @@ SearchChoices<T>.multiple(
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to false.
* autofocus bool automatically focuses on the search field bringing up the keyboard defaulted to true.
* selectedAggregateWidgetFn Function with parameter: list of widgets presenting selected values, returning Widget to be displayed to present the selected items.
* padding double sets the padding around the DropdownButton, defaults to 10.0

#### Example app usage

Expand Down Expand Up @@ -1152,7 +1156,9 @@ In your pull request, feel free to add your line in the contributors section bel
### Contributors
* (great initial project) https://github.com/icemanbsi/searchable_dropdown/pull/11
* https://github.com/lcuis
* https://github.com/avalentic
* https://github.com/luis-cruzt

## CI/CD

Continuous integration/deployment status: ![CI-CD](https://github.com/lcuis/search_choices/workflows/CI-CD/badge.svg)
Continuous integration/deployment status: ![CI-CD](https://github.com/lcuis/search_choices/workflows/CI-CD/badge.svg)
10 changes: 9 additions & 1 deletion lib/search_choices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class SearchChoices<T> extends StatefulWidget {
final bool rightToLeft;
final bool autofocus;
final Function selectedAggregateWidgetFn;
final double padding;

/// Search choices Widget with a single choice that opens a dialog or a menu to let the user do the selection conveniently with a search.
///
Expand Down Expand Up @@ -179,6 +180,7 @@ class SearchChoices<T> extends StatefulWidget {
/// @param rightToLeft [bool] mirrors the widgets display for right to left languages defaulted to false.
/// @param autofocus [bool] automatically focuses on the search field bringing up the keyboard defaulted to true.
/// @param selectedAggregateWidgetFn [Function] with parameter: __list of widgets presenting selected values__ , returning [Widget] to be displayed to present the selected items
/// @param padding [double] sets the padding around the DropdownButton, defaults to 10.0
factory SearchChoices.single({
Key key,
@required List<DropdownMenuItem<T>> items,
Expand Down Expand Up @@ -214,6 +216,7 @@ class SearchChoices<T> extends StatefulWidget {
bool rightToLeft = false,
bool autofocus = true,
Function selectedAggregateWidgetFn,
double padding = 10.0,
}) {
return (SearchChoices._(
key: key,
Expand Down Expand Up @@ -250,6 +253,7 @@ class SearchChoices<T> extends StatefulWidget {
rightToLeft: rightToLeft,
autofocus: autofocus,
selectedAggregateWidgetFn: selectedAggregateWidgetFn,
padding: padding,
));
}

Expand Down Expand Up @@ -287,6 +291,7 @@ class SearchChoices<T> extends StatefulWidget {
/// @param rightToLeft [bool] mirrors the widgets display for right to left languages defaulted to false.
/// @param autofocus [bool] automatically focuses on the search field bringing up the keyboard defaulted to true.
/// @param selectedAggregateWidgetFn [Function] with parameter: __list of widgets presenting selected values__ , returning [Widget] to be displayed to present the selected items
/// @param padding [double] sets the padding around the DropdownButton, defaults to 10.0
factory SearchChoices.multiple({
Key key,
@required List<DropdownMenuItem<T>> items,
Expand Down Expand Up @@ -321,6 +326,7 @@ class SearchChoices<T> extends StatefulWidget {
bool rightToLeft = false,
bool autofocus = true,
Function selectedAggregateWidgetFn,
double padding = 10.0,
}) {
return (SearchChoices._(
key: key,
Expand Down Expand Up @@ -357,6 +363,7 @@ class SearchChoices<T> extends StatefulWidget {
rightToLeft: rightToLeft,
autofocus: autofocus,
selectedAggregateWidgetFn: selectedAggregateWidgetFn,
padding: padding,
));
}

Expand Down Expand Up @@ -396,6 +403,7 @@ class SearchChoices<T> extends StatefulWidget {
this.rightToLeft,
this.autofocus,
this.selectedAggregateWidgetFn,
this.padding,
}) : assert(items != null),
assert(iconSize != null),
assert(isExpanded != null),
Expand Down Expand Up @@ -730,7 +738,7 @@ class _SearchChoicesState<T> extends State<SearchChoices<T>> {
Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
padding: EdgeInsets.all(widget.padding),
child: result,
),
widget.underline is NotGiven
Expand Down

0 comments on commit cb4bfe7

Please sign in to comment.