pub struct TextSelectionToolbarLayoutDelegate {
pub anchor_above: Offset,
pub anchor_below: Offset,
pub fits_above: Option<bool>,
}Expand description
A SingleChildLayoutDelegate for use with CustomSingleChildLayout that positions its
child above anchor_above if it fits, or otherwise below
anchor_below.
Primarily intended for use with toolbars or context menus.
See also:
TextSelectionToolbar, which uses this to position itself.CupertinoTextSelectionToolbar, which also uses this to position itself.
Fields§
§anchor_above: OffsetThe location that the toolbar should attempt to position itself at.
Should be provided in local coordinates.
anchor_below: OffsetThe fallback position that should be used if anchor_above
doesn’t work.
Should be provided in local coordinates.
fits_above: Option<bool>Whether or not the child should be considered to fit above
anchor_above.
Typically used to force the child to be drawn at anchor_above even when it doesn’t
fit, such as when the Material TextSelectionToolbar draws an open overflow menu.
If not provided, it will be calculated.
Implementations§
Source§impl TextSelectionToolbarLayoutDelegate
impl TextSelectionToolbarLayoutDelegate
Sourcepub fn new(
anchor_above: Offset,
anchor_below: Offset,
) -> TextSelectionToolbarLayoutDelegate
pub fn new( anchor_above: Offset, anchor_below: Offset, ) -> TextSelectionToolbarLayoutDelegate
Creates an instance of TextSelectionToolbarLayoutDelegate.
Sourcepub fn fits_above(self, fits_above: bool) -> TextSelectionToolbarLayoutDelegate
pub fn fits_above(self, fits_above: bool) -> TextSelectionToolbarLayoutDelegate
Dart TextSelectionToolbarLayoutDelegate(fitsAbove:).
Trait Implementations§
Source§impl SingleChildLayoutDelegate for TextSelectionToolbarLayoutDelegate
impl SingleChildLayoutDelegate for TextSelectionToolbarLayoutDelegate
Source§fn get_constraints_for_child(
&self,
constraints: BoxConstraints,
) -> BoxConstraints
fn get_constraints_for_child( &self, constraints: BoxConstraints, ) -> BoxConstraints
Source§fn get_position_for_child(&self, size: Size, child_size: Size) -> Offset
fn get_position_for_child(&self, size: Size, child_size: Size) -> Offset
Source§fn should_relayout(&self, old_delegate: &dyn SingleChildLayoutDelegate) -> bool
fn should_relayout(&self, old_delegate: &dyn SingleChildLayoutDelegate) -> bool
RenderCustomSingleChildLayoutBox object, or any time that a new CustomSingleChildLayout
object is created with a new instance of the custom layout delegate class (which amounts
to the same thing, because the latter is implemented in terms of the former). Read moreSource§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
runtimeType comparison and its covariant
narrowing of should_relayout’s argument.