ndialog 2.0.2+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

NDialog #

Fork  Star  Watches  Get the library  Example

Custom dialog with blur background and popup animation and ProgressDialog with native style, Made with love by Moch. Nizwar Syafuan

Let's Code! #

This library have 2 Dialog : NDialog and ProgressDialog, you can Custom your dialog with blur background using BlurDialogBackground

NAlertDialog & NDialog #

I separate the NDialog class into 2, that is NAlertDialog (NDialog like before) and NDialog (Raw Dialog without blur)

NAlertDialog

Dialog that will show using blur background, you can custom it easily.

await showDialog(
  context: context,
  builder: (context) {
    return NAlertDialog(
      dialogStyle: DialogStyle(
      onDismiss: () {},
      dismissable: true,
      titleDivider: true),
      title: Text("Hi, This is NAlertDialog"),
      content: Text("And here is your content, hoho... "), 
      actions: <Widget>[
        FlatButton(
          child: Text("You"),
          onPressed: () {},
        ),
        FlatButton(
          child: Text("Are"),
          onPressed: () {},
        ),
        FlatButton(
          child: Text("Awesome"),
          onPressed: () {},
        )
      ],
    );
  }
);

NDialog

Raw dialog that you can use directly to showDialog without Blur Background

await showDialog(
  context: context,
  builder: (context) {
    return NDialog(
      dialogStyle: DialogStyle(titleDivider: true),
      title: Text("Hi, This is NDialog"),
      content: Text("And here is your content, hoho... "),  
      actions: <Widget>[
        FlatButton(
          child: Text("You"),
          onPressed: () {},
        ),
        FlatButton(
          child: Text("Are"),
          onPressed: () {},
        ),
        FlatButton(
          child: Text("Awesome"),
          onPressed: () {},
        )
      ],
    );
  }
);

ProgressDialog #

ProgressDialog progressDialog = ProgressDialog(context, 
  message:Text("This is the message"), 
  title:Text("This is the title")
);

//You can set Message using this function
progressDialog.setTitle(Text("Loading"));
progressDialog.setMessage(Text("Please Wait, Injecting your phone with my virus"));
progressDialog.show();

await Future.delayed(Duration(seconds: 5));
//Progress Dialog already show? don't worry, you can change the message :D
progressDialog.setTitle(Text("Just Kidding"));
progressDialog.setMessage(Text("I mean, virus of love :*"));

await Future.delayed(Duration(seconds: 5));
progressDialog.dismiss();

Psstt...i make ProgressDialog realy fun... Just using future, this function will show ProgressDialog until future (param) reach the end, you can handle the operation too!

await ProgressDialog.future(context,
  future: Future.delayed(Duration(seconds: 5)),
  onProgressError: (error){
    //Error here
  },
  onProgressFinish: (data){
    //Everything setup
  },
  onProgressCancel: () {
    print("Do something onProgressCancel");
  },
  message: Text("Please Wait"),
  cancelText: Text("Batal"),
  title: Text("Waiting for delay"), 
  dialogStyle: DialogStyle(
    onDismiss: () {
      print("Do something onDismiss");
    },
    barrierDismissable: true
  )
);

BlurDialogBackground #

Now you can blur any dialog, simply wrap them with BlurDialogBackground

await showDialog(
  context: context,
  builder: (context) {
    return BlurDialogBackground(
      dialog: AlertDialog(
        title: Text("Alert Dialog"),
        content: Text("Wohoo.. This is ordinary AlertDialog with Blur background"),
        actions: <Widget>[
          FlatButton(
            child: Text("You"),
            onPressed: () {},
          ),
          FlatButton(
            child: Text("Are"),
            onPressed: () {},
          ),
          FlatButton(
            child: Text("Awesome"),
            onPressed: () {},
          )
        ],
      ),
    );
  }
);

That's it, have fun 😀

Screenshot #

[2.0.2+1] - 30 Oct 2019 #

  • Fix double blur issues
  • Set 0 as default value of blur

[2.0.2] - 10 Oct 2019 #

  • Fix set blur on progressdialog

[2.0.1] - 10 Oct 2019 #

  • Fix Return value from ProgressDialog.future

[2.0.0] - 09 Oct 2019 #

  • You can blur any dialog background using BlurDialogBackground.
  • separate the NDialog class into 2, NDialog and NAlertDialog.
  • Fix bugs when the screen gets smaller (for example when the keyboard appears)

[1.2.1+3] - 07 Oct 2019 #

  • Fix ProgressDialog bug and layouting

[1.2.1+2] - 07 Oct 2019 #

  • Fix Bug (Health issues still there -_-)

[1.2.1+1] - 07 Oct 2019 #

  • Fix Bug (Health issues)

