defaultOnError static method

Widget defaultOnError(
  1. BuildContext context,
  2. BrowserController controller,
  3. WebResourceError error
)

Default value of onError.

This function displays a web page loading error using Flutter widgets.

Implementation

static Widget defaultOnError(BuildContext context,
    BrowserController controller, WebResourceError error) {
  final localizations = Localizations.of<BrowserLocalizations>(
        context,
        BrowserLocalizations,
      ) ??
      const BrowserLocalizations();
  final label = Text(localizations.tryAgain);
  void onPressed() {
    Browser.of(context).controller.refresh();
  }

  return BasicBrowserErrorWidget.fromError(
    context: context,
    error: error,
    refreshButton: isCupertinoDesignPreferred(context)
        ? CupertinoButton(
            onPressed: onPressed,
            child: label,
          )
        : MaterialButton(
            onPressed: onPressed,
            child: label,
          ),
  );
}