rating_summary 1.0.3+1 rating_summary: ^1.0.3+1 copied to clipboard
Create a summary statistic Widget to display the rating and average rating of a product.
import 'package:flutter/material.dart';
import 'package:rating_summary/rating_summary.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Rating Summary Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Rating Summary Example'),
),
body: const Padding(
padding: EdgeInsets.all(20.0),
child: RatingSummary(
counter: 13,
average: 3.846,
counterFiveStars: 5,
counterFourStars: 4,
counterThreeStars: 2,
counterTwoStars: 1,
counterOneStars: 1,
),
),
);
}
}