按钮图像

我定义了一个 RoundIconButton 来增加用户点击按钮时的计数。如果用户需要将计数增加 50,则必须点击 50 次。
当用户点击并按住时,如何更改按钮以连续增加计数?
int age = 20;
RoundIconButton(
icon: FontAwesomeIcons.plus,
onPressed: () {
setState(() {
age++;
});
class RoundIconButton extends StatelessWidget {
RoundIconButton({@required this.icon, @required this.onPressed});
final IconData icon;
final Function onPressed;
@override
Widget build(BuildContext context) {
return RawMaterialButton(
child: Icon(icon),
onPressed: onPressed,
elevation:
6.0, // will show only when onpress is defined. it is disabled by default.
shape: CircleBorder(),
fillColor: Color(0xFF4C4F5E),
constraints: BoxConstraints.tightFor(
width: 56.0,
height: 56.0,
),
);
}
}
Run Code Online (Sandbox Code Playgroud)