flutter_rating 2.0.2 copy "flutter_rating: ^2.0.2" to clipboard
flutter_rating: ^2.0.2 copied to clipboard

A flutter plugin that implements rating system.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_rating/flutter_rating.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Test(),
    );
  }
}

class Test extends StatefulWidget {
  @override
  _TestState createState() => _TestState();
}

class _TestState extends State<Test> {
  double rating = 3.5;
  int starCount = 5;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Star Rating"),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Center(
            child: StarRating(
              size: 40.0,
              rating: rating,
              color: Colors.orange,
              borderColor: Colors.grey,
              allowHalfRating: true,
              starCount: starCount,
              onRatingChanged: (rating) => setState(() {
                this.rating = rating;
              }),
            ),
          ),
          SizedBox(height: 20),
          Text(
            "Your rating is: $rating",
            style: TextStyle(fontSize: 30.0),
          ),
        ],
      ),
    );
  }
}
17
likes
140
pub points
94%
popularity

Publisher

verified publisherunicorn.games

A flutter plugin that implements rating system.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_rating