FLUTTER ECOSYSTEM

jajpa/rating_bar

一个可自定义的 Flutter 评分条,支持半星评分

评分条 项目封面
Stars
10
Forks
5
最近推送(UTC)
2020年3月1日
项目状态
未归档
Josh GitHub avatar
GITHUB User

Josh ↗

IITD. Android, iOS and Flutter enthusiast.

CommureCalifornia
语言DartObjective-CJava

技术话题

使用的依赖

依赖清单 2 项
  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

原始 README

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

展开 / 收起项目 README

rating_bar

A customizable Rating Bar for flutter with half rating support

pub package

Installation

Add this to your package's pubspec.yaml file

dependencies:
  ...
  rating_bar: ^latest.version.here

Usage

First import paging.dart

  import 'package:rating_bar/rating_bar.dart';

onRatingChanged callback returns current rating which is a double, when the rating has changed.

  RatingBar(
    onRatingChanged: (rating) => setState(() => _rating = rating),
    filledIcon: Icons.star,
    emptyIcon: Icons.star_border,
    halfFilledIcon: Icons.star_half,
    isHalfAllowed: true,
    aligns: Alignment.centerLeft,
    filledColor: Colors.green,
    emptyColor: Colors.redAccent,
    halfFilledColor: Colors.amberAccent, 
    size: 48,
  ),

You can also use read-only rating bar widget

  RatingBar.readOnly(
    initialRating: 3.5,
    isHalfAllowed: true,
    aligns: Alignment.centerLeft,
    halfFilledIcon: Icons.star_half,
    filledIcon: Icons.star,
    emptyIcon: Icons.star_border,
  ),

Screenshots

https://raw.github.com/joshmatta/rating_bar/master/flutter_01.png

License

MIT License