Git Product home page Git Product logo

joshuadeguzman / flutter_dialogs Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 7.0 350 KB

๐Ÿ’ฌ 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

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

Dart 23.03% Kotlin 0.23% Swift 1.97% Objective-C 0.06% Shell 1.30% Ruby 1.29% CMake 30.93% C++ 35.65% C 2.43% HTML 3.10%
flutter dart sdk android ios alerts dialogs hacktoberfest

flutter_dialogs's Introduction

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("[email protected]"),
          _buildListSampleItem("[email protected]"),
          _buildListSampleItem("[email protected]"),
          _buildListSampleItem("[email protected]"),
        ],
      ),
    ),
    actions: <Widget>[
      BasicDialogAction(
        title: Text("Cancel"),
        onPressed: () {
          Navigator.pop(context);
        },
      ),
    ],
  ),
);

Output

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

License

MIT @joshuadeguzman

flutter_dialogs's People

Contributors

arielmagbanua avatar bersh avatar erdemyerebasmaz avatar erickzanardo avatar joshuadeguzman avatar tonchozhelev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_dialogs's Issues

Add Web Compatibility or Remove Web Designation or Add Documentation

I'm adding web to my mobile application, and for showPlatformDialog, the only available targets are android and ios, so the UnsupportedError "Platform is not supported by this plugin" is thrown when run for web. However, Web is listed as compatible for this plugin.

Optimal solution would be to add the web target, or if it's available add documentation for it. In the mean time, this plugin is not really compatible with web, so you should remove the tag, or am I missing something?

Feature request: automatically use correct case for dialog actions

Action labels on iOS use sentence case whereas on Material Design they are all upper case. It would be really useful to be able to supply Flutter Dialogs with a sentence case String which can be used directly on iOS, but automatically set to upper case when on Android.

A good example can be found on the Material Design Guidelines site if you scroll down to Cross Platform Adaptations.

Thank you.

Cannot test by changing platform from flutter inspector

Hello,

So I was trying to test how my app would look on both Android and IOS using this library, but while all my other widgets changed to their platform specific look just by switching the platform from the flutter inspector in Android Studio, the dialogs (created using this library) don't. I looked trough the code and i suspect it is because you are using the dart::io library in platform_dialog.dart, Theme.of(context).platform should be used instead, this would allow for greater flexibility and for making sure the dialog looks right just by switching the platform from the flutter inspector.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.