Blame view

lib/common/utils/show_star_reward_dialog.dart 839 Bytes
ae239ac7   吴启风   feat:星星动画封装(资源有点问题)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  import 'package:flutter/material.dart';
  import 'package:wow_english/common/widgets/star_reward_widget.dart';
  
  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), // 去除对话框的内边距
          child: StarRewardAnimation(
            width: width,
            height: height,
            isPlaying: true,
            starCount: starCount,
            onAnimationEnd: () {
              Navigator.of(context).pop(); // 关闭对话框
            },
          ),
        );
      },
    );
  }