Skip to content

Commit

Permalink
add constraints property to the suggestions box decoration
Browse files Browse the repository at this point in the history
  • Loading branch information
aalhamali committed Sep 15, 2018
1 parent 0121ae7 commit c898faf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ suggestions box
## 0.2.1 - 04/09/2018

* Added mention of 'autocomplete' in README and pubspec
* Executed 'flutter format'
* Executed 'flutter format'

## 0.3.0 - 15/09/2018

* Added a constraints property to the `SuggestionsBoxDecorations`
which allows to set the height and width of the suggestions box
13 changes: 11 additions & 2 deletions lib/flutter_typeahead.dart
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,12 @@ class _SuggestionsListState<T> extends State<_SuggestionsList<T>>
shape: widget.decoration.shape,
borderRadius: widget.decoration.borderRadius,
shadowColor: widget.decoration.shadowColor,
child: animationChild,
child: widget.decoration.constraints != null
? ConstrainedBox(
constraints: widget.decoration.constraints,
child: animationChild,
)
: animationChild,
);

return container;
Expand Down Expand Up @@ -942,13 +947,17 @@ class SuggestionsBoxDecoration {
/// Same as [Material.shadowColor](https://docs.flutter.io/flutter/material/Material/shadowColor.html)
final Color shadowColor;

/// The constraints to be applied to the suggestions box
final BoxConstraints constraints;

/// Creates a SuggestionsBoxDecoration
const SuggestionsBoxDecoration(
{this.elevation: 4.0,
this.color,
this.shape,
this.borderRadius,
this.shadowColor: const Color(0xFF000000)})
this.shadowColor: const Color(0xFF000000),
this.constraints})
: assert(shadowColor != null),
assert(elevation != null);
}
Expand Down

0 comments on commit c898faf

Please sign in to comment.