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

awesome_dialog 封面
套件詳情v3.3.0

awesome_dialog

Flutter 套件,可極簡方式顯示帶有動畫的美觀對話框(INFO、QUESTION、WARNING、SUCCESS、ERROR)。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.7萬
喜歡數
1480
Pub 分數
150

安裝套件

flutter pub add awesome_dialog

套件介紹

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

Awesome Dialog 是一個 Flutter 套件,可讓開發者以流暢動畫顯示各種視覺吸引力對話框,例如資訊、問題、警告、成功和錯誤。設計簡單,只需少量程式碼即可快速整合。此套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合跨平台應用。透過可自訂主題與內建動畫效果,它在無需複雜設定的情況下提升使用者體驗。

適用情境

  • 顯示應用程式警示
  • 顯示確認對話方塊
  • 增強使用者反饋
  • 建立成功或錯誤訊息
  • 新增動畫通知

主要特色

  • 預定義對話方塊類型
  • 平滑動畫
  • 跨平台支援
  • 最小設定
  • 可自定外觀
  • 內建主題

適合對象

  • 初學者 Flutter 開發者
  • 需要視覺反饋的應用程式
  • 跨平台專案
  • 簡單的 UI 增強
  • 快速原型設計

使用建議

  • 超出基本樣式之外的自訂有限
  • 可能需要額外的樣式設定以實現進階設計
  • 依賴外部動畫庫
  • 不適合複雜的模態介面
  • 低階裝置上的動畫效能

原始 README

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

awesome_dialog

A new Flutter package project for simple and awesome dialogs

Usage

To use this package, add awesome_dialog as a dependency in your pubspec.yaml file. And add this import to your file.

import 'package:awesome_dialog/awesome_dialog.dart';

Demo

Check out https://cv.toranzo.dev/awesome-dialog for more fun.

Image

alt text

Example
AwesomeDialog(
            context: context,
            dialogType: DialogType.info,
            animType: AnimType.rightSlide,,
            title: 'Dialog Title',
            desc: 'Dialog description here.............',
            btnCancelOnPress: () {},
            btnOkOnPress: () {},
            )..show();

Custom Body

If the body is specified, then title and description will be ignored, this allows to further customize the dialogue.

AwesomeDialog(
            context: context,
            animType: AnimType.scale,
            dialogType: DialogType.info,
            body: Center(child: Text(
                    'If the body is specified, then title and description will be ignored, this allows to 											further customize the dialogue.',
                    style: TextStyle(fontStyle: FontStyle.italic),
                  ),),
            title: 'This is Ignored',
            desc:   'This is also Ignored',
            btnOkOnPress: () {},
            )..show();

Custom Button

To use custom buttons, just specify the buttonOk or btnCancel widget, all text parameters icon etc will be ignored.

Dissmiss and Callback

AwesomeDialog has onDismissCallback(type) and can be dismissed at any time using dismiss() public method.

AwesomeDialog Class
Dart attribute Datatype Description Default Value
dialogType DialogType Set DialogType example: DialogType.info, this create an animated Header. Null
customHeader Widget Create your own header(if this is set DiaologType is ignored.) Null
width double The maximum width of the dialog, especially useful in web flutter, or landscape mode MediaQuery.of(context).size.width.
title String Set the title of dialog. Null
desc String Set the description text of the dialog. Null
body Widget Create your own Widget for body, if this property is set title and description will be ignored. Null
context BuildContext @required Null
btnOkText String Text of positive button 'Ok'
btnOkIcon IconData Icon of positive button Null
btnOkOnPress Function Function that handle click of positive Button, closing the dialog is handled internally. Null
btnOkColor Color Color of positive Button Color(0xFF00CA71)
btnOk Widget Allows to create a custom button, if this property is different from null then btnOkText, btnOkIcon, btnOkOnPress, btnOkColor will be ignored null
btnCancelText String Text of negative button 'Cancel'
btnCancelIcon IconData Icon of negative button Null
btnCancelOnPress Function Function that handle click of negative Button, closing the dialog is handled internally. Null
btnCancelColor Color Color of negative Button Colors.red
btnCancel Widget Allows to create a custom button, if this property is different from null then btnCancelText, btnCancelIcon, btnCancelOnPress, btnCancelColor will be ignored null
buttonsBorderRadius BorderRadiusGeometry Allows to customize buttons border radius BorderRadius.all(Radius.circular(100))
dismissOnTouchOutside bool Dismiss dialog on touch overlay true
onDismissCallback Function Dismiss callback function Null
animType AnimType Type of dialogue enter animation AnimType.SCALE
alignment AlignmentGeometry dialogue alignment gravity Alignment.center
useRootNavigator bool Use the root navigator instead than the local. This is useful when the default cancel go to the previous screen instead to just close the dialog false
headerAnimationLoop bool headerAnimationLoop control the loop for animation header true
padding EdgeInsetsGeometry The padding of dialog elements EdgeInsets.only(left: 5, right: 5),
autoHide Duration Hide the Dialog after this Duration null
keyboardAware bool Control if add or not the Padding EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom). true
dismissOnBackKeyPress bool control if AwesomeDialog is dismissible by back button. true
buttonsBorderRadius BorderRadiusGeometry Border Radius for built in buttons. BorderRadius.all(Radius.circular(100)
buttonsTextStyle TextStyle TextStyle for built in buttons. TextStyle(color: Colors.white, fontWeight:FontWeight.w700, fontSize: 14)
showCloseIcon bool Control if close icon is appear. false
closeIcon Widget Custom closeIcon. null
dialogBackgroundColor Color custom background color for entire dialog. Theme.of(context).cardColor
borderSide BorderSide enable border en entire dialog shape null
autoDismiss bool When stetted to false clicking Ok or Cancel button won't dismiss the dialog. You can pass custom Navigator.pop function in the onDissmissCallback. true
barrierColor Color Color for the barrier around the dialog Colors.black54
enableEnterKey bool If true, hitting Enter key will act like pressing the Ok button. false

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案