不爱贞子爱爽子
バキューン
环境:
material_dialogs: ^1.1.0
链接:
https://lottiefiles.com/featured 免费动画文件下载 需要注册
https://pub.flutter-io.cn/packages/material_dialogs 文档
动画文件引入:
pubspec.yaml
# animation
- assets/sprinkles.json
- assets/confetti-full-screen.json
使用:
import 'package:material_dialogs/material_dialogs.dart';
import 'package:material_dialogs/widgets/buttons/icon_button.dart';
import 'package:material_dialogs/widgets/buttons/icon_outline_button.dart';


Dialogs.materialDialog(
                msg: '真的要走么?',
                title: "信息",
                color: Colors.white,
                context: context,
                lottieBuilder: Lottie.asset(
                  'assets/confetti-full-screen.json',
                  fit: BoxFit.fitWidth,
                ),
                actions: [
                  IconsOutlineButton(
                    onPressed: () {
                      Navigator.pop(context);
                    },
                    text: '取消',
                    iconData: Icons.cancel_outlined,
                    textStyle: TextStyle(color: Colors.grey),
                    iconColor: Colors.grey,

                  ),
                  IconsButton(
                    onPressed: () {
                      Navigator.pop(context);
                      logout(context);
                    },
                    text: '确认',
                    iconData: Icons.check,
                    color: Colors.red,
                    textStyle: TextStyle(color: Colors.white),
                    iconColor: Colors.white,
                  ),
                ]);

效果:

 

 

 




posted on 2021-08-06 11:03  不爱贞子爱爽子  阅读(191)  评论(0编辑  收藏  举报

! !