StandardFabLocation class Null safety
A base class that simplifies building FloatingActionButtonLocations when used with mixins FabTopOffsetY, FabFloatOffsetY, FabDockedOffsetY, FabStartOffsetX, FabCenterOffsetX, FabEndOffsetX, and FabMiniOffsetAdjustment.
A subclass of FloatingActionButtonLocation which implements its getOffset method using three other methods: getOffsetX, getOffsetY, and isMini.
Different mixins on this class override different methods, so that combining a set of mixins creates a floating action button location.
For example: the location FloatingActionButtonLocation.miniEndTop is based on a class that extends StandardFabLocation with mixins FabMiniOffsetAdjustment, FabEndOffsetX, and FabTopOffsetY.
You can create your own subclass of StandardFabLocation to implement a custom FloatingActionButtonLocation.
The example shows a Scaffold with an AppBar, a BottomAppBar, and a FloatingActionButton using a custom FloatingActionButtonLocation.
The new FloatingActionButtonLocation is defined by extending StandardFabLocation with two mixins, FabEndOffsetX and FabFloatOffsetY, and overriding the getOffsetX method to adjust the FAB's x-coordinate, creating a FloatingActionButtonLocation slightly different from FloatingActionButtonLocation.endFloat.
flutter create --sample=material.StandardFabLocation.1 mysample
- Inheritance
-
- Object
- FloatingActionButtonLocation
- StandardFabLocation
Constructors
- StandardFabLocation()
-
Abstract const constructor. This constructor enables subclasses to provide
const constructors so that they can be used in const expressions.
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
getOffset(
ScaffoldPrelayoutGeometry scaffoldGeometry) → Offset -
Places the FloatingActionButton based on the Scaffold's layout.
override
-
getOffsetX(
ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) → double - Obtains the x-offset to place the FloatingActionButton based on the Scaffold's layout.
-
getOffsetY(
ScaffoldPrelayoutGeometry scaffoldGeometry, double adjustment) → double - Obtains the y-offset to place the FloatingActionButton based on the Scaffold's layout.
-
isMini(
) → bool - A function returning whether this StandardFabLocation is optimized for mini FloatingActionButtons.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited