alert_craft 0.0.17 copy "alert_craft: ^0.0.17" to clipboard
alert_craft: ^0.0.17 copied to clipboard

Alert Craft simplifies customizable notification and selection dialogs for Flutter. Use OverlayService for notifications and choice prompts.

example/example.dart

import 'package:flutter/material.dart';
import 'package:alert_craft/alert_craft.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // OverlayService için navigatorKey'i MaterialApp'a veriyoruz
    return MaterialApp(
      navigatorKey: navigatorKey,
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Alert Craft Example'),
      ),
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                child: const Text("Başarılı Alert (Varsayılan)"),
                onPressed: () {
                  AlertManager().showAlert(
                    type: AlertType.success,
                    title: "Başarılı",
                    description: "İşlem başarıyla tamamlandı.",
                  );
                },
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                child: const Text("Hata Alert (Özelleştirilmiş Tema)"),
                onPressed: () {
                  AlertManager().showAlert(
                    type: AlertType.error,
                    title: "Hata!",
                    description: "Bir hata oluştu.",
                    buttonText: "Kapat",
                    theme: AlertTheme(
                      backgroundColor: Colors.black,
                      titleStyle: const TextStyle(color: Colors.red, fontSize: 22, fontWeight: FontWeight.bold),
                      descriptionStyle: const TextStyle(color: Colors.white70),
                      buttonStyle: ElevatedButton.styleFrom(
                        backgroundColor: Colors.red,
                        foregroundColor: Colors.white,
                      ),
                      borderRadius: BorderRadius.circular(30),
                      shadow: [const BoxShadow(color: Colors.redAccent, blurRadius: 30)],
                      animationDuration: const Duration(milliseconds: 500),
                    ),
                  );
                },
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                child: const Text("Uyarı Seçim Dialogu"),
                onPressed: () {
                  AlertManager().showSelection(
                    type: AlertType.warning,
                    title: "Dikkat",
                    description: "Bu işlem geri alınamaz. Devam edilsin mi?",
                    leftText: "İptal",
                    rightText: "Devam",
                    onLeft: () {
                      AlertManager().close();
                    },
                    onRight: () {
                      AlertManager().close();
                      AlertManager().showToast(
                        type: AlertType.success,
                        message: "Devam edildi!",
                      );
                    },
                  );
                },
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                child: const Text("Yükleniyor Dialogu"),
                onPressed: () {
                  AlertManager().showLoading(
                    message: "Yükleniyor...",
                  );
                  Future.delayed(const Duration(seconds: 2), () {
                    AlertManager().close();
                  });
                },
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                child: const Text("Bilgi Toast"),
                onPressed: () {
                  AlertManager().showToast(
                    type: AlertType.info,
                    message: "Bu bir bilgi mesajıdır.",
                  );
                },
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                child: const Text("Özel Widget Dialogu"),
                onPressed: () {
                  AlertManager().showCustom(
                    child: Container(
                      width: 250,
                      padding: const EdgeInsets.all(24),
                      decoration: BoxDecoration(
                        color: Colors.deepPurple.shade50,
                        borderRadius: BorderRadius.circular(24),
                      ),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          const Icon(Icons.star, color: Colors.deepPurple, size: 48),
                          const SizedBox(height: 12),
                          const Text(
                            "Özel Dialog!",
                            style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.deepPurple),
                          ),
                          const SizedBox(height: 8),
                          const Text("Burada istediğiniz widget'ı gösterebilirsiniz."),
                          const SizedBox(height: 16),
                          ElevatedButton(
                            onPressed: () => AlertManager().close(),
                            child: const Text("Kapat"),
                          ),
                        ],
                      ),
                    ),
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
273
downloads

Publisher

verified publisheryeksoftware.com.tr

Weekly Downloads

Alert Craft simplifies customizable notification and selection dialogs for Flutter. Use OverlayService for notifications and choice prompts.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, get

More

Packages that depend on alert_craft