textStatusCode method

Widget textStatusCode({
  1. int statusCode = 0,
})

Implementation

Widget textStatusCode({int statusCode = 0}) {
  if (statusCode >= 200 && statusCode < 300) {
    return Text(
      statusCode.toString(),
      style:
          const TextStyle(color: Colors.green, fontWeight: FontWeight.bold),
    );
  } else if (statusCode >= 300 && statusCode < 400) {
    return Text(
      statusCode.toString(),
      style: const TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
    );
  } else if (statusCode >= 400 && statusCode < 500) {
    return Text(
      statusCode.toString(),
      style:
          const TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
    );
  } else if (statusCode >= 500 && statusCode < 600) {
    return Text(
      statusCode.toString(),
      style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
    );
  } else {
    return const Text(
      'Loading',
      style: TextStyle(color: Colors.grey, fontWeight: FontWeight.bold),
    );
  }
}