ā zeba_academy_rating
A highly customizable Flutter rating widget with support for full stars, half-stars, read-only mode, interactive mode, custom icons, and rating callbacks.
Perfect for product reviews, feedback forms, e-commerce apps, restaurant apps, movie ratings, educational platforms, and more.
⨠Features
- ā Interactive star rating
- š Half-star support
- š Read-only mode
- šÆ Fully interactive mode
- šØ Custom filled, half-filled, and empty icons
- š Custom icon size
- šØ Custom colors
- š¢ Configurable maximum rating
- š£ Rating change callbacks
- ā” Lightweight and easy to integrate
- š± Responsive design
- š Production-ready
š¦ Installation
Add the dependency to your pubspec.yaml.
dependencies:
zeba_academy_rating: ^1.0.0
Then run:
flutter pub get
š„ Import
import 'package:zeba_academy_rating/zeba_academy_rating.dart';
Basic Usage
ZebaAcademyRating(
initialRating: 3.5,
onRatingChanged: (rating) {
print(rating);
},
)
Read Only Rating
ZebaAcademyRating(
initialRating: 4.5,
readOnly: true,
)
Half-Star Support
ZebaAcademyRating(
initialRating: 2.5,
allowHalfRating: true,
)
Custom Icons
ZebaAcademyRating(
filledIcon: Icons.favorite,
halfFilledIcon: Icons.favorite,
unfilledIcon: Icons.favorite_border,
filledColor: Colors.red,
)
Custom Maximum Rating
ZebaAcademyRating(
maxRating: 10,
)
Rating Callback
ZebaAcademyRating(
onRatingChanged: (rating) {
debugPrint("Current Rating: $rating");
},
)
Complete Example
import 'package:flutter/material.dart';
import 'package:zeba_academy_rating/zeba_academy_rating.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("Rating Example")),
body: Center(
child: ZebaAcademyRating(
initialRating: 4,
allowHalfRating: true,
iconSize: 36,
filledColor: Colors.amber,
onRatingChanged: (rating) {
debugPrint("Rating: $rating");
},
),
),
),
);
}
}
Widget Properties
| Property | Type | Default | Description |
|---|---|---|---|
| initialRating | double | 0 | Initial rating value |
| maxRating | int | 5 | Maximum number of stars |
| allowHalfRating | bool | true | Enables half-star ratings |
| readOnly | bool | false | Disables user interaction |
| iconSize | double | 28 | Size of rating icons |
| filledColor | Color | Colors.amber | Filled icon color |
| unfilledColor | Color | Colors.grey | Empty icon color |
| filledIcon | IconData | Icons.star | Filled icon |
| halfFilledIcon | IconData | Icons.star_half | Half-filled icon |
| unfilledIcon | IconData | Icons.star_border | Empty icon |
| onRatingChanged | ValueChanged | null | Rating callback |
Use Cases
- Product Reviews
- Course Ratings
- Restaurant Reviews
- Hotel Reviews
- Movie Ratings
- Book Ratings
- Teacher Feedback
- Customer Satisfaction
- Survey Applications
- Service Reviews
Platform Support
| Platform | Supported |
|---|---|
| Android | ā |
| iOS | ā |
| Web | ā |
| Windows | ā |
| macOS | ā |
| Linux | ā |
Why zeba_academy_rating?
- Simple API
- Easy integration
- Highly customizable
- Lightweight
- Null-safe
- Production-ready
- Cross-platform
- Well documented
Roadmap
- Animated rating transitions
- Fractional rating support
- Emoji rating mode
- Vertical rating layout
- RTL support
- Accessibility improvements
- Theme extensions
- Controller enhancements
- Custom rating shapes
Contributing
Contributions are welcome!
If you'd like to improve this package, please feel free to fork the repository, create a feature branch, and submit a pull request.
Please ensure that your code follows Flutter and Dart best practices and includes appropriate documentation and tests.
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
See the LICENSE file for details.
About Me
⨠Iām Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.
You can learn more about me and my work at https://sufyanism.com/ or connect with me on LinkedIn:
https://www.linkedin.com/in/sufyanism
Your All-in-One Learning Hub!
š Explore courses and resources in coding, technology, and software development through Zeba Academy.
Empower yourself with practical skills, curated tutorials, real-world projects, and hands-on learning experiences.
š Main Website
https://zeba.academy
š» Coding Platform
https://code.zeba.academy
šŗ YouTube
https://www.youtube.com/@zeba.academy
šø Instagram
https://www.instagram.com/zeba.academy/
ā Support
If you find this package useful, please consider giving the repository a star on GitHub. Your support helps improve the project and encourages future development.
Made with ā¤ļø for the Flutter community by Zeba Academy.