dashronym library
Inline glossary utilities for expanding acronyms in Flutter text.
This library turns known acronyms into tappable, accessible tooltip cards without breaking reading flow. The primary surface is DashronymText, which renders strings using an AcronymRegistry, DashronymConfig, and DashronymTheme.
Quick start:
// 1) Define your glossary.
final registry = AcronymRegistry({
'SDK': 'Software Development Kit',
'API': 'Application Programming Interface',
});
// 2) Render inline acronyms with DashronymText.
const text = 'Install the (SDK) to use the API.';
DashronymText(
text,
registry: registry,
config: const DashronymConfig(enableBareAcronyms: true),
theme: const DashronymTheme(underline: true),
);
// 3) Wire up localization (typically in MaterialApp):
MaterialApp(
localizationsDelegates: const [
// ...existing delegates,
DashronymLocalizations.delegate,
],
supportedLocales: DashronymLocalizations.supportedLocales,
// ...
)
Notes:
- Marker-wrapped acronyms are recognized per DashronymConfig.acceptMarkers
(e.g.,
(SDK),"API",'API'). When DashronymConfig.enableBareAcronyms istrue, bare ALL-CAPS words within length bounds also match. - Tooltips announce show/hide events to assistive tech when localized strings are available.
- Styling (underline, thickness, offsets, fade durations, card size) is controlled via DashronymTheme.
Classes
- AcronymRegistry
- A read-only registry mapping acronyms to their descriptions.
- AcronymTooltipDetails
- Data surfaced to DashronymTooltipBuilder implementations.
- DashronymConfig
- Parsing and matching configuration for dashronyms.
- DashronymLocalizations
- Localized strings used by dashronym widgets.
- DashronymText
- Renders text with inline, accessible glossary tooltips for matched acronyms.
- DashronymTheme
- Visual customization for inline acronym triggers and their tooltip cards.
Extensions
- DashronymsTextX on Text
- Convenience APIs for turning a plain Text into a glossary-aware widget.
Typedefs
- DashronymTooltipBuilder = Widget Function(BuildContext context, AcronymTooltipDetails details)
-
Signature used to build a custom tooltip widget for
AcronymInline.