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

feat: padding parameter added #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ factory SearchableDropdown.single({
BoxConstraints menuConstraints,
bool readOnly: false,
Color menuBackgroundColor,
double padding = 10.0,
}
)
```
Expand Down Expand Up @@ -123,6 +124,7 @@ factory SearchableDropdown.single({
* menuConstraints BoxConstraints used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
* readOnly bool whether to let the user choose the value to select or just present the selected value if any.
* menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
* padding double sets the padding around the DropdownButton, defaults to 10.0


#### Multiple choice constructor
Expand Down Expand Up @@ -162,6 +164,7 @@ SearchableDropdown<T>.multiple(
BoxConstraints menuConstraints,
bool readOnly: false,
Color menuBackgroundColor,
double padding: 10.0,
}
)
```
Expand Down Expand Up @@ -195,6 +198,7 @@ SearchableDropdown<T>.multiple(
* menuConstraints BoxConstraints used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
* readOnly bool whether to let the user choose the value to select or just present the selected value if any.
* menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
* padding double sets the padding around the DropdownButton, defaults to 10.0

#### Example app usage

Expand Down Expand Up @@ -716,6 +720,7 @@ In your pull request, feel free to add your line in the contributors section bel
### Contributors
* https://github.com/icemanbsi
* https://github.com/lcuis
* https://github.com/avalentic

## CI/CD

Expand Down
11 changes: 10 additions & 1 deletion lib/searchable_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class SearchableDropdown<T> extends StatefulWidget {
final BoxConstraints menuConstraints;
final bool readOnly;
final Color menuBackgroundColor;
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 @@ -116,6 +117,7 @@ class SearchableDropdown<T> extends StatefulWidget {
/// @param menuConstraints [BoxConstraints] used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
/// @param readOnly [bool] whether to let the user choose the value to select or just present the selected value if any.
/// @param menuBackgroundColor [Color] background color of the menu whether in dialog box or menu mode.
/// @param padding [double] sets the padding around the DropdownButton, defaults to 10.0
factory SearchableDropdown.single({
Key key,
@required List<DropdownMenuItem<T>> items,
Expand Down Expand Up @@ -148,6 +150,7 @@ class SearchableDropdown<T> extends StatefulWidget {
BoxConstraints menuConstraints,
bool readOnly = false,
Color menuBackgroundColor,
double padding = 10.0,
}) {
return (SearchableDropdown._(
key: key,
Expand Down Expand Up @@ -181,6 +184,7 @@ class SearchableDropdown<T> extends StatefulWidget {
menuConstraints: menuConstraints,
readOnly: readOnly,
menuBackgroundColor: menuBackgroundColor,
padding: padding,
));
}

Expand Down Expand Up @@ -215,6 +219,7 @@ class SearchableDropdown<T> extends StatefulWidget {
/// @param menuConstraints [BoxConstraints] used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true.
/// @param readOnly [bool] whether to let the user choose the value to select or just present the selected value if any.
/// @param menuBackgroundColor [Color] background color of the menu whether in dialog box or menu mode.
/// @param padding [double] sets the padding around the DropdownButton, defaults to 10.0
factory SearchableDropdown.multiple({
Key key,
@required List<DropdownMenuItem<T>> items,
Expand Down Expand Up @@ -246,6 +251,7 @@ class SearchableDropdown<T> extends StatefulWidget {
BoxConstraints menuConstraints,
bool readOnly = false,
Color menuBackgroundColor,
double padding = 10.0,
}) {
return (SearchableDropdown._(
key: key,
Expand Down Expand Up @@ -279,6 +285,7 @@ class SearchableDropdown<T> extends StatefulWidget {
menuConstraints: menuConstraints,
readOnly: readOnly,
menuBackgroundColor: menuBackgroundColor,
padding: padding,
));
}

Expand Down Expand Up @@ -315,6 +322,7 @@ class SearchableDropdown<T> extends StatefulWidget {
this.menuConstraints,
this.readOnly = false,
this.menuBackgroundColor,
this.padding,
}) : assert(items != null),
assert(iconSize != null),
assert(isExpanded != null),
Expand Down Expand Up @@ -355,6 +363,7 @@ class SearchableDropdown<T> extends StatefulWidget {
this.menuConstraints,
this.readOnly = false,
this.menuBackgroundColor,
this.padding,
}) : assert(items != null),
assert(iconSize != null),
assert(isExpanded != null),
Expand Down Expand Up @@ -631,7 +640,7 @@ class _SearchableDropdownState<T> extends State<SearchableDropdown<T>> {
Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
padding: EdgeInsets.all(widget.padding),
child: result,
),
widget.underline is NotGiven
Expand Down