errorWidgetBuilder method

Widget errorWidgetBuilder(
  1. BuildContext context,
  2. int index,
  3. Object error,
  4. StackTrace? stackTrace,
)

Builds the error widget for the image at the specified index.

The context parameter is the build context. The error parameter is the error object that occurred while loading the image. The stackTrace parameter is the stack trace associated with the error.

Implementation

Widget errorWidgetBuilder(
    BuildContext context, int index, Object error, StackTrace? stackTrace) {
  // Remove once the minimum Flutter version is 3.10+
  // ignore: prefer_const_constructors
  return Center(
    // Remove once the minimum Flutter version is 3.10+
    // ignore: prefer_const_constructors
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: const <Widget>[
        Icon(
          Icons.broken_image,
          color: Colors.red,
          size: 120.0,
        ),
        Text(
          '🖼️💥🚫', // image, boom, no entry
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 30.0,
          ),
        ),
      ],
    ),
  );
}