BasicBrowserErrorWidget.fromError constructor

BasicBrowserErrorWidget.fromError({
  1. required BuildContext context,
  2. required WebResourceError error,
  3. required Widget? refreshButton,
})

Implementation

factory BasicBrowserErrorWidget.fromError({
  required BuildContext context,
  required WebResourceError error,
  required Widget? refreshButton,
}) {
  final localizations = Localizations.of<BrowserLocalizations>(
        context,
        BrowserLocalizations,
      ) ??
      const BrowserLocalizations();
  return BasicBrowserErrorWidget(
    title: Text(
      localizations.couldNotReach,
      textAlign: TextAlign.center,
    ),
    body: Column(
      children: [
        if (kDebugMode)
          Padding(
              padding: const EdgeInsets.only(bottom: 20),
              child: Text(
                'For debugging:\n${error.description}',
                textAlign: TextAlign.center,
              )),
        if (refreshButton != null) refreshButton,
      ],
    ),
  );
}