如何解决在 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 举报,一经查实,本站将立刻删除。