alert static method

Future alert({
  1. String? title,
  2. String? caption,
  3. List<TextButton>? actions,
  4. bool showCancel = true,
  5. bool barrierDismissible = true,
})

Implementation

static Future<dynamic> alert({
  String? title,
  String? caption,
  List<TextButton>? actions,
  bool showCancel = true,
  bool barrierDismissible = true,
}) {
  return showDialog(
      context: context,
      barrierDismissible: barrierDismissible,
      builder: (_) {
        return AlertDialog(
            titlePadding:
                const EdgeInsets.all(16).copyWith(bottom: 8, top: 20),
            actionsPadding: const EdgeInsets.all(16).copyWith(bottom: 8),
            contentPadding: const EdgeInsets.symmetric(horizontal: 16),
            title: title?.style(weight: FontWeight.w700, size: 18),
            content: caption?.style(),
            actions: [
              if (showCancel)
                TextButton(
                    onPressed: () => context.back(false),
                    child: 'Kapat'.style(selectable: false)),
              if (actions != null)
                for (var a in actions) a,
            ]);
      });
}