web

package
v1.17.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web is the platform backend of the web (GOOS=js GOARCH=wasm, SPEC §23): one window that is a canvas in a host element of the page, frames from requestAnimationFrame, and the lifecycle and the settings of the browser.

The files that talk to the browser carry the js tag; the rest (the size and device pixel ratio math, the config, the query parameters of the page, the detection of the operating system, the settings, the event queue) is plain Go that the normal test run and scripts/test-wasm.sh both test.

Flutter: engine/src/flutter/lib/web_ui/lib/src/engine/view_embedder.

Index

Constants

View Source
const (
	// AudioWorkletFile is the name of the script that glutter-web writes next to index.html and the page loads with
	// audioWorklet.addModule.
	//
	// Flutter: no counterpart
	AudioWorkletFile = "glutter-audio-worklet.js"
	// AudioPlaybackProcessor is the name that the worklet registers its playback processor under.
	//
	// Flutter: no counterpart
	AudioPlaybackProcessor = "glutter-playback"
	// AudioCaptureProcessor is the name that the worklet registers its capture processor under.
	//
	// Flutter: no counterpart
	AudioCaptureProcessor = "glutter-capture"
	// AudioDefaultBuffer is the length of the buffer of a device when the app asks for none (SPEC §22: the web's target is 120 ms).
	//
	// Flutter: no counterpart
	AudioDefaultBuffer = 100 * time.Millisecond
	// AudioPumpInterval is how often the Go program tops up the buffers of the playbacks and takes what the captures have.
	//
	// Flutter: no counterpart
	AudioPumpInterval = 10 * time.Millisecond
	// AudioCaptureBlock is the length of the blocks that a capture without shared memory posts.
	//
	// Flutter: no counterpart
	AudioCaptureBlock = 10 * time.Millisecond
	// AudioMaxChunk is the most frames that one call of a playback's handler is asked for.
	//
	// Flutter: no counterpart
	AudioMaxChunk = 4096
)
View Source
const (
	// RingWrite is the number of frames written, an unsigned counter that wraps at 2^32.
	//
	// Flutter: no counterpart
	RingWrite = 0
	// RingRead is the number of frames read, the same.
	//
	// Flutter: no counterpart
	RingRead = 1
	// RingUnderruns counts the render quanta in which a playback found too few frames, after the first frame was played.
	//
	// Flutter: no counterpart
	RingUnderruns = 2
	// RingFlags has RingFlagPaused and RingFlagClosed.
	//
	// Flutter: no counterpart
	RingFlags = 3
	// RingChannels is the number of channels of a frame.
	//
	// Flutter: no counterpart
	RingChannels = 4
	// RingCapacity is the number of frames the ring holds, a power of two.
	//
	// Flutter: no counterpart
	RingCapacity = 5
	// RingOverruns counts the render quanta in which a capture found no room.
	//
	// Flutter: no counterpart
	RingOverruns = 6
	// RingPrimed is 1 after the first frame was played: until then silence is not an underrun.
	//
	// Flutter: no counterpart
	RingPrimed = 7
	// RingHeaderWords is the size of the header in 32-bit words; the frames follow it.
	//
	// Flutter: no counterpart
	RingHeaderWords = 8
)

The words of the header of a ring, in the order of the JavaScript's H_* constants.

View Source
const (
	// RingFlagPaused is a device that its owner paused: a playback plays silence and keeps its frames, a capture drops what it hears.
	//
	// Flutter: no counterpart
	RingFlagPaused = 1
	// RingFlagClosed is a device that was closed: the processor ends.
	//
	// Flutter: no counterpart
	RingFlagClosed = 2
)

The bits of RingFlags.

View Source
const (
	// ScreenshotPath is where the engine's self-capture posts its PNG.
	//
	// Flutter: no counterpart
	ScreenshotPath = "/__glutter/screenshot"
	// ResultsPath is where a test program posts its results.
	//
	// Flutter: no counterpart
	ResultsPath = "/__glutter/results"
)

The paths under which the web server of glutter-web and of the browser tests collects what the page sends (SPEC §23.8, §17).

View Source
const DefaultScrollLineHeight = 16.0

DefaultScrollLineHeight is the height of a line of scroll when the browser's font size cannot be read: Flutter takes a quarter of the default font size, which is 16 pixels, when it can, and this fallback is 16 pixels as in Flutter.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _WheelEventListenerMixin._computeDefaultScrollLineHeight

View Source
const DevEventsEnv = "GLUTTER_DEV_EVENTS"

DevEventsEnv is the environment variable (the query parameter of the page) with the script of synthetic events that debug builds replay after the first frame, so that a proof screenshot can show an app after a scroll or a tap. It is read only in debug builds (foundation.DebugMode).

Flutter: no counterpart

View Source
const EnvPrefix = "GLUTTER_"

EnvPrefix starts the name of every query parameter that the loader copies into the Go program's environment.

Flutter: no counterpart

Variables

This section is empty.

Functions

func AudioDevicesOf

func AudioDevicesOf(list []MediaDevice, kind platform.AudioKind) []platform.AudioDeviceInfo

AudioDevicesOf turns the list of the browser into the devices of a kind. The default device is the one with the ID "default" (Chrome lists it first), else the first. A device with no label is named by its number.

Flutter: no counterpart

func AudioTarget

func AudioTarget(bufferFrames, rate int) int

AudioTarget is how many frames the Go program keeps in the ring of a device: BufferFrames of the options, else AudioDefaultBuffer at the rate.

Flutter: no counterpart

func AutocapitalizeAttribute

func AutocapitalizeAttribute(h ui.TextInputHints) string

AutocapitalizeAttribute is the autocapitalize attribute for how the text field capitalizes: words, characters or sentences, else off.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart TextCapitalizationConfig.setAutocapitalizeAttribute

func ConvertButtonToButtons

func ConvertButtonToButtons(button int) int

ConvertButtonToButtons turns PointerEvent.button, the button that changed (0 left, 1 middle, 2 right, 3 back, 4 forward, ...) into a bit of PointerEvent.buttons (0x1 left, 0x4 middle, 0x2 right, 0x8 back, 0x10 forward, ...).

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart convertButtonToButtons

func CursorCSS

func CursorCSS(c platform.MouseCursor) string

CursorCSS returns the CSS value of the cursor property for a cursor. The basic arrow, the unspecified cursor and any cursor the table does not know are "default", for which the platform removes the property.

Flutter: lib/web_ui/lib/src/engine/mouse/cursor.dart MouseCursor.activateSystemCursor

func DefaultAudioDevice

func DefaultAudioDevice(kind platform.AudioKind) platform.AudioDeviceInfo

