应用评价
用于请求和编写 App Store 和 Google Play 评论的 Flutter 插件。

使用方法
需要注意的是,App ID必须与Google Play和iTunes Connect中的App ID匹配。这可以在iOS的Info.plist和Android的app/build.gradle中进行更改。您将此App ID用于Firebase、Admob和应用发布等其他服务。
Android
导航至Google Play的Store Listing
iOS
Apple负责处理评价请求。您可以在页面加载时调用代码,如果用户开启了“应用内评分”,Apple将发送评价弹窗请求。
在调试模式下,它将始终显示。
这是iOS 10.3之后请求评价的必要方式。
import 'dart:io';
import 'package:app_review/app_review.dart';
import 'package:flutter/material.dart';
@override
void initState() {
super.initState();
if (Platform.isIOS) {
AppReview.requestReview.then((onValue) {
print(onValue);
});
}
}
示例
import 'package:app_review/app_review.dart';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
initState() {
super.initState();
AppReview.getAppID.then((onValue) {
setState(() {
appID = onValue;
});
print("App ID" + appID);
});
}
String appID = "";
String output = "";
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text('App Review'),
),
body: new SingleChildScrollView(
child: new ListBody(
children: <Widget>[
new Container(
height: 40.0,
),
new ListTile(
leading: new Icon(Icons.info),
title: new Text('App ID'),
subtitle: new Text(appID),
onTap: () {
AppReview.getAppID.then((onValue) {
setState(() {
output = onValue;
});
print(onValue);
});
},
),
new Divider(
height: 20.0,
),
new ListTile(
leading: new Icon(
Icons.shop,
),
title: new Text('View Store Page'),
onTap: () {
AppReview.storeListing.then((onValue) {
setState(() {
output = onValue;
});
print(onValue);
});
},
),
new Divider(
height: 20.0,
),
new ListTile(
leading: new Icon(
Icons.star,
),
title: new Text('Request Review'),
onTap: () {
AppReview.requestReview.then((onValue) {
setState(() {
output = onValue;
});
print(onValue);
});
},
),
new Divider(
height: 20.0,
),
new ListTile(
leading: new Icon(
Icons.note_add,
),
title: new Text('Write a New Review'),
onTap: () {
AppReview.writeReview.then((onValue) {
setState(() {
output = onValue;
});
print(onValue);
});
},
),
new Divider(
height: 20.0,
),
new ListTile(
title: new Text(output),
),
],
),
),
),
);
}
}