搜索分类、插件与代码仓

GitHub 代码仓nikunj22/animated_rating_stars

animated_rating_stars

nikunj22/animated_rating_stars open-source repository details.

animated_rating_stars 项目封面
星标
3
复刻
4
最近推送(UTC)
2024年4月2日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

Animated Rating Stars for Flutter

Package Version Package Downloads GitHub Stars GitHub Forks License

AnimatedRatingStars is a highly customizable animated rating bar widget for Flutter. It allows users to interactively provide ratings by tapping on stars. The package offers a wide range of customization options and is designed to be easy to integrate into your Flutter applications.

Demo

DEMO1 DEMO2 DEMO3

Features

  • Create animated rating bars with filled, half-filled, and empty stars.
  • Customize star colors, icons, sizes, and animation parameters.
  • Display the rating value and enable interactive tooltips for half-filled stars.
  • Supports both read-only and interactive modes.

Installation

To use this package, add animated_rating_stars as a dependency in your pubspec.yaml file:

dependencies:
  animated_rating_stars: ^1.0.1

Then, run flutter pub get to fetch the package.

Usage

Import the package in your Dart code:

import 'package:animated_rating_stars/animated_rating_stars.dart';

Now, you can use the AnimatedRatingStars widget in your Flutter app:

AnimatedRatingStars(
  initialRating: 3.5,
  minRating: 0.0,
  maxRating: 5.0,
  filledColor: Colors.amber,
  emptyColor: Colors.grey,
  filledIcon: Icons.star,
  halfFilledIcon: Icons.star_half,
  emptyIcon: Icons.star_border,
  onChanged: (double rating) {
    // Handle the rating change here
    print('Rating: $rating');
  },
  displayRatingValue: true,
  interactiveTooltips: true,
  customFilledIcon: Icons.star,
  customHalfFilledIcon: Icons.star_half,
  customEmptyIcon: Icons.star_border,
  starSize: 30.0,
  animationDuration: Duration(milliseconds: 300),
  animationCurve: Curves.easeInOut,
  readOnly: false,
)

Customize the properties according to your requirements. The onChanged callback is called when the rating changes.

For more examples and usage details, refer to the examples directory included with this package.

Customization

You can customize the appearance and behavior of the rating bar using the following properties:

  • initialRating: The initial rating value.
  • minRating: The minimum rating value.
  • maxRating: The maximum rating value.
  • filledColor: The color for filled stars.
  • emptyColor: The color for empty stars.
  • filledIcon: The icon used for filled stars.
  • halfFilledIcon: The icon used for half-filled stars.
  • emptyIcon: The icon used for empty stars.
  • displayRatingValue: Show or hide the rating value.
  • interactiveTooltips: Enable interactive tooltips for half-filled stars.
  • customFilledIcon: Use a custom icon for filled stars.
  • customHalfFilledIcon: Use a custom icon for half-filled stars.
  • customEmptyIcon: Use a custom icon for empty stars.
  • starSize: Set the size of each star.
  • animationDuration: Adjust the duration of the animation when the rating changes.
  • animationCurve: Define the animation curve for the rating change.
  • readOnly: Make the widget read-only.

Customization

Contributions and feedback are welcome! If you encounter any issues or have feature requests, please open an issue on GitHub.

License

This package is distributed under the MIT License. See LICENSE for details.

For more Flutter packages and development resources, visit pub.dev.

iamnikunj.dev GitHub avatar
GitHub 作者

iamnikunj.dev ↗

语言C++CMakeDartRubySwiftCKotlinHTMLObjective-C

此仓库发布的插件

使用的依赖

依赖清单 5 项

  • flutter{"sdk":"flutter"}
  • flutter_web_plugins{"sdk":"flutter"}
  • plugin_platform_interface^2.0.2
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^2.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