MenuStyle
Defines the visual style/appearance of a menu.
Properties
alignment- Determines the desired alignment of the submenu when opened relative to the button that opens it.bgcolor- The menu's background fill color.elevation- The menu's elevation, i.e.fixed_size- The menu's size.max_size- The maximum size of the menu itself.min_size- The minimum size of the menu itself.mouse_cursor- The cursor for a mouse pointer when it enters or is hovering over the menu.padding- The padding between the menu's boundary and its child.shadow_color- The shadow color of the menushape- The menu's shape.side- The color and weight of the menu's outline.visual_density- Defines how compact the menu's layout will be.
Properties
alignmentclass-attributeinstance-attribute
alignment: Optional[Alignment] = NoneDetermines the desired alignment of the submenu when opened relative to the button that opens it.
If there isn't sufficient space to open the menu with the given alignment,
and there's space on the other side of the button, then the alignment is
swapped to it's opposite (1 becomes -1, etc.), and the menu will try to
appear on the other side of the button. If there isn't enough space there
either, then the menu will be pushed as far over as necessary to display
as much of itself as possible, possibly overlapping the parent button.
bgcolorclass-attributeinstance-attribute
bgcolor: Optional[ControlStateValue[ColorValue]] = NoneThe menu's background fill color.
elevationclass-attributeinstance-attribute
elevation: Optional[ControlStateValue[Optional[Number]]] = NoneThe menu's elevation, i.e. the size of the shadow below the menu.
fixed_sizeclass-attributeinstance-attribute
fixed_size: Optional[ControlStateValue[Size]] = NoneThe menu's size.
This size is still constrained by the style's min_size and
max_size. Fixed size dimensions whose value is float('inf') are
ignored.
To specify menus with a fixed width and the default height use
Size.from_width(320). Similarly, to specify a fixed height and the default
width use Size.from_height(100).
max_sizeclass-attributeinstance-attribute
max_size: Optional[ControlStateValue[Size]] = NoneThe maximum size of the menu itself.
A flet.Size.infinite or None value for this property
means that the menu's maximum size is not constrained.
This value must be greater than or equal to min_size.
min_sizeclass-attributeinstance-attribute
min_size: Optional[ControlStateValue[Size]] = NoneThe minimum size of the menu itself.
This value must be less than or equal to max_size.
mouse_cursorclass-attributeinstance-attribute
mouse_cursor: Optional[ControlStateValue[MouseCursor]] = NoneThe cursor for a mouse pointer when it enters or is hovering over the menu.
paddingclass-attributeinstance-attribute
padding: Optional[ControlStateValue[PaddingValue]] = NoneThe padding between the menu's boundary and its child.
shadow_colorclass-attributeinstance-attribute
shadow_color: Optional[ControlStateValue[ColorValue]] = NoneThe shadow color of the menu
The material's elevation shadow can be difficult to see for dark themes, so by default the menu classes add a semi-transparent overlay to indicate elevation.
shapeclass-attributeinstance-attribute
shape: Optional[ControlStateValue[OutlinedBorder]] = NoneThe menu's shape.
This shape is combined with side to create a shape decorated with an outline.
sideclass-attributeinstance-attribute
side: Optional[ControlStateValue[BorderSide]] = NoneThe color and weight of the menu's outline.
This value is combined with shape to create a shape decorated with an outline.
visual_densityclass-attributeinstance-attribute
visual_density: Optional[VisualDensity] = NoneDefines how compact the menu's layout will be.