Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- MainAxisAlignment
- Hello World
- listview
- Load Image
- WillPopScope
- CrossAxisAlignment
- Column Widget
- Networking
- ListView.builder
- Flutter Example
- AppBar
- Snackbar
- FutureBuilder
- ListTile
- InkWell
- Cached Image
- Row Widget
- HTTP
- Scaffold
- Row
- Flutter Tutorial
- Image.network
- node.js
- Flutter 강좌
- 반석천
- flutter
- Flutter 예제
- Flutter 앱 배포
- sqlite
- navigator
Archives
- Today
- Total
꿈꾸는 시스템 디자이너
Flutter Example - Request App Review | app_review plugin 본문
Tutorial/Flutter with App
Flutter Example - Request App Review | app_review plugin
독행소년 2019. 10. 17. 14:13* About plugin
https://pub.dev/packages/app_review
https://pub.dev/packages/rating_dialog
1. Add this to pubspec.yaml file
dependencies:
app_review: ^1.0.0
rating_dialog: ^1.0.0
2. Source Code
import 'package:flutter/material.dart';
import 'package:app_review/app_review.dart';
import 'package:rating_dialog/rating_dialog.dart';
ReviewAppDemoState pageState;
class ReviewAppDemo extends StatefulWidget {
@override
ReviewAppDemoState createState() {
pageState = ReviewAppDemoState();
return pageState;
}
}
class ReviewAppDemoState extends State<ReviewAppDemo> {
String appID = "";
String output = "";
@override
initState() {
super.initState();
AppReview.getAppID.then((onValue) {
setState(() {
appID = onValue;
});
print("App ID" + appID);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Request App Review Demo")),
body: Column(
children: <Widget>[
Card(
child: ListTile(
title: Text("App ID"),
subtitle: Text(appID),
),
),
Expanded(
child: Center(
child: RaisedButton.icon(
color: Colors.blueAccent,
textColor: Colors.white,
icon: Icon(Icons.star),
label: Text("Review App"),
onPressed: () {
rateApp();
},
),
),
),
],
),
);
}
void rateApp() {
showDialog(
context: context,
barrierDismissible: true, // set to false if you want to force a rating
builder: (context) {
return RatingDialog(
icon: const FlutterLogo(size: 100, colors: Colors.blue),
// set your own image/icon widget
title: "The Rating Dialog",
description:
"Tap a star to set your rating. Add more description here if you want.",
submitButton: "SUBMIT",
//alternativeButton: "Contact us instead?",
// optional
//positiveComment: "We are so happy to hear :)",
// optional
//negativeComment: "We're sad to hear :(",
// optional
accentColor: Colors.blue,
// optional
onSubmitPressed: (int rating) {
print("onSubmitPressed: rating = $rating");
AppReview.writeReview;
},
onAlternativePressed: () {
print("onAlternativePressed: do something");
},
);
},
);
}
}
▶ Go to Table of Contents | 강의 목차로 이동
※ This example is also available in the Flutter Code Examples app. | 본 예제는 Flutter Code Examples 앱에서도 제공됩니다.
'Tutorial > Flutter with App' 카테고리의 다른 글
Comments