Flutter / UI Elements / IconButton
Icon Button
-
Code
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { void _onButtonPressed() { // Define the action you want to perform when the IconButton is pressed print('IconButton pressed!'); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('IconButton Example'), ), body: Center( child: IconButton( icon: Icon(Icons.add), // Icon to display onPressed: _onButtonPressed, // Action to perform on press tooltip: 'Add', // Optional tooltip ), ), ), ); } }