shirne_dialog 3.0.0 icon indicating copy to clipboard operation
shirne_dialog: ^3.0.0 copied to clipboard

A package to use alert, confirm, toast, imagePreview, snack and popup within one line code.

pub package

Dialog #

A package for flutter to use alert and toast within one line code.

function #

  • toast
  • alert
  • confirm
  • modal
  • popup
  • imagePreview
  • snack
  • loading

Notice #

You must initialize ShirneDialogTheme on theme.extensions in flutter version 3.0.0

Usage #

Direct usage


MyDialog.of(context).toast('tip message');

MyDialog.of(context).alert(Text('alert message'));

MyDialog.of(context).confirm(Text('alert message')).then((v){

});

MyDialog.of(context).popup(Text('popup contents'));

MyDialog.of(context).snack('tip');

initialize & usage

// initialize in mainApp's first page
MyDialog.initialize(context);

// Or use Mydialog.navigatorKey with MaterialApp
// and set theme for dialog
 MaterialApp(
    //...
    navigatorKey: MyDialog.navigatorKey,
    localizationsDelegates:[
        ShirneDialogLocalizations.delegate,

        // flutter locals see [https://docs.flutter.dev/development/accessibility-and-localization/internationalization]
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
    ],
    theme: ThemeData.light().copyWith(extensions: [const ShirneDialogTheme()]);
    //...
 );
 

// call in anywhere
MyDialog.confirm('aaa');
MyDialog.alert('test');
MyDialog.toase('test');

Demo

9
likes
125
pub points
73%
popularity

Publisher

verified publisher iconshirne.com

A package to use alert, confirm, toast, imagePreview, snack and popup within one line code.

Homepage
Repository (GitHub)

Documentation

API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on shirne_dialog