buildItem method

Widget buildItem(
  1. BuildContext context,
  2. NetworkEventLog item
)

Implementation

Widget buildItem(BuildContext context, NetworkEventLog item) {
  var urlText = item.request!.uri;
  if (isHiddenBaseUrl) {
    for (var element in baseUrls) {
      if (urlText.contains(element)) {
        urlText = urlText.replaceAll(element, '/');
      }
    }
  }
  return ListTile(
    key: ValueKey(item.request),
    tileColor: item.error == null
        ? (item.response == null ? Colors.amber : Colors.green)
        : Colors.red,
    title: Text(
      item.request!.method,
      style: const TextStyle(fontWeight: FontWeight.bold),
    ),
    subtitle: Text(
      urlText,
      maxLines: 1,
      overflow: TextOverflow.ellipsis,
    ),
    leading: Text(
      (item.response?.statusCode).toString(),
      textAlign: TextAlign.center,
      style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
    ),
    trailing: item.response != null
        ? _RequestTrailing(
            event: item,
          )
        : null,
    onTap: () => NetworkLoggerEventScreen.open(
      context,
      item,
      eventList,
    ),
  );
}