Skip to main content

prefer-action-button-tooltip

added in: 1.4.0
🛠
Pro+

Warns when a FloatingActionButton does not have a tooltip specified.

Adding tooltip is important if you want your users with screen readers to be able to understand what the action is supposed to do.

Example

❌ Bad:

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


Widget build(BuildContext context) => Scaffold(
// LINT: Tooltip is not specified. Try adding it.
floatingActionButton: FloatingActionButton(
onPressed: () {},
),
);
}

✅ Good:

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


Widget build(BuildContext context) => Scaffold(
floatingActionButton: FloatingActionButton(
tooltip: 'some tooltip',
onPressed: () {},
),
);
}