可点击按钮
在 Flutter 中构建的 3D 可按压按钮。非常适合应用中的重要号召性用语。

用法
PushableButton(
child: Text('ENROLL NOW', style: someTextStyle),
height: 60,
elevation: 8,
hslColor: HSLColor.fromAHSL(1.0, 120, 1.0, 0.37),
shadow: BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 2),
),
onPressed: () => print('Button Pressed!'),
)
可配置属性
- child: 子组件 (通常是一个
Text或Icon) - height: 顶层的高度
- elevation: 顶层和底层之间的距离
- hslColor: 顶层的颜色。使用
HSLColor而不是Color,以便自动计算底层的颜色,通过降低亮度 - shadow: 可选的阴影,使按钮看起来更好
- onPressed: 按钮回调