diff --git a/.gitignore b/.gitignore index ed90a429..99ccaec4 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ pubspec.lock # Old files *.old +.vscode/settings.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 823f48a0..aae87e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [2.0.1] - 06-Jul-2022 +- Added Suggestions Box Elevation option + ## [2.0.0] - 16-May-2022 * Flutter 3 compatibility diff --git a/lib/src/chips_input.dart b/lib/src/chips_input.dart index 3c10a20d..29f72cee 100644 --- a/lib/src/chips_input.dart +++ b/lib/src/chips_input.dart @@ -51,6 +51,8 @@ class ChipsInput 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); @@ -75,6 +77,8 @@ class ChipsInput extends StatefulWidget { final bool allowChipEditing; final FocusNode? focusNode; final List? initialSuggestions; + final double suggestionsBoxElevation; + final BoxDecoration suggestionsBoxDecoration; // final Color cursorColor; @@ -203,24 +207,27 @@ class ChipsInputState extends State> 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(); + }, + ), ), ), );