Flutterでよく使われるボタンコンポーネント -IconButton (クリック可能なアイコン)

 //IconButton 是Android风格的用于Icon的按钮,具有圆形范围的点击效果。默认没有背景,点击后会出现背景
            new IconButton(
              //icon 属性用于为 IconButton 指定一个图标,可以是图标,也可以是文字。
              // icon: new Text("data"),
              icon: new Icon(Icons.shopping_cart),
              //iconSize:属性用于指定图标的大小,默认值为 24。如果图标实际大小大于 iconSize,显示时会缩小 iconSize。否则,图标的显示大小不会改变。
              iconSize: 100,
              //color:属性指定启用 IconButton 时 IconButton 内图标的颜色
              color: Colors.teal,


              //disabledColor:属性指定禁用此 IconButton 时 IconButton 内图标的颜色。如果 onPressed 为 null 或未指定,则 IconButton 将被禁用
              disabledColor: Colors.black38,

              //splashColor:属性指定用户按下 IconButton 点周围的闪光的主要颜色。
              splashColor: Colors.amber,
              //splashRadius: 属性指定当用户按下 IconButton 时 IconButton 周围的闪光半径。它的默认值是 defaultSplashRadius (35)。
              splashRadius: 45,

              //highlightColor:splashColor 属性指定用户按下 IconButton 点周围的闪光灯的辅助颜色。
              highlightColor: Colors.blue,
              //onPressed:是一个回调函数,当用户单击 IconButton 时将调用该函数。如果未指定 onPressed,则 IconButton 将被禁用,这意味着当用户单击它时将没有响应。
              onPressed: (){},
              //tooltip:属性是 IconButton 的描述性文本。当用户单击此 IconButton 时,它就会出现。
              tooltip: "添加按钮",
            ),

おすすめ

転載: blog.csdn.net/guliang28/article/details/128816355