搜尋套件、儲存庫與 APP 分類

rflutter_alert 封面
套件詳情v2.0.7

rflutter_alert

RFlutter Alert 是一個超級可自訂且易於使用的 Flutter 提示/彈出對話方塊。您可輕鬆建立可重複使用的提示樣式,或隨意新增任意數量的按鈕。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.4萬
喜歡數
1070
Pub 分數
150

安裝套件

flutter pub add rflutter_alert

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

RFlutter Alert 是一個可自訂且使用者友善的套件,用於在 Flutter 應用程式中建立警示與彈出對話方塊。它讓開發者能輕鬆建立可重複使用的警示樣式,支援無限數量的按鈕,並提供各種自訂選項,例如動畫、顏色和內容版面配置。非常適合在多個平台顯示通知、確認或互動式提示。此套件與 Flutter 的元件系統完全整合,由 ratel.com.tr 維護。

適用情境

  • 顯示確認對話方塊
  • 顯示自定義通知
  • 建立可重複使用的警示範本
  • 透過彈出視窗處理使用者輸入
  • 實施入職提示
  • 管理表單驗證警告

主要特色

  • 高度可自訂的外觀
  • 支援多個按鈕
  • 可重複使用的警示樣式
  • 內建動畫
  • 跨平台相容性
  • 與 Flutter 的輕鬆整合

適合對象

  • 初學者 Flutter 開發者
  • 需要頻繁提醒的應用
  • 互動式 UI 組件
  • 跨平台應用
  • 自訂對話方塊設計
  • 快速原型設計

使用建議

  • 可能需要額外的樣式設定以適應複雜版面
  • 與完整的UI庫相比,內建主題有限
  • 嵌套警示訊息過多可能造成效能影響
  • 不適合複雜的模態工作流程
  • 需要手動處理按鈕回呼
  • 最適合簡單到中等複雜度的對話方塊

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

RFlutter Alert

RFlutter Alert is super customizable and easy-to-use alert/popup dialogs for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.

Version

Features

  • Single line basic alert
  • Adding buttons dynamically (as much as you want)
  • Predefined beautiful alert styles (success, error, warning, info)
  • Reusable alert styles
  • Super customizable
    • Change animation (fromTop, fromBottom, fromRight, fromLeft, grow, shrink) & Custom Animation
    • Set animation duration
    • Show/hide close button
    • Set overlay tap to dismiss
    • Assign Title and desc styles
    • Change dialog border style

Getting started

You must add the library as a dependency to your project.

dependencies:
 rflutter_alert: ^2.0.7

You can also reference the git repo directly if you want:

dependencies:
 rflutter_alert:
   git: git://github.com/RatelHub/rflutter_alert.git

You should then run flutter packages get

Example Project

There is a detailed example project in the example folder. You can directly run and play on it. There are code snippets from example project below.

Basic Alert

Alert(context: context, title: "RFLUTTER", desc: "Flutter is awesome.").show();

Alert with Button

    Alert(
      context: context,
      type: AlertType.error,
      title: "RFLUTTER ALERT",
      desc: "Flutter is more awesome with RFlutter Alert.",
      buttons: [
        DialogButton(
          child: Text(
            "COOL",
            style: TextStyle(color: Colors.white, fontSize: 20),
          ),
          onPressed: () => Navigator.pop(context),
          width: 120,
        )
      ],
    ).show();

Alert with Buttons

    Alert(
      context: context,
      type: AlertType.warning,
      title: "RFLUTTER ALERT",
      desc: "Flutter is more awesome with RFlutter Alert.",
      buttons: [
        DialogButton(
          child: Text(
            "FLAT",
            style: TextStyle(color: Colors.white, fontSize: 20),
          ),
          onPressed: () => Navigator.pop(context),
          color: Color.fromRGBO(0, 179, 134, 1.0),
        ),
        DialogButton(
          child: Text(
            "GRADIENT",
            style: TextStyle(color: Colors.white, fontSize: 20),
          ),
          onPressed: () => Navigator.pop(context),
          gradient: LinearGradient(colors: [
            Color.fromRGBO(116, 116, 191, 1.0),
            Color.fromRGBO(52, 138, 199, 1.0)
          ]),
        )
      ],
    ).show();

Alert with Style

AlertStyle

Use the AlertStyle class to customize.

    var alertStyle = AlertStyle(
      animationType: AnimationType.fromTop,
      isCloseButton: false,
      isOverlayTapDismiss: false,
      descStyle: TextStyle(fontWeight: FontWeight.bold),
      descTextAlign: TextAlign.start,
      animationDuration: Duration(milliseconds: 400),
      alertBorder: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(0.0),
        side: BorderSide(
          color: Colors.grey,
        ),
      ),
      titleStyle: TextStyle(
        color: Colors.red,
      ),
      alertAlignment: Alignment.topCenter,
    );

And assign your AlertStyle object to Alert's style field.

    Alert(
      context: context,
      style: alertStyle,
      type: AlertType.info,
      title: "RFLUTTER ALERT",
      desc: "Flutter is more awesome with RFlutter Alert.",
      buttons: [
        DialogButton(
          child: Text(
            "COOL",
            style: TextStyle(color: Colors.white, fontSize: 20),
          ),
          onPressed: () => Navigator.pop(context),
          color: Color.fromRGBO(0, 179, 134, 1.0),
          radius: BorderRadius.circular(0.0),
        ),
      ],
    ).show();

Alert with Custom Image

    Alert(
      context: context,
      title: "RFLUTTER ALERT",
      desc: "Flutter is better with RFlutter Alert.",
      image: Image.asset("assets/success.png"),
    ).show();

Alert with Custom Content

    Alert(
        context: context,
        title: "LOGIN",
        content: Column(
          children: <Widget>[
            TextField(
              decoration: InputDecoration(
                icon: Icon(Icons.account_circle),
                labelText: 'Username',
              ),
            ),
            TextField(
              obscureText: true,
              decoration: InputDecoration(
                icon: Icon(Icons.lock),
                labelText: 'Password',
              ),
            ),
          ],
        ),
        buttons: [
          DialogButton(
            onPressed: () => Navigator.pop(context),
            child: Text(
              "LOGIN",
              style: TextStyle(color: Colors.white, fontSize: 20),
            ),
          )
        ]).show();

Contributions

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Version compatability

See CHANGELOG for all breaking (and non-breaking) changes.


Made with ❤ by Ratel

所屬分類

原始碼儲存庫

使用此套件的專案