alert static method

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

Implementation

static Future<dynamic> alert(
    {String? title,
    String? caption,
    List<TextButton>? actions,
    bool showCancel = true}) {
  return showDialog(
      context: context,
      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,
            ]);
      });
}