accessibility_tools! Ensuring your Flutter app is accessible is crucial for inclusivity. The
accessibility_tools package helps you catch common accessibility issues during development. Here’s how to use it with examples:
1. Enable Accessibility
Wrap your
MaterialApp with AccessibilityTools: void main() {
runApp(
const AccessibilityTools(
child: MyApp(),
),
);
}2. Check for Missing Semanticscs
The package warns you if a
Text widget lacks semantics: ❌ Before:
Text('Click me') // Warning: Missing Semantics!✅ After:
Text(
'Click me',
semanticsLabel: 'Click me button', // Screen readers will announce this
)
3. Detect Low Contrast Text
Ensures text is readable:
Text(
'Low contrast',
style: TextStyle(color: Colors.grey[300]), // Warning: Low contrast!
)
4. Check Tap Target Size
Buttons should be at least 48x48px:
❌ Too small:
SizedBox(
width: 30,
height: 30,
child: IconButton(/*...*/), // Warning: Small tap target!
)
✅ Fixed:
IconButton(
iconSize: 48, // Meets minimum size
onPressed: () {},
icon: Icon(Icons.add),
)
Why Use This?
✔️ Catch issues early
✔️ Improve app usability
✔️ Support screen readers & motor impairments
Get the package:
dependencies:
accessibility_tools: ^latest_version
Try it in your project and make your app more inclusive!

