如何解决运行应用程序时,不显示抖动对话框
我想在应用启动时在我的flutter应用中显示一个应用对话框对话框,以便我使用rate_my_app插件,并且按照文档操作,并在main.dart中编写了以下代码,但是无论何时运行该应用对话框没有显示。
请在下面提供我的代码的帮助,或者,如果您知道通过其他方式实现对应用对话框的评分的方法,请告诉我
注意:我已注释掉 // if(rateMyApp.shouldOpenDialog){,因此该对话框将在应用程序运行时立即显示
class _PSAppState extends State<PSApp> {
Completer<ThemeData> themeDataCompleter;
PsSharedPreferences psSharedPreferences;
RateMyApp rateMyApp = RateMyApp(
preferencesPrefix: 'rateMyApp_',minDays: 0,minLaunches: 1,remindDays: 2,remindLaunches: 5,// appStoreIdentifier: '',// googlePlayIdentifier: '',);
@override
void initState() {
super.initState();
rateMyApp.init().then((_) {
// if (rateMyApp.shouldOpenDialog) {
rateMyApp.showRateDialog(
context,title: 'Rate this app',// The dialog title.
message: 'If you like this app,please take a little bit of your time to review it !\nIt really helps us and it shouldn\'t take you more than one minute.',// The dialog message.
rateButton: 'RATE',// The dialog "rate" button text.
noButton: 'NO THANKS',// The dialog "no" button text.
laterButton: 'MAYBE LATER',// The dialog "later" button text.
listener: (button) { // The button click listener (useful if you want to cancel the click event).
switch(button) {
case RateMyAppDialogButton.rate:
print('Clicked on "Rate".');
break;
case RateMyAppDialogButton.later:
print('Clicked on "Later".');
break;
case RateMyAppDialogButton.no:
print('Clicked on "No".');
break;
}
return true; // Return false if you want to cancel the click event.
},ignoreNativeDialog: Platform.isAndroid,// Set to false if you want to show the Apple's native app rating dialog on iOS or Google's native app rating dialog (depends on the current Platform).
dialogStyle: DialogStyle(),// Custom dialog styles.
onDismissed: () => rateMyApp.callEvent(RateMyAppEventType.laterButtonPressed),// Called when the user dismissed the dialog (either by taping outside or by pressing the "back" button).
// contentBuilder: (context,defaultContent) => content,// This one allows you to change the default dialog content.
// actionsBuilder: (context) => [],// This one allows you to use your own buttons.
);
// }
});
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。