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 st = context.simutilTheme;

  return Center(
    child: Focusable(
      focused: true,
      onKeyEvent: (event) {
        if (event.logicalKey == LogicalKey.escape ||
            event.logicalKey == LogicalKey.enter) {
          onDismiss();
          return true;
        }
        return false;
      },
      child: Container(
        margin: EdgeInsets.all(16),
        decoration: BoxDecoration(
          border: BoxBorder.all(
            style: BoxBorderStyle.rounded,
            color: st.error,
          ),
          title: BorderTitle(text: title),
          color: st.background,
        ),
        child: Padding(
          padding: EdgeInsets.all(1),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.min,
            children: [
              Text(' $message', style: st.errorStyle),
              SizedBox(height: 1),
              Divider(),
              Text(' Close: <enter> | <esc>', style: st.dimmed),
            ],
          ),
        ),
      ),
    ),
  );
}