搜索插件、代码仓与 APP 分类

shirne_dialog 封面
插件详情v4.9.0

shirne_dialog

一个 Flutter 包,可在任何地方使用可自定义样式的提示、弹出框、消息、气泡、图片预览、加载等。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
217
喜欢数
51
Pub 分数
150

安装插件

flutter pub add shirne_dialog

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

shirne_dialog 是一个 Flutter 包,提供了一套功能强大且可自定义的 UI 组件,例如警告框、提示信息、弹窗、消息条、图片预览和加载指示器。设计简洁易用,使开发者能够以一致且美观的方式在应用中的任何位置显示这些元素。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 多个平台,非常适合跨平台应用开发。通过 pub add 简单集成,它通过直观且响应迅速的反馈机制提升了用户体验。

适合场景

  • 显示警报和确认
  • 显示临时通知(吐司)
  • 实现加载旋转图标
  • 在模态框中预览图像
  • 创建自定义消息提示
  • 增强用户反馈

主要特点

  • 可自定义样式
  • 跨平台支持
  • 轻松集成
  • 多种对话类型
  • 轻便且快速
  • 可重用组件

适合对象

  • 从初学者到高级的Flutter开发者
  • 需要丰富UI反馈的应用程序
  • 跨平台项目
  • 快速原型设计
  • 面向用户的交互元素

使用建议

  • 需要理解 Flutter 上下文
  • 可能需要额外的样式来实现复杂的设计
  • 仅限基本对话功能
  • 不适合高度自定义的模态工作流
  • 依赖于正确的控件树结构

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Shirne Dialog

A flutter package to use alert, confirm, prompt, toast, popup, snack, imagePreview, loading etc. with customizable style in anywhere.

pub package

Features

  • ✅ toast

  • ✅ alert

  • ✅ confirm

  • ✅ prompt [new]

  • ✅ modal

  • ✅ popup

  • ✅ imagePreview

  • ✅ snack

  • ✅ loading

  • ✅ dropdown [new]

  • 🚧 imagePreview support hero

  • 🚧 modal adaptive & more style

  • 🚧 guide

Notice

You must initialize ShirneDialogTheme on theme.extensions between flutter version 3.0.0 - 3.0.4

Above 3.0.5 dialog will use default theme when not provide in ThemeData.extends

Preview

Online Demo

Toast Dialog ImagePreview
toast dialog imagePreview
Loading Popup Snackbar
loading popup snack
Dropdown Dropdown Customize
loading popup snack

Usage

add localizations

dependencies:
    #...
  flutter_localizations:
    sdk: flutter
    #...

Recommanded usage


// 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()]);
    // ...
);

// Use with MaterialApp.router
MaterialApp.router(
    routerDelegate: AppRouterDelegate(),
);
class AppRouterDelegate<T> extends RouterDelegate<T> with PopNavigatorRouterDelegateMixin{
  
  @override
  GlobalKey<NavigatorState>? get navigatorKey => MyDialog.navigatorKey;

  // ...
}

// Use with Getx
MyDialog.navigatorKey = Get.key;
 

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

In 2.x and earlier


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 in MaterialApp
 MaterialApp(
    //...
    navigatorKey: MyDialog.navigatorKey,
    //...
);

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

所属分类

依赖

依赖清单 1 项

  • combined_animation>=0.3.1 <1.0.0

源码仓库

使用此插件的项目

暂无相关数据。