New feature: Users can view, submit, and interact with event reviews. Components added: - ReviewModel, ReviewStatsModel, ReviewListResponse (models) - ReviewService with getReviews, submitReview, markHelpful, flagReview - StarRatingInput (interactive 5-star picker with labels) - StarDisplay (read-only fractional star display) - ReviewSummary (average rating + distribution bars) - ReviewForm (star picker + comment field + submit/update) - ReviewCard (avatar, timestamp, expandable comment, helpful/flag) - ReviewSection (main container with pagination and state mgmt) Integration: - Added to LearnMoreScreen (both mobile and desktop layouts) - Review API endpoints point to app.eventifyplus.com Node.js backend - EventModel updated with averageRating/reviewCount fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.0 KiB
Dart
43 lines
1.0 KiB
Dart
// lib/features/reviews/widgets/star_display.dart
|
|
import 'package:flutter/material.dart';
|
|
|
|
class StarDisplay extends StatelessWidget {
|
|
final double rating;
|
|
final double size;
|
|
final Color filledColor;
|
|
final Color emptyColor;
|
|
|
|
const StarDisplay({
|
|
Key? key,
|
|
required this.rating,
|
|
this.size = 16,
|
|
this.filledColor = const Color(0xFFFBBF24),
|
|
this.emptyColor = const Color(0xFFD1D5DB),
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: List.generate(5, (i) {
|
|
final starPos = i + 1;
|
|
IconData icon;
|
|
Color color;
|
|
|
|
if (rating >= starPos) {
|
|
icon = Icons.star_rounded;
|
|
color = filledColor;
|
|
} else if (rating >= starPos - 0.5) {
|
|
icon = Icons.star_half_rounded;
|
|
color = filledColor;
|
|
} else {
|
|
icon = Icons.star_outline_rounded;
|
|
color = emptyColor;
|
|
}
|
|
|
|
return Icon(icon, size: size, color: color);
|
|
}),
|
|
);
|
|
}
|
|
}
|