onPressed property

VoidCallback onPressed
final

Called when the user taps the chip.

If onPressed is set, then this callback will be called when the user taps on the label or avatar parts of the chip. If onPressed is null, then the chip will be disabled.

class Blacksmith extends StatelessWidget {
  void startHammering() {
    print('bang bang bang');
  }

  @override
  Widget build(BuildContext context) {
    return InputChip(
      label: const Text('Apply Hammer'),
      onPressed: startHammering,
    );
  }
}

Implementation

final VoidCallback onPressed