CameraPage class
The camera: takes a photo or records a video, and pops with it as an XMedia, or with nothing when closed.
- Mixed-in types
- Available extensions
Constructors
- CameraPage({CameraSession? session, XAssetKind? filter, CameraCellSource? cellSource})
-
Borrows
sessionwhen supplied; otherwise owns a new session.
Properties
- cameraButtonState → CameraButtonState
-
What the shutter shows for photo and recording.
no setter
-
cameras
→ List<
XCameraDescription> -
The devices discovered by the shared owner.
no setter
- canPop → bool
-
Whether back pops this page: system back, the swipe and Esc. The back
gestures and the system-back state take it as the router renders, so a
page whose
canPopchanges calls XRouter.pagesChanged.no setterinherited - canSwipeBack → bool
-
Whether the back gesture (the iOS edge swipe, Android's predictive back)
drags this page, read as each one starts and as an edge swipe moves and
lifts: an edge swipe it turns off springs back. Set to
falsefor bottom sheets and overlays that dismiss differently; Android's back gesture then goes back as system back does.no setterinherited - cellSource → CameraCellSource?
-
The picker cell lending its live preview through the route transition.
final
- claimsBack → bool
-
Whether handleBack takes back now, as a home's does while it closes a
search. While back goes to a screen that claims it, XRouter.canPop
holds, so the framework, not the OS, takes back though nothing pops. The
system-back state reads it as the router renders and after the screen
emits, so a screen whose claim changes emits, where it is a
Listenable, or calls XRouter.pagesChanged.
no setterinherited
-
controller
→ ValueListenable<
XCameraController?> -
The shared owner's current controller, absent during replacement.
no setter
- detach ↔ VoidCallback?
-
Set by the router when pushing. Called during pop to remove the page
from the router stack and notify the delegate.
getter/setter pairinherited
- disposed → bool
-
Whether dispose has already run.
no setterinherited
- error ↔ String?
-
The failure shown in place of the preview.
getter/setter pair
- filter → XAssetKind?
-
Restricts capture to this kind; null permits photos and videos.
final
- flashOn ↔ bool
-
Whether still captures from the back camera fire the flash.
getter/setter pair
-
future
→ Future<
XMedia?> -
A future that completes with the result when the page is popped.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether there is at least one active listener.
no setterinherited
- host → ScreenHost?
-
The host that pushes from inside this screen's body should
target. Defaults to parentHost — regular screens push
siblings onto their own host.
SheetScreenoverrides this to route into its own nested stack so pages pushed from inside a sheet body land within the sheet rather than escaping it.no setterinherited - isModal → bool
-
Whether this screen is a modal (dialog, bottom sheet, etc.), which Esc
pops while it is the top screen.
no setterinherited
- key → Key?
-
Identity tag used by ScreenStack to reconcile a
homeslot: same runtimeType + same key → same surface, slot State preserved. Has no effect on stack entries (diffed by==).no setterinherited - micPermissionGranted ↔ bool
-
Microphone authorization, refreshed on foreground return.
getter/setter pair
- orientation ↔ DeviceOrientation
-
Physical orientation for the control icons.
getter/setter pair
- parentHost ↔ ScreenHost?
-
The host that pushed this screen — set by the host on push.
Mirrors UIKit's
UIViewController.navigationController.nulluntil pushed.getter/setter pairinherited - photo → bool
-
Whether the shutter captures a still, subject to filter.
no setter
- popped ↔ bool
-
Whether this page has been popped (explicitly removed).
getter/setter pairinherited
- recording → bool
-
Whether the shared controller has an active recording.
no setter
- removed ↔ VoidCallback?
-
Set by the router when pushing. Called from onRemoved after the exit
animation completes for final cleanup (disposal).
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → CameraSession
-
A supplied session remains owned by the caller after this page closes.
final
-
supportedOrientations
→ Iterable<
DeviceOrientation> -
Device orientations this screen supports while it is the topmost
visible page. The router applies the topmost screen's value via
SystemChrome.setPreferredOrientations on each active-screen
change, mirroring UIKit's per-
UIViewController.supportedInterfaceOrientations. Override to force portrait/landscape on a specific page (e.g. a camera).no setteroverride - transitionDuration → Duration
-
Duration of the enter/exit animation.
no setteroverride
Methods
-
addDispose(
VoidCallback callback) → void -
Registers a disposal
callback. Ignored if already disposed.inherited -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object notifies its listeners.
inherited
-
buildPresenter(
BuildContext context) → Widget -
Build the page content.
override
-
buildTransition(
BuildContext context, Animation< double> animation, Widget child) → Widget -
Wrap
child(the output of buildPresenter) in a transition driven byanimation(0→1 on push, 1→0 on pop).override -
dispose(
) → void -
Releases whatever this object holds. Calling it twice is an error.
override
-
disposeBy(
Dispose disposer) → void -
Available on Disposable, provided by the DisposableDisposerExtension extension
Adds this object's dispose to another Dispose collector. -
endVideo(
) → Future< void> - Returns the recording, or starts one if capture is idle.
-
ensureAudio(
) → Future< XCameraController?> - Reopens the shared owner's controller for audio when necessary.
-
flipCamera(
) → Future< void> - Changes lens through the shared owner when capture is idle.
-
handleBack(
) → bool -
Custom back handling, asked by system back and by a predictive back as
it commits. Return
trueto consume the back: the page stays, and a predictive back springs it back. On Android 13 and later the OS takes back that would pop nothing, unless claimsBack holds.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Notifies all registered listeners.
inherited
-
onActive(
) → void -
Called when this screen becomes the topmost visible screen in the
router. Fires once after push, and again whenever it becomes topmost
after a screen above it pops or hides, or its shell shows it. Always
paired with a later onInactive.
override
-
onDetach(
) → void -
Called during pop before the future is completed.
Override for cleanup that must happen before the exit animation.
override
-
onInactive(
) → void -
Called when another screen is pushed on top, when its shell hides it,
or right before this one is popped. Mirror of onActive.
override
-
onPush(
) → void -
Called after the page is pushed onto the router.
override
-
onRemoved(
) → void -
Called after the exit animation completes and the page is fully removed.
Override for cleanup that should happen after the page is off screen.
inherited
-
pop(
[XMedia? result]) → void -
Remove this page. Marks as popped, detaches from the router,
and completes the future with
result.inherited -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
setPhoto(
bool isPhoto) → void - Selects an allowed mode while capture is idle.
-
subscribe(
VoidCallback callback) → VoidCallback -
Available on Listenable, provided by the ListenableExtension extension
Addscallbackas listener and returns a function to remove it. -
takePhoto(
) → Future< void> - Captures a still, or starts/stops recording in video mode.
-
takeVideo(
) → Future< void> - Starts an allowed video capture, with sound when available.
-
toggleFlash(
) → void - Toggles flash for still captures.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited