harbor library
A harbor for your widgets.
Docks claim the edges of the screen. Everything else moors clear of them, sails under them, or is open water, and the tide (the keyboard) rises over whatever doesn't float.
Classes
- Harbor
- A harbor: a frame whose edges docks are built against, with a body of water in the middle and buoys afloat in whatever water nothing covers.
- HarborAnchor
- A point a buoy can be anchored to: give it to a HarborAnchorPoint around the widget to anchor to (a button in a dock, a row in a list), and to the HarborBuoy.anchored that should sit by it.
- HarborAnchorPoint
- Marks child as the point anchor refers to.
- HarborBeacon
- A beacon: marks a widget the lighthouse watches.
- HarborBreakwater
- A breakwater: a sheet (or any overlay) reporting how far it covers the bottom of the harbor that opened it, so that harbor's content keeps clear of it while it is up.
- HarborBuoy
- Something afloat in a harbor: placed in the water nothing covers, so it clears the coast, every dock and the keyboard without knowing about them.
- HarborCastOff
- Casts off edges for everything beneath: after a layer has kept clear of them, the area below reads zero there and cannot clear them a second time.
- HarborCenter
- Centers child in the harbor's frame, then nudges it just far enough that it overlaps the docks and the keyboard by no more than overlapBudget: a canvas's controls that should sit in the middle of the screen, not the middle of whatever water is left, but never mostly under a sheet.
- HarborChart
- The harbor chart: who holds which edge, at which layer, in every harbor in a view.
- HarborChartEntry
- One harbor on a chart, in global coordinates.
- HarborChartOverlay
- Draws the chart over child: every dock's ground (piers in teal, quays in sand), each harbor's clear water outlined, and the tide in blue.
- HarborClaim
- A request that a dock make way, returned by HarborController.makeWay. Release it when the content no longer needs the edge.
- HarborCoast
- Where a harbor's coast comes from. Set it once, on HarborSea or on the first Harbor; everything beneath inherits it.
- HarborController
- A harbor's handle on itself, for its docks, its content and its neighbors.
-
HarborDialogRoute<
T> -
The route showHarborDialog pushes: a RawDialogRoute that builds a
harbor dialog, as Material's
DialogRouteis the routeshowDialogpushes. - HarborDock
- A dock: something built against one edge of a Harbor. Its size is measured, never declared, and it claims that much of the edge.
- HarborDockRecord
- One dock as it was last laid out.
- HarborDockSlot
- Builds one dock in its harbor: its coast padding, backdrop, frosting, hairline, and its dark and withdraw animations.
- HarborDryDock
- The ground a dry dock keeps: a box exactly as tall as the tide's high-water mark. At low tide it shows child (a panel that takes the keyboard's place); at high tide the keyboard covers it. Neither moves when they trade.
- HarborEdges
- Arithmetic on EdgeInsetsDirectional by HarborEdge, shared by every layer.
- HarborFairway
- A fairway: a scroll view whose viewport runs to the frame's edges, under the docks, while its content comes to rest clear of them at both ends.
- HarborFairwaySliver
-
One sliver of a scroll view you build yourself, kept clear at the ends you
choose. Use it on the sliver at each end of a
CustomScrollView; a whole scroll view is better as a HarborFairway. - HarborFlareEntry
-
A transient buoy raised by
HarborFlares.raise, which returns it. - HarborFlareHold
- A hold on a flare's time, returned by HarborFlareEntry.hold.
- HarborFlares
- Transient buoys: messages raised in a harbor's clear water for a while.
- HarborFleet
- Everything harbors in one view know about each other: which is on top (where a flare goes) and the list a chart reads.
- HarborFleetObserver
-
Hears harbors join and leave a HarborFleet, as a
NavigatorObserverhears routes come and go. - HarborLayoutRecord
- The dock positions and clearances a harbor laid out last, in its own coordinates.
- HarborLighthouse
- The lighthouse keeps things in sight.
- HarborLighthouseRegion
-
A region the lighthouse can lift: when a HarborBeacon inside it with
liftset would be covered by what covers the bottom (a sheet, a breakwater, the keyboard), the region moves its content up just far enough, and back down when the cover goes. Content already clear stays where it is. With reduced motion (MediaQueryData.disableAnimations) it moves at once. - HarborMakeWay
- Asks the docks on edge to make way while active: to go dark (keep their ground) or withdraw (give it back). For a panel that takes over the bottom edge, or lyrics that need the whole screen.
- HarborMoored
- Moored: kept clear of everything in the way on edges, then casts those edges off so nothing beneath keeps clear of them a second time.
- HarborMooringLine
- Moors child to the mooring line on its sides: the harbor's margin plus whatever is in the way there (a side cutout, a rail). For a row in a list, a heading, a tile grid: anything that should line up with the page margin while the list itself runs to the frame's edge.
- HarborOpenWater
- Open water: content that ignores the docks and the coast (a background, a map, a full-bleed image), told how far each of them reaches so it can place what it draws.
- HarborPontoon
- A pontoon: a dock moored to the nearest harbor from deeper in the tree, for a bar that belongs to the content rather than to the page (an unsaved changes bar, a hint, a floating pill). It joins the docks on edge, innermost, measured and stacked like any other, and leaves when this widget does. It is built where the harbor's docks are, so it sees the harbor's inherited widgets, not this widget's.
- HarborPontoonHandle
- A dock moored on a harbor by HarborController.addPontoon; give it to HarborController.updatePontoon and HarborController.removePontoon.
- HarborPortalBuoy
- An anchored buoy opened from anywhere: a menu from a list row, a popover from a button, declared where it is opened rather than in Harbor.buoys.
- HarborScaleModel
- A scale model: lays child out on a fixed reference screen (a TV's 1200×675, say) and scales it to fit the real one, letterboxed.
- HarborSea
-
The sea every harbor floats on. Mount it once, above the app's
Navigator(MaterialApp.builderis the place), so routes, dialogs and sheets all share its coast, its tide gauge and its flares. - HarborSheet
- A sheet's surface: a new port with its own docks. Its header is a pier the body sails under, with a wake; its footer is a quay that floats on the tide and keeps footerMinimum above the screen's edge on a phone with no home indicator. Neither is given a height: both are measured.
- HarborSheetController
- Closes and rebuilds a sheet showHarborSheet opened, from outside it: a now-playing drawer that a button on the page opens and closes, an editor's tool panel the page puts away when a tool is picked.
- HarborSheetExtent
- A sheet's heights, for a draggable sheet: fractions of the space above the keyboard.
- HarborSliverDock
- A dock that lives in a fairway: a header that scrolls with the content and then pins, clear of the docks above it, and becomes a dock for everything after it. The first one in a fairway with no dock above takes the status bar itself, so its backdrop runs under it. Several stack.
- HarborSticky
- Keeps child in sight at the top of the clear water while the item it is in scrolls under the docks: a pill that rides with its card and then sticks just below the header, until the card itself has scrolled away.
- HarborTide
- Reads the tide: the keyboard, as the harbor sees it.
- HarborTideSource
- Feeds a keyboard height the platform does not report into the tide: a keyboard drawn by a plugin or a platform view, a TV's on-screen keyboard reported over a channel, or a panel of your own that should push content up as a keyboard does.
- HarborTideState
- The tide as a harbor sees it.
- HarborTitleSafe
- A TV's title-safe area: the band at each edge a television may crop or overscan, which content must stay out of.
- HarborWake
- What a dock leaves behind it on the water: how the boundary between the dock and the content passing under it is drawn.
- HarborWakeBand
- One edge's wake: the band where content passing under a dock fades out.
- HarborWakeMask
- An alpha mask that fades child out along the wakes bands. Paints nothing extra when there are none, so it can always be in the tree.
- HarborWaters
- Publishes HarborWatersData beneath a harbor layer.
- HarborWatersData
-
The waters at a point in the tree: why
MediaQuery.paddingis what it is.
Enums
- HarborBuoyCrossAlignment
-
How an anchored buoy lines up with its anchor across its side, as a
Row's orColumn'sCrossAxisAlignmentlines up its children: above or below the anchor, start and end are in reading order (a dropdown under its button's leading edge); at its start or end, they are its top and bottom. - HarborBuoySide
-
Which side of its anchor an anchored buoy sits on. start and end are in
reading order, as in
AlignmentDirectional.centerStart: start is on the right under right-to-left. - HarborClear
- What a moored widget keeps clear of.
- HarborCoastFeature
- What the coast is made of: the part of the screen the platform keeps for itself. A chart shows which feature put each inset there.
- HarborCoastStance
- How a dock takes the coast on the edge it is built against.
- HarborDockKind
- How a dock meets the content of its harbor.
- HarborDockState
- Whether a dock is in service.
- HarborEdge
- An edge of a harbor. Directional, so a side follows the reading direction rather than the physical side of the screen.
- HarborExtentPolicy
- How a withdrawing dock gives its ground back.
- HarborFlareClosedReason
- Why a flare was closed, as HarborFlareEntry.closed reports it.
- HarborFlareSlot
- Where a flare is raised within the clear water of its harbor.
- HarborFlareTarget
- Which harbor a flare goes to.
- HarborFollow
- Which docks a moored widget keeps up with.
- HarborRest
- Where content comes to rest under a dock with a wake.
- HarborSheetBarrier
- How a sheet sits over the page that opened it.
- HarborSizing
- How a harbor sizes itself.
- HarborTidePhase
- Where the tide is in its cycle.
- HarborTideStance
- How a dock behaves when the tide (the keyboard) comes in.
- HarborWakeKind
- HarborWatersAspect
- Which part of the waters a reader depends on, so it rebuilds only for that.
- HarborYield
- How a dock makes way when content asks it to.
Functions
-
closeHarborSheet(
BuildContext context) → void -
Closes the sheet
contextis in, whichever way it was opened. -
harborAlphaWake(
BuildContext context, Map< HarborEdge, HarborWakeBand> wakes, Widget body) → Widget - The default HarborWakePainter: an alpha mask over the body, transparent at the body's edge, a quarter opaque at the dock's inner face, and fully opaque where the wake ends.
-
showHarborDialog<
T> (BuildContext context, {required WidgetBuilder builder, bool inheritClearWater = false, Color barrierColor = const Color(0x80000000), bool barrierDismissible = true, String? barrierLabel, String? semanticLabel, RouteSettings? routeSettings, Offset? anchorPoint, TraversalEdgeBehavior? traversalEdgeBehavior, bool? requestFocus, AnimationStyle? animationStyle, RouteTransitionsBuilder? transitionBuilder}) → Future< T?> -
Opens
builder's dialog overcontext. -
showHarborSheet<
T> (BuildContext context, {required WidgetBuilder builder, bool breakwater = false, HarborSheetBarrier barrier = HarborSheetBarrier.dismissible, bool isDismissible = true, Color barrierColor = const Color(0x80000000), double? maxWidth, Offset? anchorPoint, bool? requestFocus, bool keepsTopCoast = false, RouteSettings? routeSettings, String? barrierLabel, AnimationStyle? sheetAnimationStyle, HarborSheetController? controller, AnimationController? transitionAnimationController, String? barrierOnTapHint, String? semanticLabel}) → Future< T?> -
Opens
builder's sheet (usually a HarborSheet) overcontext's harbor.
Typedefs
-
HarborFlareTransitionBuilder
= Widget Function(BuildContext context, Animation<
double> animation, Widget child) -
Builds a flare's entrance and exit around
childfromanimation, which runs from 0 to 1 as the flare is raised and back as it is lowered. - HarborSignalClosedReason = HarborFlareClosedReason
- The old name of HarborFlareClosedReason.
- HarborSignalEntry = HarborFlareEntry
- The old name of HarborFlareEntry.
- HarborSignals = HarborFlares
- The old name of HarborFlares.
- HarborSignalSlot = HarborFlareSlot
- The old name of HarborFlareSlot.
- HarborSignalTarget = HarborFlareTarget
- The old name of HarborFlareTarget.
- HarborSignalTransitionBuilder = HarborFlareTransitionBuilder
- The old name of HarborFlareTransitionBuilder.
-
HarborWakePainter
= Widget Function(BuildContext context, Map<
HarborEdge, HarborWakeBand> wakes, Widget body) - Wraps a harbor's body so content fades out as it passes under the docks.
- HarborWatersWidgetBuilder = Widget Function(BuildContext context, HarborWatersData waters)
-
The signature of HarborOpenWater.builder: builds open water from the
watersit lies in, as aLayoutWidgetBuilderbuilds from its constraints.