You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace per-type config parameters with a single map #44
SmartText spends one constructor parameter per span type: config, addressConfig, phoneConfig, urlConfig, dateTimeConfig, emailConfig.
Six types, six parameters. The roadmap adds flight, date, hashtag, mention and custom detectors, which would mean eleven or more. That is not a simple API, and every type added makes it worse.
This blocks the type expansion work and should land before any new type.
Proposed shape:
SmartText(
text,
style: baseStyle,
linkConfig:ItemSpanConfig(...), // applies to every link type
spanConfigs: { // per-type override, optionalItemSpanType.address:ItemSpanConfig(...),
},
)
One parameter that scales to any number of types, const-able and declarative.
A builder form (spanConfigBuilder: (span) => ItemSpanConfig(...)) would additionally allow per-span logic, such as styling links to your own domain differently. It cannot be const and most users will not need it. Worth adding only if someone asks.
Migration: ship the map in the next minor release with the six existing parameters marked @Deprecated, and remove them in a later major.
Activity