flutter_rating_native 0.0.2 copy "flutter_rating_native: ^0.0.2" to clipboard
flutter_rating_native: ^0.0.2 copied to clipboard

Flutter Ratings Native 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_native/flutter_rating_native.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
150
pub points
74%
popularity

Publisher

unverified uploader

Flutter Ratings Native 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_native