评价我的应用包,因为颤振不起作用



我正在尝试将rate_my_app包与我的颤振应用程序集成。我已经尝试了所有版本,但出现了相同的问题:找不到参数 在RatingChanged.我需要创建一个弹出评级对话框,我不介意使用任何其他包或类或修复这个,使用rate_my_app提供的代码后我也收到此错误

以下 NoSuchMethodError 被抛出附加到渲染树: I/flutter (13365(:getter 'millisecondsSinceEpoch' 在 null 上被调用。 I/颤振 (13365(: 接收器:空 I/颤振 (13365(:尝试调用:毫秒自大纪元以来

我在main.dart中的代码

RateMyApp rateMyApp = RateMyApp(
preferencesPrefix: 'rateMyApp_',
minDays: 1,
minLaunches: 1,

);

@override
void initState() {
super.initState();
if(rateMyApp.shouldOpenDialog){
rateMyApp.showRateDialog(context,title: 'hii', message: 'please like');
}

如此线程中所述,尝试将smooth_star_rating依赖项的版本修复为严格等于1.0.4+2。或将其更改为^1.1.0.

请使用 actionsBuilder 而不是 onRatingChanged。 它在最新的软件包中被替换。

_rateMyApp.init().then((_) {
if (_rateMyApp.shouldOpenDialog) {
_rateMyApp.showStarRateDialog(
context,
actionsBuilder: (context, stars) {
return [
FlatButton(
onPressed: () {
if (stars != null) {
_rateMyApp.save().then((v) => Navigator.pop(context));
if (stars <= 3) {
print("User Selected $stars");
} else if (stars <= 5) {
print('Leave a Review Dialog');
}
} else {
Navigator.pop(context);
}
},
child: Text('OK'),
)
];
},
title: "Have you made someone happy today?",
message: "Please, review our app with 5 starts and make us happy",
dialogStyle: DialogStyle(
titleAlign: TextAlign.center,
messageAlign: TextAlign.center,
messagePadding: EdgeInsets.only(bottom: 20.0)),
starRatingOptions: StarRatingOptions(),
);
}
});

}

相关内容

最新更新