shirne_dialog 3.0.1 copy "shirne_dialog: ^3.0.1" to clipboard
shirne_dialog: ^3.0.1 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

30
likes
115
pub points
76%
popularity

Publisher

verified publishershirne.com

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on shirne_dialog