PlBackTop class

The way back up, once there is a way back up to want.

It is hidden until it is useful and that is the whole design: a button pinned to the corner of every screen from the first frame is one more thing covering the content, and on a screen short enough not to scroll it is a control that does nothing. It appears when the reader is a screen or so down, which is the point at which scrolling back stops being something they would just do.

The scroll is animated, and not when the platform has asked for less movement — a screen that flies past a reader who turned animations off is the exact case that setting exists for. It jumps instead, which arrives in the same place.

Where it goes is yours. There is no floating here and no equivalent of the web's position: fixed: put it in a Stack over the scrollable, in a Positioned or an Align, which is how a Flutter screen pins anything to a corner.

Stack(
  children: <Widget>[
    ListView(controller: controller, children: rows),
    Positioned(
      right: 24,
      bottom: 24,
      child: PlBackTop(controller: controller),
    ),
  ],
)
Inheritance

Constructors

PlBackTop({ScrollController? controller, double visibilityHeight = 400, String? label, Widget? icon, VoidCallback? onPressed, PlassVariant variant = PlassVariant.glass, PlassSize? size, PlassColor? color, int elevation = 2, Key? key})
Creates a back-to-top button.
const

Properties

color PlassColor?
Semantic colour role.
final
controller ScrollController?
What is scrolled, and what is watched.
final
elevation int
Drop shadow depth.
final
hashCode int
The hash code for this object.
no setterinherited
icon Widget?
The glyph. An upward chevron by default.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
What it does, in words, and the name a screen reader gives it.
final
onPressed VoidCallback?
Runs instead of the scroll, rather than before it.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size PlassSize?
The size of the disc.
final
variant PlassVariant
What the surface is made of.
final
visibilityHeight double
How far down the reader has to be before it appears, in logical pixels.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PlBackTop>
Creates the mutable state for this widget at a given location in the tree.
override
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.
inherited
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