[1.2.1] - 07 Oct 2019 #

  • Fix ProgressDialog bug and layouting

[1.2.0] - 07 Oct 2019 #

  • Add ProgressDialog
  • Add ProgressDialog with Future
  • Set your dialog look with DialogStyle

[1.1.0] - 03 Oct 2019 #

  • Fix overflow actions

[1.0.0] - 02 Oct 2019 #

  • First release.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Blur Dialog',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Example BlurDialog'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;

  const MyHomePage({Key key, this.title}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: IntrinsicWidth(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              FlatButton(
                color: Colors.blue,
                onPressed: () async {
                  ProgressDialog progressDialog =
                      ProgressDialog(context, blur: 0, onDismiss: () {
                    print("Do something onDismiss");
                  }, dismissable: true);
                  progressDialog.setMessage(
                      Text("Please Wait, Injecting your phone with my virus"));
                  progressDialog.setTitle(Text("Loading"));
                  progressDialog.show();

                  await Future.delayed(Duration(seconds: 5));

                  progressDialog.setMessage(Text("I mean, virus of love :*"));
                  progressDialog.setTitle(Text("Just Kidding"));

                  await Future.delayed(Duration(seconds: 5));

                  progressDialog.dismiss();
                },
                child: Text("Progress Dialog",
                    style: TextStyle(color: Colors.white)),
              ),
              SizedBox(
                width: 10.0,
              ),
              FlatButton(
                color: Colors.blue,
                onPressed: () async {
                  print(await ProgressDialog.future(
                    context,
                    blur: 0.0,
                    future: Future.delayed(Duration(seconds: 5), () {
                      return "HIYAAA";
                    }),
                    onProgressError: (error) {
                      print("Do something onProgressError");
                    },
                    onProgressFinish: (data) {
                      print("Do something onProgressFinish");
                    },
                    onDismiss: () {
                      print("Dismissed");
                    },
                    message: Text("Please Wait"),
                    cancelText: Text("Batal"),
                    title: Text("Loging in"),
                  ));
                },
                child: Text("Progress Dialog Future",
                    style: TextStyle(color: Colors.white)),
              ),
              SizedBox(
                width: 10.0,
              ),
              FlatButton(
                color: Colors.blue,
                onPressed: () async {
                  await showDialog(
                      context: context,
                      builder: (context) {
                        return NAlertDialog(
                          dialogStyle: DialogStyle(titleDivider: true),
                          title: Text("Hi, This is NAlertDialog"),
                          content: Text("And here is your content, hoho... "),
                          actions: <Widget>[
                            FlatButton(
                              child: Text("You"),
                              onPressed: () {},
                            ),
                            FlatButton(
                              child: Text("Are"),
                              onPressed: () {},
                            ),
                            FlatButton(
                              child: Text("Awesome"),
                              onPressed: () {},
                            )
                          ],
                        );
                      });
                },
                child: Text("Show NAlertDialog",
                    style: TextStyle(color: Colors.white)),
              ),
              FlatButton(
                color: Colors.blue,
                onPressed: () async {
                  await showDialog(
                      context: context,
                      builder: (context) {
                        return NDialog(
                          dialogStyle: DialogStyle(titleDivider: true),
                          title: Text("Hi, This is NDialog"),
                          content: Text("And here is your content, hoho... "),
                          actions: <Widget>[
                            FlatButton(
                              child: Text("You"),
                              onPressed: () {},
                            ),
                            FlatButton(
                              child: Text("Are"),
                              onPressed: () {},
                            ),
                            FlatButton(
                              child: Text("Awesome"),
                              onPressed: () {},
                            )
                          ],
                        );
                      });
                },
                child:
                    Text("Show NDialog", style: TextStyle(color: Colors.white)),
              ),
              FlatButton(
                child: Text(
                  "Show Alert Dialog\nWith Blur Background",
                  style: TextStyle(color: Colors.white),
                  textAlign: TextAlign.center,
                ),
                padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
                color: Colors.blue,
                onPressed: () async {
                  await showDialog(
                      context: context,
                      builder: (context) {
                        return BlurDialogBackground(
                          dialog: AlertDialog(
                            title: Text("Alert Dialog"),
                            content: Text(
                                "Wohoo.. This is ordinary AlertDialog with Blur background"),
                            actions: <Widget>[
                              FlatButton(
                                child: Text("You"),
                                onPressed: () {},
                              ),
                              FlatButton(
                                child: Text("Are"),
                                onPressed: () {},
                              ),
                              FlatButton(
                                child: Text("Awesome"),
                                onPressed: () {},
                              )
                            ],
                          ),
                        );
                      });
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ndialog: ^2.0.2+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ndialog/ndialog.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
flutter 0.0.0
simple_animations ^1.3.3 1.3.11
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test