Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion raionratingstar/.gitignore

This file was deleted.

40 changes: 0 additions & 40 deletions raionratingstar/build.gradle

This file was deleted.

Empty file removed raionratingstar/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions raionratingstar/proguard-rules.pro

This file was deleted.

122 changes: 122 additions & 0 deletions raionratingstar/rating_stars.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import 'package:flutter/material.dart';

class RatingStars extends StatelessWidget {
double rating;

// named constructor with scale 0-maxValue scores to the 5 stars range
RatingStars.withDivider(double _rating, double _maxValue) {
this.rating = _rating * (5 / _maxValue);
}

// default constructor with scale 0-5 scores to the 5 stars range
RatingStars(this.rating);

Row _rate(double _rating) {
if (_rating < 1) {
return Row(
children: [
Icon(Icons.star_half_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating == 1) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating < 2) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_half_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating == 2) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating < 3) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_half_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating == 3) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outline_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating < 4) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_half_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating == 4) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outline_outlined),
],
);
} else if (_rating < 5) {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_half_outlined),
],
);
} else {
return Row(
children: [
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
Icon(Icons.star_outlined),
],
);
}
}

@override
Widget build(BuildContext context) {
return _rate(rating);
}
}

This file was deleted.

5 changes: 0 additions & 5 deletions raionratingstar/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.