erickzanardo / flutter_dialogs

💬 A lightweight and platform-aware plugin for showing dialogs and alerts for both Android and iOS devices.

Home Page:https://pub.dev/packages/flutter_dialogs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter_dialogs

A lightweight and platform-aware plugin for showing dialogs and alerts for both Android and iOS devices. Supports null-safety and Flutter 2.0.

Features

  • Platform aware
  • Extendable widgets
  • Lightweight < 28 KB

Usage

Sample Alert

showPlatformDialog(
  context: context,
  builder: (context) => BasicDialogAlert(
    title: Text("Current Location Not Available"),
    content:
        Text("Your current location cannot be determined at this time."),
    actions: <Widget>[
      BasicDialogAction(
        title: Text("OK"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    ],
  ),
);

Output

iOS Android
ios-basic-dialog-alert android-basic-dialog-alert

Sample Confirmation

showPlatformDialog(
  context: context,
  builder: (context) => BasicDialogAlert(
    title: Text("Discard draft?"),
    content: Text("Action cannot be undone."),
    actions: <Widget>[
      BasicDialogAction(
        title: Text("Cancel"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
      BasicDialogAction(
        title: Text("Discard"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    ],
  ),
);

Output

iOS Android
ios-basic-dialog-confirmation android-basic-dialog-confirmation

Sample List

showPlatformDialog(
  context: context,
  builder: (context) => BasicDialogAlert(
    title: Text("Select account"),
    content: Container(
      height: 200,
      child: ListView(
        children: <Widget>[
          _buildListSampleItem("contact@jdg.ph"),
          _buildListSampleItem("hello@gmail.com"),
          _buildListSampleItem("hi@joshuadeguzman.net"),
          _buildListSampleItem("jdeguzman@freelancer.com"),
        ],
      ),
    ),
    actions: <Widget>[
      BasicDialogAction(
        title: Text("Cancel"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    ],
  ),
);

Output

iOS Android
ios-basic-dialog-list android-basic-dialog-list

License

MIT @joshuadeguzman

About

💬 A lightweight and platform-aware plugin for showing dialogs and alerts for both Android and iOS devices.

https://pub.dev/packages/flutter_dialogs

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 84.2%Language:Shell 5.9%Language:Ruby 5.6%Language:Swift 3.0%Language:Kotlin 1.0%Language:Objective-C 0.3%