Skip to content

Commit

Permalink
2.2.6 * rightToLeft is defaulted according to app Directionality. Tha…
Browse files Browse the repository at this point in the history
…nks @slavap #116
  • Loading branch information
lcuis committed Aug 16, 2023
1 parent 71cf380 commit 65af1e8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.6

* rightToLeft is defaulted according to app Directionality. Thanks @slavap https://github.com/lcuis/search_choices/issues/116

## 2.2.5

* pubspec.yaml description was too long for pub.dev
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Search choices Widget with a single choice that opens a dialog or a menu to let
BoxConstraints? menuConstraints,
bool readOnly = false,
Color? menuBackgroundColor,
bool rightToLeft = false,
bool? rightToLeft,
bool autofocus = true,
Function? selectedAggregateWidgetFn,
dynamic padding = 10.0,
Expand Down Expand Up @@ -218,7 +218,7 @@ Search choices Widget with a single choice that opens a dialog or a menu to let
* 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.
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to false.
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to app.
* 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 or EdgeInsets sets the padding around the DropdownButton, defaulted to 10.0.
Expand Down Expand Up @@ -288,7 +288,7 @@ Search choices Widget with a multiple choice that opens a dialog or a menu to le
BoxConstraints? menuConstraints,
bool readOnly = false,
Color? menuBackgroundColor,
bool rightToLeft = false,
bool? rightToLeft,
bool autofocus = true,
Function? selectedAggregateWidgetFn,
dynamic padding = 10.0,
Expand Down Expand Up @@ -389,7 +389,7 @@ Search choices Widget with a multiple choice that opens a dialog or a menu to le
* 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.
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to false.
* rightToLeft bool mirrors the widgets display for right to left languages defaulted to app.
* 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 or EdgeInsets sets the padding around the DropdownButton, defaulted to 10.0.
Expand Down
34 changes: 17 additions & 17 deletions lib/src/search_choices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ class SearchChoices<T> extends FormField<T> {
final Color? menuBackgroundColor;

/// [rightToLeft] [bool] mirrors the widgets display for right to left
/// languages defaulted to false.
final bool rightToLeft;
/// languages defaulted to app.
final bool? rightToLeft;

/// [autofocus] [bool] automatically focuses on the search field bringing up
/// the keyboard defaulted to true.
Expand Down Expand Up @@ -285,8 +285,7 @@ class SearchChoices<T> extends FormField<T> {
BuildContext context,
Widget Function({
String searchTerms,
})
menuWidget,
}) menuWidget,
String searchTerms,
)? showDialogFn;

