Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ pubspec.lock

# Old files
*.old
.vscode/settings.json
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.1] - 06-Jul-2022
- Added Suggestions Box Elevation option

## [2.0.0] - 16-May-2022
* Flutter 3 compatibility

Expand Down
35 changes: 21 additions & 14 deletions lib/src/chips_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class ChipsInput<T> extends StatefulWidget {
this.allowChipEditing = false,
this.focusNode,
this.initialSuggestions,
this.suggestionsBoxElevation = 0,
this.suggestionsBoxDecoration = const BoxDecoration(),
}) : assert(maxChips == null || initialValue.length <= maxChips),
super(key: key);

Expand All @@ -75,6 +77,8 @@ class ChipsInput<T> extends StatefulWidget {
final bool allowChipEditing;
final FocusNode? focusNode;
final List<T>? initialSuggestions;
final double suggestionsBoxElevation;
final BoxDecoration suggestionsBoxDecoration;

// final Color cursorColor;

Expand Down Expand Up @@ -203,24 +207,27 @@ class ChipsInputState<T> extends State<ChipsInput<T>>
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
final suggestionsListView = Material(
elevation: 0,
elevation: widget.suggestionsBoxElevation,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: suggestionBoxHeight,
),
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
itemCount: snapshot.data!.length,
itemBuilder: (BuildContext context, int index) {
return _suggestions != null
? widget.suggestionBuilder(
context,
this,
_suggestions![index] as T,
)
: Container();
},
child: DecoratedBox(
decoration: widget.suggestionsBoxDecoration,
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
itemCount: snapshot.data!.length,
itemBuilder: (BuildContext context, int index) {
return _suggestions != null
? widget.suggestionBuilder(
context,
this,
_suggestions![index] as T,
)
: Container();
},
),
),
),
);
Expand Down