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