Can you help me? I have these values: [code] pts is the user's points. maxPoints is the…
- User
Can you help me? I have these values:
final pts = points ?? 0.0; final maxPoints = business.maxPoints ?? 10.0; final increments = 10 ~/ maxPoints; final count = pts ~/ increments;pts is the user's points. maxPoints is the business' points on which the set.
I have 10 stamps, always, regardless of maxPoints.
It's using two rows:
/ First Row of 5 Stamps SizedBox( height: 5.26.h, child: ListView.separated( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: 5, itemBuilder: (context, index) { final filled = index < count; return Container( width: 5.26.h, height: 5.26.h, decoration: BoxDecoration( color: filled ? const Color(0xFF104BE0) : null, borderRadius: BorderRadius.circular(8), border: !filled ? Border.all( color: const Color(0xFF35C2C1), ) : null, ), ); }, separatorBuilder: (BuildContext context, int index) => SizedBox(width: 2.5.w), ), ), SizedBox(height: 2.5.w), // Second Row of 5 Stamps SizedBox( height: 5.26.h, child: ListView.separated( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: 5, itemBuilder: (context, index) { final filled = (index + 5) < count; return Container( width: 5.26.h, height: 5.26.h, decoration: BoxDecoration( color: filled ? const Color(0xFF104BE0) : null, borderRadius: BorderRadius.circular(8), border: !filled ? Border.all( color: const Color(0xFF35C2C1), ) : null, ), ); }, separatorBuilder: (BuildContext context, int index) => SizedBox(width: 2.5.w), ), ), - Assistant
Yes, I understand your intent—you want to display 10 stamps (always), filling the number of stamps based on the user's
ptsrelative to the set by the business. The problem lies in how you're calculating and .