networkErrorPage static method

Widget networkErrorPage({
  1. String? errorMsg,
  2. Icon? icon,
})

Creates a centered error page widget for network errors.

Parameters:

  • errorMsg: Optional custom error message. Defaults to 'Could not show the data'
  • icon: Optional custom icon. Defaults to a red wifi error icon

Returns a centered column with an icon and error message.

Implementation

static Widget networkErrorPage({String? errorMsg, Icon? icon}) {
  icon ??= const Icon(
    Icons.signal_wifi_statusbar_connected_no_internet_4_outlined,
    color: Colors.red,
  );
  if (errorMsg.isNullOrEmpty) {
    errorMsg = 'Could not show the data';
  }

  return Center(
      child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [icon, Text(errorMsg!).paddingAll(10)]));
}