animated_rating_stars 1.0.1 copy "animated_rating_stars: ^1.0.1" to clipboard
animated_rating_stars: ^1.0.1 copied to clipboard

A highly customizable Flutter rating bar widget for interactive star-based ratings.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  /// Constructs a new instance of [MyApp].
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double _rating = 2.5;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        debugShowCheckedModeBanner: false,
        title: 'Animated Rating Stars',
        home: Scaffold(
          appBar: AppBar(
            title: const Text("Animated Rating Stars"),
            centerTitle: true,
          ),
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(
                  'Rating: $_rating',
                  style: const TextStyle(fontSize: 24.0),
                ),
                AnimatedRatingStars(
                  initialRating: 2.5,
                  onChanged: (rating) {
                    setState(() {
                      _rating = rating;
                    });
                  },
                  displayRatingValue: true, // Display the rating value
                  interactiveTooltips: true, // Allow toggling half-star state
                  customFilledIcon: Icons.star,
                  customHalfFilledIcon: Icons.star_half,
                  customEmptyIcon: Icons.star_border,
                  starSize: 40.0,
                  animationDuration: const Duration(milliseconds: 500),
                  animationCurve: Curves.easeInOut,
                ),
              ],
            ),
          ),
        ));
  }
}
36
likes
160
pub points
92%
popularity
screenshot

Publisher

verified publishernikunjxcode.blogspot.com

A highly customizable Flutter rating bar widget for interactive star-based ratings.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on animated_rating_stars