flutter_rating_null_safe 0.0.3 copy "flutter_rating_null_safe: ^0.0.3" to clipboard
flutter_rating_null_safe: ^0.0.3 copied to clipboard

Flutter Ratings is a simple package to show ratings in flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
// ignore: depend_on_referenced_packages
import 'package:flutter_rating_null_safe/flutter_rating_null_safe.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Ratings',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Ratings'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double appRating = 3.5;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text(
            'App Rating: $appRating',
            style: const TextStyle(
              fontSize: 30,
            ),
          ),
          const SizedBox(height: 30),
          FlutterRating(
            size: 40,
            starCount: 5,
            rating: appRating,
            allowHalfRating: true,
            color: Colors.amber,
            borderColor: Colors.grey,
            mainAxisAlignment: MainAxisAlignment.center,
            onRatingChanged: (double rating) {
              setState(() {
                appRating = rating;
              });
            },
          ),
        ],
      ),
    );
  }
}
3
likes
160
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Ratings is a simple package to show ratings in flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_rating_null_safe