flutter_rating 0.0.1 flutter_rating: ^0.0.1 copied to clipboard
A flutter plugin that implements rating system.
import 'package:flutter/material.dart';
import 'package:flutter_rating/flutter_rating.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new Test(),
);
}
}
class Test extends StatefulWidget {
@override
_TestState createState() => new _TestState();
}
class _TestState extends State<Test> {
double rating = 3.5;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text("Star Rating"),
),
body:new Column(
children: <Widget>[
new Padding(
padding: EdgeInsets.all(50.0),
child: new StarRating(
rating: rating,
color: Colors.orange,
borderColor: Colors.grey,
size: 50.0,
starCount: 6,
onRatingChanged: (rating) => setState(
(){
this.rating = rating;
}
)
),
),
new Text("Your rating is: $rating", style: new TextStyle(fontSize: 30.0),),
],
),
);
}
}