Skip to content

Commit

Permalink
Added DropDownButton.onOpen and DropDownButton.onClose callbacks (F…
Browse files Browse the repository at this point in the history
…ixes #437)
  • Loading branch information
bdlukaa committed Sep 27, 2022
1 parent 90a2049 commit 91089e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Date format: DD/MM/YYYY
## 4.0.1

- `PaneItemAction.body` is no longer required ([#545](/~https://github.com/bdlukaa/fluent_ui/issues/545))
- Added `DropDownButton.onOpen` and `DropDownButton.onClose` callbacks ([#437](/~https://github.com/bdlukaa/fluent_ui/issues/537))

## 4.0.0

Expand Down
18 changes: 18 additions & 0 deletions lib/src/controls/inputs/dropdown_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class DropDownButton extends StatefulWidget {
this.placement = FlyoutPlacement.center,
this.menuShape,
this.menuColor,
this.onOpen,
this.onClose,
}) : assert(items.length > 0, 'You must provide at least one item'),
super(key: key);

Expand Down Expand Up @@ -104,6 +106,20 @@ class DropDownButton extends StatefulWidget {
/// The menu color. If null, [ThemeData.menuColor] is used
final Color? menuColor;

/// Called when the flyout is opened
///
/// See also:
///
/// * [Flyout.onClose]
final VoidCallback? onOpen;

/// Called when the flyout is closed
///
/// See also:
///
/// * [Flyout.onClose]
final VoidCallback? onClose;

@override
State<DropDownButton> createState() => _DropDownButtonState();

Expand Down Expand Up @@ -167,6 +183,8 @@ class _DropDownButtonState extends State<DropDownButton> {
position: FlyoutPosition.below,
controller: flyoutController,
verticalOffset: widget.verticalOffset,
onOpen: widget.onOpen,
onClose: widget.onClose,
child: Builder(builder: (context) {
return widget.buttonBuilder?.call(
context,
Expand Down

0 comments on commit 91089e3

Please sign in to comment.