mini library

小窗入口:小窗控制、宿主、布局、UI 套件及配置。 播放器与通用播放类型由 mova.dart 提供。

Classes

IMovaMiniPlacement
Decides where the mini window lands after a drag ends.
MovaCornerSnap
Built-in placement: clamps into bounds, then (when snap) slides horizontally to whichever side the window's center is nearer, honouring margin and the safe-area MovaMiniInsets.
MovaMini
The route-independent holder of whatever is currently playing in the mini window.
MovaMiniCloseComponent
The mini window's close (✕) button, top-right corner.
MovaMiniHost
A convenience wrapper that composites the mini window above the whole app.
MovaMiniInsets
The edge insets kept clear of system chrome (status bar, home indicator).
MovaMiniOpts
Options for the in-app mini window (app-inline picture-in-picture).
MovaMiniRect
An axis-aligned rectangle in logical pixels, in the host window's coordinate space. A tiny stand-in for Rect: core/ must not import dart:ui.
MovaMiniUiKit
The minimal chrome shown inside the mini window: center play/pause, a buffering spinner, and a close (✕) button — nothing else. A 180px-wide box has no room for a seek bar, quality picker, or fullscreen button, and MovaMiniHost's own auto-hide-bar behavior would only get in the way.
MovaMiniWindow
The draggable mini window itself, holding a MovaPlayer on the borrowed api.

Enums

MovaMiniCorner
Which corner the mini window snaps to when first shown.
MovaMiniMount
How the mini window is mounted into the widget tree.

Functions

clampToBounds(MovaMiniRect r, {required MovaMiniRect bounds, required MovaMiniInsets insets, double margin = 0}) → MovaMiniRect
Clamps r so it lies fully inside bounds minus insets and margin. Exposed separately because the drag itself needs it every frame, while snapping only happens on release.
rectForCorner(MovaMiniCorner corner, {required double width, required double height, required MovaMiniRect bounds, required MovaMiniInsets insets, double margin = 0}) → MovaMiniRect
Returns the rect for corner — the window's first appearance.
remapProportionally(MovaMiniRect r, {required MovaMiniRect oldBounds, required MovaMiniRect newBounds}) → MovaMiniRect
Remaps r from oldBounds to newBounds by preserving its relative position (e.g. "near the bottom-right corner") instead of its raw pixel coordinates. Needed because a bare clampToBounds only guarantees validity, not intent: after a bounds shape change (rotation swaps width and height), reusing the old absolute left/top can leave the window stranded far from where it visually was — real-device verification (2026-09-24) found the window "走位" toward an edge across repeated rotations. Callers should still run the result through clampToBounds as a safety net (this function does not itself guarantee validity when oldBounds is degenerate, e.g. zero-sized).