build method

  1. @override
Component build(
  1. BuildContext context
)

Describes the part of the user interface represented by this component.

Implementation

@override
Component build(BuildContext context) {
  final Color iconColor;
  final String icon;
  switch (check.status) {
    case DoctorStatus.ok:
      icon = '✔';
      iconColor = Colors.green;
    case DoctorStatus.warn:
      icon = '⚠';
      iconColor = Colors.yellow;
    case DoctorStatus.error:
      icon = '✘';
      iconColor = Colors.red;
    case DoctorStatus.info:
      icon = 'ℹ';
      iconColor = Colors.blue;
  }

  return Padding(
    padding: const EdgeInsets.only(left: 2, bottom: 0),
    child: Column(
      children: [
        Row(
          children: [
            Text(icon, style: TextStyle(color: iconColor, fontWeight: FontWeight.bold)),
            const Text(' '),
            Expanded(
              child: Text(
                check.label,
                style: TextStyle(
                  color: check.status == DoctorStatus.error
                      ? Colors.red
                      : check.status == DoctorStatus.warn
                          ? Colors.yellow
                          : null,
                ),
              ),
            ),
          ],
        ),
        if (check.hint != null)
          Padding(
            padding: const EdgeInsets.only(left: 4),
            child: Text(
              '→ ${check.hint}',
              style: const TextStyle(color: Colors.gray, fontWeight: FontWeight.dim),
            ),
          ),
      ],
    ),
  );
}