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

art_sweetalert 封面
插件详情v0.0.5

art_sweetalert

一个美观、响应式、可自定义、可访问且易于使用的 Flutter 弹出框替代品。同时支持 iOS 和 Android。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
517
喜欢数
54
Pub 分数
140

安装插件

flutter pub add art_sweetalert

插件介绍

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

ArtSweetAlert 是一个视觉上吸引人、响应迅速且高度可定制的 Flutter 对话框包,提供了比标准弹出对话框更易访问、更易于使用的替代方案。它支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,确保在各种设备上提供一致的用户体验。凭借流畅的动画和现代设计,它增强了应用程序的互动性,同时保持了无障碍标准。非常适合以风格化的方式显示警告、确认和通知。

适合场景

  • 显示警告消息
  • 用户确认对话框
  • 加载指示器
  • 成功或错误通知
  • 可自定义的弹窗

主要特点

  • 漂亮的动画
  • 跨平台支持
  • 无障碍访问兼容
  • 高度可定制
  • 轻松集成
  • 响应式设计

适合对象

  • 需要现代 UI 对话框的应用程序
  • 注重用户体验的开发者
  • 需要一致的跨平台行为的项目
  • 希望快速实施的团队
  • 针对多个操作系统的应用

使用建议

  • 可能需要额外的样式设置以应对复杂用例
  • 限于对话框类型交互
  • 过度使用时的性能影响
  • 依赖外部依赖项
  • 不适用于非对话框UI组件

原始 README

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

art_sweetalert

A beautiful, responsive, customizable, accessible replacement, easy use for flutter popup boxes. Both supported ios and android.

A success message

ArtSweetAlert.show(
  context: context,
  artDialogArgs: ArtDialogArgs(
    type: ArtSweetAlertType.success,
    title: "A success message!",
    text: "Show a success message with an icon"
  )
);

A message with title and text

ArtSweetAlert.show(
    context: context,
    artDialogArgs: ArtDialogArgs(
        type: ArtSweetAlertType.question,
        title: "A question?",
        text: "Show a question message with an icon"
    )
);

An error message

ArtSweetAlert.show(
    context: context,
    artDialogArgs: ArtDialogArgs(
        type: ArtSweetAlertType.danger,
        title: "Oops...",
        text: "There is a problem :("
    )
);

A dialog with three buttons

ArtDialogResponse response = await ArtSweetAlert.show(
  barrierDismissible: false,
  context: context,
  artDialogArgs: ArtDialogArgs(
    showCancelBtn: true,
    denyButtonText: "Don't save",
    title: "Do you want to save the changes?",
    confirmButtonText: "Save",
  )
);

if(response==null) {
  return;
}

if(response.isTapConfirmButton) {
  ArtSweetAlert.show(
    context: context,
    artDialogArgs: ArtDialogArgs(
      type: ArtSweetAlertType.success,
      title: "Saved!"
    )
  );
  return;
}

if(response.isTapDenyButton) {
  ArtSweetAlert.show(
    context: context,
    artDialogArgs: ArtDialogArgs(
      type: ArtSweetAlertType.info,
      title: "Changes are not saved!"
    )
  );
  return;
}

A confirm dialog

ArtDialogResponse response = await ArtSweetAlert.show(
  barrierDismissible: false,
  context: context,
  artDialogArgs: ArtDialogArgs(
    denyButtonText: "Cancel",
    title: "Are you sure?",
    text: "You won't be able to revert this!",
    confirmButtonText: "Yes, delete it",
    type: ArtSweetAlertType.warning
  )
);

if(response==null) {
  return;
}

if(response.isTapConfirmButton) {
  ArtSweetAlert.show(
      context: context,
      artDialogArgs: ArtDialogArgs(
          type: ArtSweetAlertType.success,
          title: "Deleted!"
      )
  );
  return;
}


A message with a custom image



ArtSweetAlert.show(
    context: context,
    artDialogArgs: ArtDialogArgs(
        title: "Sweet!",
        text: "Modal with a custom image.",
        customColumns: [
          Container(
            margin: EdgeInsets.only(
                bottom: 12.0
            ),
            child: Image.network(
              "https://unsplash.it/400/200",
            ),

          )
        ]
    )
);


Submit your Github username!

ArtDialogResponse response = await ArtSweetAlert.show(
    artDialogKey: _artDialogKey,
    context: context,
    artDialogArgs: ArtDialogArgs(
        title: "Submit your Github username!",
        customColumns: [
            Container(
                margin: EdgeInsets.only( bottom: 20.0 ),
                child: CupertinoTextField(
                    controller: _textController,
                ),
            )
        ],
        onConfirm: () async  {
            _artDialogKey.currentState.showLoader();
            var response = await http.get(Uri.parse('https://api.github.com/users/'+_textController.text));
            if(response.statusCode!=200) {
                _artDialogKey.currentState.hideLoader();
                _artDialogKey.currentState.showErrors(["Request failed: Error"]);
                return;
            }
            var body = response.body;
            var bodyJson = json.decode(body);
            _artDialogKey.currentState.hideLoader();
            _artDialogKey.currentState.closeDialog( data: { "image": bodyJson["avatar_url"] } );
        },
        onDispose: () {
            _artDialogKey = GlobalKey<ArtDialogState>();
        },
    )
);

if (response == null) { return; }

if (response.isTapConfirmButton) {
    ArtSweetAlert.show(
        context: context,
        artDialogArgs: ArtDialogArgs(
            customColumns: [
                Container(
                    margin: EdgeInsets.only(bottom: 12.0),
                    child: Image.network( response.data["image"]),
                )
            ]
        )
    );
    return;
}


所属分类

源码仓库

使用此插件的项目

暂无相关数据。