Blame view

lib/common/utils/show_star_reward_dialog.dart 1.56 KB
ae239ac7   吴启风   feat:星星动画封装(资源有点问题)
1
  import 'package:flutter/material.dart';
642081ad   吴启风   feat:lottie动画加载优化...
2
  
c623c7b2   吴启风   feat:语音跟读作答结果动效&语音
3
  import '../widgets/cheer_reward_widget.dart';
642081ad   吴启风   feat:lottie动画加载优化...
4
  import '../widgets/star_reward_widget.dart';
ae239ac7   吴启风   feat:星星动画封装(资源有点问题)
5
6
7
8
9
10
11
12
13
14
15
16
17
  
  void showStarRewardDialog(BuildContext context, {
    double width = 200,
    double height = 200,
    int starCount = 3,
  }) {
    showDialog(
      context: context,
      barrierDismissible: false, // 点击对话框外部不关闭对话框
      builder: (BuildContext context) {
        return Dialog(
          backgroundColor: Colors.transparent, // 设置对话框背景为透明
          insetPadding: const EdgeInsets.all(0), // 去除对话框的内边距
642081ad   吴启风   feat:lottie动画加载优化...
18
          child: StarRewardWidget(
ae239ac7   吴启风   feat:星星动画封装(资源有点问题)
19
20
21
22
23
24
25
26
27
28
29
            width: width,
            height: height,
            isPlaying: true,
            starCount: starCount,
            onAnimationEnd: () {
              Navigator.of(context).pop(); // 关闭对话框
            },
          ),
        );
      },
    );
c623c7b2   吴启风   feat:语音跟读作答结果动效&语音
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  }
  
  void showCheerRewardDialog(BuildContext context, {
    required String lottieFile,
    double width = 200,
    double height = 200,
  }) {
    showDialog(
      context: context,
      barrierDismissible: false, // 点击对话框外部不关闭对话框
      builder: (BuildContext context) {
        return Dialog(
          backgroundColor: Colors.transparent, // 设置对话框背景为透明
          insetPadding: const EdgeInsets.all(0), // 去除对话框的内边距
          child: CheerRewardWidget(
            lottieFile: lottieFile,
            width: width,
            height: height,
            isPlaying: true,
            onAnimationEnd: () {
              Navigator.of(context).pop(); // 关闭对话框
            },
          ),
        );
      },
    );
ae239ac7   吴启风   feat:星星动画封装(资源有点问题)
56
  }