jajpa / rating_bar

A customizable Rating Bar for flutter with half rating support
https://pub.dev/packages/rating_bar
MIT License
10 stars 5 forks source link

Rating bar always aligned in center #6

Open SdxCoder opened 4 years ago

SdxCoder commented 4 years ago

Rating bar is has widget wrapper align, which makes it always align center. Removing align widget fix the issue.

Before removing align

    return Align(
          child: Row(
        mainAxisSize: MainAxisSize.min,
        children: List.generate(widget.maxRating, (index) {
          return Builder(
            builder: (rowContext) => widget._readOnly
                ? buildIcon(context, index + 1)
                : buildStar(rowContext, index + 1),
          );
        }),
      ),
    );

Fix

Remove align

 return Row(
      mainAxisSize: MainAxisSize.min,
      children: List.generate(widget.maxRating, (index) {
        return Builder(
          builder: (rowContext) => widget._readOnly
              ? buildIcon(context, index + 1)
              : buildStar(rowContext, index + 1),
        );
      }),
    );