flutter_adaptive_dialog 1.0.0 copy "flutter_adaptive_dialog: ^1.0.0" to clipboard
flutter_adaptive_dialog: ^1.0.0 copied to clipboard

A customizable alert dialog for Flutter that adapts to both Android and iOS platforms.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Adaptive Alert Dialog Example',
      home: Scaffold(
        appBar: AppBar(
          title: const Text("Adaptive Alert Dialog"),
        ),
        body: Center(
          child: Builder(
            builder: (BuildContext context) {
              return ElevatedButton(
                onPressed: () async {
                  bool? result = await AdaptiveAlertDialog.show(
                    context: context,
                    title: "Confirm Action",
                    content: "Do you want to proceed with this action?",
                    confirmText: "Yes",
                    cancelText: "No",
                    titleStyle: const TextStyle(
                        fontWeight: FontWeight.bold, color: Colors.blue),
                    contentStyle:
                        const TextStyle(fontSize: 16, color: Colors.black),
                    confirmButtonStyle: const TextStyle(
                        color: Colors.green,
                        fontWeight: FontWeight.bold), // Style for Yes button
                    cancelButtonStyle: const TextStyle(
                        color: Colors.red), // Style for No button
                  );

                  if (result == true) {
                    print("User confirmed.");
                  } else {
                    print("User canceled.");
                  }
                },
                child: const Text("Show Dialog"),
              );
            },
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable alert dialog for Flutter that adapts to both Android and iOS platforms.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on flutter_adaptive_dialog