buildFlagIcon function

Widget? buildFlagIcon(
  1. String key,
  2. Map<String, String> iconMap, {
  3. Widget flagIconBuilder(
    1. String
    )?,
  4. bool hasShadow = true,
  5. double? height,
  6. double? width,
})

Implementation

Widget? buildFlagIcon(
  String key,
  Map<String, String> iconMap, {
  Widget Function(String)? flagIconBuilder,
  bool hasShadow = true,
  double? height,
  double? width,
}) {
  final iconKey = toCamelCase(key);
  late Widget flagIcon;

  if (flagIconBuilder != null) {
    flagIcon = flagIconBuilder(key);
  } else {
    flagIcon = FastImageAsset(
      path: iconMap[iconKey]!,
      height: height,
      width: width,
    );
  }

  if (hasShadow) {
    return FastShadowLayout(
      borderRadius: 0,
      child: flagIcon,
    );
  }

  return flagIcon;
}