showBadgePopup function

Future<void> showBadgePopup(
  1. BuildContext context,
  2. UserBadge badge
)

Implementation

Future<void> showBadgePopup(BuildContext context, UserBadge badge) {
  return showDialog<void>(
    context: context,
    builder: (context) => AlertDialog(
      icon: Icon(
        badgeIconFromKey(badge.badgeIconKey),
        size: 48,
        color: Colors.amber,
      ),
      title: Text(badge.badgeName ?? 'Badge Earned!'),
      content: badge.badgeDescription != null
          ? Text(badge.badgeDescription!, textAlign: TextAlign.center)
          : null,
      actions: [
        FilledButton(
          onPressed: () => Navigator.pop(context),
          child: const Text('Awesome!'),
        ),
      ],
      actionsAlignment: MainAxisAlignment.center,
    ),
  );
}