Synchronize font sizes with AutoSizeGroup
masterUse AutoSizeGroup to ensure multiple AutoSizeText widgets in the same group share the same font size. The group will adjust all members to match the member with the smallest effective font size.
Important: Do not create a new instance of AutoSizeGroup inside a build method. You must persist the instance (e.g., in a StatefulWidget's state) or use an AutoSizeGroupBuilder to avoid unnecessary re-calculations and synchronization issues.
// In a StatefulWidget state:
var myGroup = AutoSizeGroup();
// In build method:
Column(
children: [
AutoSizeText(
'Text 1',
group: myGroup,
),
AutoSizeText(
'Text 2',
group: myGroup,
),
],
)