Skip to content

Commit de3e899

Browse files
authored
update to 7.3.10 (#102)
This pull request reworks the `ThemedSelectInput` component to add more flexibility and control over selection behavior, including supporting unselecting options, returning null on dialog close, and auto-closing after selection. It also updates the example usage and makes several internal improvements to support these features. **Enhancements to ThemedSelectInput:** - Added new properties to `ThemedSelectInput`: `canUnselect`, `returnNullOnClose`, and `autoClose`, allowing users to unselect an option, control the return value when the dialog is closed, and auto-close the dialog after a selection, respectively. [[1]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R5) [[2]](diffhunk://#diff-b5e1b610229280dab04b9a90f5920f58e43d46b2ccc2e7b4a3bcb91ed5bebec5L270-R426) - Refactored the dialog logic into a new `DialogSelectInput` widget, improving separation of concerns and maintainability. **API and Data Model Updates:** - Introduced a `SelectInputResult` class to standardize the result returned from the selection dialog, including a flag for removed (unselected) items. - Extended `ThemedSelectItem` with an `isRemoved` property to track unselected state when `canUnselect` is enabled. [[1]](diffhunk://#diff-ae288802f22e9be1add99acd6aab0479a58630e7936110b28c4ef9b2ed227befR33-R36) [[2]](diffhunk://#diff-ae288802f22e9be1add99acd6aab0479a58630e7936110b28c4ef9b2ed227befR47) **Example and Documentation Updates:** - Updated the example usage in `general.dart` to demonstrate the new features and behaviors of `ThemedSelectInput`, including cases for unselecting and returning null on close. [[1]](diffhunk://#diff-1aeb9ec9de1c0096c75417ebfea2d5eb80c26c06c0c4dbe3566d044a49edf925R73-R76) [[2]](diffhunk://#diff-1aeb9ec9de1c0096c75417ebfea2d5eb80c26c06c0c4dbe3566d044a49edf925L83-R113) **Other Improvements:** - Changed the `dialogContraints` property to be non-nullable and renamed to `dialogConstraints` for clarity and consistency. [[1]](diffhunk://#diff-b5e1b610229280dab04b9a90f5920f58e43d46b2ccc2e7b4a3bcb91ed5bebec5L114-R114) [[2]](diffhunk://#diff-b5e1b610229280dab04b9a90f5920f58e43d46b2ccc2e7b4a3bcb91ed5bebec5L160-R166) - Bumped the package version to `7.3.10` and updated the changelog with the new features. [[1]](diffhunk://#diff-8b7e9df87668ffa6a04b32e1769a33434999e54ae081c52e5d943c541d4c0d25L3-R3) [[2]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R5)
2 parents c223152 + 0b2aa1f commit de3e899

6 files changed

Lines changed: 294 additions & 170 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 7.3.10
4+
- Rework `ThemedSelectInput` to support `canUnselect`, `returnNullOnClose` and `autoClose`
5+
36
## 7.3.9
47

58
- Added new property `onSearchChanged` in `ThemedTable` component

example/lib/views/inputs/src/selectors/general.dart

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ class _GeneralPickersViewState extends State<GeneralPickersView> {
7070
children: [
7171
const Text("Select input"),
7272
Text('Select input Current value: $selectedSingle'),
73+
74+
/// Can Unselect
7375
ThemedSelectInput<int>(
74-
labelText: "Example label",
76+
labelText: "Example Can unselect",
7577
items: _choices,
7678
value: selectedSingle,
7779
canUnselect: true,
@@ -80,21 +82,35 @@ class _GeneralPickersViewState extends State<GeneralPickersView> {
8082
},
8183
),
8284
ThemedSelectInput<int>(
83-
labelText: "2nd Example label",
84-
autoclose: false,
85-
returnNullOnClose: true,
85+
labelText: "Example Can unselect without autoClose false",
8686
items: _choices,
8787
value: selectedSingle,
88+
canUnselect: true,
89+
autoclose: false,
8890
onChanged: (v) {
8991
setState(() => selectedSingle = v?.value);
9092
},
9193
),
94+
95+
/// Can return null on close
9296
ThemedSelectInput<int>(
93-
labelText: "3rd Example label without onChanged",
97+
labelText: "Return null on close",
9498
autoclose: false,
9599
returnNullOnClose: true,
96100
items: _choices,
97101
value: selectedSingle,
102+
onChanged: (v) {
103+
setState(() => selectedSingle = v?.value);
104+
},
105+
),
106+
107+
/// Default
108+
ThemedSelectInput<int>(
109+
labelText: "Default",
110+
111+
items: _choices,
112+
value: selectedSingle,
113+
onChanged: (v) => setState(() => selectedSingle = v?.value),
98114
),
99115
],
100116
),

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ packages:
350350
path: ".."
351351
relative: true
352352
source: path
353-
version: "7.3.8"
353+
version: "7.3.9"
354354
leak_tracker:
355355
dependency: transitive
356356
description:

0 commit comments

Comments
 (0)