花哨的Flutter警报对话框

一个用于显示自定义警报对话框的 Flutter 包,您可以在“花哨”和“扁平”两种主题之间进行选择。

该包在fancy_dialog中可用

用法

导入包

将此依赖项添加到您的应用中
dependencies: fancy_dialog: ^1.0.1

使用该包

添加此导入语句
import 'package:fancy_dialog/fancy_dialog.dart';

显示基本对话框

showDialog(
              context: context,
              builder: (BuildContext context) => FancyDialog(
                title: "Fancy Gif Dialog",
                descreption: "This is descreption for fancy gif,you can load any image or gif to be displayed :), and you can choose between two themes Fancy and Flat",
                )
            ) 
         }, 

titledescreption是必需的
其余参数为

  • okFun:用户按下“确定”按钮(正向按钮)时调用的函数

  • cancelFun:用户按下取消按钮(负向按钮)时调用的函数

  • cancelColor:负向按钮的颜色,默认为Colors.grey

  • oklColor:正向按钮的颜色,默认为Colors.pink

  • ok:正向按钮的文本,默认为“OK!”

  • cancel:负向按钮的文本,默认为“取消”

  • animationType:动画类型,有4种类型:

    • FancyAnimation.LEFT_RIGHT 默认类型
    • FancyAnimation.RIGHT_LEFT
    • FancyAnimation.TOP_BOTTOM
    • FancyAnimation.BOTTOM_TOP
  • gifpath:要显示的图片或GIF的路径,或者您可以从包提供的6个GIF中选择

    • FancyGif.MOVE_FORWARD 默认类型
    • FancyGif.CHECK_MAIL
    • FancyGif.FUNNY_MAN
    • FancyGif.PLAY_MEDIA
    • FancyGif.SUBMIT
    • FancyGif.SHARE
  • theme:Fancy或Flat

    • FancyTheme.FANCY
    • FancyTheme.FLAT

对话框将在用户点击“确定”或“取消”时默认关闭,请勿添加
Navigator.of(context).pop()okFuncancelFun

1

2_flat

3

4_flat

GitHub

https://github.com/DokkarRachidReda/Fancy-Flutter-Alert-Dialog