onPressed property

  1. @override
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.

link
class Blacksmith extends StatelessWidget {
  const Blacksmith({super.key});

  void startHammering() {
    print('bang bang bang');
  }

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

Implementation

@override
final VoidCallback? onPressed;