[flutter-03] Checkbox

1. Checkbox

const Checkbox({
    Key key,
    @required this.value,
    this.tristate = false,
    @required this.onChanged,
    this.mouseCursor,
    this.activeColor,
    this.checkColor,
    this.focusColor,
    this.hoverColor,
    this.materialTapTargetSize,
    this.visualDensity,
    this.focusNode,
    this.autofocus = false,
  })

1.1 Checkbox范例

// 代码块
Widget build(BuildContext context) {
    return Checkbox(
      value: true,
      onChanged: (value) {
        print('click-checkbox: $value');
      },
    );
  }

// 简约
Widget build(BuildContext context) {
    return Checkbox(
        value: true, onChanged: (value) => print('click-checkbox: $value'));
  }
posted @ 2021-06-01 14:37  comefromchina  阅读(68)  评论(0)    收藏  举报