Expand Down Expand Up @@ -449,7 +448,7 @@ class SearchChoices<T> extends FormField<T> {
/// * [menuBackgroundColor] [Color] background color of the menu whether in
/// dialog box or menu mode.
/// * [rightToLeft] [bool] mirrors the widgets display for right to left
/// languages defaulted to false.
/// languages defaulted to app.
/// * [autofocus] [bool] automatically focuses on the search field bringing up
/// the keyboard defaulted to true.
/// * [selectedAggregateWidgetFn] [Function] with parameter: __list of widgets
Expand Down Expand Up @@ -558,7 +557,7 @@ class SearchChoices<T> extends FormField<T> {
this.menuConstraints,
this.readOnly = false,
this.menuBackgroundColor,
this.rightToLeft = false,
this.rightToLeft,
this.autofocus = true,
this.selectedAggregateWidgetFn,
this.padding,
Expand Down Expand Up @@ -775,7 +774,7 @@ class SearchChoices<T> extends FormField<T> {
this.menuConstraints,
this.readOnly = false,
this.menuBackgroundColor,
this.rightToLeft = false,
this.rightToLeft,
this.autofocus = true,
this.selectedAggregateWidgetFn,
this.padding,
Expand Down Expand Up @@ -890,6 +889,10 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
@override
SearchChoices<T> get widget => super.widget as SearchChoices<T>;

bool get rightToLeft =>
widget.rightToLeft ??
Directionality.maybeOf(context) == TextDirection.rtl;

void giveMeThePop(Function pop) {
this.pop = pop;
if (widget.giveMeThePop != null) {
Expand Down Expand Up @@ -1165,7 +1168,7 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
updateParent!(value);
setStateFromBuilder(() {});
},
rightToLeft: widget.rightToLeft,
rightToLeft: rightToLeft,
autofocus: widget.autofocus,
initialSearchTerms: searchTerms,
buildDropDownDialog: widget.buildDropDownDialog,
Expand Down Expand Up @@ -1306,7 +1309,7 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
},
child: Row(
textDirection:
widget.rightToLeft ? TextDirection.rtl : TextDirection.ltr,
rightToLeft ? TextDirection.rtl : TextDirection.ltr,
children: <Widget>[
widget.isExpanded
? Expanded(child: innerItemsWidget)
Expand All @@ -1328,8 +1331,7 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
child: Container(
padding: padding.resolve(Directionality.of(context)),
child: Row(
textDirection:
widget.rightToLeft ? TextDirection.rtl : TextDirection.ltr,
textDirection: rightToLeft ? TextDirection.rtl : TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expand All @@ -1347,9 +1349,8 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
child: Container(
padding: padding.resolve(Directionality.of(context)),
child: Row(
textDirection: widget.rightToLeft
? TextDirection.rtl
: TextDirection.ltr,
textDirection:
rightToLeft ? TextDirection.rtl : TextDirection.ltr,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expand Down Expand Up @@ -1377,8 +1378,7 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
Widget? labelOutput = prepareWidget(widget.label, parameter: selectedResult,
stringToWidgetFunction: (string) {
return (Text(string,
textDirection:
widget.rightToLeft ? TextDirection.rtl : TextDirection.ltr,
textDirection: rightToLeft ? TextDirection.rtl : TextDirection.ltr,
style: TextStyle(color: Colors.blueAccent, fontSize: 13)));
});
Widget? fieldPresentation;
Expand Down Expand Up @@ -1438,7 +1438,7 @@ class _SearchChoicesState<T> extends FormFieldState<T> {
: Text(
validatorOutput,
textDirection:
widget.rightToLeft ? TextDirection.rtl : TextDirection.ltr,
rightToLeft ? TextDirection.rtl : TextDirection.ltr,
style: TextStyle(color: Colors.red, fontSize: 13),
)),
displayMenu.value ? menuWidget() : SizedBox.shrink(),
Expand Down
34 changes: 17 additions & 17 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,10 +21,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.3.0"
clock:
dependency: transitive
description:
Expand All @@ -37,10 +37,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.17.1"
fake_async:
dependency: transitive
description:
Expand All @@ -63,18 +63,18 @@ packages:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.5"
version: "0.6.7"
matcher:
dependency: transitive
description:
name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
version: "0.12.13"
version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
Expand All @@ -87,18 +87,18 @@ packages:
dependency: transitive
description:
name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.9.1"
path:
dependency: transitive
description:
name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.8.2"
version: "1.8.3"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -148,10 +148,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
version: "0.4.16"
version: "0.5.1"
vector_math:
dependency: transitive
description:
Expand All @@ -161,5 +161,5 @@ packages:
source: hosted
version: "2.1.4"
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=3.0.0-0 <4.0.0"
flutter: ">=1.12.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: search_choices
description: Highly customizable Widget to search through a single or multiple choices list in a dialog box or a menu. Supports pagination, future/API/webservice searches with sort and filter.
version: 2.2.5
version: 2.2.6
homepage: https://github.com/lcuis/search_choices
repository: https://github.com/lcuis/search_choices
issue_tracker: https://github.com/lcuis/search_choices/issues
Expand Down

0 comments on commit 65af1e8

Please sign in to comment.