GpWebView class
WebView con los estados de carga y error-con-reintento ya resueltos, para no repetir ese boilerplate en cada pantalla que necesite mostrar contenido web. Pensado para usarse a través de GpWebViewScreen o GpWebViewModal; se expone también suelto por si alguna pantalla necesita embeberlo en un layout propio.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GpWebView
Constructors
-
GpWebView({Key? key, required String url, Map<
String, String> ? headers, List<WebViewCookie> ? cookies, String errorTitle = 'No pudimos cargar la página', String errorRetryLabel = 'Reintentar', bool showLoadingOverlay = true, bool disableInputZoom = true, bool debugLogConsole = false, bool debugLogNetwork = false, bool debugLogStorage = false, void onControllerReady(WebViewController controller)?}) -
const
Properties
-
Cookies a setear (vía
WebViewCookieManager) antes de cargar url — alternativa a headers para sitios que arman su sesión leyendo una cookie en vez de un header, o que hacen sus propias llamadas después de cargar y necesitan la cookie puesta de antemano en el dominio.final - debugLogConsole → bool
-
Si es
true, cadaconsole.log/warn/errorque corra la página (ej. lo que logueé MSAL.js al intentar el SSO) se manda pordebugPrint. Pensado para diagnosticar en desarrollo — no lo actives en pantallas de producción.final - debugLogNetwork → bool
-
Si es
true, además interceptafetch/XMLHttpRequestde la página (inyectando JS) y loguea método, URL y respuesta de cada uno pordebugPrint— comowebview_flutterno expone esas llamadas de red directamente, es la única forma de verlas sin las devtools del navegador. Requiere debugLogConsole entrue(los logs salen por ese mismo canal).final - debugLogStorage → bool
-
Si es
true, vuelcasessionStorage/localStoragepordebugPrintcada vez que la página termina de cargar. Requiere debugLogConsole entrue(los logs salen por ese mismo canal).final - disableInputZoom → bool
-
Si es
true(default), evita que el navegador haga zoom automático al enfocar un input de la página — ver_disableInputZoomScript. Como efecto secundario también desactiva el pinch-to-zoom manual del usuario; poné esto enfalsesi tu contenido sí necesita zoom manual (ej. un PDF o una imagen grande).final - errorRetryLabel → String
-
final
- errorTitle → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
Headers HTTP para la carga inicial (ej.
Authorization: Bearer ...para pasar un token de sesión a un sitio con SSO). Ojo: solo van en esa primera petición — si el sitio es una SPA que hace sus propias llamadas a APIs después de cargar, esas no van a llevar estos headers automáticamente, tiene que resolverlo el sitio por su cuenta (leyendo el token de la URL, una cookie, etc.).final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onControllerReady → void Function(WebViewController controller)?
-
Entrega el
WebViewControlleruna vez creado — para casos que GpWebView no cubre de fábrica (recargar desde un botón propio, correr JS custom, limpiarlocalStorage/cookies para reiniciar una sesión de prueba, etc.). El controller vive tanto como este widget.final -
Si es
null, todas las navegaciones (incluida la carga inicial) se permiten dentro del WebView. Devolverblockno hace nada por sí solo más que cancelar la carga — abrir la URL en otro lado es responsabilidad de quien implementa el callback.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLoadingOverlay → bool
-
Si es
true(default), mientras carga se ve un overlay con GpProgress (circular, con porcentaje) sobre un fondo sólido, en vez de la página en blanco que se ve por default apenas se crea el WebView. Poné esto enfalsesi tu pantalla ya maneja su propio estado de carga y no querés que el widget tape nada.final - url → String
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GpWebView> -
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