getDateFlexFromLocale function

List<int> getDateFlexFromLocale(
  1. Locale? locale
)

Get the date flex based on the current locale. The flex is used to determine the width of the fields.

Implementation

List<int> getDateFlexFromLocale(Locale? locale) {
  final lang = locale?.languageCode;
  if (locale?.countryCode?.toLowerCase() == 'us') return const [2, 1, 1];

  if (['zh', 'ko'].contains(lang)) return const [1, 1, 1];

  return [1, 2, 1];
}