fontSizeFor static method

double fontSizeFor(
  1. String label,
  2. double shortSide
)

The label font size on a key whose shorter side is shortSide: 0.4× for one or two characters, 0.3× for three or four, and 0.24× for five or more (m7-design §6), so sinh⁻¹ is 13.4 dp on a 56 dp key, not 16.8.

Implementation

static double fontSizeFor(String label, double shortSide) {
  final runes = label.runes.length;
  final fraction = runes >= 5
      ? 0.24
      : runes > 2
      ? 0.3
      : 0.4;
  return shortSide * fraction;
}