DefaultAudioDevice is the device that Devices lists before the browser has listed its own, and when it lists none (the labels and the devices of the microphones are hidden until the user has allowed one, and the browsers have no list of outputs).

Flutter: no counterpart

func DisplayOf

func DisplayOf(screenWidth, screenHeight, dpr float64) platform.Display

DisplayOf describes the one display of a page from the screen: its size in CSS pixels, the device pixel ratio and a refresh rate of 60 (SPEC §23.2).

Flutter: lib/web_ui/lib/src/engine/display.dart EngineFlutterDisplay

func EnterKeyHintAttribute

func EnterKeyHintAttribute(k ui.TextInputEnterKey) string

EnterKeyHintAttribute is the enterkeyhint attribute for the action of the text field; empty for the platform's own label.

Flutter: lib/web_ui/lib/src/engine/text_editing/input_action.dart EngineInputAction.enterkeyhintAttribute

func EnvFromQuery

func EnvFromQuery(search string) map[string]string

EnvFromQuery returns the environment that the query string of a page's URL (location.search, with or without the leading "?") gives the Go program: the parameters whose names start with GLUTTER_, so that ?GLUTTER_RENDERER=webgl works as the environment variable does on Linux (SPEC §23.1). Names and values are percent-decoded; the last of a repeated name wins; a parameter without "=" has an empty value. Parameters that fail to decode, or whose name has a "=" or a NUL, are left out.

The loader in index.html does the same in JavaScript before the program starts, because the engine reads its environment at startup; this is the specification it follows, and the loader's tests check it against this function's table.

Flutter: no counterpart

func FrameTime

func FrameTime(ms float64) time.Duration

