DesignSplitButton class
A main action with a menu of actions beside it.
DesignSplitButton(label: 'Save', onPressed: () {}, actions: [DesignSplitAction(label: 'Save as', onPressed: () {})], buttonBuilder: (context, part, states, open) => Text(part.name), itemBuilder: (context, action, states) => Text(action.label), surfaceBuilder: (context, info, items) => Column(mainAxisSize: MainAxisSize.min, children: items))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- DesignSplitButton
Constructors
-
DesignSplitButton({Key? key, required String label, required VoidCallback? onPressed, required List<
DesignSplitAction> actions, required Widget buttonBuilder(BuildContext context, DesignSplitPart part, Set<WidgetState> states, bool open), required Widget itemBuilder(BuildContext context, DesignSplitAction action, Set<WidgetState> states), required Widget surfaceBuilder(BuildContext context, DesignOverlayInfo info, List<Widget> items), Widget layoutBuilder(BuildContext context, Widget main, Widget toggle)?, Size minimumSize = const Size(44, 44), MenuController? controller, DesignOverlayPlacement placement = const DesignOverlayPlacement(align: DesignOverlayAlign.end), bool highlightFollowsPointer = true}) -
A split button whose main action is
onPressed.const
Properties
-
actions
→ List<
DesignSplitAction> -
The menu's actions.
final
-
Paints a half;
openwhile the menu shows.final - controller → MenuController?
-
The menu's controller; null: its own.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightFollowsPointer → bool
-
Whether a pointer over a menu item moves the keys there; true by
default, as
DesignMenuBar.highlightFollowsPointer: one item lit, the current one (hovered when the pointer moved last, focused when the keys did), and none once the pointer leaves the menu. A menu a click opened lights none until the pointer or a key picks one.final -
itemBuilder
→ Widget Function(BuildContext context, DesignSplitAction action, Set<
WidgetState> states) -
Paints a menu item.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String
-
The main action's name.
final
- layoutBuilder → Widget Function(BuildContext context, Widget main, Widget toggle)?
-
Lays out the two halves; null: a row.
final
-
What a screen reader calls the toggle; null:
DesignLocalizations.splitButtonMenuLabel.
final
- minimumSize → Size
-
Each half's least target.
final
- onPressed → VoidCallback?
-
The main action. Null disables the main half, which leaves the focus
order and reads as disabled; the menu half stays.
final
- placement → DesignOverlayPlacement
-
Where the menu opens relative to both halves of the button. Its trailing
edge aligns with the button by default. The menu is at least as wide
as the button when the screen has room.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
surfaceBuilder
→ Widget Function(BuildContext context, DesignOverlayInfo info, List<
Widget> items) -
Paints the menu's panel around its
items.final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited