show static method
Future<void>
show({
- BuildContext? context,
- required String url,
- Map<
String, String> ? headers, - List<
WebViewCookie> ? cookies, - String? title,
- double heightFactor = 0.92,
- 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
context es opcional — ver nota en GpModal.showCustomModal.
Implementation
static Future<void> show({
BuildContext? context,
required String url,
Map<String, String>? headers,
List<WebViewCookie>? cookies,
String? title,
double heightFactor = 0.92,
Future<GpWebViewNavigationDecision> Function(String url)?
onNavigationRequest,
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 Function(WebViewController controller)? onControllerReady,
}) {
final resolvedContext = GpNavigator.resolve(context);
if (resolvedContext == null) return Future.value();
return GpModal.showCustomModal<void>(
context: resolvedContext,
child: SizedBox(
height: MediaQuery.of(resolvedContext).size.height * heightFactor,
child: Column(
children: [
SizedBox(height: GpSpacing.sm()),
Container(
width: 36,
height: 4,
decoration: BoxDecoration(
color: Theme.of(resolvedContext).colorScheme.outlineVariant,
borderRadius: BorderRadius.circular(2),
),
),
Padding(
padding: EdgeInsets.fromLTRB(
GpSpacing.md(),
GpSpacing.sm(),
GpSpacing.xs(),
GpSpacing.xs(),
),
child: Row(
children: [
if (title != null && title.trim().isNotEmpty)
Expanded(
child: GpText(
text: title,
variant: GpTextVariant.titleMedium,
maxLines: 1,
),
)
else
const Spacer(),
GpIconButton(
icon: Icons.close_rounded,
onPressed: () => Navigator.of(resolvedContext).pop(),
variant: GpSurfaceVariant.text,
tone: GpSemanticTone.neutral,
semanticLabel: 'Cerrar',
),
],
),
),
Expanded(
child: GpWebView(
url: url,
headers: headers,
cookies: cookies,
onNavigationRequest: onNavigationRequest,
errorTitle: errorTitle,
errorRetryLabel: errorRetryLabel,
showLoadingOverlay: showLoadingOverlay,
disableInputZoom: disableInputZoom,
debugLogConsole: debugLogConsole,
debugLogNetwork: debugLogNetwork,
debugLogStorage: debugLogStorage,
onControllerReady: onControllerReady,
),
),
],
),
),
);
}