Skip to main content

FloatingActionButtonLocation

Trait FloatingActionButtonLocation 

Source
pub trait FloatingActionButtonLocation: Debug + 'static {
    // Required method
    fn get_offset(
        &self,
        scaffold_geometry: &ScaffoldPrelayoutGeometry,
    ) -> Offset;
}
Expand description

An object that defines a position for the FloatingActionButton based on the Scaffold’s ScaffoldPrelayoutGeometry.

Flutter provides FloatingActionButtonLocations for the common FloatingActionButton placements in Material Design applications. These locations are available as functions on dyn FloatingActionButtonLocation (<dyn FloatingActionButtonLocation>::end_float()).

See also:

Required Methods§

Source

fn get_offset(&self, scaffold_geometry: &ScaffoldPrelayoutGeometry) -> Offset

Places the FloatingActionButton based on the Scaffold’s layout.

This uses a ScaffoldPrelayoutGeometry, which the Scaffold constructs during its layout phase after it has laid out every widget it can lay out except the FloatingActionButton. The Scaffold uses the Offset returned from this method to position the FloatingActionButton and complete its layout.

Implementations§

Source§

impl dyn FloatingActionButtonLocation

Source

pub fn start_top() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body.

To align a floating action button with CircleAvatars in the ListTile.leading slots of ListTiles in a ListView in the Scaffold.body, use mini_start_top and set FloatingActionButton.mini to true.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn mini_start_top() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body, optimized for mini floating action buttons.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.leading slot of a ListTile in a ListView in the Scaffold.body.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn center_top() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn mini_center_top() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body, intended to be used with FloatingActionButton.mini set to true.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn end_top() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body.

To align a floating action button with CircleAvatars in the ListTile.trailing slots of ListTiles in a ListView in the Scaffold.body, use mini_end_top and set FloatingActionButton.mini to true.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn mini_end_top() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating over the transition between the Scaffold.appBar and the Scaffold.body, optimized for mini floating action buttons.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.trailing slot of a ListTile in a ListView in the Scaffold.body.

This is unlikely to be a useful location for apps that lack a top AppBar or that use a SliverAppBar in the scaffold body itself.

Source

pub fn start_float() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating at the bottom of the screen.

To align a floating action button with CircleAvatars in the ListTile.leading slots of ListTiles in a ListView in the Scaffold.body, use mini_start_float and set FloatingActionButton.mini to true.

Source

pub fn mini_start_float() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating at the bottom of the screen, optimized for mini floating action buttons.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.leading slot of a ListTile in a ListView in the Scaffold.body.

Compared to start_float, floating action buttons using this location will move horizontally and vertically closer to the edges, by K_MINI_BUTTON_OFFSET_ADJUSTMENT each.

Source

pub fn center_float() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating at the bottom of the screen.

To position a mini floating action button, use mini_center_float and set FloatingActionButton.mini to true.

Source

pub fn mini_center_float() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating at the bottom of the screen, optimized for mini floating action buttons.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align horizontally with the locations mini_start_float and mini_end_float.

Compared to center_float, floating action buttons using this location will move vertically down by K_MINI_BUTTON_OFFSET_ADJUSTMENT.

Source

pub fn end_float() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating at the bottom of the screen.

This is the default alignment of FloatingActionButtons in Material applications.

To align a floating action button with CircleAvatars in the ListTile.trailing slots of ListTiles in a ListView in the Scaffold.body, use mini_end_float and set FloatingActionButton.mini to true.

Source

pub fn mini_end_float() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating at the bottom of the screen, optimized for mini floating action buttons.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.trailing slot of a ListTile in a ListView in the Scaffold.body.

Compared to end_float, floating action buttons using this location will move horizontally and vertically closer to the edges, by K_MINI_BUTTON_OFFSET_ADJUSTMENT each.

Source

pub fn start_docked() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar.

To align a floating action button with CircleAvatars in the ListTile.leading slots of ListTiles in a ListView in the Scaffold.body, use mini_start_docked and set FloatingActionButton.mini to true.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn mini_start_docked() -> FloatingActionButtonLocationRef

Start-aligned FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar, optimized for mini floating action buttons.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.leading slot of a ListTile in a ListView in the Scaffold.body.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn center_docked() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn mini_center_docked() -> FloatingActionButtonLocationRef

Centered FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar; intended to be used with FloatingActionButton.mini set to true.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn end_docked() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn mini_end_docked() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the center of the floating action button lines up with the top of the bottom navigation bar, optimized for mini floating action buttons.

To align a floating action button with CircleAvatars in the ListTile.trailing slots of ListTiles in a ListView in the Scaffold.body, use mini_end_docked and set FloatingActionButton.mini to true.

If the value of Scaffold.bottomNavigationBar is a BottomAppBar, the bottom app bar can include a “notch” in its shape that accommodates the overlapping floating action button.

This is intended to be used with FloatingActionButton.mini set to true, so that the floating action button appears to align with CircleAvatars in the ListTile.trailing slot of a ListTile in a ListView in the Scaffold.body.

This is unlikely to be a useful location for apps that lack a bottom navigation bar.

Source

pub fn end_contained() -> FloatingActionButtonLocationRef

End-aligned FloatingActionButton, floating over the Scaffold.bottomNavigationBar so that the floating action button lines up with the center of the bottom navigation bar.

This is unlikely to be a useful location for apps which has a BottomNavigationBar or a non material 3 BottomAppBar.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§