在 Flutter 中提供奖励之前,如何检查用户是否真的邀请朋友使用我的应用?

问题描述

我使用 Flutter 构建了一个文字游戏应用。

如果用户邀请他的朋友玩应用程序,我想用我的应用程序中的提示奖励我的用户。为此,我有一个按钮“邀请朋友”出现在 AlertDialog 上。当用户点击它时,会显示共享选项,用户可以从那里通过 whatsapp、facebook、IG 或用户手机上的任何共享选项共享下载应用程序的链接,但是,一旦共享选项弹出,用户可以点击在外面,它将从屏幕上删除共享选项弹出窗口。对我来说,我相信我可以跟踪的唯一操作是单击 AlertDialog 上的按钮。因此,我必须假设他将完成共享操作并根据该按钮的点击奖励他。如果用户没有完成分享操作,我该如何阻止应用给予奖励?

有没有更好的方法来做到这一点?请提出建议,因为我还是应用开发的新手。

这是我的代码片段:

    AlertDialog bonusHints = AlertDialog(
    scrollable: true,title: SizedBox(
      width: MediaQuery.of(context).size.width * 0.5,child: Text(
        'hey! It looks like you\'ve exhausted your hints pretty soon!',maxLines: 3,textAlign: TextAlign.center,),content: Container(
      height: MediaQuery.of(context).size.height * 0.5,child: SingleChildScrollView(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,children: [
            Divider(thickness: 2,color: Colors.grey,SizedBox(
              height: 50,Text('Would you like some more hints??\n\nAs a one time bonus,you can get 5 more hints to help you.\n\nAll you need to do is Invite another friend to play with you\n\n',ClipRRect(
              borderRadius: BorderRadius.circular(15),child: SizedBox(
                width: MediaQuery.of(context).size.width * 0.5,child: RaisedButton(
                  elevation: 20,color: Theme.of(context).primaryColor,onpressed: () {
                    final RenderBox Box = context.findRenderObject();
                    Share.share(text,subject: subject,sharePositionorigin:
                            Box.localToGlobal(Offset.zero) & Box.size);
                   
                  child: Text('Invite a Friend',style: TextStyle(color: Colors.white),)
                ))),],))
      ));

      if (userscore.oneTimeBonus == false) {
      showDialog(context: context,builder: (BuildContext context) {
        return bonusHints;
      }
      );
      }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)