build method

  1. @override
Widget build(
  1. BuildContext context,
  2. HomeModel model
)
override

Builds the UI according to the state in model.

Implementation

@override
Widget build(BuildContext context, HomeModel model) => SizedBox(
  height: 48,
  child: InkWell(
    onTap: () => Navigator.of(context).push(MaterialPageRoute<void>(builder: (context) => LogsPage())),
    child: Card(
      shadowColor: Colors.transparent,
      color: getColor(model.message?.severity),
      shape: ContinuousRectangleBorder(
        borderRadius: BorderRadius.circular(12),
      ),
      child: (model.message == null && !showLogs) ? const SizedBox() : Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          const SizedBox(width: 4),
          Icon(getIcon(model.message?.severity), color: Colors.white),
          const SizedBox(width: 4),
          if (model.message == null) const Text("Open logs", style: TextStyle(color: Colors.white))
          else Tooltip(
            message: "Click to open logs",
            child: models.settings.easterEggs.enableClippy
              ? Row(children: [
                Image.asset("assets/clippy.webp", width: 36, height: 36),
                const Text(" -- "),
                Text(model.message!.text, style: const TextStyle(color: Colors.white)),
              ],)
              : Text(model.message!.text, style: const TextStyle(color: Colors.white)),
          ),
          const SizedBox(width: 8),
        ],
      ),
    ),
  ),
);