While learning FlutterFlow, I'm using the template app UpHomes to familiarize myself with the platform. Cleaned up most of the errors but got stuck on the following. Not sure how to go forward from here in order to be able to test the app.
RatingBar widget with the current configuration will not function properly when generated dynamically at the moment (because it is associated with a local state variable). Consider wrapping it inside of a component and then generate the component dynamically.
These are the associated custom functions in the template:
ratingSummary
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '/flutter_flow/lat_lng.dart';
import '/flutter_flow/place.dart';
import '/flutter_flow/uploaded_file.dart';
import '/flutter_flow/custom_functions.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/auth/firebase_auth/auth_util.dart';
double ratingSummary(
double totalRatings,
double rating,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
// get average rating to one decimal point from list of reviews
if (totalRatings > 0) {
return (rating +
(totalRatings - rating) ~/ math.max((totalRatings ~/ 5), 1)) /
2;
} else {
return rating;
}
/// MODIFY CODE ONLY ABOVE THIS LINE
}
ratingSummaryList
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '/flutter_flow/lat_lng.dart';
import '/flutter_flow/place.dart';
import '/flutter_flow/uploaded_file.dart';
import '/flutter_flow/custom_functions.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/auth/firebase_auth/auth_util.dart';
String ratingSummaryList(List<ReviewsRecord> rating) {
/// MODIFY CODE ONLY BELOW THIS LINE
if (rating.isEmpty) {
return '-';
}
var ratingsSum = 0.0;
for (final comment in rating) {
ratingsSum += comment.rating!;
}
return (ratingsSum / rating.length).toStringAsFixed(1);
/// MODIFY CODE ONLY ABOVE THIS LINE
}