Skip to content

Commit

Permalink
DropDownButton updates (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa authored Feb 6, 2023
2 parents 4cde95f + e00681a commit e729e81
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 107 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
```

With it, it's also possible to have multiple info about the current open flyout. Sub-menus also have their own flyout instance. To close the current flyout, use `Flyout.of(context).close();`
- Added option to open `DropDownButton` flyout programatically ([#723](https://github.com/bdlukaa/fluent_ui/issues/723))
```dart
final dropdownKey = GlobalKey<DropDownButtonState>();
DropDownButton(
key: dropdownKey,
...
);
dropdownKey.currentState?.open(...); // opens the flyout
final isOpen = dropdownKey.currentState?.isOpen ?? false; // checks if the flyout is open
```
- **BREAKING** Removed deprecated memebers: `DropDownButtonItem` and `DropDownButton.buttonStyle` ([#724](https://github.com/bdlukaa/fluent_ui/pull/724))

## 4.2.0

Expand Down
2 changes: 1 addition & 1 deletion example/lib/screens/inputs/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ ToggleButton(
),
SizedBox(width: 10.0),
DropDownButton(
title: Icon(FluentIcons.edit_mail, size: 22.0),
title: Icon(FluentIcons.mail),
items: [
MenuFlyoutItem(
leading: Icon(FluentIcons.send),
Expand Down
7 changes: 7 additions & 0 deletions lib/src/controls/flyouts/flyout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ typedef FlyoutTransitionBuilder = Widget Function(
Widget child,
);

/// Controls the state of a flyout
class FlyoutController with ChangeNotifier {
_FlyoutTargetState? _attachState;
bool _open = false;
Expand Down Expand Up @@ -484,17 +485,23 @@ class FlyoutController with ChangeNotifier {
/// [builder] builds the flyout with the given context. Usually a [FlyoutContent]
/// is used
///
/// {@template fluent_ui.flyouts.barrierDismissible}
/// If [barrierDismissible] is true, tapping outside of the flyout will close
/// it.
/// {@end-template}
///
/// [barrierColor] is the color of the barrier.
///
/// {@template fluent_ui.flyouts.dismissWithEsc}
/// When [dismissWithEsc] is true, the flyout can be dismissed by pressing the
/// ESC key.
/// {@end-template}
///
/// {@template fluent_ui.flyouts.dismissOnPointerMoveAway}
/// If [dismissOnPointerMoveAway] is enabled, the flyout is dismissed when the
/// cursor moves away from either the target or the flyout. It's disabled by
/// default.
/// {@end-template}
///
/// [placementMode] describes where the flyout will be placed. Defaults to auto
///
Expand Down
Loading

0 comments on commit e729e81

Please # to comment.