FrameTime turns the timestamp of a requestAnimationFrame callback (a DOMHighResTimeStamp, in milliseconds since the page's time origin) into the frame time of Handler.OnFrame. A timestamp that is not a finite, non-negative number is 0.

Flutter: no counterpart

func FramesToProduce

func FramesToProduce(write, read uint32, capacity, target int) int

FramesToProduce is how many frames a producer puts in a ring that holds capacity frames and has write and read as its counters, to bring what waits to target frames (and no more than fits): 0 when it has that much already.

Flutter: no counterpart

func HapticMillis

func HapticMillis(kind ui.HapticFeedbackKind) int

HapticMillis is the length of the vibration of navigator.vibrate that a kind of haptic feedback is, in milliseconds, or 0 for a kind that makes none. The lengths are Glutter's: a phone's browser has only a motor that is on or off, so the lengths tell the kinds apart (the browser rounds them to what the motor can do).

Deviation: Flutter asks the platform for its own feedback (a click of the screen on Android, an impact generator on iOS); the web has the length alone (SPEC §12.10).

Flutter: services/haptic_feedback.dart HapticFeedback

func IconURL

func IconURL(icon string) string

IconURL returns the icon when it can be an image URL of the web: it has a slash (a path or a URL) or is a data: URI. A name from an icon theme ("dialog-information") is not, and gives an empty string, since the browser has no icon themes.

Flutter: no counterpart

func InputModeAttribute

func InputModeAttribute(p ui.TextInputPurpose) string

InputModeAttribute is the inputmode attribute for what the text field is for: the numeric, decimal, tel, email and url keyboards; empty for the others.

Flutter: lib/web_ui/lib/src/engine/text_editing/input_type.dart EngineInputType.inputmodeAttribute

func IsFirefox

func IsFirefox(userAgent string) bool

IsFirefox says whether the user agent is Firefox's, whose wheel events are told from a trackpad's differently.

Flutter: lib/web_ui/lib/ui_web/src/ui_web/browser_detection.dart BrowserDetection.browserEngine

func IsNativePasteKey

func IsNativePasteKey(e KeyEvent, os OperatingSystem) bool

IsNativePasteKey says whether the key event is the paste shortcut of the browser while the hidden text field has the focus: Control+V (also with Shift, which pastes plain text) and Shift+Insert, and on macOS and iOS Command+V (also with Shift), where Control+V pastes nothing. The event is not given to the framework, so that nothing handles the shortcut and the browser pastes into the hidden text field and sends its paste event, which needs no permission from the user (SPEC §23.5). The framework's own paste (Command+V in its macOS bindings) would read the clipboard with navigator.clipboard, which Safari answers with a "Paste" button that the user has to press.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart DefaultTextEditingStrategy.handleClipboardEvent

func LifecycleOf

func LifecycleOf(visible, focused bool) ui.AppLifecycleState

LifecycleOf is the application lifecycle state of a page: Hidden when the page is not visible (document.visibilityState, a background tab or a minimized window), Resumed when it is visible and has the focus, and Inactive when it is visible without it (SPEC §13, §23.3).

Flutter: lib/web_ui/lib/src/engine/platform_dispatcher.dart EnginePlatformDispatcher.sendAppLifecycleState

func MediaErrorTag

func MediaErrorTag(name string) string

MediaErrorTag is the tag of the audio error that a browser's DOMException (the name of the rejection of getUserMedia, or of the exception of a constructor) stands for: a refusal of the user is AudioCapturePermissionDenied, constraints that the browser cannot meet are AudioFormatUnsupported, and any other failure is AudioDeviceOpenFailed.

Flutter: no counterpart

func MotionRate

func MotionRate(intervalMillis float64) float64

MotionRate is the number of events a second that an interval in milliseconds means, or 0 when the browser gives none.

Flutter: no counterpart

func MotionReading

func MotionReading(kind platform.SensorKind, e MotionEvent) (platform.SensorReading, bool)

MotionReading is the reading of the sensor of the kind that the event holds, in the unit and on the axes of the toolkit (m/s² and rad/s; x to the right, y up, z out of the screen, which are the browser's axes for the acceleration, and for the rotation x is beta, y is gamma and z is alpha). It is false when the event has none for the kind, or has a number that is not finite.

Flutter: no counterpart

func PadOSNumber

func PadOSNumber(os OperatingSystem) uint8

PadOSNumber numbers the operating systems the way SDL 3's browser backend does for the subtype of a pad's GUID: 1 Android, 2 Linux, 3 iOS, 4 macOS, 5 Windows, 0 unknown.

Flutter: no counterpart

func ParseLocale

func ParseLocale(tag string) (ui.Locale, bool)

ParseLocale reads a BCP 47 language tag such as "en", "en-US", "zh-Hant-TW" or "es-419" into a locale: the language in lower case, an optional script of four letters in title case, and an optional region (two letters in upper case, or three digits). It is false for a tag whose language is not two or three letters. Extensions and private-use subtags after the region are ignored.

Flutter: lib/web_ui/lib/src/engine/platform_dispatcher.dart parseBrowserLanguages

func ParsePadID

func ParsePadID(id string) (name string, vendor, product uint16, xinput bool)

ParsePadID reads what a browser's id says about a pad: its name without the browser's additions, the vendor and product numbers when it has them, and whether it is an XInput pad. Chrome, Edge and Opera write "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)", "usb gamepad (Vendor: 0810 Product: e501)" or "Xbox 360 Controller (XInput STANDARD GAMEPAD)"; Firefox and Safari write "046d-c216-Logitech Dual Action" (the numbers may lose their leading zeros) or "xinput".

Flutter: no counterpart

func ParsePixels

func ParsePixels(s string) (float64, bool)

ParsePixels reads a CSS length in pixels, such as the computed font size "16px".

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _WheelEventListenerMixin._computeDefaultScrollLineHeight

func PlaybackChannels

func PlaybackChannels(asked, max int) int

PlaybackChannels is the number of channels of a playback: the app's (2 when it asks for none), cut to what the output has.

Flutter: no counterpart

func PowerOfTwo

func PowerOfTwo(n int) int

PowerOfTwo is the smallest power of two that is not less than n (1 for n of 1 or less).

Flutter: no counterpart

func ResolutionQuery

func ResolutionQuery(dpr float64) string

ResolutionQuery is the media query that stops matching when the device pixel ratio changes from dpr (browser zoom, or a move to a monitor with another scale). The platform listens to it and makes a new one for the new ratio each time it fires.

Flutter: lib/web_ui/lib/src/engine/view_embedder/display_dpr_stream.dart DisplayDprStream

func RingFrames

func RingFrames(rate int, buffer time.Duration) int

RingFrames is the capacity, in frames, of a ring that holds a buffer of the given length at a rate: the next power of two, with room for 20% more than the buffer (so that a producer that tops it up to the buffer never finds it full) and 1024 frames at least.

Flutter: no counterpart

func SanitizeDPR

func SanitizeDPR(dpr float64) float64

SanitizeDPR returns dpr when it is a usable device pixel ratio (finite and above zero), and 1 otherwise: a browser that reports 0 or nothing is treated as a screen without scaling.

Flutter: lib/web_ui/lib/src/engine/display.dart EngineFlutterDisplay.devicePixelRatio

func SettingsOf

func SettingsOf(p Prefs) platform.Settings

SettingsOf turns the preferences into the platform's settings: the brightness, reduced motion (which turns animations off), high contrast, the locales, and a text scale of 1. Without a usable language the locale is en-US, as in Flutter web.

Flutter: lib/web_ui/lib/src/engine/platform_dispatcher.dart EnginePlatformDispatcher.configuration

func StripMarkup

func StripMarkup(body string) string

StripMarkup makes the plain text of a notification body that has the markup of the Desktop Notifications specification (<b>, <i>, <u>, <a href>, <img>): the tags are dropped and the entities read. A Notification's body is plain text.

Flutter: no counterpart

Types

type AudioRing

type AudioRing struct {
	H        [RingHeaderWords]int32
	D        []float32
	Channels int
	Capacity int
	// contains filtered or unexported fields
}

AudioRing is the model of the ring: a header of RingHeaderWords words and interleaved frames in a slice of float32.

Flutter: no counterpart

func NewAudioRing

func NewAudioRing(channels, capacity int) *AudioRing

NewAudioRing makes a ring of capacity frames of channels channels. The capacity is rounded up to a power of two (the counters wrap at 2^32, which only a power of two divides evenly).

Flutter: no counterpart

func (*AudioRing) Available

func (r *AudioRing) Available() uint32

Available is the number of frames that wait to be read.

Flutter: no counterpart

func (*AudioRing) Free

func (r *AudioRing) Free() int

Free is the number of frames that fit.

Flutter: no counterpart

func (*AudioRing) Play

func (r *AudioRing) Play(dst []float32, frames int) int

Play is what a playback does for a render quantum of frames frames: it reads what there is into dst, fills the rest with silence and, once a frame has been played, counts an underrun when the frames were not all there. A paused ring plays silence and keeps its frames. It returns how many frames it read.

Flutter: no counterpart

func (*AudioRing) Read

func (r *AudioRing) Read(dst []float32) int

Read reads up to len(dst) / channels frames into dst and returns how many.

Flutter: no counterpart

func (*AudioRing) Record

func (r *AudioRing) Record(src []float32, frames int) int

Record is what a capture does with a render quantum of frames frames (interleaved in src): it writes what fits, and counts an overrun when it all did not. A paused ring drops the quantum. It returns how many frames it wrote.

Flutter: no counterpart

func (*AudioRing) Write

func (r *AudioRing) Write(src []float32) int

Write writes as many whole frames of src as fit and returns how many.

Flutter: no counterpart

type BrowserButton

type BrowserButton struct {
	Pressed bool
	// Value is how far it is pressed, from 0 to 1.
	Value float64
}

BrowserButton is a button of a Gamepad of the browser.

Flutter: no counterpart

type BrowserPad

type BrowserPad struct {
	// Index is its place in the array of navigator.getGamepads().
	Index int
	// ID is the browser's name for it ("Xbox 360 Controller (XInput STANDARD GAMEPAD)" in Chrome, "045e-028e-Xbox 360 Controller"
	// in Firefox).
	ID string
	// Mapping is "standard" when the browser maps the pad to the standard layout, else "".
	Mapping   string
	Connected bool
	Buttons   []BrowserButton
	Axes      []float64
	// Timestamp is when the state was last changed, in milliseconds (the browser's DOMHighResTimeStamp).
	Timestamp float64
	// DualRumble and TriggerRumble say that its vibration actuator can play the "dual-rumble" and "trigger-rumble" effects.
	DualRumble, TriggerRumble bool
}

BrowserPad is the state of one Gamepad of the browser, copied out of it.

Flutter: no counterpart

type ButtonSanitizer

type ButtonSanitizer struct {
	// contains filtered or unexported fields
}

ButtonSanitizer keeps the buttons of one pointer and turns the browser's events, which are not always consistent (a move that says a button went down, a right button that never comes up because the context menu opened), into changes the framework can follow.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer

func (*ButtonSanitizer) Cancel

func (s *ButtonSanitizer) Cancel() sanitized

Cancel sanitizes a pointercancel.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeCancelEvent

func (*ButtonSanitizer) Down

func (s *ButtonSanitizer) Down(button, buttons int) sanitized

Down sanitizes a pointerdown. A pointer that is already down gets a move with the new buttons.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeDownEvent

func (*ButtonSanitizer) Leave

func (s *ButtonSanitizer) Leave(buttons int) (sanitized, bool)

Leave sanitizes a pointerleave: a hover, when no button is down (a pointer that is down is already handled by the moves).

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeLeaveEvent

func (*ButtonSanitizer) MissingRightClickUp

func (s *ButtonSanitizer) MissingRightClickUp(buttons int) (sanitized, bool)

MissingRightClickUp reports the up that never came when the right button was clicked and released while the context menu was shown, if the buttons say so.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeMissingRightClickUp

func (*ButtonSanitizer) Move

func (s *ButtonSanitizer) Move(buttons int) sanitized

Move sanitizes a pointermove. A move that says buttons are down for a pointer that is not (the user pressed the right button and moved quickly) is a hover.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeMoveEvent

func (*ButtonSanitizer) Up

func (s *ButtonSanitizer) Up(buttons int) (sanitized, bool)

Up sanitizes a pointerup. It reports false for a pointer that was not down (a pointerout can have released it), and a move, not an up, while buttons are still down.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _ButtonSanitizer.sanitizeUpEvent

type CloseReason

type CloseReason int

CloseReason is why a notification went away. The values are those of the Desktop Notifications specification, as package desktop's NotificationCloseReason has them.

Flutter: no counterpart

const (
	// CloseUnknown is a close that the page cannot explain: the browser's own timeout, or the user
	// clearing the notification center.
	//
	// Flutter: no counterpart
	CloseUnknown CloseReason = iota
	// CloseExpired is a notification whose Timeout was up.
	//
	// Flutter: no counterpart
	CloseExpired
	// CloseDismissed is a notification that closed after the user clicked it.
	//
	// Flutter: no counterpart
	CloseDismissed
	// CloseByApp is a notification that the app closed.
	//
	// Flutter: no counterpart
	CloseByApp
)

The reasons a notification closes.

type Composition

type Composition = textedit.Composition

Composition is textedit.Composition.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart CompositionAwareMixin

type Config

type Config struct {
	// HostElement is the CSS selector of the element the view fills. Empty means the
	// view fills the page.
	HostElement string
}

Config is what the page tells the app through globalThis.glutterConfig, which the index.html of glutter-web sets (SPEC §23.2).

Flutter: lib/web_ui/lib/src/engine/configuration.dart FlutterConfiguration

func ParseConfig

func ParseConfig(fields map[string]any) (Config, error)

ParseConfig reads the fields of glutterConfig, given as the plain values of a JavaScript object: a nil map is the zero Config. A field of the wrong type fails with WebConfigInvalid. Fields it does not know are ignored, so that a later step can add some.

Flutter: lib/web_ui/lib/src/engine/configuration.dart FlutterConfiguration.fromJs

type DOMWrite

type DOMWrite = textedit.DOMWrite

DOMWrite is textedit.DOMWrite.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditingState.applyToDomElement

type Desktop

type Desktop struct {
	// contains filtered or unexported fields
}

Desktop is what package desktop calls on the web (SPEC §23.7): OpenURI, ShowNotification and CloseNotification. Its methods may be called from any goroutine but the UI's: ShowNotification waits for the permission prompt, which the UI goroutine must never do (SPEC §23.3).

Flutter: no counterpart (Flutter web apps use the url_launcher_web and flutter_local_notifications plugins)

func NewDesktop

func NewDesktop() *Desktop

NewDesktop makes the web's desktop services. Off the web there is no page: OpenURI is OpenURIUnavailable and the notifications are NotificationsUnavailable. Package desktop does not use it off the web; it exists so that the package builds everywhere.

Flutter: no counterpart

func (*Desktop) Clicked

func (d *Desktop) Clicked(serial int)

Clicked is the browser telling that the user clicked the notification with the serial.

Flutter: no counterpart

func (*Desktop) CloseNotification

func (d *Desktop) CloseNotification(_ context.Context, id uint32) error

CloseNotification closes the notification with the ID, which calls its OnClose with CloseByApp. Closing one that is gone is not an error; a page without the Notifications API is NotificationsUnavailable.

Flutter: no counterpart

func (*Desktop) Closed

func (d *Desktop) Closed(serial int)

Closed is the browser telling that the notification with the serial is gone: after a click the user dismissed it, and otherwise the page cannot tell why (the browser's timeout, the notification center).

Flutter: no counterpart

func (*Desktop) OpenURI

func (d *Desktop) OpenURI(ctx context.Context, uri string) error

OpenURI opens the URI in a new browsing context, with window.open(uri, "_blank", "noopener") (SPEC §23.7). A scheme that runs script (javascript:, vbscript:) is OpenURISchemeBlocked, and a window.open that throws, or a page without a window, OpenURIUnavailable. The call has no way to know that the browser's pop-up blocker refused (noopener makes window.open answer null whatever happened), and the browser lets a page open a window only soon after a click or a key press: an app calls OpenURI from the handler of one.

Flutter: no counterpart (url_launcher_web: launchUrl)

func (*Desktop) ShowNotification

func (d *Desktop) ShowNotification(ctx context.Context, spec NotificationSpec) (uint32, error)

ShowNotification shows the notification and returns its ID. The first call asks the browser for the permission when the user has not decided; a permission that is not granted, and a page without the Notifications API, are NotificationsUnavailable (SPEC §23.7). A spec with ReplacesID of a notification that is shown replaces it and keeps its ID. A browser that refuses to construct the notification is WebNotificationFailed.

Flutter: no counterpart (flutter_local_notifications)

type DevEvent

type DevEvent struct {
	// Kind is "wait", "wheel", "tap", "move", "key", "input", "compose" or "paste".
	Kind string
	// Wait is how long to wait before the next step, for "wait".
	Wait time.Duration
	// X and Y are the position in CSS pixels from the top left of the view, for "wheel" and
	// "tap" and "move"; DX and DY are the deltas of a "wheel" in pixels.
	X, Y, DX, DY float64
	// Code and Key are KeyboardEvent.code and KeyboardEvent.key for a "key".
	Code, Key string
	// Text is the text of an "input" and a "paste", and Steps the successive texts of a "compose".
	Text  string
	Steps []string
}

DevEvent is one step of a dev events script.

Flutter: no counterpart

func ParseDevEvents

func ParseDevEvents(script string) ([]DevEvent, error)

ParseDevEvents reads a dev events script: steps separated by ";", each "name:arguments".

wait:500ms        waits
wheel:x,y,dx,dy   a wheel event at the position, with the deltas in pixels
tap:x,y           a pointer down and up of the mouse's primary button at the position
move:x,y          the mouse moves to the position
key:code,key      a key down and up, such as key:KeyK,k or key:Enter,Enter
input:text        text typed into the hidden text field, as the browser's beforeinput and input
                  events do (\n is a line break); the text has no ";"
compose:a,b,c     an input method composing a, then b, then c, which it commits
paste:text        a paste event with the text, at the hidden text field

A step that is not one of these, or has the wrong arguments, fails with WebDevEventsInvalid.

Flutter: no counterpart

type DispatchKeyData

type DispatchKeyData func(ui.KeyData) bool

DispatchKeyData gives key data to the framework and reports whether it handled it.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart DispatchKeyData

type EditingState

type EditingState = textedit.EditingState

EditingState is textedit.EditingState.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditingState

func EditingStateFromDOM

func EditingStateFromDOM(value string, selectionStart, selectionEnd int, direction string) EditingState

EditingStateFromDOM is textedit.EditingStateFromDOM.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditingState.fromDomElement

func NewEditingState

func NewEditingState(text string, base, extent int) EditingState

NewEditingState is textedit.NewEditingState.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditingState.new

type ElementConfig

type ElementConfig struct {
	// Tag is the element: "textarea" for a multiline field, "input" for the others.
	Tag string
	// Type is the type attribute of an input element: "password" for hidden text, else empty.
	Type string
	// InputMode is the inputmode attribute; empty for none.
	InputMode string
	// EnterKeyHint is the enterkeyhint attribute; empty for none.
	EnterKeyHint string
	// Autocapitalize is the autocapitalize attribute: "off", "words", "characters" or "sentences".
	Autocapitalize string
	// Autocorrect is the autocorrect attribute: "on" or "off".
	Autocorrect string
}

ElementConfig is how the hidden text field (SPEC §23.5) is made for a text field of the framework: the kind of element and the attributes that tell the browser which virtual keyboard to show and how to treat the text. It is a plain value, so that the choice is tested without a browser.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart InputConfiguration

func ElementConfigOf

func ElementConfigOf(state ui.TextInputState, mobile bool) ElementConfig

ElementConfigOf chooses the element and its attributes for the state of the text field. mobile says the browser is on iOS or Android: inputmode and enterkeyhint are set only there, where they pick the virtual keyboard, as Flutter web does.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart DefaultTextEditingStrategy.applyConfiguration

type FieldBox

type FieldBox struct {
	Left, Top, Width, Height float64
	// FontSize is the font size of the field, so that the input method's window (opened below the field)
	// is as high as the caret.
	FontSize float64
}

FieldBox is where the hidden text field is, in CSS pixels of the page, and the size of its text.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditableTextGeometry

func FieldBoxOf

func FieldBoxOf(caret ui.Rect, originX, originY float64) FieldBox

FieldBoxOf places the hidden text field at the caret: the caret's rectangle, in logical pixels of the view, moved by the position of the view in the page. The field is at least one pixel wide and high.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart EditableTextGeometry.applyToDomElement

type Geometry

type Geometry struct {
	// CSSWidth and CSSHeight are the size of the canvas element in CSS pixels.
	CSSWidth, CSSHeight float64
	// DeviceWidth and DeviceHeight are the size in device pixels from
	// devicePixelContentBoxSize; zero when the browser does not give it.
	DeviceWidth, DeviceHeight int
	// DPR is window.devicePixelRatio.
	DPR float64
}

Geometry is what the browser says about the size of the view: the size of the canvas in CSS pixels, its size in device pixels when the browser gives it exactly (ResizeObserver's devicePixelContentBoxSize), and the device pixel ratio.

Flutter: no counterpart

func (Geometry) PhysicalSize

func (g Geometry) PhysicalSize() (width, height int)

PhysicalSize is the size of the view in device pixels: the exact one from devicePixelContentBoxSize when the browser gave it, otherwise round(CSS size × device pixel ratio) (SPEC §23.2).

Flutter: lib/web_ui/lib/src/engine/view_embedder/dimensions_provider/full_page_dimensions_provider.dart FullPageDimensionsProvider.computePhysicalSize

func (Geometry) ViewMetrics

func (g Geometry) ViewMetrics() platform.ViewMetrics

ViewMetrics are the metrics of the view for the engine: the physical size and the device pixel ratio. The browser has no system areas of its own, so the paddings and insets are zero.

Flutter: lib/web_ui/lib/src/engine/window.dart EngineFlutterView.physicalSize

type KeyConverter

type KeyConverter struct {
	// contains filtered or unexported fields
}

KeyConverter turns the keyboard events of the browser into the key data of the framework: the physical key from KeyboardEvent.code, the logical key from KeyboardEvent.key through the generated tables, the type (down, repeat or up) from what is known to be pressed, and the events it synthesizes to keep that record true. It must be used on one goroutine.

Deviation: Flutter asks the web_locale_keymap package for the logical key of the keys that are characters; this package is not part of the Flutter sources the port reads (reference/), so the keys that are characters get the lower case of the character, or, on a layout whose key is not a Latin letter or digit, the key of the layout goal (SPEC §23.4, §12.10). Keys Flutter makes up an id for (a hash of the name) use a stable FNV hash, not Dart's hashCode.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter

func NewKeyConverter

func NewKeyConverter(perform DispatchKeyData, os OperatingSystem, after KeyScheduler) *KeyConverter

NewKeyConverter makes a converter that gives its key data to perform. The operating system decides how CapsLock and the key guards work (macOS and iOS); after runs the converter's delayed events and may be nil where there are none.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.KeyboardConverter

func (*KeyConverter) ClearPressedKeys

func (c *KeyConverter) ClearPressedKeys()

ClearPressedKeys forgets which keys are down.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.clearPressedKeys

func (*KeyConverter) Dispose

func (c *KeyConverter) Dispose()

Dispose cancels what the converter scheduled and forgets the pressed keys.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.dispose

func (*KeyConverter) Handle

func (c *KeyConverter) Handle(e KeyEvent) (preventDefault bool)

Handle converts a keydown or keyup event, gives the key data to the framework, and reports whether the event's default action must be prevented: the framework handled the key, or the event was an up of a key that was not down. Key data that updates the state of the converter (a synthesized up of a modifier the event says is up) is given first, and what the framework answers to it is dropped; exactly one key data is made from the event itself.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.handleEvent

func (*KeyConverter) KeyIsPressed

func (c *KeyConverter) KeyIsPressed(physical uint64) bool

KeyIsPressed reports whether the physical key is known to be down.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.keyIsPressed

func (*KeyConverter) ReleaseAll

func (c *KeyConverter) ReleaseAll(timeStamp float64)

ReleaseAll gives the framework a synthesized up for every key that is down, in the order they went down, and forgets them: the page lost the focus, and the keyups will go elsewhere.

Deviation: Flutter web keeps the record across a loss of focus and repairs it at the next event (SPEC §12.10).

Flutter: no counterpart

func (*KeyConverter) SynthesizeModifiersIfNeeded

func (c *KeyConverter) SynthesizeModifiersIfNeeded(alt, ctrl, meta, shift bool, timeStamp float64)

SynthesizeModifiersIfNeeded gives the framework the modifier key events that make its record of the modifiers agree with the flags of a pointer event (or any event that has them), only where they differ: a down of the left key when neither side is known to be down, an up of each side that is. It is called before the pointer events are converted.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart KeyboardConverter.synthesizeModifiersIfNeeded

type KeyEvent

type KeyEvent struct {
	// Down is true for keydown and false for keyup.
	Down bool
	// Code is KeyboardEvent.code, and Key is KeyboardEvent.key.
	Code, Key string
	// Incomplete is true when the event has no key or no code, as the events of Chrome's
	// autofill: the converter ignores it.
	Incomplete bool
	// Repeat is KeyboardEvent.repeat.
	Repeat bool
	// Location is KeyboardEvent.location: 0 standard, 1 left, 2 right, 3 numpad.
	Location int
	// TimeStamp is KeyboardEvent.timeStamp, in milliseconds.
	TimeStamp float64
	// Alt, Ctrl, Shift and Meta are the modifier flags of the event.
	Alt, Ctrl, Shift, Meta bool
}

KeyEvent is what the converter reads from a DOM KeyboardEvent. The platform copies the fields out of the event, so that the conversion is plain Go.

Flutter: lib/web_ui/lib/src/engine/keyboard_binding.dart FlutterHtmlKeyboardEvent

type KeyScheduler

type KeyScheduler func(d time.Duration, fn func()) (cancel func())

KeyScheduler runs fn after d on the thread of the converter, and returns the function that cancels it.

Flutter: no counterpart (dart:async Future.delayed)

type MediaDevice

type MediaDevice struct {
	// Kind is "audioinput", "audiooutput" or a kind of video.
	Kind string
	// ID is the deviceId.
	ID string
	// Label is the name of the device, which the browser gives only after the user allowed a recording ("" before).
	Label string
}

MediaDevice is one entry of the list that navigator.mediaDevices.enumerateDevices gives.

Flutter: no counterpart

type MotionEvent

type MotionEvent struct {
	HasAcceleration bool
	Acceleration    [3]float64 // x, y, z
	HasRotation     bool
	Alpha           float64
	Beta            float64
	Gamma           float64
	// TimeStamp is Event.timeStamp, a time in milliseconds on the page's clock, and Interval is DeviceMotionEvent.interval.
	TimeStamp, Interval float64
}

MotionEvent is what the platform reads from a DeviceMotionEvent (https://w3c.github.io/deviceorientation/): the acceleration with gravity included in m/s² on the axes of the device (x to the right, y toward the top of the screen, z out of the screen), the rate of rotation in degrees a second about the axes z (alpha), x (beta) and y (gamma), the time of the event in milliseconds and the interval between two events in milliseconds. A browser that has no such sensor sends events whose members are null; HasAcceleration and HasRotation say that the three numbers are there.

Flutter: no counterpart

type NotificationSpec

type NotificationSpec struct {
	// Title is the summary; Body the plain text under it; Icon the URL of an image, or empty (the web
	// has no icon themes: IconURL tells a URL from a name).
	Title, Body, Icon string
	// RequireInteraction keeps the notification on screen until the user acts (Persistent, Critical).
	RequireInteraction bool
	// Silent asks for no sound (Low urgency).
	Silent bool
	// Timeout, when positive, closes the notification after that long, with CloseExpired. The browser
	// has no timeout of its own to set.
	Timeout time.Duration
	// ReplacesID is the ID of a notification that is shown, which this one replaces; zero makes a new
	// one. The browser does the replacing through the tag.
	ReplacesID uint32
	// OnClick is called, on any goroutine, when the user clicks the notification; nil listens to
	// nothing.
	OnClick func()
	// OnClose is called, on any goroutine, once, when the notification goes away. A notification that
	// another one replaced does not call it.
	OnClose func(CloseReason)
}

NotificationSpec is a notification for Desktop.ShowNotification.

Flutter: no counterpart

type OperatingSystem

type OperatingSystem int

OperatingSystem is the operating system a browser runs on, as Flutter web detects it.

Flutter: lib/web_ui/lib/ui_web/src/ui_web/browser_detection.dart OperatingSystem

const (
	// OSUnknown is an operating system that none of the checks recognizes.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.unknown
	OSUnknown OperatingSystem = iota
	// OSAndroid is Android.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.android
	OSAndroid
	// OSIOS is iOS and iPadOS.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.iOs
	OSIOS
	// OSLinux is Linux.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.linux
	OSLinux
	// OSMacOS is macOS.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.macOs
	OSMacOS
	// OSWindows is Windows.
	//
	// Flutter: ui_web/browser_detection.dart OperatingSystem.windows
	OSWindows
)

The values of OperatingSystem. OSUnknown is the zero value.

func DetectOS

func DetectOS(navigatorPlatform, userAgent string, maxTouchPoints int) OperatingSystem

DetectOS finds the operating system from navigator.platform, navigator.userAgent and navigator.maxTouchPoints, with the checks of Flutter web in the same order: a Mac with more than two touch points is an iPad that asks for the desktop site; the user agent decides Android, because Android reports its platform as "Linux armv8l".

Flutter: lib/web_ui/lib/ui_web/src/ui_web/browser_detection.dart BrowserDetection.detectOperatingSystem

func (OperatingSystem) TargetPlatform

func (o OperatingSystem) TargetPlatform() foundation.TargetPlatform

TargetPlatform is the platform the framework behaves like on this operating system. An operating system that is not known becomes Android, as in Flutter web.

Flutter: packages/flutter/lib/src/foundation/_platform_web.dart _operatingSystemToTargetPlatform

type PadPoller

type PadPoller struct {
	// contains filtered or unexported fields
}

PadPoller follows the pads of the browser from one reading of navigator.getGamepads() to the next, and tells a handler what changed. It belongs to the UI goroutine.

Flutter: no counterpart

func NewPadPoller

func NewPadPoller(os OperatingSystem, ids *atomic.Int64) *PadPoller

NewPadPoller makes a poller for a browser on the given operating system. ids numbers the pads; it may be shared.

Flutter: no counterpart

func (*PadPoller) Count

func (pp *PadPoller) Count() int

Count is the number of pads that are connected.

Flutter: no counterpart

func (*PadPoller) IDOf

func (pp *PadPoller) IDOf(index int) platform.PadID

IDOf gives the id of the pad at an index of the browser's array, 0 when there is none.

Flutter: no counterpart

func (*PadPoller) IndexOf

func (pp *PadPoller) IndexOf(id platform.PadID) (int, bool)

IndexOf gives the index in the browser's array of the pad with an id.

Flutter: no counterpart

func (*PadPoller) Update

func (pp *PadPoller) Update(now time.Duration, snapshot []BrowserPad, h platform.PadHandler)

Update takes a reading: pads that are new are added, those that are gone are removed, and the others report what changed since the last reading (a pad whose timestamp is the one it had is not looked at). snapshot is the array of the browser, with the gaps left out; now is the time of the reading.

Flutter: no counterpart

type PointerConverter

type PointerConverter struct {
	// contains filtered or unexported fields
}

PointerConverter turns the pointer events of the browser into the data the framework needs: it works out the position change and a pointer identifier for each pointer, and keeps the order the framework checks by synthesizing the add before a hover or a down, the hover before a down at another place, the move before an up at another place, and the remove after the end of a touch.

hover -> down -> move -> up          becomes   add(synthesized) -> hover -> down -> move -> up
down -> move -> up                   becomes   add(synthesized) -> down -> move -> up

Deviation: Flutter keeps the state of the pointers in a static, because the framework's is global; here it is a field of the converter, which the platform has one of (CLAUDE.md: no global mutable state).

Flutter: lib/web_ui/lib/src/engine/pointer_converter.dart PointerDataConverter

func NewPointerConverter

func NewPointerConverter() *PointerConverter

NewPointerConverter makes a converter that has seen no pointer.

Flutter: lib/web_ui/lib/src/engine/pointer_converter.dart PointerDataConverter.PointerDataConverter

func (*PointerConverter) Convert

func (c *PointerConverter) Convert(result []ui.PointerData, p PointerParams) []ui.PointerData

Convert appends to result the data for one browser event: the data of the event, preceded and followed by what is synthesized to keep the sequence valid.

Flutter: lib/web_ui/lib/src/engine/pointer_converter.dart PointerDataConverter.convert

type PointerEvent

type PointerEvent struct {
	// PointerType is PointerEvent.pointerType: "mouse", "pen" or "touch".
	PointerType string
	// PointerID is PointerEvent.pointerId.
	PointerID int
	// Button and Buttons are PointerEvent.button and PointerEvent.buttons.
	Button, Buttons int
	// X and Y are the position in CSS pixels relative to the view.
	X, Y float64
	// Pressure, TiltX and TiltY are the pressure and the tilt of a stylus, in degrees.
	Pressure, TiltX, TiltY float64
	// TimeStamp is the time of the event, in milliseconds.
	TimeStamp float64
	// MovementX and MovementY are MouseEvent.movementX and movementY in CSS pixels: the motion
	// since the previous event, which is all a locked pointer reports (SPEC §27.6).
	MovementX, MovementY float64
	// Alt, Ctrl, Meta and Shift are the modifier flags of the event.
	Alt, Ctrl, Meta, Shift bool
	// Coalesced are the events a pointermove stands for, from getCoalescedEvents; they have
	// no pointer ID of their own. Empty when the browser has none.
	Coalesced []PointerEvent
}

PointerEvent is what the pointer input reads from a DOM PointerEvent (or MouseEvent), copied out of the event so that the conversion is plain Go.

Flutter: lib/web_ui/lib/src/engine/dom.dart DomPointerEvent

type PointerInput

type PointerInput struct {
	// contains filtered or unexported fields
}

PointerInput converts the pointer events of one view. It keeps the buttons of each pointer, the state of the converter and what it needs to tell a trackpad from a wheel. It must be used on one goroutine.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter

func NewPointerInput

func NewPointerInput(view ui.ViewID, os OperatingSystem, opts ...PointerInputOptions) *PointerInput

NewPointerInput makes the input of a view, on an operating system.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart PointerBinding.PointerBinding

func (*PointerInput) Cancel

func (in *PointerInput) Cancel(e PointerEvent, dpr float64) []ui.PointerData

Cancel converts a pointercancel, which the browser sends when the pointer can no longer produce events (the device was deactivated).

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter.setup (pointercancel)

func (*PointerInput) CancelAbandonedTouches

func (in *PointerInput) CancelAbandonedTouches(touchesOnSurface []int, timeStamp float64) []ui.PointerData

CancelAbandonedTouches cancels the touches that the browser stopped reporting in the middle of a gesture: iOS WebKit sends neither pointerup nor pointercancel for a touch it promotes to a native gesture (dragging the caret in a text field), which would leave the framework with a pointer that never lifts. touchesOnSurface are the identifiers of the touches the browser still lists; any touch believed to be down that is not among them is cancelled. Only iOS does it.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter._cancelAbandonedTouches

func (*PointerInput) Down

func (in *PointerInput) Down(e PointerEvent, dpr float64) []ui.PointerData

Down converts a pointerdown, with the up of a right click that never came before it.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter.setup (pointerdown)

func (*PointerInput) Leave

func (in *PointerInput) Leave(e PointerEvent, dpr float64) []ui.PointerData

Leave converts a pointerleave.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter.setup (pointerleave)

func (*PointerInput) Lock

func (in *PointerInput) Lock(x, y, dpr float64) []ui.PointerData

Lock holds the mouse where it is: the place it was last seen at, or the one given when it has not been seen yet (the middle of the view). It returns the pointer data that places the pointer there, with no delta. Locking a locked input does nothing.

Flutter: no counterpart

func (*PointerInput) Locked

func (in *PointerInput) Locked() bool

Locked says whether the pointer is locked.

Flutter: no counterpart

func (*PointerInput) Move

func (in *PointerInput) Move(e PointerEvent, dpr float64) []ui.PointerData

Move converts a pointermove, as many pointer data as the browser coalesced into it.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter.setup (pointermove)

func (*PointerInput) Unlock

func (in *PointerInput) Unlock()

Unlock lets the mouse go. The next event of the mouse has its own place.

Flutter: no counterpart

func (*PointerInput) Up

func (in *PointerInput) Up(e PointerEvent, dpr float64) []ui.PointerData

Up converts a pointerup; the data is empty for a pointer that was not down.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _PointerAdapter.setup (pointerup)

func (*PointerInput) Wheel

Wheel converts a wheel event: the deltas in lines or pages become pixels (a line is a quarter of the font size, a page the size of the view, and on macOS Safari and Firefox report pixels in CSS pixels where Chrome reports device pixels); a wheel with control down is a scale (a pinch), anything else a scroll. The result collects the framework's answers, which come while the data is dispatched.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _WheelEventListenerMixin._convertWheelEventToPointerData

type PointerInputOptions

type PointerInputOptions struct {
	// Keys is the key converter whose record of the modifier keys is kept in step with the
	// modifier flags of the pointer events (and which tells whether control is down on macOS).
	Keys *KeyConverter
	// Firefox is whether the browser is Firefox.
	Firefox bool
}

PointerInputOptions are the optional parameters of NewPointerInput.

Flutter: no counterpart

type PointerParams

type PointerParams struct {
	// View is the view the pointer is over.
	View ui.ViewID
	// TimeStamp is the time of the event.
	TimeStamp time.Duration
	// Change is the change; the zero value is taken for a cancel, like Flutter's default.
	Change ui.PointerChange
	// Kind is the kind of device; the zero value is taken for a touch.
	Kind ui.PointerDeviceKind
	// SignalKind is the signal, PointerSignalKindUnspecified or None for none.
	SignalKind ui.PointerSignalKind
	// Device is the ID of the device (the browser's pointerId for a touch).
	Device int
	// PhysicalX and PhysicalY are the position.
	PhysicalX, PhysicalY float64
	// Buttons are the buttons that are down.
	Buttons int
	// Pressure and PressureMax are the pressure.
	Pressure, PressureMax float64
	// Tilt is the tilt of a stylus, in radians.
	Tilt float64
	// ScrollDeltaX and ScrollDeltaY are the scroll of a scroll signal.
	ScrollDeltaX, ScrollDeltaY float64
	// Scale is the scale of a scale signal; the zero value is 1.
	Scale float64
	// OnRespond is the answer to a scroll signal.
	OnRespond func(allowPlatformDefault bool)
}

PointerParams are the parameters of PointerConverter.Convert: what Flutter web reads from a browser event, in physical pixels.

Flutter: lib/web_ui/lib/src/engine/pointer_converter.dart PointerDataConverter.convert

type Prefs

type Prefs struct {
	// Dark is whether prefers-color-scheme is dark.
	Dark bool
	// ReducedMotion is whether prefers-reduced-motion is reduce.
	ReducedMotion bool
	// HighContrast is whether prefers-contrast is more.
	HighContrast bool
	// Languages is navigator.languages, most preferred first.
	Languages []string
}

Prefs are the preferences of the user that the browser tells through media queries and navigator.languages (SPEC §23.6).

Flutter: no counterpart

type TextEditor

type TextEditor = textedit.TextEditor

TextEditor is textedit.TextEditor.

Flutter: lib/web_ui/lib/src/engine/text_editing/text_editing.dart DefaultTextEditingStrategy

type WheelContext

type WheelContext struct {
	// DevicePixelRatio is the number of physical pixels per CSS pixel.
	DevicePixelRatio float64
	// PhysicalWidth and PhysicalHeight are the size of the view in physical pixels, which a
	// page of scroll is.
	PhysicalWidth, PhysicalHeight float64
	// LineHeight is the height of a line of scroll in physical pixels; DefaultScrollLineHeight
	// when zero.
	LineHeight float64
}

WheelContext is what the conversion of a wheel event needs to know about the view.

Flutter: no counterpart

type WheelEvent

type WheelEvent struct {
	// X and Y are the position in CSS pixels relative to the view.
	X, Y float64
	// DeltaX, DeltaY and DeltaMode are WheelEvent.deltaX, deltaY and deltaMode (0 pixels, 1
	// lines, 2 pages).
	DeltaX, DeltaY float64
	DeltaMode      int
	// WheelDeltaX and WheelDeltaY are the legacy wheelDeltaX and wheelDeltaY, when the browser
	// has them (HasWheelDelta).
	WheelDeltaX, WheelDeltaY float64
	HasWheelDelta            bool
	// Buttons is MouseEvent.buttons.
	Buttons int
	// Ctrl is whether the control key is down: a pinch on a trackpad arrives as a wheel with it.
	Ctrl bool
	// TimeStamp is the time of the event, in milliseconds.
	TimeStamp float64
}

WheelEvent is what the pointer input reads from a DOM WheelEvent.

Flutter: lib/web_ui/lib/src/engine/dom.dart DomWheelEvent

type WheelResult

type WheelResult struct {
	// AllowedDefault is whether a scrollable at its boundary let the browser scroll.
	AllowedDefault bool
	// HandledByWidget is whether a widget took the scroll.
	HandledByWidget bool
}

WheelResult is the answer of the framework to a wheel event, collected while the event is dispatched: whether the page may scroll (a scrollable is at its boundary) or a widget took the scroll. Once the page may scroll, a later answer does not take it back.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _BaseAdapter._lastWheelEventAllowedDefault

func (*WheelResult) PreventDefault

func (r *WheelResult) PreventDefault(fullPageInFrame bool) bool

PreventDefault reports whether the wheel event's default action must be prevented: unless a scrollable let the page scroll, the page does not. A full-page app in a frame (an iframe) lets the page scroll, so that the scroll goes on to the parent page, only when the scrollables are at their boundary and no widget took the scroll.

Flutter: lib/web_ui/lib/src/engine/pointer_binding.dart _WheelEventListenerMixin._handleWheelEvent

Directories

Path Synopsis
Command audiotest is the program of the browser tests of the audio of the web (step 31.6, SPEC §28.3, §28.8).
Command audiotest is the program of the browser tests of the audio of the web (step 31.6, SPEC §28.3, §28.8).
Command desktoptest is the program of the browser tests of the web desktop services (step 21.6, SPEC §17, §23.7).
Command desktoptest is the program of the browser tests of the web desktop services (step 21.6, SPEC §17, §23.7).
Command inputtest is the program of the browser tests of the web input (step 21.2, SPEC §17, §23.4).
Command inputtest is the program of the browser tests of the web input (step 21.2, SPEC §17, §23.4).
Command padtest is the program of the browser test of the gamepads of the web (step 31.2, SPEC §28.2, §28.8).
Command padtest is the program of the browser test of the gamepads of the web (step 31.2, SPEC §28.2, §28.8).
Command sensortest is the program of the browser tests of the motion sensors and the haptics of the web (step 31.7, SPEC §28.4, §28.8).
Command sensortest is the program of the browser tests of the motion sensors and the haptics of the web (step 31.7, SPEC §28.4, §28.8).
Package synthetic dispatches synthetic DOM events at the canvas of a Glutter app, the way the browser would deliver real ones: the debug-only script of the web platform (GLUTTER_DEV_EVENTS, for proof screenshots) and the browser tests use it.
Package synthetic dispatches synthetic DOM events at the canvas of a Glutter app, the way the browser would deliver real ones: the debug-only script of the web platform (GLUTTER_DEV_EVENTS, for proof screenshots) and the browser tests use it.
Command texttest is the program of the browser tests of the web text input and clipboard (step 21.3, SPEC §17, §23.5).
Command texttest is the program of the browser tests of the web text input and clipboard (step 21.3, SPEC §17, §23.5).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL