setButtonStyle method

void setButtonStyle ()

Sets the button attributes from but_attr

Implementation

void setButtonStyle() {
  but.style
    ..display = but_attr[BUT_DISPLAY]
    ..borderRadius = but_attr[BUT_BORDER_RADIUS]
    ..border = but_attr[BUT_BORDER]
    ..fontSize = but_attr[BUT_FONT_SIZE]
    ..padding = but_attr[BUT_PADDING]
    ..background =
        but_attr[BUT_BACKGROUND] // must be identical to SVG_BUTTON_COLOR
    ..color = but_attr[BUT_COLOR]
    ..borderBottom = but_attr[BUT_BORDER_BOTTOM]
    ..fontSmoothing = but_attr[BUT_FONT_SMOOTHING]
    //..-webkit-font-smoothing=
    ..fontWeight = but_attr[BUT_FONT_WEIGHT]
    ..margin = but_attr[BUT_MARGIN]
    ..textAlign = but_attr[BUT_TEXT_ALIGN]
    ..opacity = but_attr[BUT_OPACITY_LEAVE];

  but.onMouseOver.listen((e) {
    but.style
      ..opacity = but_attr[BUT_OPACITY_OVER]
      ..cursor = but_attr[BUT_CURSOR_POINTER];
  });

  but.onMouseLeave.listen((e) {
    but.style
      ..opacity = but_attr[BUT_OPACITY_LEAVE]
      ..cursor = but_attr[BUT_CURSOR_AUTO];
  });

  // focus acquired
  but.onFocus.listen((e) {
    but.style
      ..opacity = but_attr[BUT_OPACITY_OVER]
      ..cursor = but_attr[BUT_CURSOR_POINTER];
  });

  // focus lost
  but.onBlur.listen((e) {
    but.style
      ..opacity = but_attr[BUT_OPACITY_LEAVE]
      ..cursor = but_attr[BUT_CURSOR_AUTO];
  });
}